Class.h File Reference


Detailed Description

Interfaces to class functionality.


Classes

union  ConstPoolEntry
 The constant pool entry descriptor. More...
struct  ConstantPool
 The constant pool of a class and related operations. More...
struct  Class
 VM representation of Java class. More...
struct  Class.Class_Super
struct  Class.InnerClass

Defines

#define CLASSFILE_MAGIC   0xCAFEBABE
#define CLASSFILE_MAJOR_MIN   45
#define CLASSFILE_MAJOR_MAX   50
#define CLASSFILE_MINOR_MAX   0

Enumerations

enum  ConstPoolTags {
  CONSTANT_Tags = 0, CONSTANT_Utf8 = 1, CONSTANT_Integer = 3, CONSTANT_Float = 4,
  CONSTANT_Long = 5, CONSTANT_Double = 6, CONSTANT_Class = 7, CONSTANT_String = 8,
  CONSTANT_Fieldref = 9, CONSTANT_Methodref = 10, CONSTANT_InterfaceMethodref = 11, CONSTANT_NameAndType = 12,
  CONSTANT_Last = CONSTANT_NameAndType, CONSTANT_UnusedEntry = CONSTANT_Last + 1
}
 Types of constant pool entries. More...
enum  Class_State {
  ST_Start, ST_LoadingAncestors, ST_Loaded, ST_BytecodesVerified,
  ST_InstanceSizeComputed, ST_Prepared, ST_ConstraintsVerified, ST_Initializing,
  ST_Initialized, ST_Error
}
 The state of the Java class. More...
enum  AccessAndPropertiesFlags {
  ACC_PUBLIC = 0x0001, ACC_PRIVATE = 0x0002, ACC_PROTECTED = 0x0004, ACC_STATIC = 0x0008,
  ACC_FINAL = 0x0010, ACC_SUPER = 0x0020, ACC_SYNCHRONIZED = 0x0020, ACC_BRIDGE = 0x0040,
  ACC_VOLATILE = 0x0040, ACC_VARARGS = 0x0080, ACC_TRANSIENT = 0x0080, ACC_NATIVE = 0x0100,
  ACC_INTERFACE = 0x0200, ACC_ABSTRACT = 0x0400, ACC_STRICT = 0x0800, ACC_SYNTHETIC = 0x1000,
  ACC_ANNOTATION = 0x2000, ACC_ENUM = 0x4000
}
 Access and properties flags for Class, Field and Method. More...

Functions

VMEXPORT Stringclass_name_get_java_name (const String *class_name)
 Converts a class name from an internal (VM) form to the Java form.
ManagedObjectstruct_Class_to_java_lang_Class (Class *clss)
 Gets instance of java/lang/Class associated with this class.
jclass struct_Class_to_jclass (Class *clss)
 Gets handle of java/lang/Class instance associated with this class.
Classjclass_to_struct_Class (jclass jc)
 Gets native class from the java/lang/Class handle.
Classjobject_to_struct_Class (jobject jobj)
 Gets native class for any given object handle.
jobject struct_Class_to_java_lang_Class_Handle (Class *clss)
 Gets pointer to instance of java/lang/Class associated with the class.
Classjava_lang_Class_to_struct_Class (ManagedObject *jlc)
 Gets native class from instance of java/lang/Class.
Fieldclass_lookup_field_recursive (Class *clss, const char *name, const char *desc)
 Looks up field in class and its superclasses.
VMEXPORT Methodclass_lookup_method_recursive (Class *clss, const String *name, const String *desc)
 Looks up method in class and its superclasses.
Methodclass_lookup_method_recursive (Class *clss, const char *name, const char *desc)
 Looks up method in class and its superclasses.
Methodclass_lookup_method (Class *clss, const char *name, const char *desc)
 Looks up method in the given class only.
Methodclass_get_method_from_vt_offset (VTable *vt, unsigned offset)
 Gets method given its offset in the vtable.
Fieldclass_resolve_nonstatic_field (Class *clss, unsigned cp_index)
 Resolves non-static field at the specified index in the constant pool of the class.
Classclass_load_verify_prepare_by_loader_jni (Global_Env *env, const String *classname, ClassLoader *cl)
 Loads a class and performs the first two parts of the link process: verify and prepare.
Classclass_load_verify_prepare_from_jni (Global_Env *env, const String *classname)
 Loads a class with bootstrap class loader and performs the first two parts of the link process: verify and prepare.
void class_initialize_from_jni (Class *clss)
 Executes static initializer of class.
void class_initialize_ex (Class *clss)
 Executes static initializer of class.
VMEXPORT void class_initialize (Class *clss)
 Executes static initializer of class.
bool class_register_methods (Class_Handle klass, const JNINativeMethod *methods, int num_methods)
 Registers a number of native methods to a given class.
bool class_unregister_methods (Class_Handle klass)
 Unregisters a native methods off a given class.
