Class Struct Reference

#include <Class.h>

List of all members.


Detailed Description

VM representation of Java class.

This class contains methods for parsing classes, querying class properties, setting external properties of a class (source file name, class file name), calling the verifier, preparing, resolving and initializing the class.


Public Member Functions

void init_internals (const Global_Env *env, const String *name, ClassLoader *cl)
 Initializes class-member variables to their initial values.
void clear_internals ()
 Clears member variables within a class.
bool has_super_class () const
 Determines whether the given class has a super class.
const Stringget_super_class_name () const
 Gets the name of the super class.
Classget_super_class () const
 Gets the super class of the given class.
ClassLoader * get_class_loader () const
 Gets the class loader of the given class.
ManagedObject ** get_class_handle () const
 Gets the class handle of java.lang.Class for the given class.
const Stringget_name () const
 Gets the natively interned class name for the given class.
Stringget_java_name ()
 Gets a natively interned class name for the given class.
Stringget_signature () const
 Gets a class signature.
Stringget_simple_name ()
 Gets a simple name of the class.
Package * get_package () const
 Gets a package containing the given class.
int get_depth () const
 Gets depth in the hierarchy of the given class.
bool get_fast_instanceof_flag () const
VTable * get_vtable () const
 Gets the vtable for the given class.
Allocation_Handle get_allocation_handle () const
 Gets an allocation handle for the given class.
size_t get_source_file_name_length ()
 Gets the length of the source-file name.
const char * get_source_file_name ()
 Gets a source-file name.
Method * get_method_from_vtable (unsigned method_idx) const
 Gets a method localed at method_idx in the m_vtable_descriptors table.
unsigned get_number_of_virtual_method_entries () const
 Returns the number of virtual methods in vtable.
Classget_first_child () const
 Gets the first subclass for Class Hierarchy Analysis.
Classget_next_sibling () const
 Return the next sibling for Class Hierarchy Analysis.
size_t get_offset_of_fast_allocation_flag ()
 Gets an offset of m_is_fast_allocation_possible in the class.
size_t get_offset_of_allocation_handle ()
 Gets an offset of m_allocation_handle in the class.
size_t get_offset_of_instance_data_size ()
 Gets an offset of m_instance_data_size in the class.
unsigned char get_number_of_dimensions () const
 Gets the number of array dimensions.
Classget_array_base_class () const
 Gets the base class of the array (for non-primitive arrays only).
Classget_array_element_class () const
 Gets the class of the array element.
TypeDesc * get_array_element_type_desc () const
 Gets the array-element type descriptor.
Class_State get_state () const
 Gets the class state.
uint16 get_number_of_superinterfaces () const
 Gets a number of superinterfaces.
const Stringget_superinterface_name (uint16 index) const
 Gets a super-interface name from the array of super-interfaces that the given class implements.
Classget_superinterface (uint16 index) const
 Gets a superinterface from the array of superinterfaces the given class implements.
ConstantPoolget_constant_pool ()
 Gets a constant pool of the given class.
uint16 get_number_of_fields () const
 Gets a number of fields in the given class.
uint16 get_number_of_static_fields () const
 Gets a number of static fields in the given class.
Field * get_field (uint16 index) const
 Gets a field from the given class by its position in the class-fields array.
void * get_static_data_address () const
 Gets an address of the memory block containing static data of the given class.
uint16 get_number_of_methods () const
 Gets a number of methods in the given class.
Method * get_method (uint16 index) const
 Gets a method from the given class by its position in the class-method array.
uint16 get_declaring_class_index () const
 Gets a constant-pool index of the declaring class.
uint16 get_enclosing_class_index () const
 Gets a constant-pool index of the enclosing class.
uint16 get_enclosing_method_index () const
 Gets a constant-pool index of the enclosing method.
uint16 get_number_of_inner_classes () const
 Gets a number of inner classes.
uint16 get_inner_class_index (uint16 index) const
 Gets an index in the constant pool of the given class, which describes the inner class.
uint16 get_inner_class_access_flags (uint16 index) const
 Gets access flags for the inner class.
AnnotationTable * get_annotations () const
 Gets a collection of annotations.
