/** * Function returns class name. * * @param klass - class handle * * @return Class name bytes. * * @note Assertion is raised if klass is equal to null. */ const char * class_get_name(Class_Handle klass); /** * Function returns class name. * * @param klass - class handle * * @return Class name bytes. */ char * class_get_java_name(Class_Handle klass); /** * Function returns super class of current class. * * @param klass - class handle * * @return Class handle of super class. * * @note Assertion is raised if klass is equal to null. */ Class_Handle class_get_super_class(Class_Handle klass); /** * Function receives number of super interfaces of class. * * @param klass - class handle * * @return Number of super interfaces of class. * * @note Assertion is raised if klass is equal to null. * @note Replace class_number_implements function. */ unsigned short class_get_superinterfaces_number(Class_Handle klass); /** * Function returns super interface of class. * * @param klass - class handle * @param index - super interface number * * @return Super interface of class. * * @note Assertion is raised if klass is equal to null or index is out of range. * @note Replace class_get_implements function. */ Class_Handle class_get_superinterface(Class_Handle klass, unsigned short index); /** * Function return declaring class of current class. * * @param klass - class handle * * @return Return class handle of class that declared current one, * or NULL if it's a top-level class. */ Class_Handle class_get_declaring_class(Class_Handle klass); /** * Function returns the number of inner classes of current class. * * @param klass - class handle * * @return Returns the number of inner classes. * * @note Replases class_number_inner_classes function. */ unsigned short class_get_inner_classes_number(Class_Handle klass); /** * Function returns inner class of current class. * * @param klass - class handle * @param index - inner class index * * @return Returns inner class. * * @note Assertion is raised if klass is equal to null or index is out of range. */ Class_Handle class_get_inner_class(Class_Handle klass, unsigned short index); /** * Function returns class loader of current class. * * @param klass - class handle * * @return Returns class loader. * * @note Assertion is raised if klass is equal to null. */ ClassLoaderHandle class_get_class_loader(Class_Handle klass); /** * Function returns the number of class fields of current class. * * @param klass - class handle * * @return Returns the number of class fields. * * @note Assertion is raised if klass is equal to null. * @note Replaces class_number_fields function. */ unsigned short class_get_fields_number(Class_Handle klass); /** * Function returns class field of current class. * * @param klass - class handle * @param index - class field index * * @return Returns the number of class fields. * * @note Assertion is raised if klass is equal to null or index is out of range. */ Field_Handle class_get_field(Class_Handle klass, unsigned short index); /** * Function returns number of methods for current class. * * @param klass - class handle * * @return Number of methods for class. * * @note Assertion is raised if klass is equal to null. * @note Replaces class_get_number_methods function. */ unsigned short class_get_methods_number(Class_Handle klass); /** * Function returns method of current class. * * @param klass - class handle * @param index - method index * * @return Method handle. * * @note Assertion is raised if klass is equal to null or index is out of range. */ Method_Handle class_get_method(Class_Handle klass, unsigned short index); /** * Function returns access flags for current class. * * @param klass - class handle * * @return Class access flags. * * @note Assertion is raised if klass is equal to null. */ unsigned short class_get_flags(Class_Handle klass); /** * Function returns source file name for current class. * * @param klass - class handle * * @return Source file name. */ const char * class_get_source_file_name(Class_Handle klass); /** * Function checks if current class is primitive class. * * @param klass - class handle * * @return If class is primitive returns TRUE, else returns FALSE. * * @note Assertion is raised if klass is equal to null. */ Boolean class_is_primitive(Class_Handle klass); /** * Function checks if current class is array. * * @param klass - class handle * * @return If class is array returns TRUE, else returns FALSE. * * @note Assertion is raised if klass is equal to null. */ Boolean class_is_array(Class_Handle klass); /** * Function checks if current class is an instance of another class. * * @param klass - class handle * @param super_klass - super class handle * * @return If klass is an instance of super_class returns * TRUE, else returns FALSE. * * @note Assertion is raised if klass or super_klass are equal to null. */ Boolean class_is_instanceof(Class_Handle klass, Class_Handle super_klass); /** * Function checks if current class is abstract. * * @param klass - class handle * * @return If class is abstract returns TRUE, else returns FALSE. * * @note Assertion is raised if klass is equal to null. * @note Replaces class_property_is_abstract function. */ Boolean class_is_abstract(Class_Handle klass); /** * Function checks if current class is interface class. * * @param klass - class handle * * @return If class is interface class returns TRUE, * else returns FALSE. * * @note Assertion is raised if klass is equal to null. * @note Replaces class_is_interface_ and class_property_is_interface2 functions. */ Boolean class_is_interface(Class_Handle klass); /** * Function checks if current class is final. * * @param klass - class handle * * @return If class is final returns TRUE, else returns FALSE. * * @note Assertion is raised if klass is equal to null. * @note Replaces class_is_final_ and class_property_is_final functions. */ Boolean class_is_final(Class_Handle klass); /** * Function checks if given classes are the same. * * @param klass1 - first class handle * @param klass2 - second class handle * * @return If classes are the same returns TRUE, else returns FALSE. * * @note Assertion is raised if klass1 or klass2 are equal to null. */ Boolean class_is_same_class(Class_Handle klass1, Class_Handler klass2); /** * Function checks if class extends current class with given name. * * @param klass - checked klass * @param super_name - parent class name * * @return If given class extends current class with given name, * function returns TRUE, else function returns FALSE. * * @note Assertion is raised if klass or super_name are equal to null. */ Boolean class_is_extending_class(Class_Handle klass, const char* super_name); /** * Function checks if an inner class is public. * * @param klass - class handle * @param index - inner class index * * @return If an inner class is public, function returns TRUE, * else function returns FALSE. * * @note Assertion is raised if klass is equal to null. */ Boolean class_is_inner_class_public(Class_Handle klass, unsigned index); /** * Function returns a hierarchy depth for a given class. * * @param klass - class handle * * @return Return a hierarchy depth. */ int class_get_depth(Class_Handle klass); /** * Returns the offset of the referent field * in the java.lang.ref.Reference object. * * clss is assumed to represent the reference object, * i.e. class_is_reference() returned non-zero value. * * @note the returned value is most probably a constant, * and is not dependent on the clss. * * @note this interface allows only one non-strong (i.e. weak * soft or phantom) reference per object. * It seems to be sufficient for JVM Spec. */ int class_get_referent_offset(Class_Handle clss); /** * Function returns an VM_Data_Type value for a given class. * * @param klass - class handle * * @return VM_Data_Type value */ VM_Data_Type class_get_primitive_type_of_class(Class_Handle klass); /** * Function returns a class corresponding to a primitive type. * * @param type - primitive type * * @return Class corresponding to a primitive type. * * @note For all primitive types type: * type == class_get_primitive_type_of_class(class_get_class_of_primitive_type(type)) */ Class_Handle class_get_class_of_primitive_type(VM_Data_Type type); /** * For given a class handle klass construct a class handle of * the type representing array of klass. If class klass * is value type, assume that the element is a reference to a boxed * instance of that type. * * @param klass - class handle * * @return Return a class handle of the type representing array of klass. */ Class_Handle class_get_array_of_class(Class_Handle klass); /** * Function returns the class of the array element of the given class. * * @param klass - class handle * * @return The class of the array element of the given class. * * @note The behavior is undefined if the parameter does not represent * an array class. */ Class_Handle class_get_array_element_class(Class_Handle klass); /** * For a class that is an array function returns the type info for the elements * of the array. * * @param klass - class handle * * @return The type info for the elements of the array. */ Type_Info_Handle class_get_element_type_info(Class_Handle klass); /** * Function gets the handle for a field. * * @param klass - class handle * @param index - The value of index indexes into the set of fields that * includes both fields defined in this class and inherited fields. * * @return The handle for a field. * * @note If index is greater than or equal to * class_num_instance_fields_recursive, return NULL. */ Field_Handle class_get_instance_field_recursive(Class_Handle klass, unsigned index); /** * For a class handle that represents and array, function returns the * size of the element of the array. * * @param klass - class handle * * @return The size of the element of the array. */ unsigned class_element_size(Class_Handle klass); /** * Function returns the vtable handle of the given class. * * @param klass - class handle * * @return The vtable handle of the given class. */ VTable_Handle class_get_vtable(Class_Handle klass); /** * Function returns TRUE if the class is neither initialized * nor in the process of being initialized. The intention is that the JIT * will emit a call to VM_RT_INITIALIZE_CLASS before every access to a static * field in Java. * * @param klass - class handle * * @return Return TRUE if the class is neither initialized * nor in the process of being initialized. */ Boolean class_needs_initialization(Class_Handle klass); /** * Function returns TRUE if the class is already fully * initialized. * * @param klass - class handle * * @return Return TRUE if the class is already fully * initialized. */ Boolean class_is_initialized(Class_Handle klass); /** * Function returns the allocation handle to be used for runtime type * checks in JIT-generated code, given a class handle. * * @param klass - class handle * * @return The allocation handle to be used for runtime type checks. */ Runtime_Type_Handle class_get_runtime_type_handle(Class_Handle klass); /** * Function returns the allocation handle to be used for the object * allocation routines, given a class handle. * * @param klass - class handle * * @return The allocation handle to be used for the object * allocation routines. */ Allocation_Handle class_get_allocation_handle(Class_Handle klass); /** * Function gets the alignment of the class. * * @param klass - class handle * * @return The alignment of the class. */ unsigned class_get_alignment(Class_Handle klass); /** * Function returns TRUE if the class has a non-trivial finalizer. * * @param klass - class handle * * @return Returns TRUE if the class has a non-trivial finalizer.. */ Boolean class_is_finalizable(Class_Handle klass); /** * Function checks if this is an array of primitives. * * @param klass - class handle * * @return Returns TRUE if this is an array of primitives. */ Boolean class_is_non_ref_array(Class_Handle klass); /** * Returns non-zero value if the class represented by Class_Handle * is a descendant of java.lang.ref.Reference. The particular type * of reference (weak, soft or phantom) is encoded by the return * value of WeakReferenceType. * * @param klass - class handle * * @return Returns non-zero value if the class is a descendant * of java.lang.ref.Reference. */ WeakReferenceType class_is_reference(Class_Handle klass); /** * Function returns TRUE if th class is likely to be used * as an exception object. This is a hint only. If the result is FALSE, * the class may still be used for exceptions but it is less likely. * * @param klass - class handle * * @return Return TRUE if th class is likely to be used * as an exception object. */ Boolean class_hint_is_exceptiontype(Class_Handle klass); /** * Function returns TRUE if the class represents an enum. * * @param klass - class handle * * @return Return TRUE if the class represents an enum. * * @note For Java 1.4 always returns FALSE. */ Boolean class_is_enum(Class_Handle klass); /** * Function returns number of instance fields defined in a class. * This number includes inherited fields. * * @param klass - class handle * * @return Return number of instance fields defined in a class. * * @note Replace class_num_instance_fields_recursive function. */ unsigned class_get_all_instance_fields_number(Class_Handle klass); /** * Function returns the name of the package containing the class. * * @param klass - class handle * * @return Return the name of the package containing the class. */ const char * class_get_package_name(Class_Handle klass); /** * Function returns a pointer to the location where the constant is stored. * * @param klass - class handle * @param index - interpreted as a constant pool index * * @return Return a pointer to the location where the constant is stored. * * @note This function shouldn't be called for constant strings. * Instead, either: * 1. the jitted code should get the string object at runtime by calling * VM_RT_LDC_STRING, or * 2. use class_get_const_string_intern_addr(). */ const void * class_get_const_addr(Class_Handle klass, unsigned short index); /** * Function returns the type of a compile-time constant. * * @param klass - class handle * @param index - interpreted as a constant pool index * * @return Return the type of a compile-time constant. */ VM_Data_Type class_get_const_type(Class_Handle klass, unsigned short index); /** * Function returns the address where the interned version of the string * is stored. Calling class_get_const_string_intern_addr has * a side-effect of interning the string, so that the JIT can * load a reference to the interned string without checking if * it is null. * * @param klass - class handle * @param index - interpreted as a constant pool index * * @return Return the address where the interned version of the string * is stored. */ void * class_get_const_string_intern_addr(Class_Handle klass, unsigned short index); /** * Function looks up of methods in class. * * @param klass - class handle * @param signature - method signature * @param recursive - flag for recursive search * * @return Found method handle. * * @note Reference to internal type Signature. * @note Replace class_lookup_method_recursively function and function class_lookup_method * with parameter recursive. */ Method_Handle class_lookup_method(Class_Handle klass, Signature* signature, Boolean recursive); /** * Function looks up of fields in class. * * @param klass - class handle * @param signature - field signature * @param recursive - flag for recursive search * * @return Found field handle. * * @note Reference to internal type Signature. * @note Replace class_lookup_field_recursive function and function class_lookup_field * with parameter recursive. */ Field_Handle class_lookup_field(Class_Handle klass, Signature* signature, Boolean recursive); /** * Function returns the signature for field or method/interface in constant pool entry. * * @param klass - class handle * @param cp_index - interpreted as a constant pool index * * @return Return the signature for field or method/interface in constant pool entry. */ const char * class_get_cp_entry_signature(Class_Handle klass, unsigned short cp_index); /** * Function returns the data type for field in constant pool entry. * * @param klass - class handle * @param cp_index - interpreted as a constant pool index * * @return Return the data type for field in constant pool entry. */ VM_Data_Type class_get_cp_field_type(Class_Handle klass, unsigned short cp_index); /** * Function initializes the iterator, to iterate over all classes that * descend from klass, including klass itself. * * @param klass - class handle * @param iterator - class iterator * * @return Return TRUE if iteration is supported over klass, * FALSE if not. * * @note Reference to internal type ChaClassIterator. */ Boolean class_iterator_initialize(ChaClassIterator *iterator, Class_Handle klass); /** * Function returns the current class of the iterator. * * @param iterator - class iterator * * @return Return the current class of the iterator * * @note NULL is returned if there are no more classes. * @note Reference to internal type ChaClassIterator. */ Class_Handle class_iterator_get_current(ChaClassIterator *iterator); /** * Function advances the iterator. * * @param iterator - class iterator * * @note Reference to internal type ChaClassIterator. */ void class_iterator_advance(ChaClassIterator *iterator); /** * Function returns java type for the descriptor. * * @param descriptor - java type descriptor * * @return Return java type for the descriptor. * * @note Replaces get_java_type function. */ Java_Type type_get_java_type(const char* descriptor); /** * Function returns the descriptor for method. * * @param klass - class handle * @param index - interpreted as a constant pool index * * @return Return the the descriptor for method. * * @note Replaces const_pool_get_method_descriptor function. */ const char * class_get_cp_method_descriptor(Class_Handle klass, unsigned short index); /** * Function returns the descriptor for field. * * @param klass - class handle * @param index - interpreted as a constant pool index * * @return Return the the descriptor for field. * * @note Replaces const_pool_get_field_descriptor function. */ const char * class_get_cp_field_descriptor(Class_Handle klass, unsigned short index); /** * Function returns class constant pool size. * * @param klass - class handle * * @return Return constant pool size. * * @note Assertion is raised if klass is equal to null. */ unsigned short class_get_cp_size(Class_Handle klass); /** * Function returns constant pool entry tag. * * @param klass - class handle * @param index - constant pool entry index * * @return Return constant pool entry tag. * * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned char class_get_cp_tag(Class_Handle klass, unsigned short index); /** * Function returns class name entry index in constant pool. * * @param klass - class handle * @param index - constant pool entry index * * @return Return class name entry index. * * @note Function is legal only for constant pool entry with CONSTANT_Class tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned short class_get_cp_class_name_index(Class_Handle klass, unsigned short index); /** * Function returns class name entry index in constant pool. * * @param klass - class handle * @param index - constant pool entry index * * @return Return class name entry index. * * @note Function is legal for constant pool entry with * CONSTANT_Fieldref, CONSTANT_Methodref and CONSTANT_InterfaceMethodref tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned short class_get_cp_ref_class_index(Class_Handle klass, unsigned short index); /** * Function returns name_and_type entry index in constant pool. * * @param klass - class handle * @param index - constant pool entry index * * @return Return name_and_type entry index. * * @note Function is legal for constant pool entry with * CONSTANT_Fieldref, CONSTANT_Methodref and CONSTANT_InterfaceMethodref tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned short class_get_cp_ref_name_and_type_index(Class_Handle klass, unsigned short index); /** * Function returns string entry index in constant pool. * * @param klass - class handle * @param index - constant pool entry index * * @return Return string entry index. * * @note Function is legal for constant pool entry with CONSTANT_String tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned short class_get_cp_string_index(Class_Handle klass, unsigned short index); /** * Function returns name entry index in constant pool. * * @param klass - class handle * @param index - constant pool entry index * * @return Return name entry index. * * @note Function is legal for constant pool entry with CONSTANT_NameAndType tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned short class_get_cp_name_index(Class_Handle klass, unsigned short index); /** * Function returns descriptor entry index in constant pool. * * @param klass - class handle * @param index - constant pool entry index * * @return Return descriptor entry index. * * @note Function is legal for constant pool entry with CONSTANT_NameAndType tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ unsigned short class_get_cp_descriptor_index(Class_Handle klass, unsigned short index); /** * Function returns bytes for UTF8 constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * * @return bytes for UTF8 constant pool entry * * @note Function is legal for constant pool entry with CONSTANT_UTF8 tags. * @note Assertion is raised if klass is equal to null or index is out of range. */ const char * class_get_cp_utf8_bytes(Class_Handle klass, unsigned short index); /** * Function resolves class for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return class resolved for constant pool entry. * * @note Replace vm_resolve_class and resolve_class functions. * @note Reference to external type Loader_Exception. */ Class_Handle class_resolve_class(Class_Handle klass, unsigned short index, Loader_Exception* exc); /** * Function resolves class for constant pool entry * and checks possibility for instance creation. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return class resolved for constant pool entry. * * @note Replace vm_resolve_class_new and resolve_class_new functions. * @note Reference to external type Loader_Exception. * @note If an instance of the class couldn't be created, returns NULL and set * exc exception value. */ Class_Handle class_resolve_class_new(Class_Handle klass, unsigned short index, Loader_Exception *exc); /** * Function resolves class interface method for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return interface method resolved for constant pool entry. * * @note Replace resolve_interface_method function. * @note Reference to external type Loader_Exception. */ Method_Handle class_resolve_interface_method(Class_Handle klass, unsigned short index, Loader_Exception *exc); /** * Function resolves class static method for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return static method resolved for constant pool entry. * * @note Replace resolve_static_method function. * @note Reference to external type Loader_Exception. */ Method_Handle class_resolve_static_method(Class_Handle klass, unsigned short index, Loader_Exception *exc); /** * Function resolves class virtual method for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return virtual method resolved for constant pool entry. * * @note Replace resolve_virtual_method function. * @note Reference to external type Loader_Exception. */ Method_Handle class_resolve_virtual_method(Class_Handle klass, unsigned short index, Loader_Exception* exc); /** * Function resolves class special method for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return special method resolved for constant pool entry. * * @note Replace resolve_special_method function. * @note Reference to external type Loader_Exception. */ Method_Handle class_resolve_special_method(Class_Handle klass, unsigned short index, Loader_Exception* exc); /** * Function resolves class static field for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return static field resolved for constant pool entry. * * @note Replace resolve_static_field function. * @note Reference to external type Loader_Exception. */ Field_Handle class_resolve_static_field(Class_Handle klass, unsigned short index, Loader_Exception* exc); /** * Function resolves class nonstatic field for constant pool entry. * * @param klass - class handle * @param index - constant pool entry index * @param exc - pointer to exception * * @return Return nonstatic field resolved for constant pool entry. * * @note Replace resolve_nonstatic_field function. * @note Reference to external type Loader_Exception. */ Field_Handle class_resolve_nonstatic_field(Class_Handle klass, unsigned short index, Loader_Exception* exc); /** * Function converts class handle to JNI handle class. * * @param jnienv - JNI environment * @param klass - class handle * * @return Return JNI handle class. * * @note Replace jni_class_from_handle and jclass_to_struct_Class functions. */ jclass class_from_handle_jni(JNIEnv *jnienv, Class_Handle klass); /** * Function converts JNI class handle to class handle. * * @param jnienv - JNI environment * @param klass - JNI class handle * * @return Return class handle. * * @note Replace jni_get_class_handle and struct_Class_to_jclass functions. */ Class_Handle class_to_handle_jni(JNIEnv *jnienv, jclass klass); /** * Function provides preparation phase of class loading for a given class. * * @param klass - class handle * @param ld_exc - pointer to exception * * @return Return result of class preparing. * * @note Reference to external type Loader_Exception. */ Loader_Result class_prepare(Class_Handle klass, Loader_Exception *ld_exc); /** * Function provides initialization phase for a given class. * * @param klass - class handle */ void class_initialize(Class_Handle klass); /** * Function provides initialization phase of for a given class for JNI. * * @param klass - class handle * @param throw_exception - exception thrown flag */ void class_initialize_from_jni(Class_Handle klass, bool throw_exception);