Classresolve_class_new_env (Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn)
Methodresolve_special_method_env (Global_Env *env, Class_Handle curr_clss, unsigned index, bool raise_exn)
Methodresolve_static_method_env (Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn)
Methodresolve_virtual_method_env (Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn)
Methodresolve_interface_method_env (Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn)
Fieldresolve_static_field_env (Global_Env *env, Class *clss, unsigned cp_index, bool putfield, bool is_runtume)
Fieldresolve_nonstatic_field_env (Global_Env *env, Class *clss, unsigned cp_index, unsigned putfield, bool raise_exn)


Define Documentation

#define CLASSFILE_MAGIC   0xCAFEBABE

#define CLASSFILE_MAJOR_MIN   45

#define CLASSFILE_MAJOR_MAX   50

#define CLASSFILE_MINOR_MAX   0


Enumeration Type Documentation

enum ConstPoolTags

Types of constant pool entries.

These entry types are defined by a seperate byte array that the first constant pool entry points at.

Enumerator:
CONSTANT_Tags  pointer to the tags array.

CONSTANT_Utf8  The next 11 tag values are taken from The Java Virtual Machine Specification, Chapter 4, The Constant Pool section.

CONSTANT_Integer 
CONSTANT_Float 
CONSTANT_Long 
CONSTANT_Double 
CONSTANT_Class 
CONSTANT_String 
CONSTANT_Fieldref 
CONSTANT_Methodref 
CONSTANT_InterfaceMethodref 
CONSTANT_NameAndType 
CONSTANT_Last 
CONSTANT_UnusedEntry  used to mark second entry of Long and Double

enum Class_State

The state of the Java class.

Enumerator:
ST_Start 
ST_LoadingAncestors  the initial state
ST_Loaded  the loading super class and super interfaces
ST_BytecodesVerified  successfully loaded
ST_InstanceSizeComputed  bytecodes for methods verified for the class
ST_Prepared  preparing the class; instance size known
ST_ConstraintsVerified  successfully prepared
ST_Initializing  constraints verified for the class
ST_Initialized  initializing the class
ST_Error  bad class or the class initializer failed

enum AccessAndPropertiesFlags

Access and properties flags for Class, Field and Method.

Enumerator:
ACC_PUBLIC  Public access modifier.

Valid for Class, Field, Method.

ACC_PRIVATE  Private access modifier.

Valid for Field, Method.

ACC_PROTECTED  Protected access modifier.

Valid for Field, Method.

ACC_STATIC  Static modifier.

Valid for Field, Method.

ACC_FINAL  Final modifier.

Valid for Class, Field, Method.

ACC_SUPER  Super modifier.

Valid for Class.

ACC_SYNCHRONIZED  Synchronized modifier.

Valid for Method.

ACC_BRIDGE  Bridge modifier.

Valid for Method (since J2SE 5.0).

ACC_VOLATILE  Volatile modifier.

Valid for Field.

ACC_VARARGS  Varargs modifier.

Valid for Method (since J2SE 5.0).

ACC_TRANSIENT  Transient modifier.

Valid for Field.

ACC_NATIVE  Native modifier.

Valid for Method.

ACC_INTERFACE  Interface modifier.

Valid for Class.

ACC_ABSTRACT  Abstract modifier.

Valid for Class, Method.

ACC_STRICT  Strict modifier.

Valid for Method.

ACC_SYNTHETIC  Synthetic modifier.

Valid for Class, Field, Method (since J2SE 5.0).

ACC_ANNOTATION  Annotation modifier.

Valid for Class (since J2SE 5.0).

ACC_ENUM  Enum modifier.

Valid for Class, Field (since J2SE 5.0).


Function Documentation

VMEXPORT String* class_name_get_java_name ( const String class_name  ) 

Converts a class name from an internal (VM) form to the Java form.

Parameters:
[in] class_name - the class name in an internal form
Returns:
The class name in the Java form.

ManagedObject* struct_Class_to_java_lang_Class ( Class clss  ) 

Gets instance of java/lang/Class associated with this class.

Parameters:
[in] clss - class to retrieve java/lang/Class instance for.
Returns:
Instance of java/lang/Class associated with class.

jclass struct_Class_to_jclass ( Class clss  ) 

Gets handle of java/lang/Class instance associated with this class.

Parameters:
[in] clss - class to retrieve handle with java/lang/Class instance for.
Returns:
Handle with instance of java/lang/Class associated with class.
Note:
This function allocates local handle and stores reference to java/lang/Class into it.

Class* jclass_to_struct_Class ( jclass  jc  ) 

Gets native class from the java/lang/Class handle.

Parameters:
[in] jc - handle to retrieve struct Class from.
Returns:
Class for the given handle.

Class* jobject_to_struct_Class ( jobject  jobj  ) 

Gets native class for any given object handle.

Parameters:
[in] jobj - object to retrieve class for.
Returns:
Class for the given object handle.

jobject struct_Class_to_java_lang_Class_Handle ( Class clss  ) 

Gets pointer to instance of java/lang/Class associated with the class.

Parameters:
[in] clss - class to retrieve pointer to instance of java/lang/Class for.
Returns:
Pointer to instance of java/lang/Class associated with the class.
Note:
This is NOT real handle, so, when using this function, make sure the returned value will never be passed to ANY user code including JVMTI agent callbacks.