AnnotationTable * get_invisible_annotations () const
 Gets a collection of invisible annotations.
unsigned int get_allocated_size () const
 Gets a class instance size.
unsigned int get_instance_data_size () const
unsigned int get_array_element_size () const
 Gets the array-alement size.
unsigned get_id () const
 Gets the class ID.
uint16 get_version () const
 Gets major version of class file.
uint16 get_access_flags () const
 Gets access and properties flags of the given class.
bool is_primitive () const
 Checks whether the given class represents the primitive type.
bool is_array () const
 Checks whether the given class represents an array.
bool is_array_of_primitives () const
 Checks whether the base class of the given array is primitive.
bool is_public () const
 Checks whether the class has the ACC_PUBLIC flag set.
bool is_private () const
 Checks whether the class has the ACC_PUBLIC flag set.
bool is_protected () const
 Checks whether the class has the ACC_PUBLIC flag set.
bool is_final () const
 Checks whether the class has the ACC_FINAL flag set.
bool is_super () const
 Checks whether the class has the ACC_SUPER flag set.
bool is_interface () const
 Checks whether the class has the ACC_INTERFACE flag set.
bool is_abstract () const
 Checks whether the class has the ACC_ABSTRACT flag set.
bool is_enum () const
 Checks whether the class is enum, that is the ACC_ENUM flag is set.
bool is_synthetic () const
 Checks whether the class has the ACC_SYNTHETIC flag set.
bool is_annotation () const
 Checks whether the class is an annotation.
bool has_finalizer () const
 Checks whether the given class has a finalizer.
bool is_inner_class () const
 Checks whether the given class is an inner class of some other class.
bool can_access_inner_class (Global_Env *env, Class *inner_class)
 Checks whether the given class can access inner_class.
bool can_access_member (Class_Member *member)
 Checks whether the given class can access a member class.
bool has_source_information () const
 Checks whether the given class has a source-file name available.
bool is_initializing () const
 Checks whether the given class is in the process of initialization.
bool is_initialized () const
 Checks whether the class is initialized.
bool in_error () const
 Checks whether the class is in the error state.
bool is_at_least_prepared () const
 Checks whether the given class has a passed preparation stage.
bool is_instanceof (Class *clss)
 Checks whether the given class represents a class that is a subtype of clss, according to the Java instance of rules.
void set_class_file_name (const char *cf_name)
 FIXME: all setter functions must be rethought to become private or to be removed altogether, if possible.
void set_instance_data_size_constraint_bit ()
 Sets instance data size constraint bit to let the allocation know there are constraints on the way instance should be allocated.
void set_class_handle (ManagedObject **oh)
 Sets a class handle of java.lang.Class for the given class.
bool parse (Global_Env *env, ByteReader &cfs)
 Constructs internal representation of a class from the byte array (defines class).
bool load_ancestors (Global_Env *env)
 Loads a super class and super interfaces of the given class.
bool verify (const Global_Env *env)
 Verifies bytecodes of the class.
bool verify_constraints (const Global_Env *env)
 Verifies constraints for the given class collected during the bytecodes verification.
void setup_as_primitive (ClassLoader *cl)
 Setups the given class as representing a primitive type.
void setup_as_array (Global_Env *env, unsigned char num_dimensions, bool isArrayOfPrimitives, Class *baseClass, Class *elementClass)
 Sets up the given class as representing an array.
bool prepare (Global_Env *env)
 Prepares a class:.
Class_resolve_class (Global_Env *env, unsigned cp_index)
 Resolves a constant-pool entry to a class.
Classresolve_declaring_class (Global_Env *env)
 Resolves a declaring class.
Field * _resolve_field (Global_Env *env, unsigned cp_index)
 Resolves a field in the constant pool of the given class.
Method * _resolve_method (Global_Env *env, unsigned cp_index)
 Resolves a method in the constant pool of the given class.
void initialize ()
 Initializes the class.
Field * lookup_field (const String *name, const String *descriptor)
 Looks up the field with specified name and descriptor in the given class only.
Field * lookup_field_recursive (const String *name, const String *descriptor)
 Looks up the field with specified name and descriptor in the given class and also in the super class and super-interfaces recursively.
