Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp Tue Apr 15 04:29:41 2008
@@ -25,7 +25,8 @@
#define DYNAMIC_OPEN
#include "VMInterface.h"
#include "open/vm_properties.h"
-#include "open/vm_class_info.h"
+#include "open/vm_class_manipulation.h"
+#include "open/vm_class_loading.h"
#include "open/vm_type_access.h"
#include "open/vm_field_access.h"
#include "open/vm_method_access.h"
@@ -71,26 +72,26 @@
static class_is_array_t class_is_array = 0;
static class_is_enum_t class_is_enum = 0;
-static class_is_final_t class_is_final = 0; //class_is_final
-static class_is_throwable_t class_is_throwable = 0; //class_hint_is_exceptiontype
-static class_is_interface_t class_is_interface = 0; //class_is_interface2
-static class_is_abstract_t class_is_abstract = 0; //class_is_abstract
-static class_is_initialized_t class_is_initialized = 0; //class_needs_initialization && class_is_initialized()
+static class_is_final_t class_is_final = 0;
+static class_is_throwable_t class_is_throwable = 0;
+static class_is_interface_t class_is_interface = 0;
+static class_is_abstract_t class_is_abstract = 0;
+static class_is_initialized_t class_is_initialized = 0;
static class_is_finalizable_t class_is_finalizable = 0;
static class_is_instanceof_t class_is_instanceof = 0;
static class_is_support_fast_instanceof_t class_is_support_fast_instanceof = 0;// class_get_fast_instanceof_flag
static class_is_primitive_t class_is_primitive = 0;
-static class_lookup_class_by_name_using_bootstrap_class_loader_t class_lookup_class_by_name_using_bootstrap_class_loader = 0;
+static vm_lookup_class_with_bootstrap_t vm_lookup_class_with_bootstrap = 0;
static class_lookup_method_recursively_t class_lookup_method_recursively = 0;
// Const Pool
static class_cp_get_field_type_t class_cp_get_field_type = 0;// VM_Data_Type class_cp_get_field_type(Class_Handle src_class, unsigned short cp_index);
-static class_cp_get_entry_signature_t class_cp_get_entry_signature = 0;//const char* class_cp_get_entry_signature(Class_Handle src_class, unsigned short index); ? const char* class_cp_get_field_descriptor(Class_Handle cl, unsigned index);
+static class_cp_get_entry_class_name_t class_cp_get_entry_class_name = 0;//const char* class_cp_get_entry_class_name(Class_Handle cl, unsigned short index);
+static class_cp_get_entry_name_t class_cp_get_entry_name = 0;//const char* class_cp_get_entry_name(Class_Handle cl, unsigned short index);
+static class_cp_get_entry_descriptor_t class_cp_get_entry_descriptor = 0;//const char* class_cp_get_entry_descriptor(Class_Handle cl, unsigned short index);
static class_cp_is_entry_resolved_t class_cp_is_entry_resolved = 0;//bool class_cp_is_entry_resolved(Compile_Handle ch, Class_Handle clazz, unsigned cp_index);
static class_cp_get_class_name_t class_cp_get_class_name =0;//const char* class_cp_get_class_name(Class_Handle cl, unsigned index);
-static class_cp_get_method_class_name_t class_cp_get_method_class_name = 0;//const char *class_cp_get_method_class_name(Class_Handle cl, unsigned index);
-static class_cp_get_method_name_t class_cp_get_method_name = 0;//const char* class_cp_get_method_name(Class_Handle cl, unsigned index);
//Field
@@ -204,9 +205,9 @@
static vm_properties_get_value_t vm_properties_get_value = 0;//char* vm_properties_get_value(const char* key, PropertyTable table_number)
-static vm_get_system_object_class_t vm_get_system_object_class = 0; // get_system_object_class
+static vm_get_system_object_class_t vm_get_system_object_class = 0;
static vm_get_system_class_class_t vm_get_system_class_class = 0; // get_system_class_class
-static vm_get_system_string_class_t vm_get_system_string_class = 0; // get_system_string_class
+static vm_get_system_string_class_t vm_get_system_string_class = 0;
static vm_get_vtable_base_t vm_get_vtable_base = 0; //POINTER_SIZE_INT vm_get_vtable_base()
static vm_get_heap_base_address_t vm_get_heap_base_address = 0; //vm_heap_base_address
static vm_get_heap_ceiling_address_t vm_get_heap_ceiling_address = 0; //vm_heap_ceiling_address
@@ -275,16 +276,16 @@
class_is_support_fast_instanceof = GET_INTERFACE(vm, class_is_support_fast_instanceof);
class_is_primitive = GET_INTERFACE(vm, class_is_primitive);
- class_lookup_class_by_name_using_bootstrap_class_loader = GET_INTERFACE(vm, class_lookup_class_by_name_using_bootstrap_class_loader);
+ vm_lookup_class_with_bootstrap = GET_INTERFACE(vm, vm_lookup_class_with_bootstrap);
class_lookup_method_recursively = GET_INTERFACE(vm, class_lookup_method_recursively);
// Const Pool
class_cp_get_field_type = GET_INTERFACE(vm, class_cp_get_field_type);
- class_cp_get_entry_signature = GET_INTERFACE(vm, class_cp_get_entry_signature);
+ class_cp_get_entry_class_name = GET_INTERFACE(vm, class_cp_get_entry_class_name);
+ class_cp_get_entry_name = GET_INTERFACE(vm, class_cp_get_entry_name);
+ class_cp_get_entry_descriptor = GET_INTERFACE(vm, class_cp_get_entry_descriptor);
class_cp_is_entry_resolved = GET_INTERFACE(vm, class_cp_is_entry_resolved);
class_cp_get_class_name = GET_INTERFACE(vm, class_cp_get_class_name);
- class_cp_get_method_class_name = GET_INTERFACE(vm, class_cp_get_method_class_name);
- class_cp_get_method_name = GET_INTERFACE(vm, class_cp_get_method_name);
//Field
@@ -554,7 +555,7 @@
void*
VMInterface::getArrayVMTypeHandle(void* elemVMTypeHandle,bool isUnboxed) {
//if (isUnboxed)
- // return class_get_array_of_unboxed((Class_Handle) elemVMTypeHandle);
+ // return class_get_array_of_unboxed((Class_Handle) elemVMTypeHandle);
return class_get_array_of_class((Class_Handle) elemVMTypeHandle);
}
@@ -743,7 +744,12 @@
return method_get_class(drlMethod);
}
-void MethodDesc::getHandlerInfo(unsigned index, unsigned* beginOffset, unsigned* endOffset, unsigned* handlerOffset, unsigned* handlerClassIndex) const {
+void MethodDesc::getHandlerInfo(unsigned short index,
+ unsigned short* beginOffset,
+ unsigned short* endOffset,
+ unsigned short* handlerOffset,
+ unsigned short* handlerClassIndex) const
+{
method_get_exc_handler_info(drlMethod,index,beginOffset,endOffset,handlerOffset,handlerClassIndex);
}
@@ -778,7 +784,7 @@
const char*
CompilationInterface::getSignatureString(MethodDesc* enclosingMethodDesc, uint32 methodToken) {
Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
- return class_cp_get_entry_signature(enclosingDrlVMClass, (unsigned short)methodToken);
+ return class_cp_get_entry_descriptor(enclosingDrlVMClass, (unsigned short)methodToken);
}
Method_Side_Effects
@@ -1067,7 +1073,7 @@
}
ObjectType * CompilationInterface::findClassUsingBootstrapClassloader( const char * klassName ) {
- Class_Handle cls = class_lookup_class_by_name_using_bootstrap_class_loader(klassName);
+ Class_Handle cls = vm_lookup_class_with_bootstrap(klassName);
if( NULL == cls ) {
return NULL;
}
@@ -1329,7 +1335,7 @@
case VM_DATA_TYPE_CLASS:
if (lazy) {
- const char* fieldTypeName = class_cp_get_entry_signature(enclClass, cpIndex);
+ const char* fieldTypeName = class_cp_get_entry_descriptor(enclClass, cpIndex);
assert(fieldTypeName);
return getTypeFromDescriptor(enclClass, fieldTypeName);
}
@@ -1345,17 +1351,17 @@
const char*
CompilationInterface::getMethodName(Class_Handle enclClass, uint32 cpIndex) {
- return class_cp_get_method_name(enclClass, cpIndex);
+ return class_cp_get_entry_name(enclClass, cpIndex);
}
const char*
CompilationInterface::getMethodClassName(Class_Handle enclClass, uint32 cpIndex) {
- return class_cp_get_method_class_name(enclClass, cpIndex);
+ return class_cp_get_entry_class_name(enclClass, cpIndex);
}
const char*
CompilationInterface::getFieldSignature(Class_Handle enclClass, uint32 cpIndex) {
- return class_cp_get_entry_signature(enclClass, cpIndex);
+ return class_cp_get_entry_descriptor(enclClass, cpIndex);
}
::std::ostream& operator<<(::std::ostream& os, Method_Handle method) {
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h Tue Apr 15 04:29:41 2008
@@ -206,8 +206,9 @@
uint32 getByteCodeSize() const;
uint16 getMaxStack() const;
uint32 getNumHandlers() const;
- void getHandlerInfo(unsigned index, unsigned* beginOffset,
- unsigned* endOffset, unsigned* handlerOffset, unsigned* handlerClassIndex) const;
+ void getHandlerInfo(unsigned short index, unsigned short* beginOffset,
+ unsigned short* endOffset, unsigned short* handlerOffset,
+ unsigned short* handlerClassIndex) const;
bool hasAnnotation(NamedType* type) const;
//
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp Tue Apr 15 04:29:41 2008
@@ -7,17 +7,16 @@
class_alloc_via_classloader;
class_element_size;
class_find_class_from_loader;
- class_find_loaded;
class_get_alignment;
class_get_alignment_unboxed;
class_get_allocation_handle;
class_get_array_element_class;
class_get_array_element_size;
class_get_array_of_class;
- class_get_array_of_unboxed;
class_get_boxed_data_size;
class_get_class_loader;
class_get_class_of_primitive_type;
+ class_initialize;
class_cp_get_const_addr;
class_cp_get_const_string;
class_get_const_string_intern_addr;
@@ -47,7 +46,7 @@
class_get_super_class;
class_get_super_offset;
class_get_vtable;
- class_hint_is_exceptiontype;
+ class_is_throwable;
class_is_array;
class_cp_is_entry_resolved;
class_is_enum;
@@ -56,20 +55,13 @@
class_is_inner_class_public;
class_is_instanceof;
class_is_non_ref_array;
- class_is_pinned;
class_is_primitive;
class_is_reference;
class_is_valuetype;
- class_iterator_advance;
- class_iterator_get_current;
- class_iterator_initialize;
class_load_class_by_descriptor;
class_load_class_by_name;
- class_lookup_class_by_name_using_bootstrap_class_loader;
- class_loader_load_native_lib;
- class_loader_lookup;
+ vm_lookup_class_with_bootstrap;
class_lookup_method_recursively;
- class_needs_initialization;
class_number_fields;
class_number_implements;
class_number_inner_classes;
@@ -81,15 +73,9 @@
compiled_method_load;
compress_reference;
class_cp_get_class_name;
- class_cp_get_field_class_name;
- class_cp_get_field_descriptor;
- class_cp_get_field_name;
- class_cp_get_interface_method_class_name;
- class_cp_get_interface_method_descriptor;
- class_cp_get_interface_method_name;
- class_cp_get_method_class_name;
- class_cp_get_method_descriptor;
- class_cp_get_method_name;
+ class_cp_get_entry_name;
+ class_cp_get_entry_descriptor;
+ class_cp_get_entry_class_name;
curr_arg;
vm_properties_destroy_keys;
vm_properties_destroy_value;
@@ -132,9 +118,15 @@
vm_properties_get_keys_starting_with;
vm_properties_get_value;
vm_property_get_size;
- get_system_class_class;
- get_system_object_class;
- get_system_string_class;
+ vm_get_system_class_class;
+ vm_get_system_object_class;
+ vm_get_system_string_class;
+ class_loader_lookup_class;
+ class_loader_load_class;
+ class_loader_set_verifier_data_ptr;
+ class_loader_get_verifier_data_ptr;
+ class_loader_lock;
+ class_loader_unlock;
get_thread_ptr;
get_vm_interface;
initialize_arg_list_iterator;
@@ -534,7 +526,7 @@
resolve_class_new;
resolve_field;
resolve_interface_method;
- resolve_method;
+ class_resolve_method;
resolve_nonstatic_field;
resolve_special_method;
resolve_static_field;
@@ -667,7 +659,6 @@
*exn_raised*;
*vm_instanceof*;
*vm_new_vector*;
- *class_initialize*;
*exn_raise_object*;
*m2n_set_last_frame*;
*get_jni_native_intf*;
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Tue Apr 15 04:29:41 2008
@@ -1993,14 +1993,6 @@
* @param[in] offset - offset of the method in the vtable.
* @return Method at the specified offset.*/
Method* class_get_method_from_vt_offset(VTable* vt, unsigned offset);
-/** Resolves non-static field at the specified index in
- * the constant pool of the class.
- * @param[in] clss - class to resolve field in.
- * @param[in] cp_index - index in the constant pool of the class.
- * @return Resolved field, if resolution succeeded,
- * <code>NULL</code> otherwise.*/
-Field* class_resolve_nonstatic_field(Class* clss, unsigned cp_index);
-
/** Loads a class and performs the first two parts of the link process:
* verify and prepare.
@@ -2027,15 +2019,6 @@
/** Executes static initializer of class.
* @param[in] clss - class to initialize.*/
void class_initialize_from_jni(Class *clss);
-/** Executes static initializer of class.
- * @param[in] clss - class to initialize.*/
-void class_initialize_ex(Class *clss);
-/** Executes static initializer of class.
- * @param[in] clss - class to initialize.
- * @note VMEXPORT specifier is solely for interpreter.*/
-VMEXPORT
-void class_initialize(Class *clss);
-
/** Registers a number of native methods to a given class.
* @param[in] klass - a specified class
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h Tue Apr 15 04:29:41 2008
@@ -14,30 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Pavel Rebriy
- * @version $Revision: 1.1.2.1.4.3 $
- */
+#ifndef __CLASS_INTERFACE_H__
+#define __CLASS_INTERFACE_H__
-/**
- * Define class handler
- */
-typedef struct Class_ * class_handler;
-
-/**
- * Define field handler
- */
-typedef struct Field_ * field_handler;
-
-/**
- * Define method handler
- */
-typedef struct Method_ * method_handler;
-
-/**
- * Define class loader handler
- */
-typedef struct ClassLoader_ * classloader_handler;
+//#include "open/types.h"
+//#include "open/common.h"
/**
* Enum of constant pool tags
@@ -62,456 +43,9 @@
*/
/**
- * Function returns class major version.
- * @param klass - class handler
- * @return Class name bytes.
- * @note Assertion is raised if klass is equal to null.
- */
-unsigned short
-class_get_version( class_handler klass );
-
-/**
- * Function returns class name.
- * @param klass - class handler
- * @return Class name bytes.
- * @note Assertion is raised if klass is equal to null.
- */
-const char *
-class_get_name( class_handler klass );
-
-/**
- * Function returns class loader.
- * @param klass - class handler
- * @return Class class loader handler.
- * @note Assertion is raised if klass is equal to null.
- */
-classloader_handler
-class_get_class_loader( class_handler klass );
-
-/**
- * Function returns super class of current class.
- * @param klass - class handler
- * @return Super class of current class.
- * @note Assertion is raised if klass is equal to null.
- */
-class_handler
-class_get_super_class( class_handler klass );
-
-/**
- * Function checks if classes are equal.
- * @param klass1 - class handler
- * @param klass2 - class handler
- * @return If classes are equal returns <code>true</code>, else returns <code>false</code>.
- * @note Assertion is raised if klass1 or klass2 are equal to null.
- */
-unsigned
-class_is_same_class( class_handler klass1, class_handler klass2 );
-
-/**
- * Function checks if classes have the same package.
- * @param klass1 - class handler
- * @param klass2 - class handler
- * @return If classes have the same package returns <code>true</code>, else returns <code>false</code>.
- * @note Assertion is raised if klass1 or klass2 are equal to null.
- */
-unsigned
-class_is_same_package( class_handler klass1, class_handler klass2 );
-
-/**
- * Function checks if current class is interface.
- * @param klass - class handler
- * @return If class is interface returns <code>true</code>, else returns <code>false</code>.
- * @note Assertion is raised if klass is equal to null.
- */
-// FIXME - There is a macro class_is_interface in Class.h
-unsigned
-class_is_interface_( class_handler klass );
-
-/**
- * Function checks if current class is array.
- * @param klass - class handler
- * @return If class is array returns <code>true</code>, else returns <code>false</code>.
- * @note Assertion is raised if klass is equal to null.
- */
-unsigned
-class_is_array( class_handler klass );
-
-/**
- * Function checks if current class is final.
- * @param klass - class handler
- * @return If class is final returns <code>true</code>, else returns <code>false</code>.
- * @note Assertion is raised if klass is equal to null.
- */
-// FIXME - There is a macro class_is_final in Class.h
-unsigned
-class_is_final_( class_handler klass );
-
-/**
- * Function receives number of super interfaces of class.
- * @param klass - class handler
- * @return Number of super interfaces of class.
- * @note Assertion is raised if klass is equal to null.
- */
-unsigned short
-class_get_superinterface_number( class_handler klass );
-
-/**
- * Function receives super interface of class.
- * @param klass - class handler
- * @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.
- */
-class_handler
-class_get_superinterface( class_handler klass, unsigned short index );
-
-/**
- * Function receives element class of array class.
- * @param klass - class handler
- * @return Element class of array class.
- * @note Assertion is raised if klass is equal to null or isn't array class.
- */
-class_handler
-class_get_array_element_class( class_handler klass );
-
-/**
- * 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 its class handler, else function returns 0.
- * @note Assertion is raised if <i>klass</i> or <i>super_name</i> are equal to null.
- */
-class_handler
-class_is_extending_class( class_handler klass, const char *super_name );
-
-/**
- * Function returns number of methods for current class.
- * @param klass - class handler
- * @return Number of methods for class.
- * @note Assertion is raised if klass is equal to null.
- */
-unsigned short
-class_get_method_number( class_handler klass );
-
-/**
- * Function returns method of current class.
- * @param klass - class handler
- * @param index - method index
- * @return Method handler.
- * @note Assertion is raised if klass is equal to null or index is out of range.
- */
-method_handler
-class_get_method( class_handler klass, unsigned short index );
-
-/**
- * Constant pool inteface
- */
-
-/**
- * Function returns class constant pool size.
- * @param klass - class handler
- * @return constant pool size
- * @note Assertion is raised if klass is equal to null.
- */
-unsigned short
-class_get_cp_size( class_handler klass );
-
-/**
- * Function returns constant pool entry tag.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns class name entry index in constant pool.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns class name entry index in constant pool.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns name_and_type entry index in constant pool.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns string entry index in constant pool.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns name entry index in constant pool.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns descriptor entry index in constant pool.
- * @param klass - class handler
- * @param index - constant pool entry index
- * @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_handler klass, unsigned short index );
-
-/**
- * Function returns bytes for UTF8 constant pool entry.
- * @param klass - class handler
- * @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_handler klass, unsigned short index );
-
-/**
- * Function sets verify data to a given class.
- * @param klass - class handler
- * @param data - verify data
- * @note Assertion is raised if class is equal to null.
- * @note Function makes non thread save operation and
- * must be called in thread safe point.
- */
-void
-class_set_verify_data_ptr( class_handler klass, void *data );
-
-/**
- * Function returns verify data for a given class.
- * @param klass - class handler
- * @return Verify data for a given class.
- * @note Assertion is raised if klass is equal to null.
- */
-void *
-class_get_verify_data_ptr( class_handler klass );
-
-/**
- * Function resolves class nonstatic method for constant pool entry.
- *
- * @param klass - class handle
- * @param index - constant pool entry index
- * @param exc - pointer to exception
- *
- * @return Return nonstatic method resolved for constant pool entry.
- */
-method_handler
-class_resolve_method( class_handler klass, unsigned short index );
-
-/**
- * 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.
- */
-field_handler
-class_resolve_nonstatic_field( class_handler klass, unsigned short index );
-
-/**
- * Method interface
- */
-
-/**
- * Function returns a class in which the method is declared.
- * @param method - method handler
- * @return Return a class in which the method is declared.
- * @note Assertion is raised if <i>method</i> is equal to null.
- */
-class_handler
-method_get_class( method_handler hmethod );
-
-/**
- * Function returns method name.
- * @param method - method handler
- * @return Method name bytes.
- * @note Assertion is raised if method is equal to null.
- */
-const char *
-method_get_name( method_handler method );
-
-/**
- * Function returns method descriptor.
- * @param method - method handler
- * @return Method descriptor bytes.
- * @note Assertion is raised if method is equal to null.
- */
-const char *
-method_get_descriptor( method_handler method );
-
-/**
- * Function returns method code length.
- * @param method - method handler
- * @return Method code length.
- * @note Assertion is raised if method is equal to null.
- */
-unsigned
-method_get_bytecode_length( method_handler method );
-
-/**
- * Function returns method bytecode array.
- * @param method - method handler
- * @return Method bytecode array.
- * @note Assertion is raised if method is equal to null.
- */
-unsigned char *
-method_get_bytecode( method_handler method );
-
-/**
- * Function returns maximal local variables number of method.
- * @param method - method handler
- * @return Maximal local variables number of method.
- * @note Assertion is raised if method is equal to null.
- */
-unsigned short
-method_get_max_local( method_handler method );
-
-/**
- * Function returns maximal stack deep of method.
- * @param method - method handler
- * @return Maximal stack deep of method.
- * @note Assertion is raised if method is equal to null.
- */
-unsigned short
-method_get_max_stack( method_handler method );
-
-/**
- * Function checks if method is static.
- * @param method - method handler
- * @return If method is static, function returns <code>true</code>,
- * else returns <code>false</code>.
- * @note Assertion is raised if method is equal to null.
- */
-unsigned
-method_is_static( method_handler method );
-
-/**
- * Function checks if a given method is protected.
- *
- * @param method - method handle
- *
- * @return Return <code>TRUE</code> if a given method is protected.
- *
- * @note Assertion is raised if <i>method</i> is equal to null.
- */
-unsigned
-method_is_protected( method_handler method );
-
-/**
- * Method exception handler
- */
-
-/**
- * Function returns number of method exception handlers.
- * @param method - method handler
- * @return Number of method exception handlers.
- * @note Assertion is raised if method is equal to null.
- */
-unsigned short
-method_get_exc_handler_number( method_handler method );
-
-/**
- * Function obtains method exception handler info.
- * @param method - method handler
- * @param index - exception handler index number
- * @param start_pc - resulting pointer to exception handler start program count
- * @param end_pc - resulting pointer to exception handler end program count
- * @param handler_pc - resulting pointer to exception handler program count
- * @param catch_type - resulting pointer to constant pool entry index
- * @note Assertion is raised if method is equal to null or
- * exception handler index is out of range or
- * any pointer is equal to null.
- */
-void
-method_get_exc_handler_info( method_handler method, unsigned short index,
- unsigned short *start_pc, unsigned short *end_pc,
- unsigned short *handler_pc, unsigned short *catch_type );
-
-/**
- * Gets number of exceptions a method can throw.
- * Parameter <i>hmethod</i> must not equal to <code>NULL</code>.
- *
- * @param hmethod method handle
- *
- * @return number of exceptions
- */
-unsigned short
-method_get_number_exc_method_can_throw( method_handler hmethod );
-
-/**
- * Gets name of exception a method can throw.
- * Parameter <i>hmethod</i> must not equal to <code>NULL</code>.
- * If parameter <i>index</i> is out of range, returns <code>NULL</code>.
- *
- * @param hmethod method handle
- * @param index index of exception
- *
- * @return name of exception
- */
-const char *
-method_get_exc_method_can_throw( method_handler hmethod, unsigned short index );
-
-
-/**
- * Gets StackMapTable attribute.
- * Parameter <i>hmethod</i> must not equal to <code>NULL</code>.
- * If parameter <i>index</i> is out of range, returns <code>NULL</code>.
- *
- * @param hmethod method handle
- *
- * @return StackMapTable bytes
- */
-unsigned char *
-method_get_stackmaptable( method_handler hmethod );
-
-
-
-/**
* Class loader interface
*/
-
+#if 0
/**
* Function sets verify data in class loader.
* @param classloader - class loader handler
@@ -521,7 +55,7 @@
* must be called in thread safe point.
*/
void
-cl_set_verify_data_ptr( classloader_handler classloader, void *data );
+cl_set_verify_data_ptr( ClassLoaderHandle classloader, void *data );
/**
* Function returns verify data in class loader.
@@ -530,7 +64,7 @@
* @note Assertion is raised if classloader is equal to null.
*/
void *
-cl_get_verify_data_ptr( classloader_handler classloader );
+cl_get_verify_data_ptr( ClassLoaderHandle classloader );
/**
* Function locks class loader.
@@ -538,7 +72,7 @@
* @note Assertion is raised if classloader is equal to null.
*/
void
-cl_acquire_lock( classloader_handler classloader );
+cl_acquire_lock( ClassLoaderHandle classloader );
/**
* Function releases class loader.
@@ -546,7 +80,7 @@
* @note Assertion is raised if classloader is equal to null.
*/
void
-cl_release_lock( classloader_handler classloader );
+cl_release_lock( ClassLoaderHandle classloader );
/**
* Function returns loaded class in class loader.
@@ -555,8 +89,8 @@
* @return Loaded class in classloader or null if class isn't loaded in class loader.
* @note Assertion is raised if classloader or name are equal to null.
*/
-class_handler
-cl_get_class( classloader_handler classloader, const char *name );
+Class_Handle
+cl_get_class( ClassLoaderHandle classloader, const char *name );
/**
* Function returns loaded class in class loader.
@@ -566,13 +100,9 @@
* function loads it.
* @note Assertion is raised if classloader or name are equal to null.
*/
-class_handler
-cl_load_class( classloader_handler classloader, const char *name );
+Class_Handle
+cl_load_class( ClassLoaderHandle classloader, const char *name );
-/**
- * Function checks if the field is protected.
- * @param field - field handler
- * @return Returns <code>TRUE</code> if the field is protected.
- */
-unsigned
-field_is_protected( field_handler field );
+#endif
+
+#endif
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h Tue Apr 15 04:29:41 2008
@@ -35,8 +35,8 @@
VMEXPORT Class_Handle jni_get_class_handle(JNIEnv*, jclass);
VMEXPORT jclass jni_class_from_handle(JNIEnv*, Class_Handle);
VMEXPORT jobject jni_class_loader_from_handle(JNIEnv*, ClassLoaderHandle);
-VMEXPORT ClassLoaderHandle class_loader_lookup(jobject loader);
-VMEXPORT void class_loader_load_native_lib(const char* lib, ClassLoaderHandle loader);
+ClassLoaderHandle class_loader_lookup(jobject loader);
+void class_loader_load_native_lib(const char* lib, ClassLoaderHandle loader);
VMEXPORT jvalue *get_jvalue_arg_array(Method *method, va_list args);
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h Tue Apr 15 04:29:41 2008
@@ -21,7 +21,7 @@
#ifndef _VERIFIER_H_
#define _VERIFIER_H_
-#include "class_interface.h"
+#include "open/types.h"
enum vf_Result
{
@@ -60,7 +60,7 @@
* @note Assertion is raised if klass is equal to null.
*/
vf_Result
-vf_verify_class(class_handler klass, unsigned verifyAll, char **error);
+vf_verify_class(Class_Handle klass, unsigned verifyAll, char** error);
/**
* Function provides final constraint checks for a given class.
@@ -71,21 +71,21 @@
* @note Assertion is raised if klass or error_message are equal to null.
*/
vf_Result
-vf_verify_class_constraints(class_handler klass, unsigned verifyAll,
- char **error);
+vf_verify_class_constraints(Class_Handle klass, unsigned verifyAll,
+ char** error);
/**
* Function provides final constraint checks for a given class.
* @param error - error message of verifier
* @note Assertion is raised if error_message is equal to null.
*/
-void vf_release_error_message(void *error);
+void vf_release_error_message(void* error);
/**
* Function releases verify data in class loader.
* @param data - verify data
* @note Assertion is raised if data is equal to null.
*/
-void vf_release_verify_data(void *data);
+void vf_release_verify_data(void* data);
#endif // _VERIFIER_H_
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h Tue Apr 15 04:29:41 2008
@@ -21,7 +21,7 @@
#ifndef _VMCORE_LOG_H_
#define _VMCORE_LOG_H_
-#include "open/vm_log.h"
+//#include "open/vm_log.h"
#include "object_layout.h"
#include "object_handles.h"
#include "vtable.h"
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Tue Apr 15 04:29:41 2008
@@ -14,10 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Intel, Alexei Fedotov
- * @version $Revision: 1.1.2.6.2.1.2.4 $
- */
#define LOG_DOMAIN "vm.core"
#include "cxxlog.h"
@@ -36,21 +32,21 @@
#include "cci.h"
#include "nogc.h"
-#include "class_interface.h"
#include "Package.h"
#include "open/vm_type_access.h"
#include "open/vm_field_access.h"
#include "open/vm_method_access.h"
-#include "open/vm_class_info.h"
+#include "open/vm_class_manipulation.h"
+#include "open/vm_class_loading.h"
#include "jit_intf.h"
-Boolean class_is_final(Class_Handle cl) {
+BOOLEAN class_is_final(Class_Handle cl) {
assert(cl);
return cl->is_final();
}
-Boolean class_is_abstract(Class_Handle cl) {
+BOOLEAN class_is_abstract(Class_Handle cl) {
assert(cl);
return cl->is_abstract();
}
@@ -61,13 +57,13 @@
}
-Boolean class_is_array(Class_Handle cl) {
+BOOLEAN class_is_array(Class_Handle cl) {
assert(cl);
return cl->is_array();
} //class_is_array
-static uint32 countLeadingChars(const char* str, char c) {
+static unsigned countLeadingChars(const char* str, char c) {
uint32 n=0;
while (str[n]==c) {
n++;
@@ -75,7 +71,7 @@
return n;
}
-U_32 class_cp_get_num_array_dimensions(Class_Handle cl, U_16 cpIndex) {
+unsigned class_cp_get_num_array_dimensions(Class_Handle cl, unsigned short cpIndex) {
ConstantPool& cp = cl->get_constant_pool();
unsigned char tag = cp.get_tag(cpIndex);
char c = '[';
@@ -86,7 +82,7 @@
return countLeadingChars(str, c);
}
case CONSTANT_Fieldref: {
- const char* str = class_cp_get_entry_signature(cl, cpIndex);
+ const char* str = class_cp_get_entry_descriptor(cl, cpIndex);
return countLeadingChars(str, c);
}
default:
@@ -480,6 +476,11 @@
return cl->get_name()->bytes;
} //class_get_name
+unsigned short class_get_version(Class_Handle klass)
+{
+ assert(klass);
+ return klass->get_version();
+} // class_get_version
unsigned class_get_flags(Class_Handle cl)
{
@@ -518,25 +519,34 @@
return vh->clss;
} // vtable_get_class
-Boolean class_is_initialized(Class_Handle ch)
+BOOLEAN class_is_initialized(Class_Handle ch)
{
assert(ch);
return ch->is_initialized();
} //class_is_initialized
-
-
-Boolean class_needs_initialization(Class_Handle ch)
-{
- assert(ch);
- return !ch->is_initialized();
-} //class_needs_initialization
-
Class_Handle class_get_super_class(Class_Handle cl)
{
assert(cl);
return cl->get_super_class();
-} //class_get_super_class
+} // class_get_super_class
+
+Class_Handle class_get_extended_class(Class_Handle klass, const char* super_name)
+{
+ assert(klass);
+ assert(super_name);
+
+ Global_Env* env = VM_Global_State::loader_env;
+ String* pooled_name = env->string_pool.lookup(super_name);
+
+ for(Class* clss = klass; clss; clss = clss->get_super_class()) {
+ if(clss->get_name() == pooled_name) {
+ // found class with given name
+ return clss;
+ }
+ }
+ return NULL;
+} // class_get_extended_class
unsigned class_number_implements(Class_Handle ch)
{
@@ -575,12 +585,12 @@
return ch->_resolve_class(VM_Global_State::loader_env, cp_index);
}
-Boolean class_is_instanceof(Class_Handle s, Class_Handle t)
+BOOLEAN class_is_instanceof(Class_Handle s, Class_Handle t)
{
assert(s);
assert(t);
return class_is_subtype(s, t);
-} //class_get_super_class
+} // class_is_instanceof
@@ -598,7 +608,7 @@
-Boolean class_hint_is_exceptiontype(Class_Handle ch)
+BOOLEAN class_is_throwable(Class_Handle ch)
{
assert(ch);
Global_Env *env = VM_Global_State::loader_env;
@@ -611,19 +621,8 @@
ch = class_get_super_class(ch);
}
return FALSE;
-} //class_hint_is_exceptiontype
-
+} // class_is_throwable
-
-
-/*
- * Procedure class_get_class_of_primitive_type
- * Given an VM_Data_Type that describes a primitive type,
- * returns the corresponding preloaded Class for that type.
- *
- * Side effects:
- * None
- */
Class_Handle class_get_class_of_primitive_type(VM_Data_Type typ)
{
Global_Env *env = VM_Global_State::loader_env;
@@ -662,13 +661,13 @@
case VM_DATA_TYPE_UINT16:
case VM_DATA_TYPE_UINT32:
case VM_DATA_TYPE_UINT64:
- clss = NULL; // ts07.09.02 - to allow star jit initialization
+ clss = NULL; // to allow star jit initialization
break;
default:
ABORT("Unknown vm data type"); // We need a better way to indicate an internal error
}
return clss;
-} //class_get_class_of_primitive_type
+} // class_get_class_of_primitive_type
VTable_Handle class_get_vtable(Class_Handle cl)
{
@@ -697,7 +696,7 @@
// Returns the address where the interned version of the string is stored: this will be the address
// of a slot containing a Java_java_lang_String* or a uint32 compressed reference. Also interns the
// string so that the JIT can load a reference to the interned string without checking if it is null.
-const void *class_get_const_string_intern_addr(Class_Handle cl, U_16 index)
+const void *class_get_const_string_intern_addr(Class_Handle cl, unsigned short index)
{
assert(cl);
Global_Env* env = VM_Global_State::loader_env;
@@ -710,44 +709,38 @@
} //class_get_const_string_intern_addr
-const char* class_cp_get_entry_signature(Class_Handle src_class, U_16 index)
+const char* class_cp_get_entry_descriptor(Class_Handle src_class, unsigned short index)
{
- Class* clss = (Class*)src_class;
ConstantPool& cp = src_class->get_constant_pool();
-
- assert(cp.is_fieldref(index)
+ if(!(cp.is_fieldref(index)
|| cp.is_methodref(index)
- || cp.is_interfacemethodref(index));
+ || cp.is_interfacemethodref(index)))
+ {
+ return NULL;
+ }
index = cp.get_ref_name_and_type_index(index);
index = cp.get_name_and_type_descriptor_index(index);
return cp.get_utf8_chars(index);
-} // class_cp_get_entry_signature
+} // class_cp_get_entry_descriptor
VM_Data_Type class_cp_get_field_type(Class_Handle src_class, U_16 cp_index)
{
assert(src_class->get_constant_pool().is_fieldref(cp_index));
- char class_id = (class_cp_get_entry_signature(src_class, cp_index))[0];
+ char class_id = (class_cp_get_entry_descriptor(src_class, cp_index))[0];
switch(class_id)
{
case VM_DATA_TYPE_BOOLEAN:
- return VM_DATA_TYPE_BOOLEAN;
case VM_DATA_TYPE_CHAR:
- return VM_DATA_TYPE_CHAR;
case VM_DATA_TYPE_INT8:
- return VM_DATA_TYPE_INT8;
case VM_DATA_TYPE_INT16:
- return VM_DATA_TYPE_INT16;
case VM_DATA_TYPE_INT32:
- return VM_DATA_TYPE_INT32;
case VM_DATA_TYPE_INT64:
- return VM_DATA_TYPE_INT64;
case VM_DATA_TYPE_F4:
- return VM_DATA_TYPE_F4;
case VM_DATA_TYPE_F8:
- return VM_DATA_TYPE_F8;
+ return (VM_Data_Type)class_id;
case VM_DATA_TYPE_ARRAY:
case VM_DATA_TYPE_CLASS:
return VM_DATA_TYPE_CLASS;
@@ -850,7 +843,7 @@
}
-Field* class_resolve_nonstatic_field(Class* clss, unsigned cp_index)
+Field_Handle class_resolve_nonstatic_field(Class_Handle clss, unsigned short cp_index)
{
Compilation_Handle ch;
ch.env = VM_Global_State::loader_env;
@@ -884,7 +877,7 @@
Class_Handle
-class_lookup_class_by_name_using_bootstrap_class_loader(const char *name)
+vm_lookup_class_with_bootstrap(const char* name)
{
Global_Env *env = VM_Global_State::loader_env;
String *n = env->string_pool.lookup(name);
@@ -999,139 +992,38 @@
// The following do not cause constant pools to be resolve, if they are not
// resolved already
//
-const char* class_cp_get_field_name(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if(!const_pool.is_fieldref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_name_and_type_index(index);
- index = const_pool.get_name_and_type_name_index(index);
- return const_pool.get_utf8_chars(index);
-} // class_cp_get_field_name
-
-
-
-const char* class_cp_get_field_class_name(Class_Handle cl, U_16 index)
+const char* class_cp_get_entry_name(Class_Handle cl, U_16 index)
{
assert(cl);
ConstantPool& const_pool = cl->get_constant_pool();
- if(!const_pool.is_fieldref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_class_index(index);
- return class_cp_get_class_name(cl, index);
-} //class_cp_get_field_class_name
-
-
-
-const char* class_cp_get_field_descriptor(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if (!const_pool.is_fieldref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_name_and_type_index(index);
- index = const_pool.get_name_and_type_descriptor_index(index);
- return const_pool.get_utf8_chars(index);
-} // class_cp_get_field_descriptor
-
-
-
-const char* class_cp_get_method_name(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if (!const_pool.is_methodref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_name_and_type_index(index);
- index = const_pool.get_name_and_type_name_index(index);
- return const_pool.get_utf8_chars(index);
-} // class_cp_get_method_name
-
-
-
-const char *class_cp_get_method_class_name(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if (!const_pool.is_methodref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_class_index(index);
- return class_cp_get_class_name(cl,index);
-} //class_cp_get_method_class_name
-
-
-
-const char* class_cp_get_interface_method_name(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if(!const_pool.is_interfacemethodref(index)) {
+ if (!(const_pool.is_fieldref(index)
+ || const_pool.is_methodref(index)
+ || const_pool.is_interfacemethodref(index)))
+ {
ABORT("Wrong index");
return 0;
}
index = const_pool.get_ref_name_and_type_index(index);
index = const_pool.get_name_and_type_name_index(index);
return const_pool.get_utf8_chars(index);
-} // class_cp_get_interface_method_name
-
+} // class_cp_get_entry_name
-
-const char* class_cp_get_interface_method_class_name(Class_Handle cl, U_16 index)
+const char* class_cp_get_entry_class_name(Class_Handle cl, unsigned short index)
{
assert(cl);
ConstantPool& const_pool = cl->get_constant_pool();
- if (!const_pool.is_interfacemethodref(index)) {
+ if (!(const_pool.is_fieldref(index)
+ || const_pool.is_methodref(index)
+ || const_pool.is_interfacemethodref(index)))
+ {
ABORT("Wrong index");
return 0;
}
index = const_pool.get_ref_class_index(index);
return class_cp_get_class_name(cl,index);
-} //class_cp_get_interface_method_class_name
+} // class_cp_get_entry_class_name
-
-
-const char* class_cp_get_method_descriptor(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if (!const_pool.is_methodref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_name_and_type_index(index);
- index = const_pool.get_name_and_type_descriptor_index(index);
- return const_pool.get_utf8_chars(index);
-} // class_cp_get_method_descriptor
-
-
-
-const char* class_cp_get_interface_method_descriptor(Class_Handle cl, U_16 index)
-{
- assert(cl);
- ConstantPool& const_pool = cl->get_constant_pool();
- if (!const_pool.is_interfacemethodref(index)) {
- ABORT("Wrong index");
- return 0;
- }
- index = const_pool.get_ref_name_and_type_index(index);
- index = const_pool.get_name_and_type_descriptor_index(index);
- return const_pool.get_utf8_chars(index);
-} // class_cp_get_interface_method_descriptor
-
-
-
-const char* class_cp_get_class_name(Class_Handle cl, U_16 index)
+const char* class_cp_get_class_name(Class_Handle cl, unsigned short index)
{
assert(cl);
ConstantPool& const_pool = cl->get_constant_pool();
@@ -1167,11 +1059,11 @@
void method_get_exc_handler_info(Method_Handle m,
- uint32 handler_id,
- uint32* begin_offset,
- uint32* end_offset,
- uint32* handler_offset,
- uint32* handler_cpindex)
+ uint16 handler_id,
+ uint16* begin_offset,
+ uint16* end_offset,
+ uint16* handler_offset,
+ uint16* handler_cpindex)
{
assert(m);
Handler* h = m->get_bc_exception_handler_info(handler_id);
@@ -1251,42 +1143,27 @@
return 0;
} //object_get_vtable_offset
-////////////////////////////////////////////////////////////
-/// 20020220 New stuff for the interface
-
-
-////////////////////////////////////////////////////////////
-// begin declarations
-
-
-VMEXPORT Class_Handle class_get_class_of_primitive_type(VM_Data_Type ch);
-
-////////////////////////////////////////////////////////////
-// begin definitions
-
-
-
-Class_Handle get_system_object_class()
+Class_Handle vm_get_system_object_class()
{
Global_Env *env = VM_Global_State::loader_env;
return env->JavaLangObject_Class;
-} //get_system_object_class
+} // vm_get_system_object_class
-Class_Handle get_system_class_class()
+Class_Handle vm_get_system_class_class()
{
Global_Env *env = VM_Global_State::loader_env;
return env->JavaLangClass_Class;
-} //get_system_class_class
+} // vm_get_system_class_class
-Class_Handle get_system_string_class()
+Class_Handle vm_get_system_string_class()
{
Global_Env *env = VM_Global_State::loader_env;
return env->JavaLangString_Class;
-} //get_system_string_class
+} // vm_get_system_string_class
@@ -1367,14 +1244,11 @@
return class_is_primitive(ch);
} //class_is_valuetype
-Boolean class_is_enum(Class_Handle ch)
+BOOLEAN class_is_enum(Class_Handle ch)
{
assert(ch);
return ch->is_enum() ? TRUE : FALSE;
-} //class_is_enum
-
-
-
+} // class_is_enum
static Class *class_get_array_of_primitive_type(VM_Data_Type typ)
{
@@ -1416,65 +1290,37 @@
break;
}
return clss;
-} //class_get_array_of_primitive_type
-
-
+} // class_get_array_of_primitive_type
-Class_Handle class_get_array_of_unboxed(Class_Handle ch)
-{
- assert(ch);
- if(class_is_primitive(ch)) {
- VM_Data_Type typ = class_get_primitive_type_of_class(ch);
- return class_get_array_of_primitive_type(typ);
- } else {
- // 20020319 This should never happen for Java.
- ABORT("The given class handle does not represent a primitive type");
- return 0;
- }
-} //class_get_array_of_unboxed
-
-
-Boolean class_is_primitive(Class_Handle ch)
+BOOLEAN class_is_primitive(Class_Handle ch)
{
assert(ch);
return ch->is_primitive();
-} //class_is_primitive
-
+} // class_is_primitive
-
-VM_Data_Type class_get_primitive_type_java(Class_Handle clss)
+VM_Data_Type class_get_primitive_type_of_class(Class_Handle ch)
{
- assert(clss);
+ assert(ch);
Global_Env *env = VM_Global_State::loader_env;
- if (clss == env->Boolean_Class)
+ if (ch == env->Boolean_Class)
return VM_DATA_TYPE_BOOLEAN;
- if (clss == env->Char_Class)
+ if (ch == env->Char_Class)
return VM_DATA_TYPE_CHAR;
- if (clss == env->Byte_Class)
+ if (ch == env->Byte_Class)
return VM_DATA_TYPE_INT8;
- if (clss == env->Short_Class)
+ if (ch == env->Short_Class)
return VM_DATA_TYPE_INT16;
- if (clss == env->Int_Class)
+ if (ch == env->Int_Class)
return VM_DATA_TYPE_INT32;
- if (clss == env->Long_Class)
+ if (ch == env->Long_Class)
return VM_DATA_TYPE_INT64;
- if (clss == env->Float_Class)
+ if (ch == env->Float_Class)
return VM_DATA_TYPE_F4;
- if (clss == env->Double_Class)
+ if (ch == env->Double_Class)
return VM_DATA_TYPE_F8;
return VM_DATA_TYPE_CLASS;
-} //class_get_primitive_type_java
-
-
-
-
-
-VM_Data_Type class_get_primitive_type_of_class(Class_Handle ch)
-{
- assert(ch);
- return class_get_primitive_type_java(ch);
-} //class_get_primitive_type_of_class
+} // class_get_primitive_type_of_class
// Returns the number of arguments defined for the method.
@@ -1482,11 +1328,8 @@
unsigned char method_args_get_number(Method_Signature_Handle mh)
{
assert(mh);
- Method_Signature *ms = (Method_Signature *)mh;
- assert(!ms->sig);
- Method *m = ms->method;
- assert(m);
- return m->get_num_args();
+ assert(!mh->sig);
+ return mh->method->get_num_args();
} // method_args_get_number
@@ -1665,15 +1508,6 @@
} // class_get_number_methods
-Method_Handle class_get_method(Class_Handle ch, unsigned index)
-{
- assert(ch);
- if(index >= ch->get_number_of_methods())
- return NULL;
- return ch->get_method(index);
-} // class_get_method
-
-
// -gc magic needs this to do the recursive load.
Class_Handle field_get_class_of_field_type(Field_Handle fh)
{
@@ -1714,7 +1548,7 @@
BOOLEAN field_is_injected(Field_Handle f)
{
assert(f);
- return ((Field*)f)->is_injected();
+ return f->is_injected();
} //field_is_injected
@@ -1790,7 +1624,7 @@
/////////////////////////////////////////////////////
// New GC stuff
-Boolean class_is_non_ref_array(Class_Handle ch)
+BOOLEAN class_is_non_ref_array(Class_Handle ch)
{
assert(ch);
// Use the if statement to normalize the value of TRUE
@@ -1803,15 +1637,6 @@
}
} // class_is_non_ref_array
-
-Boolean class_is_pinned(Class_Handle ch)
-{
- assert(ch);
- return (ch->get_vtable()->class_properties & CL_PROP_PINNED_MASK) != 0
- ? TRUE : FALSE;
-} // class_is_pinned
-
-
BOOLEAN class_is_finalizable(Class_Handle ch)
{
assert(ch);
@@ -1823,17 +1648,17 @@
WeakReferenceType class_is_reference(Class_Handle clss)
{
assert(clss);
- if (class_is_extending_class( (class_handler)clss, "java/lang/ref/WeakReference"))
+ if(class_get_extended_class(clss, "java/lang/ref/WeakReference") != NULL)
return WEAK_REFERENCE;
- else if (class_is_extending_class( (class_handler)clss, "java/lang/ref/SoftReference"))
+ else if(class_get_extended_class(clss, "java/lang/ref/SoftReference") != NULL)
return SOFT_REFERENCE;
- else if (class_is_extending_class( (class_handler)clss, "java/lang/ref/PhantomReference"))
+ else if(class_get_extended_class(clss, "java/lang/ref/PhantomReference") != NULL)
return PHANTOM_REFERENCE;
else
return NOT_REFERENCE;
}
-int class_get_referent_offset(Class_Handle ch)
+unsigned class_get_referent_offset(Class_Handle ch)
{
Field_Handle referent =
class_lookup_field_recursive(ch, "referent", "Ljava/lang/Object;");
@@ -2169,58 +1994,6 @@
{
return compile_do_compilation_jit((Method*) method, (JIT*) jit);
} // vm_compile_method
-
-
-
-Boolean class_iterator_initialize(ChaClassIterator *chaClassIterator, Class_Handle root_class)
-{
- chaClassIterator->_current = NULL;
- chaClassIterator->_is_valid = FALSE;
- chaClassIterator->_root_class = root_class;
-
- // Partial implementation for now.
- if (!root_class->is_interface() && !root_class->is_array())
- {
- chaClassIterator->_is_valid = TRUE;
- chaClassIterator->_current = root_class;
- }
-
- return chaClassIterator->_is_valid;
-} // class_iterator_initialize
-
-
-Class_Handle class_iterator_get_current(ChaClassIterator *chaClassIterator)
-{
- return (chaClassIterator->_is_valid ? chaClassIterator->_current : NULL);
-} // class_iterator_get_current
-
-
-void class_iterator_advance(ChaClassIterator* chaClassIterator)
-{
- if (!chaClassIterator->_is_valid)
- return;
- if (chaClassIterator->_current == NULL)
- return;
- Class* clss = (Class*)chaClassIterator->_current;
- if(clss->get_first_child() != NULL)
- {
- chaClassIterator->_current = (Class_Handle)clss->get_first_child();
- return;
- }
- Class* next = clss;
- while(next != NULL)
- {
- if(next->get_next_sibling() != NULL)
- {
- next = next->get_next_sibling();
- break;
- }
- next = next->get_super_class();
- }
- if(next != NULL && next->get_depth() <= chaClassIterator->_root_class->get_depth())
- next = NULL;
- chaClassIterator->_current = next;
-} // class_iterator_advance
CallingConvention vm_managed_calling_convention()
{
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp Tue Apr 15 04:29:41 2008
@@ -26,7 +26,7 @@
#include <sstream>
-#include "open/vm_class_info.h"
+#include "open/vm_class_manipulation.h"
#include "Class.h"
#include "classloader.h"
#include "environment.h"
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp Tue Apr 15 04:29:41 2008
@@ -15,17 +15,13 @@
* limitations under the License.
*/
-/**
- * @author Pavel Pervov
- * @version $Revision: 1.1.2.3.4.4 $
- */
-
#define LOG_DOMAIN "classloader"
#include "cxxlog.h"
+#include "open/vm_class_manipulation.h"
#include "Class.h"
#include "open/jthread.h"
-#include "open/gc.h"
+//#include "open/gc.h"
#include "exceptions.h"
#include "thread_manager.h"
#include "vm_strings.h"
@@ -99,7 +95,7 @@
// --- step 7 ------------------------------------------------------------
if(has_super_class()) {
- class_initialize_ex(get_super_class());
+ class_initialize(get_super_class());
if(exn_raised()) {
jthread_monitor_enter(jlc);
@@ -208,7 +204,7 @@
}
tmn_suspend_disable();
- if (class_needs_initialization(clss)) {
+ if (!clss->is_initialized()) {
clss->initialize();
}
tmn_suspend_enable();
@@ -218,12 +214,6 @@
void class_initialize(Class *clss)
{
ASSERT_RAISE_AREA;
- class_initialize_ex(clss);
-}
-
-void class_initialize_ex(Class *clss)
-{
- ASSERT_RAISE_AREA;
assert(!hythread_is_suspend_enabled());
// check verifier constraints
@@ -235,7 +225,7 @@
}
tmn_suspend_disable();
- if(class_needs_initialization(clss)) {
+ if(!clss->is_initialized()) {
clss->initialize();
}
-} // class_initialize_ex
+} // class_initialize
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp Tue Apr 15 04:29:41 2008
@@ -102,8 +102,8 @@
#include "interpreter.h"
#include "open/bytecodes.h"
-#include "open/vm_class_info.h"
-#include "open/vm_util.h"
+#include "open/vm_class_manipulation.h"
+//#include "open/vm_util.h"
static void class_report_failure(Class* target, uint16 cp_index, jthrowable exn)
@@ -1066,8 +1066,7 @@
tmn_suspend_disable();
}
-Class *resolve_class_array_of_class1(Global_Env *env,
- Class *cc)
+Class* resolve_class_array_of_class(Global_Env* env, Class* cc)
{
// If the element type is primitive, return one of the preloaded
// classes of arrays of primitive types.
@@ -1103,7 +1102,7 @@
Class* arr_clss = cc->get_class_loader()->LoadVerifyAndPrepareClass(env, arr_str);
return arr_clss;
-} //resolve_class_array_of_class1
+} // resolve_class_array_of_class
//
// Given a class handle cl construct a class handle of the type
@@ -1112,11 +1111,11 @@
Class_Handle class_get_array_of_class(Class_Handle cl)
{
Global_Env *env = VM_Global_State::loader_env;
- Class *arr_clss = resolve_class_array_of_class1(env, cl);
+ Class *arr_clss = resolve_class_array_of_class(env, cl);
assert(arr_clss || exn_raised());
return arr_clss;
-} //class_get_array_of_class
+} // class_get_array_of_class
static bool resolve_const_pool_item(Global_Env* env, Class* clss, unsigned cp_index)
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp Tue Apr 15 04:29:41 2008
@@ -61,7 +61,7 @@
&& (is_bootstrap == FALSE || is_forced == TRUE)) {
char *error;
vf_Result result =
- vf_verify_class((class_handler) this, is_strict, &error);
+ vf_verify_class(this, is_strict, &error);
if (VF_OK != result) {
aulock.ForceUnlock();
REPORT_FAILED_CLASS_CLASS(m_class_loader, this,
@@ -72,7 +72,7 @@
m_state = ST_BytecodesVerified;
return true;
-} // Class::verify
+} // Class::verify
bool Class::verify_constraints(const Global_Env * env)
@@ -115,7 +115,7 @@
// check method constraints
char *error;
vf_Result result =
- vf_verify_class_constraints((class_handler) this, is_strict, &error);
+ vf_verify_class_constraints(this, is_strict, &error);
// lock class and check result
lock();
@@ -145,4 +145,4 @@
unlock();
return true;
-} // class_verify_method_constraints
+} // Class::verify_constraints
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/class_impl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/class_impl.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/class_impl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/class_impl.cpp Tue Apr 15 04:29:41 2008
@@ -14,29 +14,157 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Pavel Pervov
- * @version $Revision: 1.1.2.1.4.4 $
- */
-
-#define LOG_DOMAIN util::CLASS_LOGGER
-#include "cxxlog.h"
-
-#include "class_interface.h"
+#include <assert.h>
+#include "open/vm_method_access.h"
+#include "open/vm_field_access.h"
+#include "open/vm_class_manipulation.h"
+#include "open/vm_class_loading.h"
+#include "open/vm_util.h" // for VM_Global_State ???!!!
#include "Class.h"
+#include "class_member.h"
#include "classloader.h"
-#include "environment.h"
-/**
- * Function returns class major version.
- */
-unsigned short
-class_get_version( class_handler klass )
+unsigned short class_cp_get_size(Class_Handle klass)
{
- assert( klass );
- Class *clss = (Class*)klass;
- return clss->get_version();
-} // class_get_version
+ assert(klass);
+ return klass->get_constant_pool().get_size();
+} // class_cp_get_size
+
+unsigned char class_cp_get_tag(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_tag(index);
+} // class_cp_get_tag
+
+const char* class_cp_get_utf8_bytes(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_utf8_chars(index);
+} // class_cp_get_utf8_bytes
+
+unsigned short class_cp_get_class_name_index(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_class_name_index(index);
+} // class_cp_get_class_name_index
+
+unsigned short class_cp_get_descriptor_index(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_name_and_type_descriptor_index(index);
+} // class_cp_get_descriptor_index
+
+unsigned short class_cp_get_ref_name_and_type_index(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_ref_name_and_type_index(index);
+} // class_cp_get_ref_name_and_type_index
+
+unsigned short class_cp_get_ref_class_index(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_ref_class_index(index);
+} // class_cp_get_ref_class_index
+
+unsigned short class_cp_get_name_index(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ return klass->get_constant_pool().get_name_and_type_name_index(index);
+} // class_cp_get_name_index
+
+Method_Handle class_resolve_method(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ assert(index);
+ return klass->_resolve_method(VM_Global_State::loader_env, index);
+} // class_resolve_method
+
+BOOLEAN class_is_same_package(Class_Handle klass1, Class_Handle klass2)
+{
+ assert(klass1);
+ assert(klass2);
+ return (klass1->get_package() == klass2->get_package()) ? TRUE : FALSE;
+} // class_is_same_package
+
+unsigned short class_get_method_number(Class_Handle klass)
+{
+ assert(klass);
+ return klass->get_number_of_methods();
+} // class_get_method_number
+
+Method_Handle class_get_method(Class_Handle klass, unsigned short index)
+{
+ assert(klass);
+ if(index >= klass->get_number_of_methods())
+ {
+ assert(index < klass->get_number_of_methods());
+ return NULL;
+ }
+ return klass->get_method(index);
+} // class_get_method_number
+
+unsigned char* method_get_stackmaptable(Method_Handle hmethod)
+{
+ assert(hmethod);
+ return hmethod->get_stackmap();
+} // method_get_stackmaptable
+
+BOOLEAN method_is_protected(Method_Handle hmethod)
+{
+ assert(hmethod);
+ Method *method = (Method*)hmethod;
+ return hmethod->is_protected();
+} // method_is_protected
+
+BOOLEAN field_is_protected(Field_Handle hfield)
+{
+ assert(hfield);
+ return hfield->is_protected();
+} // field_is_protected
+
+void class_loader_set_verifier_data_ptr(ClassLoaderHandle classloader, void* data)
+{
+ assert(classloader);
+ classloader->SetVerifyData(data);
+} // class_loader_set_verifier_data_ptr
+
+void* class_loader_get_verifier_data_ptr(ClassLoaderHandle classloader)
+{
+ assert(classloader);
+ return classloader->GetVerifyData();
+} // class_loader_get_verifier_data_ptr
+
+void class_loader_lock(ClassLoaderHandle classloader)
+{
+ assert(classloader);
+ classloader->Lock();
+} // class_loader_lock
+
+void class_loader_unlock(ClassLoaderHandle classloader)
+{
+ assert(classloader);
+ classloader->Unlock();
+} // class_loader_unlock
+
+Class_Handle class_loader_lookup_class(ClassLoaderHandle classloader, const char* name)
+{
+ assert(classloader);
+ assert(name);
+ Global_Env *env = VM_Global_State::loader_env;
+ String* class_name = env->string_pool.lookup( name );
+ return classloader->LookupClass(class_name);
+} // class_loader_lookup_class
+
+Class_Handle class_loader_load_class(ClassLoaderHandle classloader, const char* name)
+{
+ assert(classloader);
+ assert(name);
+ Global_Env *env = VM_Global_State::loader_env;
+ String* class_name = env->string_pool.lookup(name);
+ return classloader->LoadClass(env, class_name);
+} // class_loader_load_class
+
+#if 0
/**
* Function returns class name.
@@ -82,19 +210,6 @@
return (klass1 == klass2) ? 1 : 0;
} // class_is_same_class
-/**
- * Function checks if classes have the same package.
- */
-unsigned
-class_is_same_package(class_handler klass1, class_handler klass2)
-{
- assert( klass1 );
- assert( klass2 );
- Class* clss1 = (Class*)klass1;
- Class* clss2 = (Class*)klass2;
- return (clss1->get_package() == clss2->get_package()) ? 1 : 0;
-} // class_is_same_package
-
/**
* Function checks if current class is interface.
*/
@@ -168,104 +283,6 @@
return (class_handler)clss->get_array_element_class();
} // class_get_array_element_class
-/**
- * Function checks if class extends current class with given name.
- */
-class_handler
-class_is_extending_class( class_handler klass, const char *super_name )
-{
- assert( klass );
- assert( super_name );
-
- Global_Env *env = VM_Global_State::loader_env;
- String *pooled_name = env->string_pool.lookup( super_name );
-
- for( Class *clss = (Class*)klass; clss; clss = clss->get_super_class() ) {
- if( clss->get_name() == pooled_name ) {
- // found class with given name
- return (class_handler)clss;
- }
- }
- return 0;
-} // class_is_extending_class
-
-/**
- * Function returns number of methods for current class.
- */
-unsigned short
-class_get_method_number( class_handler klass )
-{
- assert( klass );
- Class *clss = (Class*)klass;
- return clss->get_number_of_methods();
-} // class_get_method_number
-
-/**
- * Function returns method of current class.
- */
-method_handler
-class_get_method( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class *clss = (Class*)klass;
- return (method_handler)clss->get_method(index);
-} // class_get_method
-
-/**
- * Function returns class constant pool size.
- */
-unsigned short
-class_get_cp_size( class_handler klass )
-{
- assert(klass);
- Class* clss = (Class*)klass;
- return clss->get_constant_pool().get_size();
-} // class_get_cp_size
-
-/**
- * Function returns constant pool entry tag.
- */
-unsigned char
-class_get_cp_tag( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class* clss = (Class*)klass;
- return clss->get_constant_pool().get_tag(index);
-} // class_get_cp_tag
-
-/**
- * Function returns class name entry index in constant pool.
- */
-unsigned short
-class_get_cp_class_name_index( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class* clss = (Class*)klass;
- return clss->get_constant_pool().get_class_name_index(index);
-} // class_get_cp_class_name_index
-
-/**
- * Function returns class name entry index in constant pool.
- */
-unsigned short
-class_get_cp_ref_class_index( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class *clss = (Class*)klass;
- return clss->get_constant_pool().get_ref_class_index(index);
-} // class_get_cp_ref_class_index
-
-/**
- * Function returns name_and_type entry index in constant pool.
- */
-unsigned short
-class_get_cp_ref_name_and_type_index( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class *clss = (Class*)klass;
- return clss->get_constant_pool().get_ref_name_and_type_index(index);
-} // class_get_cp_ref_name_and_type_index
-
/**
* Function returns string entry index in constant pool.
*/
@@ -278,17 +295,6 @@
} // class_get_cp_string_index
/**
- * Function returns name entry index in constant pool.
- */
-unsigned short
-class_get_cp_name_index( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class* clss = (Class*)klass;
- return clss->get_constant_pool().get_name_and_type_name_index(index);
-} // class_get_cp_name_index
-
-/**
* Function returns descriptor entry index in constant pool.
*/
unsigned short
@@ -299,17 +305,6 @@
return clss->get_constant_pool().get_name_and_type_descriptor_index(index);
} // class_get_cp_descriptor_index
-/**
- * Function returns bytes for UTF8 constant pool entry.
- */
-const char*
-class_get_cp_utf8_bytes( class_handler klass, unsigned short index )
-{
- assert( klass );
- Class* clss = (Class*)klass;
- return clss->get_constant_pool().get_utf8_chars(index);
-} // class_get_cp_utf8_bytes
-
/**
* Function sets verify data to a given class.
*/
@@ -331,32 +326,6 @@
} // class_get_verify_data_ptr
/**
- * Function resolves class nonstatic method for constant pool entry.
- */
-method_handler
-class_resolve_method( class_handler klass, unsigned short index )
-{
- assert(klass);
- assert(index);
- Class* clss = (Class*)klass;
- Method* method = clss->_resolve_method(VM_Global_State::loader_env, index);
- return (method_handler)method;
-} // class_resolve_method
-
-/**
- * Function resolves class nonstatic field for constant pool entry.
- */
-field_handler
-class_resolve_nonstatic_field( class_handler klass, unsigned short index )
-{
- assert( klass );
- assert( index );
- Class *clss = (Class*)klass;
- Field *field = class_resolve_nonstatic_field( clss, index );
- return (field_handler)field;
-} // class_resolve_nonstatic_field
-
-/**
* Function returns a class in which the method is declared.
*/
class_handler
@@ -445,17 +414,6 @@
} // method_is_static
/**
- * Function checks if method is protected.
- */
-unsigned
-method_is_protected( method_handler hmethod )
-{
- assert( hmethod );
- Method *method = (Method*)hmethod;
- return method->is_protected();
-} // method_is_protected
-
-/**
* Function returns number of method exception handlers.
*/
unsigned short
@@ -467,29 +425,6 @@
} // method_get_exc_handler_number
/**
- * Function obtains method exception handler info.
- */
-void
-method_get_exc_handler_info( method_handler hmethod, unsigned short index,
- unsigned short *start_pc, unsigned short *end_pc,
- unsigned short *handler_pc, unsigned short *catch_type )
-{
- assert( hmethod );
- assert( start_pc );
- assert( end_pc );
- assert( handler_pc );
- assert( catch_type );
- Method *method = (Method*)hmethod;
- assert( index < method->num_bc_exception_handlers() );
- Handler *handler = method->get_bc_exception_handler_info( index );
- *start_pc = (unsigned short)handler->get_start_pc();
- *end_pc = (unsigned short)handler->get_end_pc();
- *handler_pc = (unsigned short)handler->get_handler_pc();
- *catch_type = (unsigned short)handler->get_catch_type_index();
- return;
-} // method_get_exc_handler_info
-
-/**
* Gets number of exceptions a method can throw.
*/
unsigned short
@@ -512,103 +447,4 @@
return method->get_exception_name( index )->bytes;
} // method_get_exc_method_can_throw
-/**
- * Gets StackMapTable attribute bytes.
- */
-unsigned char *
-method_get_stackmaptable( method_handler hmethod)
-{
- assert( hmethod );
- Method *method = (Method*)hmethod;
- return method->get_stackmap();
-} // method_get_stackmaptable
-
-/**
- * Function sets verify data in class loader.
- */
-void
-cl_set_verify_data_ptr( classloader_handler classloader, void *data )
-{
- assert(classloader);
- ClassLoader *cl = (ClassLoader*)classloader;
- cl->SetVerifyData( data );
- return;
-} // cl_set_verify_data_ptr
-
-/**
- * Function returns verify data in class loader.
- */
-void *
-cl_get_verify_data_ptr( classloader_handler classloader )
-{
- assert(classloader);
- ClassLoader *cl = (ClassLoader*)classloader;
- return cl->GetVerifyData();
-} // cl_get_verify_data_ptr
-
-/**
- * Function locks class loader.
- */
-void
-cl_acquire_lock( classloader_handler classloader )
-{
- assert(classloader);
- ClassLoader *cl = (ClassLoader*)classloader;
- cl->Lock();
- return;
-} // cl_acquire_lock
-
-/**
- * Function releases class loader.
- */
-void
-cl_release_lock( classloader_handler classloader )
-{
- assert(classloader);
- ClassLoader *cl = (ClassLoader*)classloader;
- cl->Unlock();
- return;
-} // cl_release_lock
-
-/**
- * Function returns loaded class in class loader.
- */
-class_handler
-cl_get_class( classloader_handler classloader, const char *name )
-{
- assert(classloader);
- assert(name);
- ClassLoader *cl = (ClassLoader*)classloader;
- Global_Env *env = VM_Global_State::loader_env;
- String *class_name = env->string_pool.lookup( name );
- return (class_handler)cl->LookupClass( class_name );
-} // cl_get_class
-
-/**
- * Function returns loaded class in class loader.
- */
-class_handler
-cl_load_class( classloader_handler classloader, const char *name )
-{
- assert(classloader);
- assert(name);
- ClassLoader *cl = (ClassLoader*)classloader;
- Global_Env *env = VM_Global_State::loader_env;
- String *class_name = env->string_pool.lookup( name );
- Class *klass = cl->LoadClass(env, class_name);
- return (class_handler)klass;
-} // cl_load_class
-
-
-/**
- * Function checks if a given field is protected.
- */
-unsigned
-field_is_protected( field_handler hfield )
-{
- assert( hfield );
- Field *field = (Field*)hfield;
- return field->is_protected();
-} // field_is_protected
-
-
+#endif
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Tue Apr 15 04:29:41 2008
@@ -26,11 +26,12 @@
#include <sstream>
#include "open/vm_method_access.h"
+#include "open/vm_class_manipulation.h"
#include "open/vm_properties.h"
#include "classloader.h"
#include "object_layout.h"
#include "String_Pool.h"
-#include "open/vm.h"
+//#include "open/vm.h"
#include "exceptions.h"
#include "properties.h"
#include "vm_strings.h"
@@ -826,7 +827,7 @@
REPORT_FAILED_CLASS_NAME(this, classNameString->bytes, "java/lang/NoClassDefFoundError", classNameString->bytes);
return NULL;
}
- baseClass = (Class*)class_get_class_of_primitive_type((VM_Data_Type)*baseType);
+ baseClass = class_get_class_of_primitive_type((VM_Data_Type)*baseType);
isArrayOfPrimitives = true;
break;
case 'L':
@@ -2121,12 +2122,9 @@
classloader_find_native(const Method_Handle method)
{
assert(hythread_is_suspend_enabled());
- assert( !exn_raised() );
-
- // get class and class loader of a given method
- Class_Handle klass = method_get_class( method );
- ClassLoader *loader = (ClassLoader*)class_get_class_loader( klass );
- return loader->LookupNative( method );
+ assert(!exn_raised());
+ assert(method);
+ return method->get_class()->get_class_loader()->LookupNative(method);
}
void ClassLoader::ReportException(const char* exn_name, std::stringstream& message_stream)
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp Tue Apr 15 04:29:41 2008
@@ -108,7 +108,7 @@
return td;
}
-Class *resolve_class_array_of_class1(Global_Env *env, Class *cc);
+Class *resolve_class_array_of_class(Global_Env *env, Class *cc);
Class* TypeDesc::load_type_desc()
{
@@ -137,7 +137,7 @@
assert (component_type);
element_clss = component_type->load_type_desc();
if (!element_clss) return NULL;
- clss = resolve_class_array_of_class1(env, element_clss);
+ clss = resolve_class_array_of_class(env, element_clss);
return clss;
default:
// All other types are not Java types, so fail
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/type.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/type.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/type.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/type.cpp Tue Apr 15 04:29:41 2008
@@ -14,25 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Pavel Pervov
- * @version $Revision: 1.1.2.2.4.4 $
- */
-
#include <assert.h>
-#include <stdlib.h>
+//#include <stdlib.h>
#define LOG_DOMAIN "vm.core"
#include "cxxlog.h"
+#include "open/types.h"
+#include "open/vm_class_manipulation.h"
+
#include "Class.h"
#include "environment.h"
#include "lock_manager.h"
-#include "open/types.h"
-#include "open/vm_util.h"
#include "type.h"
-#include "open/vm.h"
#include "vm_core_types.h"
Kind TypeDesc::get_kind()
@@ -142,7 +137,7 @@
{
TypeDesc* td;
- if (class_is_primitive(c)) {
+ if (c->is_primitive()) {
Kind k = K_UnmanagedPointer;
switch (class_get_primitive_type_of_class(c)) {
case VM_DATA_TYPE_INT8: k = K_S1; break;
@@ -164,7 +159,7 @@
ABORT("Unexpected data type");
}
td = new TypeDesc(k, NULL, NULL, NULL, c->get_class_loader(), c);
- } else if (class_is_array(c)) {
+ } else if (c->is_array()) {
td = new TypeDesc(K_Vector, NULL, NULL, NULL, c->get_class_loader(), c);
} else {
Kind k = K_Object;
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp Tue Apr 15 04:29:41 2008
@@ -110,7 +110,7 @@
return NULL;
}
- return class_get_name(exc_class);
+ return exc_class->get_name()->bytes;
}
void exn_clear()
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp Tue Apr 15 04:29:41 2008
@@ -23,6 +23,7 @@
#define LOG_DOMAIN "exn"
#include "clog.h"
+#include "open/vm_class_manipulation.h"
#include "Class.h"
#include "classloader.h"
#include "exceptions.h"
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp Tue Apr 15 04:29:41 2008
@@ -301,10 +301,10 @@
vm_stats_inc(cci->num_unwind_java_frames_gc);
#endif
TRACE2("enumeration", "enumerating eip=" << (void *) si_get_ip(si)
- << " is_first=" << !si_get_jit_context(si)->is_ip_past
- << " " << class_get_name(method_get_class(cci->get_method()))
- << "." << method_get_name(cci->get_method())
- << method_get_descriptor(cci->get_method()));
+ << " is_first=" << !si_get_jit_context(si)->is_ip_past << " "
+ << cci->get_method()->get_class()->get_name()->bytes << "."
+ << cci->get_method()->get_name()->bytes
+ << cci->get_method()->get_descriptor()->bytes);
cci->get_jit()->get_root_set_from_stack_frame(cci->get_method(), 0, si_get_jit_context(si));
ClassLoader* cl = cci->get_method()->get_class()->get_class_loader();
assert (cl);
@@ -327,19 +327,19 @@
}
}
TRACE2("enumeration", "enumerated eip=" << (void *) si_get_ip(si)
- << " is_first=" << !si_get_jit_context(si)->is_ip_past
- << " " << class_get_name(method_get_class(cci->get_method()))
- << "." << method_get_name(cci->get_method())
- << method_get_descriptor(cci->get_method()));
+ << " is_first=" << !si_get_jit_context(si)->is_ip_past << " "
+ << cci->get_method()->get_class()->get_name()->bytes << "."
+ << cci->get_method()->get_name()->bytes
+ << cci->get_method()->get_descriptor()->bytes);
} else {
#ifdef VM_STATS
vm_stats_inc(VM_Statistics::get_vm_stats().num_unwind_native_frames_gc);
#endif
+ Method* m = m2n_get_method(si_get_m2n(si));
TRACE2("enumeration", "enumeration local handles "
- << (m2n_get_method(si_get_m2n(si)) ? method_get_name(m2n_get_method(si_get_m2n(si))) : "")
- << (m2n_get_method(si_get_m2n(si)) ? method_get_descriptor(m2n_get_method(si_get_m2n(si))) : ""));
+ << (m ? m->get_name()->bytes : "")
+ << (m ? m->get_descriptor()->bytes : ""));
oh_enumerate_handles(m2n_get_local_handles(si_get_m2n(si)));
- Method* m = m2n_get_method(si_get_m2n(si));
if (m) {
ClassLoader* cl = m->get_class()->get_class_loader();
assert (cl);
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp?rev=648211&r1=648210&r2=648211&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp Tue Apr 15 04:29:41 2008
@@ -26,7 +26,7 @@
#include "lock_manager.h"
#include "object_layout.h"
#include "open/types.h"
-#include <open/jthread.h>
+#include "open/jthread.h"
#include "Class.h"
#include "open/vm_util.h"
#include "environment.h"
@@ -506,7 +506,7 @@
VM_Global_State::loader_env->VoidVoidDescriptor_String);
assert(finalize);
- TRACE2("finalize", "finalize object " << class_get_name(handle->object->vt()->clss));
+ TRACE2("finalize", "finalize object " << handle->object->vt()->clss->get_name()->bytes);
vm_execute_java_method_array( (jmethodID) finalize, 0, args);
tmn_suspend_enable();
@@ -517,7 +517,7 @@
INFO2("finalize", "Uncaught exception "
<< exn_get_name()
<< " while running a finalize of the object"
- << class_get_name(object->vt()->clss) << ".");
+ << object->vt()->clss->get_name()->bytes << ".");
tmn_suspend_enable();
}
#endif
@@ -574,7 +574,7 @@
INFO2("ref", "Uncaught exception "
<< exn_get_name()
<< " while running a enqueue method of the object"
- << class_get_name(object->vt()->clss) << ".");
+ << object->vt()->clss->get_name()->bytes << ".");
tmn_suspend_enable();
}
|