Class* java_lang_Class_to_struct_Class ( ManagedObject jlc  ) 

Gets native class from instance of java/lang/Class.

Parameters:
[in] jlc - instance of java/lang/Class to retrieve class from.
Returns:
Native class from instance of java/lang/Class.

Field* class_lookup_field_recursive ( Class clss,
const char *  name,
const char *  desc 
)

Looks up field in class and its superclasses.

Parameters:
[in] clss - class to lookup field in.
[in] name - name of the field.
[in] desc - descriptor of the field.
Returns:
Requested field, if the field exists, NULL otherwise.

VMEXPORT Method* class_lookup_method_recursive ( Class clss,
const String name,
const String desc 
)

Looks up method in class and its superclasses.

Parameters:
[in] clss - class to lookup method in.
[in] name - name of the method as VM String.
[in] desc - descriptor of the method as VM String.
Returns:
Requested method, if the method exists, NULL otherwise.
Note:
VMEXPORT specifier is solely for interpreter.

Method* class_lookup_method_recursive ( Class clss,
const char *  name,
const char *  desc 
)

Looks up method in class and its superclasses.

Parameters:
[in] clss - class to lookup method in.
[in] name - name of the method.
[in] desc - descriptor of the method.
Returns:
Requested method, if the method exists, NULL otherwise.

Method* class_lookup_method ( Class clss,
const char *  name,
const char *  desc 
)

Looks up method in the given class only.

Parameters:
[in] clss - class to lookup method in.
[in] name - name of the method.
[in] desc - descriptor of the method.
Returns:
Requested method, if the method exists, NULL otherwise.

Method* class_get_method_from_vt_offset ( VTable vt,
unsigned  offset 
)

Gets method given its offset in the vtable.

Parameters:
[in] vt - vtable containing method.
[in] offset - offset of the method in the vtable.
Returns:
Method at the specified offset.

Field* class_resolve_nonstatic_field ( Class clss,
unsigned  cp_index 
)

Resolves non-static field at the specified index in the constant pool of the class.

Parameters:
[in] clss - class to resolve field in.
[in] cp_index - index in the constant pool of the class.
Returns:
Resolved field, if resolution succeeded, NULL otherwise.

Class* class_load_verify_prepare_by_loader_jni ( Global_Env env,
const String classname,
ClassLoader cl 
)

Loads a class and performs the first two parts of the link process: verify and prepare.

Parameters:
[in] env - VM environment.
[in] classname - name of a class to load.
[in] cl - class loader to load class with.
Returns:
Loaded class, if loading and linking succeeded, NULL otherwise.

Class* class_load_verify_prepare_from_jni ( Global_Env env,
const String classname 
)

Loads a class with bootstrap class loader and performs the first two parts of the link process: verify and prepare.

Parameters:
[in] env - VM environment.
[in] classname - name of a class to load.
[in] cl - class loader to load class with.
Returns:
Loaded class, if loading and linking succeeded, NULL otherwise.
Note:
The class is loaded .

void class_initialize_from_jni ( Class clss  ) 

Executes static initializer of class.

Parameters:
[in] clss - class to initialize.

void class_initialize_ex ( Class clss  ) 

Executes static initializer of class.

Parameters:
[in] clss - class to initialize.

VMEXPORT void class_initialize ( Class clss  ) 

Executes static initializer of class.

Parameters:
[in] clss - class to initialize.
Note:
VMEXPORT specifier is solely for interpreter.

bool class_register_methods ( Class_Handle  klass,
const JNINativeMethod methods,
int  num_methods 
)

Registers a number of native methods to a given class.

Parameters:
[in] klass - a specified class
[in] methods - an array of methods
[in] num_methods - a number of methods
Returns:
false, if methods resistration is successful; otherwise true.
Note:
Function raises NoSuchMethodError with the method name in exception message, if one of the methods in the JNINativeMethod* array is not present in a specified class.

bool class_unregister_methods ( Class_Handle  klass  ) 

Unregisters a native methods off a given class.

Parameters:
[in] klass - specified class
Returns:
false, if methods unresistration is successful; otherwise true.

Class* resolve_class_new_env ( Global_Env env,
Class clss,
unsigned  cp_index,
bool  raise_exn 
)

Method* resolve_special_method_env ( Global_Env env,
Class_Handle  curr_clss,
unsigned  index,
bool  raise_exn 
)

Method* resolve_static_method_env ( Global_Env env,
Class clss,
unsigned  cp_index,
bool  raise_exn 
)

Method* resolve_virtual_method_env ( Global_Env env,
Class clss,
unsigned  cp_index,
bool  raise_exn 
)

Method* resolve_interface_method_env ( Global_Env env,
Class clss,
unsigned  cp_index,
bool  raise_exn 
)

Field* resolve_static_field_env ( Global_Env env,
Class clss,
unsigned  cp_index,
bool  putfield,
bool  is_runtume 
)

Field* resolve_nonstatic_field_env ( Global_Env env,
Class clss,
unsigned  cp_index,
unsigned  putfield,
bool  raise_exn 
)


Genereated on Tue Mar 11 19:25:56 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.