Method * lookup_method (const String *name, const String *desc)
 Looks up a method with a specified name and descriptor in the given class only.
ManagedObjectallocate_instance ()
 Allocates an instance of the given class and returns a pointer to it.
unsigned calculate_array_size (int length) const
 Calculates a size of the block allocated for the array, which is represented by the given class.
unsigned calculate_size ()
 Estimates the amount of memory allocated for C++ part of the given class.
void register_jit_extended_class_callback (JIT *jit_to_be_notified, void *callback_data)
 Registers a callback that is called to notify the given JIT whenever the given class is extended.
void do_jit_extended_class_callbacks (Class *new_subclass)
 Calls registered JITs callbacks to notify that the given class was extended by new_class.
bool has_source_debug_extension () const
 Checks whether the given class has the SourceDebugExtension attribute.
unsigned get_source_debug_extension_length () const
 Gets length of the SourceDebugExtension attribute.
const char * get_source_debug_extension () const
 Gets data from the SourceDebugExtension attribute.
void set_verification_data (void *data)
 Stores a verifier specific pointer into the given class.
void * get_verification_data ()
 Gets a pointer to verifier specific data, previously stored with the call to set_verification_data.
void lock ()
 Locks access to the given class.
void unlock ()
 Unlocks access to the given class.
void instance_allocated (unsigned size)
 Updates allocation statistics.
void instanceof_slow_path_taken ()
 Updates an instance of slow path statistics.
void class_thrown ()
 Updates throwing statistics for java/lang/Throwable decendants.
void * code_alloc (size_t size, size_t alignment, Code_Allocation_Action action)
 Allocates memory for code from pool of defining classloader for the class.
void initialization_checked ()
 Updates initialization check statistics.
uint64 get_times_allocated () const
 Gets the number of times instance of the given class was allocated.
uint64 get_total_bytes_allocated () const
 Gets the total number of bytes allocated for instances of the given class.
uint64 get_times_instanceof_slow_path_taken () const
 Gets the number of times the slow path of the check instance was taken.
uint64 get_times_thrown () const
 Gets the number of times the given class was thrown.
uint64 get_times_init_checked () const
 Gets the number of times the initialization of the given class was checked by run-time helpers.
uint64 get_total_padding_bytes () const
 Gets the number of excessive bytes used for aligning class fields.

Static Public Member Functions

static size_t get_offset_of_depth ()
 Gets offset of m_depth field in struct Class.
static size_t get_offset_of_fast_instanceof_flag ()
 Gets offset of m_is_suitable_for_fast_instanceof field in struct Class.
static size_t get_offset_of_class_init_checks ()
 Gets an offset of m_num_class_init_checks in the class.
static size_t get_offset_of_array_element_class ()
 Gets an offset of m_array_element_class in the class.
static size_t get_offset_of_jlc_handle ()
 Gets an offset of m_class_handle in the class.
static void * helper_get_interface_vtable (ManagedObject *obj, Class *iid)
 Gets the interface vtable for interface iid within object obj.

Classes

struct  Class_Super
struct  InnerClass


Member Function Documentation

void Class.init_internals ( const Global_Env env,
const String name,
ClassLoader *  cl 
)

Initializes class-member variables to their initial values.

Parameters:
[in] env - VM environment
[in] name - a class name to assign to the given class
[in] cl - a class loader for the given class

void Class.clear_internals (  ) 

Clears member variables within a class.

bool Class.has_super_class (  )  const

Determines whether the given class has a super class.

Returns:
true if the current class has a super class; otherwise false.

const String* Class.get_super_class_name (  )  const

Gets the name of the super class.

Returns:
The super class name or NULL, if the given class is java/lang/Object.
Note:
It is valid until the super class is loaded; after that, use get_super_class()->get_name() to retrieve the super class name.

Class* Class.get_super_class (  )  const

Gets the super class of the given class.

Returns:
The super class of the given class or NULL, if the given class is java/lang/Object.

ClassLoader* Class.get_class_loader (  )  const

Gets the class loader of the given class.

Returns:
the class loader of the given class.

ManagedObject** Class.get_class_handle (  )  const

Gets the class handle of java.lang.Class for the given class.

Returns:
The java.lang.Class handle for the given class.

