harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r472771 [10/11] - in /incubator/harmony/enhanced/drlvm/trunk/vm: gc_cc/src/ gcv4/src/ include/ include/open/ interpreter/src/ jitrino/src/jet/ jitrino/src/vm/drl/ port/src/lil/ia32/pim/ port/src/lil/pim/ vmcore/include/ vmcore/src/class_sup...
Date Thu, 09 Nov 2006 04:52:17 GMT
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp Wed Nov  8 20:52:12 2006
@@ -278,34 +278,34 @@
  * GetClassSignatureLength() + 1 bytes.
  */
 //should we care about buffer overflow and return len?
-size_t GetClassSignatureLength (Class* cl)
+size_t GetClassSignatureLength(Class* cl)
 {
-    assert (cl);
+    assert(cl);
 
-    const char* name = cl->name->bytes;
+    const String* name = cl->get_name();
 
-    if (name[0] == '[') {
-        return strlen(name);
+    if (name->bytes[0] == '[') {
+        return name->len;
     }
-    else if (cl->is_primitive) {
+    else if (cl->is_primitive()) {
         return 1;
     }
     else {
-        return 2 + strlen(name);
+        return 2 + name->len; // 2 bytes are for L and ;
     }
 } // GetClassSignatureLength
 
 //should we care about buffer overflow and return len?
-void GetClassSignature (Class* cl, char *sig)
+void GetClassSignature(Class* cl, char* sig)
 {
     assert (cl);
 
-    const char* name = cl->name->bytes;
+    const char* name = cl->get_name()->bytes;
 
     if (name[0] == '[') {
         sprintf (sig, "%s",name);
     }
-    else if (cl->is_primitive) {
+    else if (cl->is_primitive()) {
         sig[0] = PrimitiveNameToSignature (name);
         sig[1] = '\0';
     }
@@ -374,7 +374,7 @@
 Field* LookupField (Class *clss, const char *name)
 {
     Field *f = 0;
-    for(; clss && !f; clss = clss->super_class) {
+    for(; clss && !f; clss = clss->get_super_class()) {
         if((f = LookupDeclaredField(clss, name)))
             return f;
     }
@@ -382,21 +382,20 @@
     return NULL;
 } // LookupField
 
-Method* LookupMethod (Class *clss, const char *mname, const char *mdesc)
+Method* LookupMethod(Class* clss, const char* mname, const char* mdesc)
 {
     Method* m = 0;
-    Class *oclss = clss;
-    for (; clss; clss = clss->super_class) {        // for each superclass
+    Class* oclss = clss;
+    for (; clss; clss = clss->get_super_class()) {      // for each superclass
         if((m = LookupDeclaredMethod(clss, mname, mdesc)))
             return m;
     }
 
-    Class_Superinterface *intfs = oclss->superinterfaces;
-    for(int i = 0; i < oclss->n_superinterfaces; i++)
-        if((m = LookupMethod(intfs[i].clss, mname, mdesc)))
+    for(int i = 0; i < oclss->get_number_of_superinterfaces(); i++)
+        if((m = LookupMethod(oclss->get_superinterface(i), mname, mdesc)))
             return m;
 
-    return (Method*)0;                                // method not found
+    return NULL;                                        // method not found
 } // LookupMethod
 
 char PrimitiveNameToSignature (const char* name)
@@ -523,9 +522,9 @@
 
     assert (clss);
 
-    for (unsigned i =0; i < clss->n_fields; i++) {
-        if (clss->fields[i].get_name() == field_name) {
-            return &clss->fields[i];
+    for (unsigned i =0; i < clss->get_number_of_fields(); i++) {
+        if (clss->get_field(i)->get_name() == field_name) {
+            return clss->get_field(i);
         }
     }
 
@@ -545,7 +544,7 @@
     // Acquire handle to internal class handle (Class):
     Class* clss = jclass_to_struct_Class(aclazz);
 
-    if (!clss->is_array) {
+    if (!clss->is_array()) {
         ThrowNew_Quick (env, "java/lang/IllegalArgumentException", 0);
         return;
     }
@@ -558,7 +557,7 @@
 
     // Acquire handle to internal class handle (Class):
     Class* clss = jclass_to_struct_Class(aclazz);
-    return clss->name->bytes[1]; // return component first character
+    return clss->get_name()->bytes[1]; // return component first character
 }
 
 
@@ -568,19 +567,20 @@
    
     size_t len = strlen (mdesc);
     Method *m = 0;
-    for (unsigned i =0; i < clss->n_methods; i++) {   // for each method
-        m = &clss->methods[i];
+    for (unsigned i =0; i < clss->get_number_of_methods(); i++) {   // for each method
+        m = clss->get_method(i);
         if (m->is_fake_method()) {
             continue;   // ignore fake methods
         }
         const char* desc = m->get_descriptor()->bytes;
-        if ((m->get_name() == method_name) &&        // if names and signatures
-            (strncmp (mdesc, desc, len) == 0)) {     //   (excluding return types) match,   
-            return m;                                //     return method
+        if ((m->get_name() == method_name)          // if names and signatures
+            && (strncmp (mdesc, desc, len) == 0))   // (excluding return types) match
+        {
+            return m;                               // return method
         }
     }
 
-    return (Method*)0;                                   // method not found
+    return NULL;                                    // method not found
 } // LookupDeclaredMethod
 
 //Checks if the object is null.
@@ -669,10 +669,6 @@
     jenv->ThrowNew(tclass, "bad arrayCopy");
 }
 
-Boolean class_is_subclass(Class_Handle subclss, Class_Handle superclss)
-{
-    return class_is_subtype_fast(((Class*)subclss)->vtable, (Class*)superclss);
-}
 
 jclass FindClass(JNIEnv* env_ext, String* name)
 {
@@ -744,9 +740,9 @@
 
     Method* ctor;
     if (message)
-        ctor = class_lookup_method(clazz, genv->Init_String, genv->FromStringConstructorDescriptor_String);
+        ctor = clazz->lookup_method(genv->Init_String, genv->FromStringConstructorDescriptor_String);
     else
-        ctor = class_lookup_method(clazz, genv->Init_String, genv->VoidVoidDescriptor_String);
+        ctor = clazz->lookup_method(genv->Init_String, genv->VoidVoidDescriptor_String);
     assert(ctor);
     jclass jclazz = struct_Class_to_jclass(clazz);
     assert(jclazz);
@@ -795,14 +791,14 @@
     ASSERT_RAISE_AREA;
     assert(hythread_is_suspend_enabled());
 
-    if(clss->state != ST_Initialized) {
+    if(!clss->is_initialized()) {
         class_initialize_from_jni(clss);
-        if(clss->state == ST_Error) {
+        if(clss->in_error()) {
             // If exception is already raised, no need to
             // throw new one, just return instead
-            if (!exn_raised()) 
+            if(!exn_raised()) 
             {
-                env->Throw(class_get_error_cause(clss));
+                env->Throw(clss->get_error_cause());
             }
             return false;
         }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp Wed Nov  8 20:52:12 2006
@@ -28,6 +28,7 @@
 #include "environment.h"
 #include "Class.h"
 #include "cxxlog.h"
+#include "cci.h"
 
 #include "suspend_checker.h"
 #include "interpreter_exports.h"

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Wed Nov  8 20:52:12 2006
@@ -34,8 +34,10 @@
 #include "m2n.h"
 #include "stack_iterator.h"
 #include "open/bytecodes.h"
-#include "jvmti_break_intf.h"
+#include "cci.h"
 
+#include "jvmti_break_intf.h"
+#include "cci.h"
 
 // Forvard declarations
 static ConditionCode

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_class.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_class.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_class.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_class.cpp Wed Nov  8 20:52:12 2006
@@ -133,7 +133,7 @@
         for(it = tbl->begin(); it != tbl->end(); it++)
         {
             klass = &it->second;
-            if ((*klass)->class_loader != classloader)
+            if ((*klass)->get_class_loader() != classloader)
                 continue;
             count++;
         }
@@ -176,15 +176,12 @@
         for(it = tbl->begin(); it != tbl->end(); it++)
         {
             klass = &it->second;
-            if((*klass)->is_primitive)
+            if((*klass)->is_primitive())
                 continue;
-            if ((*klass)->class_loader != classloader)
+            if ((*klass)->get_class_loader() != classloader)
                 continue;
             // create a new jclass handle for Class
-            tmn_suspend_disable();
-            ObjectHandle new_handle = oh_allocate_local_handle();
-            new_handle->object = struct_Class_to_java_lang_Class( *klass );
-            tmn_suspend_enable();
+            ObjectHandle new_handle = struct_Class_to_jclass(*klass);
 
             // set created handle into jclass handle table
             (*classes)[number++] = (jclass)new_handle;
@@ -277,10 +274,7 @@
     {
         klass = &it->second;
         // create a new jclass handle for Class
-        tmn_suspend_disable();
-        ObjectHandle new_handle = oh_allocate_local_handle();
-        new_handle->object = struct_Class_to_java_lang_Class( *klass );
-        tmn_suspend_enable();
+        ObjectHandle new_handle = struct_Class_to_jclass(*klass);
 
         // set created handle into jclass handle table
         (*classes_ptr)[index++] = (jclass)new_handle;
@@ -398,18 +392,18 @@
     } else if( class_is_array( cl ) ) {
         *status_ptr = JVMTI_CLASS_STATUS_ARRAY;
     } else {
-        switch( cl->state )
+        switch(cl->get_state())
         {
         case ST_Start:
         case ST_LoadingAncestors:
-            break;
         case ST_Loaded:
+        case ST_BytecodesVerified:
         case ST_InstanceSizeComputed:
-            if( cl->is_verified ) {
-                *status_ptr |= JVMTI_CLASS_STATUS_VERIFIED;
-            }
             break;
         case ST_Prepared:
+            *status_ptr |= JVMTI_CLASS_STATUS_PREPARED;
+            break;
+        case ST_ConstraintsVerified:
         case ST_Initializing:
             *status_ptr |= JVMTI_CLASS_STATUS_PREPARED
                 | JVMTI_CLASS_STATUS_VERIFIED;
@@ -459,20 +453,21 @@
             &errorCode);
     if( cl == NULL ) return errorCode;
 
-    if( cl->is_primitive || cl->is_array )
+    if(cl->is_primitive() || cl->is_array())
     {
-        TRACE2("jvmti.class", "GetSourceFileName called, name = " << cl->name->bytes <<
-            " file name is absent");
+        TRACE2("jvmti.class", "GetSourceFileName called, name = "
+            << cl->get_name()->bytes << " file name is absent");
         return JVMTI_ERROR_ABSENT_INFORMATION;
     }
-    if(!cl->src_file_name) return JVMTI_ERROR_ABSENT_INFORMATION;
+    if(!cl->has_source_information()) return JVMTI_ERROR_ABSENT_INFORMATION;
 
-    TRACE2("jvmti.class", "GetSourceFileName called, name = " << cl->name->bytes <<
-        " file name = " << cl->src_file_name->bytes);
-    errorCode = _allocate( cl->src_file_name->len + 1, (unsigned char**)res );
+    TRACE2("jvmti.class", "GetSourceFileName called, name = "
+        << cl->get_name()->bytes << " file name = "
+        << cl->get_source_file_name());
+    errorCode = _allocate(cl->get_source_file_name_length() + 1, (unsigned char**)res);
     if( errorCode != JVMTI_ERROR_NONE ) return errorCode;
 
-    strcpy( *res, cl->src_file_name->bytes );
+    memcpy(*res, cl->get_source_file_name(), cl->get_source_file_name_length() + 1);
 
     return JVMTI_ERROR_NONE;
 }
@@ -503,11 +498,11 @@
     if( cl == NULL ) return errorCode;
 
     *modifiers_ptr = 0;
-    if( class_is_public( cl ) ) *modifiers_ptr |= ACC_PUBLIC;
-    if( class_is_final( cl ) ) *modifiers_ptr |= ACC_FINAL;
-    if( class_is_super( cl ) ) *modifiers_ptr |= ACC_SUPER;
-    if( class_is_interface( cl ) ) *modifiers_ptr |= ACC_INTERFACE;
-    if( class_is_abstract( cl ) ) *modifiers_ptr |= ACC_ABSTRACT;
+    if(cl->is_public()) *modifiers_ptr |= ACC_PUBLIC;
+    if(cl->is_final()) *modifiers_ptr |= ACC_FINAL;
+    if(cl->is_super()) *modifiers_ptr |= ACC_SUPER;
+    if(cl->is_interface()) *modifiers_ptr |= ACC_INTERFACE;
+    if(cl->is_abstract()) *modifiers_ptr |= ACC_ABSTRACT;
 
     return JVMTI_ERROR_NONE;
 }
@@ -542,16 +537,14 @@
      * Check class status. If class is not on PREPARED status, GetClassMethods(...)
      * function returns JVMTI_ERROR_CLASS_NOT_PREPARED
      */
-    if ((cl->state == ST_Start) ||
-            (cl->state == ST_LoadingAncestors) ||
-            (cl->state == ST_Loaded) ||
-            (cl->state == ST_InstanceSizeComputed))
+    if(!cl->is_at_least_prepared())
         return JVMTI_ERROR_CLASS_NOT_PREPARED;
 
-    errorCode = _allocate( cl->n_methods*sizeof(jmethodID), (unsigned char**)methods_ptr );
+    errorCode = _allocate(cl->get_number_of_methods()*sizeof(jmethodID), (unsigned char**)methods_ptr );
     if( errorCode != JVMTI_ERROR_NONE ) return errorCode;
-    *method_count_ptr = cl->n_methods;
-    for( short i = 0; i < cl->n_methods; i++ ) (*methods_ptr)[i] = (jmethodID)&(cl->methods[i]);
+    *method_count_ptr = cl->get_number_of_methods();
+    for(short i = 0; i < cl->get_number_of_methods(); i++ )
+        (*methods_ptr)[i] = (jmethodID)cl->get_method(i);
 
     return JVMTI_ERROR_NONE;
 }
@@ -586,16 +579,15 @@
      * Check class status. If class is not on PREPARED status, GetClassMethods(...)
      * function returns JVMTI_ERROR_CLASS_NOT_PREPARED
      */
-    if ((cl->state == ST_Start) ||
-            (cl->state == ST_LoadingAncestors) ||
-            (cl->state == ST_Loaded) ||
-            (cl->state == ST_InstanceSizeComputed))
+    if(!cl->is_at_least_prepared())
         return JVMTI_ERROR_CLASS_NOT_PREPARED;
 
-    errorCode = _allocate( cl->n_fields*sizeof(jfieldID), (unsigned char**)fields_ptr );
+    errorCode = _allocate(cl->get_number_of_fields()*sizeof(jfieldID),
+        (unsigned char**)fields_ptr);
     if( errorCode != JVMTI_ERROR_NONE ) return errorCode;
-    *field_count_ptr = cl->n_fields;
-    for( short i = 0; i < cl->n_fields; i++ ) (*fields_ptr)[i] = (jfieldID)&(cl->fields[i]);
+    *field_count_ptr = cl->get_number_of_fields();
+    for(short i = 0; i < cl->get_number_of_fields(); i++ )
+        (*fields_ptr)[i] = (jfieldID)cl->get_field(i);
 
     return JVMTI_ERROR_NONE;
 }
@@ -630,25 +622,19 @@
      * Check class status. If class is not on PREPARED status, GetClassMethods(...)
      * function returns JVMTI_ERROR_CLASS_NOT_PREPARED
      */
-    if ((cl->state == ST_Start) ||
-            (cl->state == ST_LoadingAncestors) ||
-            (cl->state == ST_Loaded) ||
-            (cl->state == ST_InstanceSizeComputed))
+    if(!cl->is_at_least_prepared())
         return JVMTI_ERROR_CLASS_NOT_PREPARED;
 
-    errorCode = _allocate( cl->n_superinterfaces*sizeof(jclass),
+    errorCode = _allocate( cl->get_number_of_superinterfaces()*sizeof(jclass),
         reinterpret_cast<unsigned char**>(interfaces_ptr) );
     if( errorCode != JVMTI_ERROR_NONE ) return errorCode;
     ObjectHandle jclss;
-    for( int i = 0; i < cl->n_superinterfaces; i++ )
+    for( int i = 0; i < cl->get_number_of_superinterfaces(); i++ )
     {
-        tmn_suspend_disable();
-        jclss = oh_allocate_local_handle();
-        jclss->object = struct_Class_to_java_lang_Class( cl->superinterfaces[i].clss );
-        tmn_suspend_enable();
+        jclss = struct_Class_to_jclass(cl->get_superinterface(i));
         (*interfaces_ptr)[i] = (jclass)jclss;
     }
-    *interface_count_ptr = cl->n_superinterfaces;
+    *interface_count_ptr = cl->get_number_of_superinterfaces();
 
     return JVMTI_ERROR_NONE;
 }
@@ -680,8 +666,8 @@
     if (cl == NULL)
         return errorCode;
 
-    TRACE2("jvmti.class", "IsInterface: class = " << cl->name->bytes);
-    *is_interface_ptr = (jboolean)(class_is_interface(cl) ? JNI_TRUE : JNI_FALSE);
+    TRACE2("jvmti.class", "IsInterface: class = " << cl->get_name()->bytes);
+    *is_interface_ptr = (jboolean)(cl->is_interface() ? JNI_TRUE : JNI_FALSE);
     return JVMTI_ERROR_NONE;
 }
 
@@ -712,8 +698,8 @@
     if (cl == NULL)
         return errorCode;
 
-    TRACE2("jvmti.class", "IsArrayClass: class = " << cl->name->bytes);
-    *is_array_class_ptr = (jboolean)(cl->is_array ? JNI_TRUE : JNI_FALSE);
+    TRACE2("jvmti.class", "IsArrayClass: class = " << cl->get_name()->bytes);
+    *is_array_class_ptr = (jboolean)(cl->is_array() ? JNI_TRUE : JNI_FALSE);
     return JVMTI_ERROR_NONE;
 }
 
@@ -743,7 +729,7 @@
         return errorCode;
 
     tmn_suspend_disable();
-    ManagedObject* cl = clss->class_loader->GetLoader();
+    ManagedObject* cl = clss->get_class_loader()->GetLoader();
     if( !cl ) {
         *classloader_ptr = NULL;
     } else {
@@ -782,14 +768,15 @@
     if (clss == NULL)
         return errorCode;
 
-    if( !clss->sourceDebugExtension ) return JVMTI_ERROR_ABSENT_INFORMATION;
+    if(!clss->has_source_debug_extension()) return JVMTI_ERROR_ABSENT_INFORMATION;
 
-    errorCode = _allocate( clss->sourceDebugExtension->len + 1,
-        reinterpret_cast<unsigned char**>(source_debug_extension_ptr) );
+    errorCode = _allocate(clss->get_source_debug_extension_length() + 1,
+        reinterpret_cast<unsigned char**>(source_debug_extension_ptr));
     if( errorCode != JVMTI_ERROR_NONE )
         return errorCode;
 
-    strcpy( *source_debug_extension_ptr, clss->sourceDebugExtension->bytes );
+    memcpy(*source_debug_extension_ptr, clss->get_source_debug_extension(),
+        clss->get_source_debug_extension_length() + 1);
 
     return JVMTI_ERROR_NONE;
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Wed Nov  8 20:52:12 2006
@@ -25,6 +25,7 @@
 #define LOG_DOMAIN "jvmti"
 #include "cxxlog.h"
 
+#include "open/gc.h"
 #include "jvmti_direct.h"
 #include "jvmti_internal.h"
 #include "jvmti_utils.h"
@@ -36,6 +37,7 @@
 #include "suspend_checker.h"
 #include "jit_intf_cpp.h"
 #include "vm_log.h"
+#include "cci.h"
 #include "compile.h"
 #include "jvmti_break_intf.h"
 #include "stack_iterator.h"
@@ -455,7 +457,7 @@
             {
                 TRACE2("jvmti.event.cml",
                     "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD called, method = " <<
-                    method->get_class()->name->bytes << "." << method->get_name()->bytes <<
+                    method->get_class()->get_name()->bytes << "." << method->get_name()->bytes <<
                     method->get_descriptor()->bytes);
 
                 for (CodeChunkInfo* cci = method->get_first_JIT_specific_info();  cci;  cci = cci->_next)
@@ -466,7 +468,7 @@
 
                 TRACE2("jvmti.event.cml",
                     "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD finished, method = " <<
-                    method->get_class()->name->bytes << "." << method->get_name()->bytes <<
+                    method->get_class()->get_name()->bytes << "." << method->get_name()->bytes <<
                     method->get_descriptor()->bytes);
             }
         }
@@ -557,25 +559,23 @@
             /**
              * Create jclass handle for classes and set in jclass table
              */
-          classloader->Lock();
-          ClassTable* tbl;
-          Class **klass;
-          ClassTable::iterator it;
-          tbl = classloader->GetLoadedClasses();
-          for(it = tbl->begin(); it != tbl->end(); it++)
-          {
+            classloader->Lock();
+            ClassTable* tbl;
+            Class **klass;
+            ClassTable::iterator it;
+            tbl = classloader->GetLoadedClasses();
+            for(it = tbl->begin(); it != tbl->end(); it++)
+            {
                 klass = &it->second;
-                TRACE2("jvmti.event", "Class = " << (*klass)->name->bytes);
-                if((*klass)->is_primitive)
+                TRACE2("jvmti.event", "Class = " << (*klass)->get_name()->bytes);
+                if((*klass)->is_primitive())
                     continue;
-                if((*klass)->class_loader != classloader)
+                if((*klass)->get_class_loader() != classloader)
                     continue;
-                if((*klass)->state == ST_Prepared ||
-                    (*klass)->state == ST_Initializing ||
-                    (*klass)->state == ST_Initialized)
-                    for (int jjj = 0; jjj < (*klass)->n_methods; jjj++)
+                if((*klass)->is_at_least_prepared())
+                    for (int jjj = 0; jjj < (*klass)->get_number_of_methods(); jjj++)
                     {
-                        Method *method = &(*klass)->methods[jjj];
+                        Method* method = (*klass)->get_method(jjj);
                         TRACE2("jvmti.event", "    Method = " << method->get_name()->bytes <<
                             method->get_descriptor()->bytes <<
                             (method->get_state() == Method::ST_Compiled ? " compiled" : " not compiled"));
@@ -593,7 +593,7 @@
             } else {
                 break;
             }
-        } while( true );
+        } while(true);
 
         ClassLoader::UnlockLoadersTable();
     }
@@ -1510,7 +1510,7 @@
 void jvmti_send_class_load_event(const Global_Env* env, Class* clss)
 {
     assert(hythread_is_suspend_enabled());
-    if( clss->is_array || clss->is_primitive ) {
+    if(clss->is_array() || clss->is_primitive()) {
         // array class creation and creation of a primitive class
         // do not generate a class load event.
         return;
@@ -1527,11 +1527,10 @@
     }
 
     JNIEnv *jni_env = p_TLS_vmthread->jni_env;
-    tmn_suspend_disable();
     ObjectHandle hThread = oh_allocate_local_handle();
-    ObjectHandle hClass = oh_allocate_local_handle();
+    ObjectHandle hClass = struct_Class_to_jclass(clss);
+    tmn_suspend_disable();
     hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
-    hClass->object = struct_Class_to_java_lang_Class(clss);
     tmn_suspend_enable();
 
     TIEnv *ti_env = ti->getEnvironments();
@@ -1545,7 +1544,7 @@
         {
             if (ti_env->global_events[JVMTI_EVENT_CLASS_LOAD - JVMTI_MIN_EVENT_TYPE_VAL])
             {
-                TRACE2("jvmti.class.cl", "Class load event, class name = " << clss->name->bytes);
+                TRACE2("jvmti.class.cl", "Class load event, class name = " << clss->get_name()->bytes);
                 // fire global event
                 func((jvmtiEnv *)ti_env, jni_env, (jthread)hThread, (jclass)hClass);
                 ti_env = next_env;
@@ -1557,7 +1556,7 @@
                  ti_et != NULL; ti_et = ti_et->next )
                 if (ti_et->thread == hythread_self())
                 {
-                    TRACE2("jvmti.class.cl", "Class load event, class name = " << clss->name->bytes);
+                    TRACE2("jvmti.class.cl", "Class load event, class name = " << clss->get_name()->bytes);
                     tmn_suspend_disable();
                     ObjectHandle hThreadLocal = oh_allocate_local_handle();
                     hThreadLocal->object = (Java_java_lang_Thread *)jthread_get_java_thread(ti_et->thread)->object;
@@ -1654,7 +1653,7 @@
 void jvmti_send_class_prepare_event(Class* clss)
 {
     assert(hythread_is_suspend_enabled());
-    if( clss->is_array || clss->is_primitive ) {
+    if(clss->is_array() || clss->is_primitive()) {
         // class prepare events are not generated for primitive classes
         // and arrays
         return;
@@ -1671,12 +1670,11 @@
     }
 
     JNIEnv *jni_env = p_TLS_vmthread->jni_env;
+    ObjectHandle hClass = struct_Class_to_jclass(clss);
     tmn_suspend_disable(); // -----------vv
     ObjectHandle hThread = oh_allocate_local_handle();
-    ObjectHandle hClass = oh_allocate_local_handle();
     hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
-    hClass->object = struct_Class_to_java_lang_Class(clss);
-    tmn_suspend_enable(); // ------------^^
+    tmn_suspend_enable();   // -----------^^
 
     TIEnv *ti_env = ti->getEnvironments();
     TIEnv *next_env;
@@ -1689,10 +1687,10 @@
         {
             if (ti_env->global_events[JVMTI_EVENT_CLASS_PREPARE - JVMTI_MIN_EVENT_TYPE_VAL])
             {
-                TRACE2("jvmti.class.cp", "Class prepare event, class name = " << clss->name->bytes);
+                TRACE2("jvmti.class.cp", "Class prepare event, class name = " << clss->get_name()->bytes);
                 // fire global event
                 func((jvmtiEnv *)ti_env, jni_env, (jthread)hThread, (jclass)hClass);
-                TRACE2("jvmti.class.cp", "Class prepare event exited, class name = " << clss->name->bytes);
+                TRACE2("jvmti.class.cp", "Class prepare event exited, class name = " << clss->get_name()->bytes);
                 ti_env = next_env;
                 continue;
             }
@@ -1701,7 +1699,7 @@
                 ti_et != NULL; ti_et = ti_et->next )
                 if (ti_et->thread == hythread_self())
                 {
-                    TRACE2("jvmti.class.cp", "Class prepare event, class name = " << clss->name->bytes);
+                    TRACE2("jvmti.class.cp", "Class prepare event, class name = " << clss->get_name()->bytes);
                     tmn_suspend_disable(); // -------------------------------vv
                     ObjectHandle hThreadLocal = oh_allocate_local_handle();
                     hThreadLocal->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp Wed Nov  8 20:52:12 2006
@@ -66,8 +66,8 @@
     if( !field ) return JVMTI_ERROR_INVALID_FIELDID; // (25)
 
     bool present = false;
-    for( unsigned i = 0; i < cl->n_fields; i++ ) {
-        if( (jfieldID)&(cl->fields[i]) == field ) {
+    for( unsigned i = 0; i < cl->get_number_of_fields(); i++ ) {
+        if( (jfieldID)cl->get_field(i) == field ) {
             present = true;
             break;
         }
@@ -146,8 +146,8 @@
     if( !field ) return JVMTI_ERROR_INVALID_FIELDID;
 
     bool present = false;
-    for( unsigned i = 0; i < cl->n_fields; i++ ) {
-        if( (jfieldID)&(cl->fields[i]) == field ) {
+    for( unsigned i = 0; i < cl->get_number_of_fields(); i++ ) {
+        if( (jfieldID)cl->get_field(i) == field ) {
             present = true;
             break;
         }
@@ -200,8 +200,8 @@
     if( !field ) return JVMTI_ERROR_INVALID_FIELDID;
 
     bool present = false;
-    for( unsigned i = 0; i < cl->n_fields; i++ ) {
-        if( (jfieldID)&(cl->fields[i]) == field ) {
+    for( unsigned i = 0; i < cl->get_number_of_fields(); i++ ) {
+        if( (jfieldID)cl->get_field(i) == field ) {
             present = true;
             break;
         }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.cpp Wed Nov  8 20:52:12 2006
@@ -192,12 +192,12 @@
     memset(state, 0, sizeof(TIIterationState));
 
     // we trust in correct values of global values
-    // Class::heap_base and Class::heap_ceiling
-    assert((UDATA)Class::heap_base == (UDATA)gc_heap_base_address());
-    assert((UDATA)Class::heap_end == (UDATA)gc_heap_ceiling_address());
+    // Global_Env::heap_base and Global_Env::heap_end
+    assert((UDATA)ti_env->vm->vm_env->heap_base == (UDATA)gc_heap_base_address());
+    assert((UDATA)ti_env->vm->vm_env->heap_end == (UDATA)gc_heap_ceiling_address());
 
-    state->markbits_size = ((UDATA)Class::heap_end - (UDATA)Class::heap_base) 
-        / GC_OBJECT_ALIGNMENT / 8;
+    state->markbits_size = ((UDATA)ti_env->vm->vm_env->heap_end
+        - (UDATA)ti_env->vm->vm_env->heap_base) / GC_OBJECT_ALIGNMENT / 8;
     state->markbits = new unsigned char[state->markbits_size];
     if (state->markbits == NULL) {
         delete state;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_heap.h Wed Nov  8 20:52:12 2006
@@ -94,7 +94,7 @@
 inline jlong ti_get_object_class_tag(TIEnv *ti_env, Managed_Object_Handle obj)
 {
     Class* clss = ((ManagedObject*)obj)->vt()->clss;
-    return ti_env->tags->get(*clss->class_handle);
+    return ti_env->tags->get(*(clss->get_class_handle()));
 }
 
 /**
@@ -115,8 +115,8 @@
  */
 inline bool is_object_valid(Managed_Object_Handle obj)
 {
-    return ((obj != NULL) && (obj > Class::heap_base)
-            && (obj < Class::heap_end));
+    return ((obj != NULL) && (obj > VM_Global_State::loader_env->heap_base)
+            && (obj < VM_Global_State::loader_env->heap_end));
 }
 
 /**

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_internal.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_internal.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_internal.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_internal.cpp Wed Nov  8 20:52:12 2006
@@ -38,8 +38,8 @@
     ManagedObject *mo = h->object;
 
     // Check that reference pointer points to the heap
-    if (mo < (ManagedObject *)Class::heap_base ||
-        mo > (ManagedObject *)Class::heap_end)
+    if (mo < (ManagedObject *)VM_Global_State::loader_env->heap_base ||
+        mo > (ManagedObject *)VM_Global_State::loader_env->heap_end)
     {
         tmn_suspend_enable();
         return false;
@@ -52,8 +52,8 @@
         return false;
     }
 
-    Class *object_clss = mo->vt()->clss;
-    Boolean result = class_is_subtype_fast(object_clss->vtable, clss);
+    Class* object_clss = mo->vt()->clss;
+    Boolean result = object_clss->is_instanceof(clss);
     tmn_suspend_enable();        //---------------------------------^
 
     return result;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp Wed Nov  8 20:52:12 2006
@@ -36,6 +36,8 @@
 #include "stack_iterator.h"
 #include "stack_trace.h"
 #include "jit_intf_cpp.h"
+#include "cci.h"
+#include "Class.h"
 
 #define jvmti_test_jenv (p_TLS_vmthread->jni_env)
 
@@ -409,8 +411,8 @@
         tmn_suspend_disable();
         ManagedObject *obj = handle->object;
 
-        if (obj < (ManagedObject *)Class::heap_base ||
-            obj > (ManagedObject *)Class::heap_end)
+        if (obj < (ManagedObject *)VM_Global_State::loader_env->heap_base ||
+            obj > (ManagedObject *)VM_Global_State::loader_env->heap_end)
         {
             tmn_suspend_enable();
             return JVMTI_ERROR_INVALID_OBJECT;
@@ -418,6 +420,9 @@
 
         Class *clss = obj->vt()->clss;
         ManagedObject *clsObj = struct_Class_to_java_lang_Class(clss);
+        // ppervov: FIXME: there is an assertion in the above function which
+        // is exactly the same as in the following if. So, this code will only
+        // work in release and just assert in debug.
         if (clsObj->vt()->clss != VM_Global_State::loader_env->JavaLangClass_Class) {
             tmn_suspend_enable();
             return JVMTI_ERROR_INVALID_OBJECT;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_object.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_object.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_object.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_object.cpp Wed Nov  8 20:52:12 2006
@@ -67,16 +67,16 @@
     ManagedObject *mo = h->object;
 
     // Check that reference pointer points to the heap
-    if (mo < (ManagedObject *)Class::heap_base ||
-        mo > (ManagedObject *)Class::heap_end)
+    if (mo < (ManagedObject *)VM_Global_State::loader_env->heap_base ||
+        mo > (ManagedObject *)VM_Global_State::loader_env->heap_end)
     {
         tmn_suspend_enable();
         return JVMTI_ERROR_INVALID_OBJECT;
     }
 
     Class *object_clss = mo->vt()->clss;
-    if (class_is_array(object_clss))
-        *size_ptr = vm_vector_size(object_clss, get_vector_length((Vector_Handle)mo));
+    if(object_clss->is_array())
+        *size_ptr = object_clss->calculate_array_size(get_vector_length((Vector_Handle)mo));
     else
         *size_ptr = class_get_boxed_data_size(object_clss);
 
@@ -119,7 +119,7 @@
         p_obj = NULL;
     *hash_code_ptr = generic_hashcode(p_obj);
     TRACE2("jvmti-object", "Object " <<
-        ((NULL == p_obj) ? "is null" : p_obj->vt()->clss->name->bytes) <<
+        ((NULL == p_obj) ? "is null" : p_obj->vt()->clss->get_name()->bytes) <<
         " hash code = " << *hash_code_ptr);
     tmn_suspend_enable();
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp Wed Nov  8 20:52:12 2006
@@ -32,6 +32,7 @@
 #include "mon_enter_exit.h"
 #include "stack_iterator.h"
 #include "jvmti_break_intf.h"
+#include "cci.h"
 #include "clog.h"
 
 static void jvmti_pop_frame_callback()

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp Wed Nov  8 20:52:12 2006
@@ -31,6 +31,7 @@
 
 // VM headers
 #include "Class.h"
+#include "cci.h"
 #include "classloader.h"
 #include "finalize.h"
 #include "interpreter.h"

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp Wed Nov  8 20:52:12 2006
@@ -36,6 +36,7 @@
 #include "stack_iterator.h"
 #include "jit_intf_cpp.h"
 #include "thread_manager.h"
+#include "cci.h"
 
 #define jvmti_test_jenv (p_TLS_vmthread->jni_env)
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Wed Nov  8 20:52:12 2006
@@ -28,6 +28,7 @@
 #include "stack_iterator.h"
 #include "interpreter.h"
 #include "method_lookup.h"
+#include "cci.h"
 #include "open/bytecodes.h"
 #include "open/jthread.h"
 #include "jvmti_break_intf.h"
@@ -317,13 +318,13 @@
             {
                 unsigned short index = jvmti_GetHalfWordValue( bytecode, location + 1 );
                 Class *klass = method_get_class( method );
-                assert( cp_is_resolved(klass->const_pool, index) );
+                assert(klass->get_constant_pool().is_entry_resolved(index));
 
-                if( !method_is_native( klass->const_pool[index].CONSTANT_ref.method ) ) {
+                if(!method_is_native(klass->get_constant_pool().get_ref_method(index))) {
                     *count = 1;
                     error = _allocate( sizeof(jvmti_StepLocation), (unsigned char**)next_step );
                     assert( error == JVMTI_ERROR_NONE );
-                    (*next_step)->method = klass->const_pool[index].CONSTANT_ref.method;
+                    (*next_step)->method = klass->get_constant_pool().get_ref_method(index);
                     (*next_step)->location = 0;
                     (*next_step)->native_location = NULL;
                     (*next_step)->no_event = false;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.h Wed Nov  8 20:52:12 2006
@@ -26,6 +26,7 @@
 
 #include "jvmti_types.h"
 #include "open/types.h"
+#include "vtable.h"
 
 #include "ulist.h"
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp Wed Nov  8 20:52:12 2006
@@ -43,6 +43,8 @@
 #include "stack_iterator.h"
 
 
+#include "Class.h" // FIXME: this is for Class::heap_base and Class::heap_end
+
 #define MAX_JVMTI_ENV_NUMBER 10
 #define jvmti_test_jenv (p_TLS_vmthread->jni_env)
 
@@ -417,8 +419,8 @@
     ManagedObject *mo = h->object;
 
     // Check that reference pointer points to the heap
-    if (mo < (ManagedObject *)Class::heap_base ||
-        mo > (ManagedObject *)Class::heap_end)
+    if (mo < (ManagedObject*)VM_Global_State::loader_env->heap_base ||
+        mo > (ManagedObject*)VM_Global_State::loader_env->heap_end)
     {
         tmn_suspend_enable();
         return JVMTI_ERROR_INVALID_OBJECT;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp Wed Nov  8 20:52:12 2006
@@ -29,6 +29,7 @@
 #include "cxxlog.h"
 #include "suspend_checker.h"
 #include "environment.h"
+#include "Class.h"
 
 #define jvmti_test_jenv (p_TLS_vmthread->jni_env)
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_trace.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_trace.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_trace.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_trace.cpp Wed Nov  8 20:52:12 2006
@@ -129,9 +129,9 @@
 
 bool ti_mark_object(Managed_Object_Handle obj, TIIterationState *state)
 {
-    assert((UDATA)obj < (UDATA)Class::heap_end);
-    assert((UDATA)obj >= (UDATA)Class::heap_base);
-    unsigned offset = (UDATA)obj - (UDATA)Class::heap_base;
+    assert((UDATA)obj < (UDATA)VM_Global_State::loader_env->heap_end);
+    assert((UDATA)obj >= (UDATA)VM_Global_State::loader_env->heap_base);
+    unsigned offset = (UDATA)obj - (UDATA)VM_Global_State::loader_env->heap_base;
     unsigned bitnum = offset / GC_OBJECT_ALIGNMENT;
     unsigned index = bitnum / 8;
     unsigned mask = 1 << (bitnum % 8);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp Wed Nov  8 20:52:12 2006
@@ -35,9 +35,9 @@
 #include "Class.h"
 #include "vm_strings.h"
 #include "jvmti_direct.h"
-#include "Class.h"
 #include "object_handles.h"
 #include "jvmti_utils.h"
+#include "type.h"
 #include "cxxlog.h"
 
 #include "jvmti_interface.h"
@@ -333,8 +333,8 @@
 
     if (! field->get_field_type_desc()->is_primitive() && NULL != new_value.l) {
         // if new_value.l is not a handle but a direct pointer to java heap
-        if ((ManagedObject*)new_value.l >= (ManagedObject*)Class::heap_base &&
-            (ManagedObject*)new_value.l <= (ManagedObject*)Class::heap_end)
+        if ((ManagedObject*)new_value.l >= (ManagedObject*)VM_Global_State::loader_env->heap_base
+            && (ManagedObject*)new_value.l <= (ManagedObject*)VM_Global_State::loader_env->heap_end)
         {
             new_value.l = oh_allocate_local_handle();
             new_value.l->object = (ManagedObject*)p_new_value->l;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java Wed Nov  8 20:52:12 2006
@@ -337,6 +337,7 @@
      * @com.intel.drl.spec_ref
      */
     public Class<?> getComponentType() {
+		if(!isArray()) return null;
         return VMClassRegistry.getComponentType(this);
     }
 
@@ -646,7 +647,10 @@
      * @com.intel.drl.spec_ref
      */
     public boolean isArray() {
-        return VMClassRegistry.isArray(this);
+        if (reflectionData == null) {
+            initReflectionData();
+        }
+        return reflectionData.isArray;
     }
 
     /**
@@ -1169,6 +1173,8 @@
         String name;
         
         int modifiers = -1;
+        
+        boolean isArray;
 
         Constructor<T>[] declaredConstructors;
 
@@ -1188,6 +1194,7 @@
         
         public ReflectionData() {
             name = VMClassRegistry.getName(Class.this);
+            isArray = VMClassRegistry.isArray(Class.this);
             packageName = Class.getParentName(name);
         }
         

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java Wed Nov  8 20:52:12 2006
@@ -172,14 +172,14 @@
      * @throws NullPointerException if any of the arguments is null 
      */
     void appendArrayType(StringBuilder sb, Class<?> obj) {
-        Class simplified = obj.getComponentType();
-        if (simplified == null) {
+        if (!obj.isArray()) {
             sb.append(obj.getName());
             return;
         }
         int dimensions = 1;
+        Class simplified = obj.getComponentType();
         obj = simplified;
-        while ((simplified = obj.getComponentType()) != null) {
+        while (simplified.isArray()) {
             obj = simplified;
             dimensions++;
         }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp Wed Nov  8 20:52:12 2006
@@ -130,9 +130,9 @@
     int primitives_len = sizeof(primitives) / sizeof(Class*);
 
     for (int i = 0; i < primitives_len; i++) {
-        if (primitives[i] && primitives[i]->name) {
-            char *pname = (char*)primitives[i]->name->bytes;
-            if (0 == strcmp(buf, pname)) { 
+        if (primitives[i] && primitives[i]->get_name()) {
+            char *pname = (char*)primitives[i]->get_name()->bytes;
+            if (0 == strcmp(buf, pname)) {
                 STD_FREE(buf);
                 return NULL;
             }
@@ -201,7 +201,7 @@
   (JNIEnv *jenv, jclass, jclass clazz)
 {
     Class_Handle ch = jni_get_class_handle(jenv, clazz);
-    Class *pCompClass = ((Class*)ch)->array_element_class;
+    Class* pCompClass = ch->get_array_element_class();
     return jni_class_from_handle(jenv, pCompClass);
 }
 
@@ -323,7 +323,7 @@
   (JNIEnv *jenv, jclass, jclass clazz)
 {
     Class_Handle clss = jni_get_class_handle(jenv, clazz);
-    return class_get_flags(clss) & (~ACC_SUPER);
+    return clss->get_access_flags() & (~ACC_SUPER);
 }
 
 /*
@@ -336,7 +336,7 @@
 {
     ASSERT_RAISE_AREA;
     Class* clss = jclass_to_struct_Class(clazz);
-    String* str = class_get_java_name(clss, VM_Global_State::loader_env);
+    String* str = clss->get_java_name();
     return String_to_interned_jstring(str);
 }
 
@@ -350,12 +350,12 @@
 {
     Class *clss = jni_get_class_handle(jenv, clazz);
 
-    if (class_is_interface (clss) || clss->is_primitive || !clss->super_class) {
+    if (clss->is_interface() || clss->is_primitive() || !clss->has_super_class()) {
         // Interfaces and primitive classes have no superclasses.
         return (jclass)0;
     }
 
-    return jni_class_from_handle(jenv, clss->super_class);
+    return jni_class_from_handle(jenv, clss->get_super_class());
 }
 
 /*
@@ -393,7 +393,7 @@
     cl->Unlock();
 
     jclass string_class = struct_Class_to_java_lang_Class_Handle(genv->JavaLangString_Class);
-    static Class* aos = genv->LoadCoreClass(genv->string_pool.lookup("[Ljava/lang/String;"));
+    static Class* aos = genv->LoadCoreClass("[Ljava/lang/String;");
     jclass string_array_class = struct_Class_to_java_lang_Class_Handle(aos);
     assert(string_class);
     assert(string_array_class);
@@ -600,17 +600,17 @@
 {
     assert(jclazz);
     Class* clazz = jclass_to_struct_Class(jclazz);
-    unsigned idx = clazz->enclosing_class_index;
+    unsigned idx = clazz->get_enclosing_class_index();
     if (!idx) {
-        idx = clazz->declaringclass_index;
+        idx = clazz->get_declaring_class_index();
     }
     if (idx) {
-        Class* outer_clss = class_resolve_class(clazz, idx);
+        Class* outer_clss = clazz->_resolve_class(VM_Global_State::loader_env, idx);
         if (outer_clss) {
-            return struct_Class_to_java_lang_Class_Handle(outer_clss);
+            return struct_Class_to_jclass(outer_clss);
         }
         if (!exn_raised()) {
-            exn_raise_object(class_get_linking_error(clazz, idx));
+            exn_raise_object(clazz->get_constant_pool().get_error_cause(idx));
         }
     } 
     return NULL;
@@ -626,20 +626,20 @@
 {
     assert(jclazz);
     Class* clazz = jclass_to_struct_Class(jclazz);
-    unsigned m_idx = clazz->enclosing_method_index;
-    if (m_idx) {
-        unsigned c_idx = clazz->enclosing_class_index;
+    unsigned method_idx = clazz->get_enclosing_method_index();
+    if (method_idx) {
+        unsigned c_idx = clazz->get_enclosing_class_index();
         ASSERT(c_idx, "No class for enclosing method");
-        Class* outer_clss = class_resolve_class(clazz, c_idx);
+        Class* outer_clss = clazz->_resolve_class(VM_Global_State::loader_env, c_idx);
         if (outer_clss) 
         {
-            String* name = clazz->const_pool[m_idx].CONSTANT_NameAndType.name;
-            String* desc = clazz->const_pool[m_idx].CONSTANT_NameAndType.descriptor;
+            String* name = clazz->get_constant_pool().get_name_and_type_name(method_idx);
+            String* desc = clazz->get_constant_pool().get_name_and_type_descriptor(method_idx);
 
-            TRACE("Looking for enclosing method: class="<<outer_clss->name->bytes 
+            TRACE("Looking for enclosing method: class="<<outer_clss->get_name()->bytes 
                 <<"; name="<<name->bytes<<"; desc="<<desc->bytes);
 
-            Method* enclosing = class_lookup_method(outer_clss, name, desc);
+            Method* enclosing = outer_clss->lookup_method(name, desc);
             if (enclosing) 
             {
                 if (enclosing->is_init()) 
@@ -656,7 +656,7 @@
                     "Invalid enclosing method declared");
             }
         } else if (!exn_raised()) {
-            exn_raise_object(class_get_linking_error(clazz, c_idx));
+            exn_raise_object(clazz->get_constant_pool().get_error_cause(c_idx));
         }
     } 
     return NULL;
@@ -673,6 +673,6 @@
     ASSERT_RAISE_AREA;
     assert(jclazz);
     Class* clazz = jclass_to_struct_Class(jclazz);
-    String* str = class_get_simple_name(clazz, VM_Global_State::loader_env);
+    String* str = clazz->get_simple_name();
     return str ? String_to_interned_jstring(str) : NULL;
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp Wed Nov  8 20:52:12 2006
@@ -93,11 +93,11 @@
 
     if(jclss) {
         Class* clss = jclass_to_struct_Class(jclss);
-        while (clss->declaringclass_index) {
+        while (clss->get_declaring_class_index()) {
             clss = class_get_declaring_class((Class_Handle)clss);
         }
-        const char* name = class_get_java_name(clss, genv)->bytes;
-        bool system = (((void*)clss->class_loader) == ((void*)genv->bootstrap_class_loader));
+        const char* name = clss->get_java_name()->bytes;
+        bool system = (((void*)clss->get_class_loader()) == ((void*)genv->bootstrap_class_loader));
         TRACE("check assert status for " << name << " system=" << system);
         if (system || !recursive) {
             status = reg->get_class_status(name);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp Wed Nov  8 20:52:12 2006
@@ -36,6 +36,7 @@
 #include "exceptions.h"
 #include "primitives_support.h"
 #include "jni_utils.h"
+#include "type.h"
 
 #include "java_lang_reflect_VMField.h"
 
@@ -175,7 +176,7 @@
 
     jobject retobj = NULL;
 
-    if (field->get_field_type_desc()->is_primitive()) 
+    if (field->get_field_type_desc()->is_primitive())
     {
         char field_sig = field->get_descriptor()->bytes[0];
         jvalue primitive_value = read_primitive(jenv, (jfieldID)field, obj, field_sig);
@@ -286,7 +287,7 @@
 
     if (field->get_field_type_desc()->is_primitive()) 
     {
-        char value_sig = value ? is_wrapper_class(jobject_to_struct_Class(value)->name->bytes) : 0;
+        char value_sig = value ? is_wrapper_class(jobject_to_struct_Class(value)->get_name()->bytes) : 0;
         if (!value_sig) {
             // the value is not primitive
             ThrowNew_Quick(jenv, "java/lang/IllegalArgumentException",
@@ -302,7 +303,7 @@
         Class* value_clss = jobject_to_struct_Class(value);
         Class* clss = field->get_field_type_desc()->load_type_desc();
         assert(clss);
-        if (!class_is_subtype_fast(value_clss->vtable, clss)) {
+        if (!value_clss->is_instanceof(clss)) {
             ThrowNew_Quick(jenv, "java/lang/IllegalArgumentException",
                 "The specified value cannot be converted to the field's type type by an identity or widening conversions");
             return;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp Wed Nov  8 20:52:12 2006
@@ -36,6 +36,7 @@
 #include "vm_strings.h"
 #include "primitives_support.h"
 #include "jni_utils.h"
+#include "Class.h"
 
 #include "java_lang_VMClassRegistry.h"
 #include "java_lang_reflect_VMReflection.h"
@@ -112,7 +113,7 @@
     jthrowable exn = exn_get(); 
     //FIXME need better handling for lazy exceptions
     if (!exn) {
-    	WARN("ATTENTION! Could not get cause exception from lazy machinery");
+        WARN("ATTENTION! Could not get cause exception from lazy machinery");
     }
     exn_clear();
     //static Class* ITE_class = genv->LoadCoreClass(
@@ -199,7 +200,7 @@
     Class* type = VM_Global_State::loader_env->java_lang_reflect_Method_Class;
     Method_Handle method = (Method_Handle) ((POINTER_SIZE_INT) member);
 
-    TRACE("invoke : " << method->get_class()->name->bytes << "."  << method->get_name()->bytes << "()");
+    TRACE("invoke : " << method->get_class()->get_name()->bytes << "."  << method->get_name()->bytes << "()");
 
     unsigned num_args = method->get_num_args();
     jvalue *jvalue_args = (jvalue *)STD_ALLOCA(num_args * sizeof(jvalue));
@@ -302,7 +303,7 @@
 {
     Method_Handle method = (Method_Handle) ((POINTER_SIZE_INT) member);
 
-    TRACE("new class instance : " << method->get_class()->name->bytes);
+    TRACE("new class instance : " << method->get_class()->get_name()->bytes);
 
     unsigned num_args = method->get_num_args();
     jvalue *jvalue_args = (jvalue *)STD_ALLOCA(num_args * sizeof(jvalue));

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp Wed Nov  8 20:52:12 2006
@@ -39,7 +39,7 @@
   (JNIEnv * env, jclass self, jclass array)
 {
     Class * clz = jclass_to_struct_Class(array);
-    return clz->array_element_size;
+    return clz->get_array_element_size();
 }
 
 JNIEXPORT void JNICALL 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp Wed Nov  8 20:52:12 2006
@@ -52,7 +52,7 @@
 (JNIEnv *jenv, jclass, jclass jclazz) 
 {
     Class* clazz = jclass_to_struct_Class(jclazz);
-    String* sig = clazz->Signature;
+    String* sig = clazz->get_signature();
     TRACE("Signature of " << clazz << " : " << sig);
     return sig ? NewStringUTF(jenv, sig->bytes) : NULL;
 }
@@ -70,7 +70,7 @@
 {
     Class* clazz = jclass_to_struct_Class(jclazz);
     TRACE("Requested annotations for class " << clazz);
-    return get_annotations(jenv, clazz->annotations, clazz);
+    return get_annotations(jenv, clazz->get_annotations(), clazz);
 }
 
 JNIEXPORT jobjectArray JNICALL Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getParameterAnnotations
@@ -81,7 +81,7 @@
     Class* declaring_class = method->get_class();
 
     static Class* array_class = genv->LoadCoreClass(
-        genv->string_pool.lookup("[Ljava/lang/annotation/Annotation;"));
+        "[Ljava/lang/annotation/Annotation;");
 
     unsigned num = method->get_num_param_annotations();
     TRACE("Requested parameters annotations for method " << method

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp Wed Nov  8 20:52:12 2006
@@ -285,8 +285,8 @@
     jclass ste = struct_Class_to_java_lang_Class_Handle(genv->java_lang_StackTraceElement_Class);
     assert(ste);
 
-    static jmethodID init = (jmethodID) class_lookup_method(
-        genv->java_lang_StackTraceElement_Class, genv->Init_String, 
+    static jmethodID init = (jmethodID) genv->java_lang_StackTraceElement_Class->lookup_method(
+        genv->Init_String,
         genv->string_pool.lookup("(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V"));
    
     jarray arr = jenv->NewObjectArray(size - skip, ste, NULL);
@@ -321,7 +321,7 @@
      
         tmn_suspend_disable();
         // class name
-        String* className = class_get_java_name(method->get_class(), genv);
+        String* className = method->get_class()->get_java_name();
         strClassName->object = vm_instantiate_cp_string_resolved(className);
         if (!strClassName->object) {
             tmn_suspend_enable();
@@ -398,74 +398,73 @@
     assert(method);
     // skip only for main application thread
     if (!strcmp(method_get_name(method), "runImpl")
-        && method->get_class()->name == starter_String) {
+        && method->get_class()->get_name() == starter_String) {
 
-            size --;
-        }
+        size --;
+    }
 
-        assert(hythread_is_suspend_enabled());
-        jclass ste = struct_Class_to_java_lang_Class_Handle(genv->java_lang_StackTraceElement_Class);
-        assert(ste);
+    assert(hythread_is_suspend_enabled());
+    jclass ste = struct_Class_to_java_lang_Class_Handle(genv->java_lang_StackTraceElement_Class);
+    assert(ste);
 
-        static jmethodID init = (jmethodID) class_lookup_method(
-            genv->java_lang_StackTraceElement_Class, genv->Init_String, 
-            genv->string_pool.lookup("(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V"));
+    static jmethodID init = (jmethodID) genv->java_lang_StackTraceElement_Class->lookup_method(
+        genv->Init_String,
+        genv->string_pool.lookup("(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V"));
 
-        jarray arr = jenv->NewObjectArray(size, ste, NULL);
-        if (!arr) {
-            assert(exn_raised());
-            return NULL;
-        }
+    jarray arr = jenv->NewObjectArray(size, ste, NULL);
+    if (!arr) {
+        assert(exn_raised());
+        return NULL;
+    }
 
-        tmn_suspend_disable();
-        ObjectHandle strMethodName = oh_allocate_local_handle();
-        ObjectHandle strClassName = oh_allocate_local_handle();
-        tmn_suspend_enable();
+    tmn_suspend_disable();
+    ObjectHandle strMethodName = oh_allocate_local_handle();
+    ObjectHandle strClassName = oh_allocate_local_handle();
+    tmn_suspend_enable();
 
-        for(unsigned i = 0; i < size; i++) {
-            Method_Handle method = frames[i].method;
-            NativeCodePtr ip = frames[i].ip;
-            int lineNumber;
-            const char* fileName;
+    for(unsigned i = 0; i < size; i++) {
+        Method_Handle method = frames[i].method;
+        NativeCodePtr ip = frames[i].ip;
+        int lineNumber;
+        const char* fileName;
 
-            get_file_and_line(method, ip, true, &fileName, &lineNumber);
-            if (fileName == NULL) fileName = "";
+        get_file_and_line(method, ip, true, &fileName, &lineNumber);
+        if (fileName == NULL) fileName = "";
 
-            jstring strFileName = jenv->NewStringUTF(fileName);
-            if (!strFileName) {
-                assert(exn_raised());
-                return NULL;
-            }
+        jstring strFileName = jenv->NewStringUTF(fileName);
+        if (!strFileName) {
+            assert(exn_raised());
+            return NULL;
+        }
 
-            tmn_suspend_disable();
-            // class name
-            String* className = class_get_java_name(method->get_class(), 
-                VM_Global_State::loader_env);
-            strClassName->object = vm_instantiate_cp_string_resolved(className);
-            if (!strClassName->object) {
-                tmn_suspend_enable();
-                assert(exn_raised());
-                return NULL;
-            }
-            // method name
-            strMethodName->object = vm_instantiate_cp_string_resolved(method->get_name());
-            if (!strMethodName->object) {
-                tmn_suspend_enable();
-                assert(exn_raised());
-                return NULL;
-            }
+        tmn_suspend_disable();
+        // class name
+        String* className = method->get_class()->get_java_name();
+        strClassName->object = vm_instantiate_cp_string_resolved(className);
+        if (!strClassName->object) {
             tmn_suspend_enable();
+            assert(exn_raised());
+            return NULL;
+        }
+        // method name
+        strMethodName->object = vm_instantiate_cp_string_resolved(method->get_name());
+        if (!strMethodName->object) {
+            tmn_suspend_enable();
+            assert(exn_raised());
+            return NULL;
+        }
+        tmn_suspend_enable();
 
-            // creating StackTraceElement object
-            jobject obj = jenv->NewObject(ste, init, strClassName, strMethodName, 
-                strFileName, lineNumber);
-            if (!obj) {
-                assert(exn_raised());
-                return NULL;
-            }
-
-            jenv->SetObjectArrayElement(arr, i, obj);
+        // creating StackTraceElement object
+        jobject obj = jenv->NewObject(ste, init, strClassName, strMethodName, 
+            strFileName, lineNumber);
+        if (!obj) {
+            assert(exn_raised());
+            return NULL;
         }
-        core_free(frames);
-        return arr;
+
+        jenv->SetObjectArrayElement(arr, i, obj);
+    }
+    core_free(frames);
+    return arr;
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/object_handles.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/object_handles.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/object_handles.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/object_handles.cpp Wed Nov  8 20:52:12 2006
@@ -37,6 +37,13 @@
 #include "thread_manager.h"
 #include "open/types.h"
 #include "open/vm_util.h"
+#include "vtable.h"
+
+#ifndef NDEBUG
+// this is for managed object sanity checks
+// (used in monitor enter/exit functions)
+#include "Class.h"
+#endif
 
 static ObjectHandlesOld* oh_allocate_object_handle();
 
@@ -173,8 +180,8 @@
 static bool
 managed_object_object_is_valid_unsafe(ManagedObject* p_obj) {
     Class* clss = p_obj->vt()->clss;
-    assert(clss->vtable->clss == clss);
-    return managed_object_is_java_lang_class_unsafe(*clss->class_handle);
+    assert(clss->get_vtable()->clss == clss);
+    return managed_object_is_java_lang_class_unsafe(*(clss->get_class_handle()));
 }
 
 bool
@@ -352,18 +359,19 @@
 ObjectHandle oh_allocate_local_handle()
 {
     assert(!hythread_is_suspend_enabled());
-    // FIXME: it looks like this should be uncoment or suspend_disable added 
-       //assert(!hythread_is_suspend_enabled());
-       
-       
-    // ? 20021202 There are really 3 cases to check: 
-    //   1) JNI transition: both LJF and LJF->local_object_handles are non-NULL. Any local handles will be cleaned up on return.
-    //   2) RNI/stub transition: LJF is non-NULL but LJF->local_object_handles is NULL. Although an LJF frame was pushed, 
-    //      local handles will NOT be cleaned up, so to avoid a storage leak we use the same code as case 3) below.
-    //   3) LJF is NULL. Native code uses Native_Local_Object_Handles, whose destructor cleans up any local handles.
 
-    // As of 2005-03-05, RNI is not used at all, and we need local handles,
-    // so 2) is handled by creating new local handles. 
+    // There are really 3 cases to check:
+    //   1) JNI transition: both LJF and LJF->local_object_handles are
+    //      non-NULL. Any local handles will be cleaned up on return.
+    //   2) RNI/stub transition: LJF is non-NULL but LJF->local_object_handles
+    //      is NULL. Although an LJF frame was pushed, local handles will NOT
+    //      be cleaned up, so to avoid a storage leak we use the same code as
+    //      case (3) below.
+    //   3) LJF is NULL. Native code uses Native_Local_Object_Handles, whose
+    //      destructor cleans up any local handles.
+
+    // RNI is not used at all, and we need local handles, so (2) is handled by
+    // creating new local handles.
     // XXX: need to check against leaks. -salikh
 
     M2nFrame* lm2nf = m2n_get_last_frame();
@@ -526,7 +534,8 @@
     if (null_check && VM_Global_State::loader_env->compress_references) {
         sprintf(buf,
                 "jc %s=%p:ref,%%n; st [%s+%d:ref],%s; j %%o; :%%g; st [%s+%d:ref],0; :%%g;",
-                val, Class::heap_base, base_var, offset, val, base_var, offset);
+                val, VM_Global_State::loader_env->heap_base, base_var, offset,
+                val, base_var, offset);
     } else {
         sprintf(buf, "st [%s+%d:ref],%s;", base_var, offset, val);
     }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/vm_arrays.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/vm_arrays.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/vm_arrays.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/object/vm_arrays.cpp Wed Nov  8 20:52:12 2006
@@ -38,17 +38,6 @@
 #include "vm_stats.h"
 
 
-#define BITS_PER_BYTE 8
-#define HIGH_BIT_SET_MASK (1<<((sizeof(unsigned) * BITS_PER_BYTE)-1))
-#define HIGH_BIT_CLEAR_MASK (~HIGH_BIT_SET_MASK)
-#ifndef NEXT_TO_HIGH_BIT_SET_MASK
-#define NEXT_TO_HIGH_BIT_SET_MASK (1<<((sizeof(unsigned) * BITS_PER_BYTE)-2))
-#define NEXT_TO_HIGH_BIT_CLEAR_MASK (~NEXT_TO_HIGH_BIT_SET_MASK)
-#endif /* #ifndef NEXT_TO_HIGH_BIT_SET_MAS */
-#define TWO_HIGHEST_BITS_SET_MASK (HIGH_BIT_SET_MASK|NEXT_TO_HIGH_BIT_SET_MASK)
-
-
-
 /////////////////////////////////////////////////////////////
 // begin vector access functions
 //
@@ -81,7 +70,7 @@
 #endif
     ASSERT_RAISE_AREA;
     assert(!hythread_is_suspend_enabled());
-    assert(!arr_clss->is_array_of_primitives);
+    assert(!arr_clss->is_array_of_primitives());
 
     if (length < 0) {
         tmn_suspend_enable();
@@ -90,7 +79,7 @@
         return NULL;
     }
 
-    unsigned sz = vm_array_size(arr_clss->vtable, length);
+    unsigned sz = arr_clss->calculate_array_size(length);
 
     if ((length & TWO_HIGHEST_BITS_SET_MASK) || (sz & TWO_HIGHEST_BITS_SET_MASK)) {
         // VM does not support arrays of length >= MAXINT>>2
@@ -102,10 +91,10 @@
         return NULL;
     }
 
-    Vector_Handle object_array = (Vector_Handle )gc_alloc(sz, arr_clss->allocation_handle, vm_get_gc_thread_local());
+    Vector_Handle object_array = (Vector_Handle )gc_alloc(sz,
+        arr_clss->get_allocation_handle(), vm_get_gc_thread_local());
 #ifdef VM_STATS
-    arr_clss->num_allocations++;    
-    arr_clss->num_bytes_allocated += sz;
+    arr_clss->instance_allocated(sz);
 #endif //VM_STATS
 
     if (NULL == object_array) {
@@ -115,7 +104,7 @@
     }
 
     set_vector_length(object_array, length);
-    assert(get_vector_vtable(object_array) == arr_clss->vtable);
+    assert(get_vector_vtable(object_array) == arr_clss->get_vtable());
     return object_array;
 } //vm_anewarray_resolved_array_type
 
@@ -145,14 +134,12 @@
         tmn_suspend_disable();
         return NULL;
     }
-    assert(vector_class->is_array_of_primitives);
-    assert(vector_class->vtable);
-    unsigned sz = vm_array_size(vector_class->vtable, length);
+    assert(vector_class->is_array_of_primitives());
+    unsigned sz = vector_class->calculate_array_size(length);
     Vector_Handle vector = (Vector_Handle)gc_alloc(sz, 
-        vector_class->allocation_handle, vm_get_gc_thread_local());
+        vector_class->get_allocation_handle(), vm_get_gc_thread_local());
 #ifdef VM_STATS
-    vector_class->num_allocations++;
-    vector_class->num_bytes_allocated += sz;
+    vector_class->instance_allocated(sz);
 #endif //VM_STATS
 
     if (NULL == vector) {
@@ -162,7 +149,7 @@
     }
 
     set_vector_length(vector, length);
-    assert(get_vector_vtable(vector) == vector_class->vtable);
+    assert(get_vector_vtable(vector) == vector_class->get_vtable());
     return vector;
 }
 
@@ -172,7 +159,7 @@
     ASSERT_RAISE_AREA;
     Vector_Handle returned_vector;
 
-    if(vector_class->is_array_of_primitives) {
+    if(vector_class->is_array_of_primitives()) {
         returned_vector = vm_new_vector_primitive(vector_class,length);
     } else {
         returned_vector = vm_anewarray_resolved_array_type(vector_class, length);
@@ -197,10 +184,9 @@
 #ifdef VM_STATS
     if (0 != (length&TWO_HIGHEST_BITS_SET_MASK)) return;
     VTable *vector_vtable = ManagedObject::allocation_handle_to_vtable(vector_handle);
-    unsigned sz = vm_array_size(vector_vtable, (unsigned)length);
-    vector_vtable->clss->num_allocations++;
-    vector_vtable->clss->num_bytes_allocated += sz;
-    if (!get_prop_non_ref_array(vector_vtable->class_properties))
+    unsigned sz = vector_vtable->clss->calculate_array_size(length);
+    vector_vtable->clss->instance_allocated(sz);
+    if((vector_vtable->class_properties & CL_PROP_NON_REF_ARRAY_MASK) == 0)
     {
         VM_Statistics::get_vm_stats().num_anewarray++;
     }
@@ -225,10 +211,9 @@
     }
 
     VTable *vector_vtable = ManagedObject::allocation_handle_to_vtable(vector_handle);
-    unsigned sz = vm_array_size(vector_vtable, length);
+    unsigned sz = vector_vtable->clss->calculate_array_size(length);
 #ifdef VM_STATSxxx // Functionality moved into vm_new_vector_update_stats().
-    vector_vtable->clss->num_allocations++;
-    vector_vtable->clss->num_bytes_allocated += sz;
+    vector_vtable->clss->instance_allocated(sz);
 #endif //VM_STATS
     assert( ! hythread_is_suspend_enabled());
     Vector_Handle vector = (Vector_Handle)gc_alloc(sz, vector_handle, tp);
@@ -256,21 +241,13 @@
     }
 
     VTable *vector_vtable = ManagedObject::allocation_handle_to_vtable(vector_handle);
-    unsigned sz = vm_array_size(vector_vtable, length);
+    unsigned sz = vector_vtable->clss->calculate_array_size(length);
     Vector_Handle vector = (Vector_Handle)gc_alloc_fast(sz, vector_handle, tp);
     if (vector == NULL)
     {
         return NULL;
     }
-#ifdef VM_STATSxxx // Functionality moved into vm_new_vector_update_stats().
-    vector_vtable->clss->num_allocations++;
-    vector_vtable->clss->num_bytes_allocated += sz;
-    if (!get_prop_non_ref_array(vector_vtable->class_properties))
-    {
-        VM_Statistics::get_vm_stats().num_anewarray++;
-    }
-#endif //VM_STATS
-    
+
     set_vector_length(vector, length);
     assert(get_vector_vtable(vector) == vector_vtable);
     return vector;
@@ -323,13 +300,13 @@
 
     // init Class* array
     clss[0] = c;
-    assert(c->name->bytes[0] == '[');
-    assert(c->name->len > 1);
+    assert(c->get_name()->bytes[0] == '[');
+    assert(c->get_name()->len > 1);
 
     for(d = 1; d < dims; d++) {
-        c = c->array_element_class;
-        assert(c->name->bytes[0] == '[');
-        assert(c->name->len > 1);
+        c = c->get_array_element_class();
+        assert(c->get_name()->bytes[0] == '[');
+        assert(c->get_name()->len > 1);
         clss[d] = c;
     }
 
@@ -445,8 +422,8 @@
 
 ArrayCopyResult array_copy(ManagedObject *src, int32 srcOffset, ManagedObject *dst, int32 dstOffset, int32 length)
 {
-    if (src == ((ManagedObject *)Class::managed_null) ||
-        dst == ((ManagedObject *)Class::managed_null)) {
+    if (src == ((ManagedObject *)VM_Global_State::loader_env->managed_null) ||
+        dst == ((ManagedObject *)VM_Global_State::loader_env->managed_null)) {
         return ACR_NullPointer;
     }
 
@@ -455,12 +432,12 @@
     Class *dst_class = dst->vt()->clss;
     assert(dst_class);
 
-    if (!(src_class->is_array && dst_class->is_array)) return ACR_TypeMismatch;
-    assert(src_class->name->bytes[0] == '[');
-    assert(dst_class->name->bytes[0] == '[');
+    if (!(src_class->is_array() && dst_class->is_array())) return ACR_TypeMismatch;
+    assert(src_class->get_name()->bytes[0] == '[');
+    assert(dst_class->get_name()->bytes[0] == '[');
 
-    if (src_class->name != dst_class->name
-        && (src_class->is_array_of_primitives || dst_class->is_array_of_primitives)) {
+    if (src_class->get_name() != dst_class->get_name()
+        && (src_class->is_array_of_primitives() || dst_class->is_array_of_primitives())) {
         return ACR_TypeMismatch;
     }
 
@@ -476,7 +453,7 @@
     if((srcOffset + length) > src_length || (dstOffset + length) > dst_length)
        return ACR_BadIndices;
 
-    char src_elem_type = src_class->name->bytes[1];
+    char src_elem_type = src_class->get_name()->bytes[1];
 
     switch(src_elem_type) {
     case 'C': 
@@ -591,7 +568,7 @@
 #ifdef VM_STATS
                 increment_array_copy_counter(VM_Statistics::get_vm_stats().num_arraycopy_object_different_type);
 #endif // VM_STATS
-                Class *dst_elem_clss = dst_class->array_element_class;
+                Class* dst_elem_clss = dst_class->get_array_element_class();
                 assert(dst_elem_clss);
                 
                 if (VM_Global_State::loader_env->compress_references) {
@@ -604,8 +581,8 @@
                             ManagedObject *src_elem = (ManagedObject *)uncompress_compressed_reference(src_elem_offset);
                             Class *src_elem_clss = src_elem->vt()->clss;
                             if (src_elem_clss == dst_elem_clss) {
-                            } else if (!class_is_subtype_fast(src_elem_clss->vtable, dst_elem_clss)) {
-                                // note: VM_STATS values are updated when class_is_subtype_fast() is called.
+                            } else if (!src_elem_clss->is_instanceof(dst_elem_clss)) {
+                                // note: VM_STATS values are updated when Class::is_instanceof() is called.
                                 // Since we only flag the base do it before we throw exception
                                 gc_heap_wrote_object(dst);
                                 return ACR_TypeMismatch;
@@ -621,7 +598,7 @@
                         if (src_body[count] != NULL) {
                             Class *src_elem_clss = src_body[count]->vt()->clss;
                             if (src_elem_clss == dst_elem_clss) {
-                            } else if (!class_is_subtype_fast(src_elem_clss->vtable, dst_elem_clss)) {
+                            } else if (!src_elem_clss->is_instanceof(dst_elem_clss)) {
                                 // note: VM_STATS values are updated when class_is_subtype_fast() is called.
                                 // Since we only flag the base do it before we throw exception
                                 gc_heap_wrote_object(dst);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/annotations.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/annotations.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/annotations.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/annotations.cpp Wed Nov  8 20:52:12 2006
@@ -29,6 +29,7 @@
 #include "annotations.h"
 #include "jni.h"
 #include "jni_utils.h"
+#include "type.h"
 #include "environment.h"
 #include "reflection.h"
 #include "exceptions.h"
@@ -69,7 +70,7 @@
                                        jthrowable* cause = NULL)
 {
     Type_Info_Handle tih = (Type_Info_Handle)
-        type_desc_create_from_java_descriptor(desc->bytes, clss->class_loader);
+        type_desc_create_from_java_descriptor(desc->bytes, clss->get_class_loader());
     if (tih) {
         Class* type = type_info_get_class(tih);
         if (type) {
@@ -114,7 +115,7 @@
     if (!antn_type) {
         return NULL;
     }
-    if (!class_is_annotation(antn_type)) {
+    if (!antn_type->is_annotation()) {
         std::stringstream ss;
         ss << "Non-annotation type : " << antn->type->bytes;
         ThrowNew_Quick(jenv, "java/lang/annotation/AnnotationFormatError", ss.str().c_str());
@@ -198,7 +199,7 @@
             }
         } else {
             std::stringstream ss;
-            ss << "Invalid enum type " << enum_type->name->bytes
+            ss << "Invalid enum type " << enum_type->get_name()->bytes
                 << " specified for value of element \'" << name->bytes << "\'";
             ThrowNew_Quick(jenv, "java/lang/annotation/AnnotationFormatError", ss.str().c_str());
         }
@@ -279,7 +280,7 @@
             // primitive value type does not match array type
             std::stringstream ss;
             ss << "Encountered value tag \'" << (char)value.tag 
-                << "\' does not match array type " << type->name->bytes << "[]";
+                << "\' does not match array type " << type->get_name()->bytes << "[]";
 
             *cause = CreateNewThrowable(jenv, genv->java_lang_ArrayStoreException_Class, 
                 ss.str().c_str(), NULL);
@@ -350,8 +351,8 @@
             // of the element-defining method.
             Class* arr_type = NULL;
             unsigned i;
-            for (i = 0; i < antn_type->n_methods; i++) {
-                Method* m = antn_type->methods + i;
+            for (i = 0; i < antn_type->get_number_of_methods(); i++) {
+                Method* m = antn_type->get_method(i);
                 if (m->get_name() == name && m->get_num_args() == 1) 
                 {
                     Type_Info_Handle tih = method_ret_type_get_type_info(
@@ -366,13 +367,13 @@
                     break;
                 }
             }
-            if (!arr_type || arr_type->n_dimensions != 1) {
+            if (!arr_type || arr_type->get_number_of_dimensions() != 1) {
                 std::stringstream ss;
                 ss << "Invalid array value for element \'" << name->bytes << "\'";
                 ThrowNew_Quick(jenv, "java/lang/annotation/AnnotationFormatError", ss.str().c_str());
                 return NULL;
             }
-            arr_type = arr_type->array_element_class;
+            arr_type = arr_type->get_array_element_class();
 
             jclass jarr_type = struct_Class_to_java_lang_Class_Handle(arr_type);
             jarray array = NewObjectArray(jenv, (jsize)value.array.length, jarr_type, NULL);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/reflection.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/reflection.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/reflection.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/reflection/reflection.cpp Wed Nov  8 20:52:12 2006
@@ -83,7 +83,7 @@
     static Global_Env* genv = VM_Global_State::loader_env;
     static String* desc = genv->string_pool.lookup(
         "(JLjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V");
-    Method* member_constr = class_lookup_method(type, genv->Init_String, desc);
+    Method* member_constr = type->lookup_method(genv->Init_String, desc);
 
     jstring jname = String_to_interned_jstring(member->get_name());
     if (jname == NULL) {
@@ -308,11 +308,11 @@
         {
             ASSERT(arg, "Cannot unwrap NULL");
             Class* arg_clss = jobject_to_struct_Class(arg);
-            char arg_sig = is_wrapper_class(arg_clss->name->bytes);
+            char arg_sig = is_wrapper_class(arg_clss->get_name()->bytes);
             char param_sig = (char)type;
 
             ASSERT(arg_sig, "Reflection arguments mismatch: expected " 
-                << param_sig << " but was " << arg_clss->name->bytes);
+                << param_sig << " but was " << arg_clss->get_name()->bytes);
             
             array[arg_number] = unwrap_primitive(jenv, arg, arg_sig);
 
@@ -332,14 +332,14 @@
 jobject reflection_get_enum_value(JNIEnv *jenv, Class* enum_type, String* name) 
 {
     ASSERT(class_is_enum(enum_type), "Requested Class is not ENUM: " 
-        << enum_type->name->bytes);
+        << enum_type->get_name()->bytes);
 
-    for (unsigned i=0; i<enum_type->n_fields; i++) {
-        if (enum_type->fields[i].get_name() == name) {
+    for (unsigned i=0; i<enum_type->get_number_of_fields(); i++) {
+        if (enum_type->get_field(i)->get_name() == name) {
 #ifndef NDEBUG
-            ASSERT(enum_type->fields[i].is_enum(), "Requested field is not ENUM: " << name->bytes);
-            const String* type = enum_type->name;
-            const String* desc = enum_type->fields[i].get_descriptor();
+            ASSERT(enum_type->get_field(i)->is_enum(), "Requested field is not ENUM: " << name->bytes);
+            const String* type = enum_type->get_name();
+            const String* desc = enum_type->get_field(i)->get_descriptor();
             if (desc->len != (type->len + 2)
                 || desc->bytes[0] != 'L' 
                 || strncmp(desc->bytes + 1, type->bytes, type->len)
@@ -348,7 +348,7 @@
                 DIE("Invalid enum field descriptor: " << desc->bytes);
             }
 #endif
-            return GetStaticObjectField(jenv, 0, (jfieldID)(enum_type->fields + i));
+            return GetStaticObjectField(jenv, 0, (jfieldID)(enum_type->get_field(i)));
         }
     }
     //public EnumConstantNotPresentException(Class<? extends Enum> enumType,String constantName)



Mime
View raw message