const String* Class.get_name (  )  const

Gets the natively interned class name for the given class.

Returns:
The class name in the VM format.

String* Class.get_java_name (  ) 

Gets a natively interned class name for the given class.

Returns:
A class name in the Java format.

String* Class.get_signature (  )  const

Gets a class signature.

Returns:
A class signature.

String* Class.get_simple_name (  ) 

Gets a simple name of the class.

Returns:
A simple name of the class.

Package* Class.get_package (  )  const

Gets a package containing the given class.

Returns:
A package to which the given class belongs.

int Class.get_depth (  )  const

Gets depth in the hierarchy of the given class.

Returns:
A number of classes in the super-class hierarchy.

bool Class.get_fast_instanceof_flag (  )  const

VTable* Class.get_vtable (  )  const

Gets the vtable for the given class.

Returns:
The vtable for the given class or NULL, if the given class is an interface.

Allocation_Handle Class.get_allocation_handle (  )  const

Gets an allocation handle for the given class.

size_t Class.get_source_file_name_length (  ) 

Gets the length of the source-file name.

Returns:
The length in bytes of the source-file name.

const char* Class.get_source_file_name (  ) 

Gets a source-file name.

Returns:
A source-file name for the given class.

Method* Class.get_method_from_vtable ( unsigned  method_idx  )  const

Gets a method localed at method_idx in the m_vtable_descriptors table.

Parameters:
method_idx - index of method in vtable descriptors table
Returns:
A method from the vtable descriptors table.

unsigned Class.get_number_of_virtual_method_entries (  )  const

Returns the number of virtual methods in vtable.

Class* Class.get_first_child (  )  const

Gets the first subclass for Class Hierarchy Analysis.

Returns:
The first subclass.

Class* Class.get_next_sibling (  )  const

Return the next sibling for Class Hierarchy Analysis.

Returns:
The next sibling.

static size_t Class.get_offset_of_depth (  )  [static]

Gets offset of m_depth field in struct Class.

Note:
Instanceof helpers use returned offset.

static size_t Class.get_offset_of_fast_instanceof_flag (  )  [static]

Gets offset of m_is_suitable_for_fast_instanceof field in struct Class.

Note:
Instanceof helper uses returned offset.

size_t Class.get_offset_of_fast_allocation_flag (  ) 

Gets an offset of m_is_fast_allocation_possible in the class.

Note:
Allocation helpers use returned offset.

size_t Class.get_offset_of_allocation_handle (  ) 

Gets an offset of m_allocation_handle in the class.

Note:
Allocation helpers use returned offset.

size_t Class.get_offset_of_instance_data_size (  ) 

Gets an offset of m_instance_data_size in the class.

Note:
Allocation helpers use returned offset.

static size_t Class.get_offset_of_class_init_checks (  )  [static]

Gets an offset of m_num_class_init_checks in the class.

Note:
Class initialization helper on IPF uses returned offset.

static size_t Class.get_offset_of_array_element_class (  )  [static]

Gets an offset of m_array_element_class in the class.

Note:
Class initialization helper on IPF uses returned offset.

static size_t Class.get_offset_of_jlc_handle (  )  [static]

Gets an offset of m_class_handle in the class.

Note:
It used by VMHelper class

unsigned char Class.get_number_of_dimensions (  )  const

Gets the number of array dimensions.

Returns:
Number of dimentions in an array represented by this class.

Class* Class.get_array_base_class (  )  const

Gets the base class of the array (for non-primitive arrays only).

Returns:
Class describing the base type of an array represented by this class.

Class* Class.get_array_element_class (  )  const

Gets the class of the array element.

Returns:
Class describing the element of an array represented by this class.

TypeDesc* Class.get_array_element_type_desc (  )  const

Gets the array-element type descriptor.

Returns:
Type descriptor for the element of an array represented by this class.

Class_State Class.get_state (  )  const

Gets the class state.

Returns:
The class state.

uint16 Class.get_number_of_superinterfaces (  )  const

Gets a number of superinterfaces.

Returns:
A number of superinterfaces of the given class.

const String* Class.get_superinterface_name ( uint16  index  )  const

Gets a super-interface name from the array of super-interfaces that the given class implements.

Parameters:
[in] index - an index of super-interface to return the name for
Returns:
The requested super-interface name.

Class* Class.get_superinterface ( uint16  index  )  const

Gets a superinterface from the array of superinterfaces the given class implements.

Parameters:
[in] index - an index of a superinterface to return
Returns:
A requested superinterface.

ConstantPool& Class.get_constant_pool (  ) 

Gets a constant pool of the given class.

Returns:
A constant pool of the given class.

uint16 Class.get_number_of_fields (  )  const

Gets a number of fields in the given class.

Returns:
A number of fields in the given class.

uint16 Class.get_number_of_static_fields (  )  const

Gets a number of static fields in the given class.

Returns:
A number of static fields in the given class.

Field* Class.get_field ( uint16  index  )  const

Gets a field from the given class by its position in the class-fields array.

Parameters:
[in] index - an index in the class-fields array of a field to retrieve
Returns:
The requested field.

void* Class.get_static_data_address (  )  const

Gets an address of the memory block containing static data of the given class.

Returns:
An address of a static data block.

uint16 Class.get_number_of_methods (  )  const

Gets a number of methods in the given class.

Returns:
A number of methods in the given class.

Method* Class.get_method ( uint16  index  )  const

Gets a method from the given class by its position in the class-method array.

Parameters:
[in] index - an index in the class-method array of a method to retrieve
Returns:
A requested method.

uint16 Class.get_declaring_class_index (  )  const

Gets a constant-pool index of the declaring class.

Returns:
An index in the constant pool describing the requested declaring class.

uint16 Class.get_enclosing_class_index (  )  const

Gets a constant-pool index of the enclosing class.

Returns:
An index in the constant pool describing the requested enclosing class.

uint16 Class.get_enclosing_method_index (  )  const

Gets a constant-pool index of the enclosing method.

Returns:
An index in the constant pool describing the requested enclosing method.

uint16 Class.get_number_of_inner_classes (  )  const

Gets a number of inner classes.

Returns:
A number of inner classes.

uint16 Class.get_inner_class_index ( uint16  index  )  const

Gets an index in the constant pool of the given class, which describes the inner class.

Parameters:
[in] index - an index of the inner class in the array of inner classes in the given class
Returns:
An index in the constant pool describing the requested inner class.

uint16 Class.get_inner_class_access_flags ( uint16  index  )  const

Gets access flags for the inner class.

Parameters:
[in] index - an index of the inner class in the array of inner classes in the given class
Returns:
Access flags of the requested inner class.

AnnotationTable* Class.get_annotations (  )  const

Gets a collection of annotations.

Returns:
A collection of annotations.

AnnotationTable* Class.get_invisible_annotations (  )  const

Gets a collection of invisible annotations.

Returns:
A collection of invisible annotations.

unsigned int Class.get_allocated_size (  )  const

Gets a class instance size.

Returns:
A size of the allocated instance in bytes.

unsigned int Class.get_instance_data_size (  )  const

unsigned int Class.get_array_element_size (  )  const

Gets the array-alement size.

Returns:
A size of the array element.
Note:
The given function assumes that the class is an array class.

unsigned Class.get_id (  )  const

Gets the class ID.

uint16 Class.get_version (  )  const

Gets major version of class file.

Returns:
Major version of class file.

uint16 Class.get_access_flags (  )  const

Gets access and properties flags of the given class.

Returns:
The 16-bit integer representing access and properties flags the given class.

bool Class.is_primitive (  )  const

Checks whether the given class represents the primitive type.

Returns:
true if the class is primitive; otherwise false.

bool Class.is_array (  )  const

Checks whether the given class represents an array.

Returns:
true if the given class is an array, otherwise false.

bool Class.is_array_of_primitives (  )  const

Checks whether the base class of the given array is primitive.

Returns:
true if the base class is primitive, otherwise false.

bool Class.is_public (  )  const

Checks whether the class has the ACC_PUBLIC flag set.

Returns:
true if the class has the ACC_PUBLIC access flag set.

bool Class.is_private (  )  const

Checks whether the class has the ACC_PUBLIC flag set.

Returns:
true if the class has the ACC_PUBLIC access flag set.

bool Class.is_protected (  )  const

Checks whether the class has the ACC_PUBLIC flag set.

Returns:
true if the class has the ACC_PUBLIC access flag set.

bool Class.is_final (  )  const

Checks whether the class has the ACC_FINAL flag set.

Returns:
true if the class has the ACC_FINAL access flag set.

bool Class.is_super (  )  const

Checks whether the class has the ACC_SUPER flag set.

Returns:
true if the class has the ACC_SUPER access flag set.

bool Class.is_interface (  )  const

Checks whether the class has the ACC_INTERFACE flag set.

Returns:
true if the class has the ACC_INTERFACE access flag set.

bool Class.is_abstract (  )  const

Checks whether the class has the ACC_ABSTRACT flag set.

Returns:
true if the class has the ACC_ABSTRACT access flag set.

bool Class.is_enum (  )  const

Checks whether the class is enum, that is the ACC_ENUM flag is set.

Returns:
true if the class is enum.

bool Class.is_synthetic (  )  const

Checks whether the class has the ACC_SYNTHETIC flag set.

Returns:
true if the class has the ACC_SYNTHETIC access flag set.

bool Class.is_annotation (  )  const

Checks whether the class is an annotation.

Returns:
true if the class is an annotation.

bool Class.has_finalizer (  )  const

Checks whether the given class has a finalizer.

Returns:
true if the given class (or its super class) has a finalize method; otherwise false.

bool Class.is_inner_class (  )  const

Checks whether the given class is an inner class of some other class.

Returns:
true if the given class is an inner class of some other class, otherwise false.

bool Class.can_access_inner_class ( Global_Env env,
Class inner_class 
)

Checks whether the given class can access inner_class.

Parameters:
[in] env - VM environment
[in] inner_class - an inner class to check access to
Returns:
true if the given class has access to the inner class; otherwise false.

bool Class.can_access_member ( Class_Member *  member  ) 

Checks whether the given class can access a member class.

Parameters:
[in] member - a class member to check access to
Returns:
true if the given class can access a member class; otherwise false.

bool Class.has_source_information (  )  const

Checks whether the given class has a source-file name available.

Returns:
true if source file name is available for the given class; otherwise false.

bool Class.is_initializing (  )  const

Checks whether the given class is in the process of initialization.

Returns:
true if the class initialization method is executed; otherwise false.

bool Class.is_initialized (  )  const

Checks whether the class is initialized.

Returns:
true if the class is initialized; otherwise false.

bool Class.in_error (  )  const

Checks whether the class is in the error state.

Returns:
true if the class is in the error state; otherwise false.

bool Class.is_at_least_prepared (  )  const

Checks whether the given class has a passed preparation stage.

Returns:
true if the class has a passed preparation stage; otherwise false.

bool Class.is_instanceof ( Class clss  ) 

Checks whether the given class represents a class that is a subtype of clss, according to the Java instance of rules.

Parameters:
[in] clss - a class to check for being super relative
Returns:
true if the given class represents a class that is a subtype of clss, otherwise false.

void Class.set_class_file_name ( const char *  cf_name  ) 

FIXME: all setter functions must be rethought to become private or to be removed altogether, if possible.

Sets the name of a file from which the given class has been loaded.

Parameters:
[in] cf_name - a class-file name

void Class.set_instance_data_size_constraint_bit (  ) 

Sets instance data size constraint bit to let the allocation know there are constraints on the way instance should be allocated.

Note:
Constaints are recorded in the class_properties field of the class VTable.

void Class.set_class_handle ( ManagedObject **  oh  ) 

Sets a class handle of java.lang.Class for the given class.

Parameters:
[in] oh - a class handle of java.lang.Class

bool Class.parse ( Global_Env env,
ByteReader &  cfs 
)

Constructs internal representation of a class from the byte array (defines class).

Parameters:
[in] env - VM environment
[in] cfs - a class-file stream; byte array contaning class data

bool Class.load_ancestors ( Global_Env env  ) 

Loads a super class and super interfaces of the given class.

The given class's class loader is used for it.

Parameters:
[in] env - VM environment

bool Class.verify ( const Global_Env env  ) 

Verifies bytecodes of the class.

Parameters:
[in] env - VM environment
Returns:
true if bytecodes of a class were successfully verified; otherwise false.

bool Class.verify_constraints ( const Global_Env env  ) 

Verifies constraints for the given class collected during the bytecodes verification.

Parameters:
[in] env - VM environment
Returns:
true if constraints successfully pass verification; otherwise false.

void Class.setup_as_primitive ( ClassLoader *  cl  ) 

Setups the given class as representing a primitive type.

Parameters:
[in] cl - a class loader the given class belongs to
Note:
FIXME: cl is always a bootstrap class loader for primitive types. Retrieve the bootstrap class loader from VM environment here, not one level up the calling stack.

void Class.setup_as_array ( Global_Env env,
unsigned char  num_dimensions,
bool  isArrayOfPrimitives,
Class baseClass,
Class elementClass 
)

Sets up the given class as representing an array.

Parameters:
[in] env - VM environment
[in] num_dimentions - a number of dimentions this array has
[in] isArrayOfPrimitives - does this array is an array of primitives
[in] baseClass - base class of this array; for example, for [[[Ljava/lang/String; base class is java/lang/String
[in] elementClass - class representing element of this array; for example, for [[I, element the class is [I
Note:
For single-dimentional arrays baseClass and elementClass are the same.

bool Class.prepare ( Global_Env env  ) 

Prepares a class:.

  1. assigns offsets:
    • the offset of instance data fields
    • virtual methods in a vtable
    • static data fields in a static data block
  2. creates a class vtable
  3. creates a static field block
  4. creates a static method block
Parameters:
[in] env - vm environment
Returns:
true if the class was successfully prepared; otherwise false.

Class* Class._resolve_class ( Global_Env env,
unsigned  cp_index 
)

Resolves a constant-pool entry to a class.

Loads a class if neccessary.

Parameters:
[in] env - VM environment
[in] cp_index - a constant-pool index of CONSTANT_Class to resolve
Returns:
A resolved class, if a resolution attempt succeeds; otherwise NULL.
Note:
Should become private as soon as wrappers become members of the struct Class.

Class* Class.resolve_declaring_class ( Global_Env env  ) 

Resolves a declaring class.

Returns:
A declaring class, if the given class is inner class of some other class and if the resolution was successful; otherwise NULL.

Field* Class._resolve_field ( Global_Env env,
unsigned  cp_index 
)

Resolves a field in the constant pool of the given class.

Parameters:
[in] env - VM environment
[in] cp_index - an index of an entry in the constant pool, which describes field to be resolved
Returns:
A resolved field, if a resolution attempt succeeds; otherwise NULL.
Note:
Should become private as soon as wrappers become members of the struct Class.

Method* Class._resolve_method ( Global_Env env,
unsigned  cp_index 
)

Resolves a method in the constant pool of the given class.

Parameters:
[in] env - VM environment
[in] cp_index - an index of an entry in the constant pool, which describes method to be resolved
Returns:
A resolved method, if a resolution attempt succeeds; otherwise NULL.
Note:
Should become private as soon as wrappers become members of the struct Class.

void Class.initialize (  ) 

Initializes the class.

Parameters:
[in] throw_exception - defines whether the exception should be thrown or raised
Note:
The given method may raise exception, if an error occurs during the initialization of the class.

Field* Class.lookup_field ( const String name,
const String descriptor 
)

Looks up the field with specified name and descriptor in the given class only.

Parameters:
[in] name - the field name to look up for
[in] desc - the field descriptor to look up for
Returns:
The looked up field if found in the given class, otherwise NULL.

Field* Class.lookup_field_recursive ( const String name,
const String descriptor 
)

Looks up the field with specified name and descriptor in the given class and also in the super class and super-interfaces recursively.

Parameters:
[in] name - field name to look up for
[in] desc - field descriptor to look up for
Returns:
The looked up field if found, NULL otherwise

Method* Class.lookup_method ( const String name,
const String desc 
)

Looks up a method with a specified name and descriptor in the given class only.

Parameters:
[in] name - a method name to look up for
[in] desc - a method descriptor to look up for
Returns:
The looked-up method, if found in the given class; otherwise NULL.

ManagedObject* Class.allocate_instance (  ) 

Allocates an instance of the given class and returns a pointer to it.

Returns:
A managed pointer to the allocated class instance; NULL, if no memory is available and OutOfMemoryError exception is raised on a caller thread.

unsigned Class.calculate_array_size ( int  length  )  const

Calculates a size of the block allocated for the array, which is represented by the given class.

Parameters:
[in] length the length of the array
Returns:
The size of the array of specified length in bytes, or 0 if the size is too big.

unsigned Class.calculate_size (  ) 

Estimates the amount of memory allocated for C++ part of the given class.

Returns:
The size of memory allocated for the given class.

static void* Class.helper_get_interface_vtable ( ManagedObject obj,
Class iid 
) [static]

Gets the interface vtable for interface iid within object obj.

Parameters:
[in] obj - an object to retrieve an interface table entry from
[in] iid - an interface class to retrieve vtable for
Returns:
An interface vtable from object; NULL, if no such interface exists for the object.

void Class.register_jit_extended_class_callback ( JIT *  jit_to_be_notified,
void *  callback_data 
)

Registers a callback that is called to notify the given JIT whenever the given class is extended.

The callback_data pointer will be passed back to the JIT during the callback. The JIT's callback function is JIT_extended_class_callback.

Parameters:
[in] jit_to_be_notified - JIT to notify on extending the class
[in] callback_data - data to be passed back to JIT, when the callback is called

void Class.do_jit_extended_class_callbacks ( Class new_subclass  ) 

Calls registered JITs callbacks to notify that the given class was extended by new_class.

Parameters:
[in] new_subclass - a subclass extending the given class

bool Class.has_source_debug_extension (  )  const

Checks whether the given class has the SourceDebugExtension attribute.

Returns:
true if the SourceDebugExtension attribute is available for the given class; otherwise false.

unsigned Class.get_source_debug_extension_length (  )  const

Gets length of the SourceDebugExtension attribute.

Returns:
The SourceDebugExtension attribute length.

const char* Class.get_source_debug_extension (  )  const

Gets data from the SourceDebugExtension attribute.

Returns:
SourceDebugExtension attribute bytes.

void Class.set_verification_data ( void *  data  ) 

Stores a verifier specific pointer into the given class.

Parameters:
[in] data - a verifier specific data pointer

void* Class.get_verification_data (  ) 

Gets a pointer to verifier specific data, previously stored with the call to set_verification_data.

Returns:
A pointer to verifier specific data or NULL, if none was set.

void Class.lock (  ) 

Locks access to the given class.

void Class.unlock (  ) 

Unlocks access to the given class.

void Class.instance_allocated ( unsigned  size  ) 

Updates allocation statistics.

Parameters:
[in] size - a size of an allocated instance

void Class.instanceof_slow_path_taken (  ) 

Updates an instance of slow path statistics.

void Class.class_thrown (  ) 

Updates throwing statistics for java/lang/Throwable decendants.

void* Class.code_alloc ( size_t  size,
size_t  alignment,
Code_Allocation_Action  action 
)

Allocates memory for code from pool of defining classloader for the class.

void Class.initialization_checked (  ) 

Updates initialization check statistics.

uint64 Class.get_times_allocated (  )  const

Gets the number of times instance of the given class was allocated.

Returns:
The number of allocations of the given class.

uint64 Class.get_total_bytes_allocated (  )  const

Gets the total number of bytes allocated for instances of the given class.

Returns:
The number of bytes allocated for all instances of the given class.

uint64 Class.get_times_instanceof_slow_path_taken (  )  const

Gets the number of times the slow path of the check instance was taken.

Returns:
The number of times the slow path was taken.

uint64 Class.get_times_thrown (  )  const

Gets the number of times the given class was thrown.

Returns:
The number of times the given class was thrown.

uint64 Class.get_times_init_checked (  )  const

Gets the number of times the initialization of the given class was checked by run-time helpers.

Returns:
The number of times initialization of the given class was checked.

uint64 Class.get_total_padding_bytes (  )  const

Gets the number of excessive bytes used for aligning class fields.

Returns:
A number of excessive bytes used for aligning class fields.


The documentation for this struct was generated from the following file:

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

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