harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r472771 [3/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_supp...
Date Thu, 09 Nov 2006 04:52:17 GMT
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/String_Pool.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/String_Pool.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/String_Pool.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/String_Pool.h Wed Nov  8 20:52:12 2006
@@ -30,30 +30,29 @@
 
 #define STRING_PADDING 4
 
-extern "C" {
-    typedef struct String {
+struct String
+{
 #ifdef _DEBUG
-        unsigned id; // id for debugging
+    unsigned id; // id for debugging
 #endif
-        // 20030507 Ref to the interned string used by java.lang.String.intern().
-        // It is compressed when compressing refs.
-        union {
-            // raw reference to interned string if not compressing references
-            ManagedObject   * raw_ref;
-            // equivalent compressed reference.
-            uint32          compressed_ref;
-        } intern;
-        unsigned len;
-        char bytes[STRING_PADDING];
-    } String;
-}
+    // 20030507 Ref to the interned string used by java.lang.String.intern().
+    // It is compressed when compressing refs.
+    union {
+        // raw reference to interned string if not compressing references
+        ManagedObject   * raw_ref;
+        // equivalent compressed reference.
+        uint32          compressed_ref;
+    } intern;
+    unsigned len;
+    char bytes[STRING_PADDING];
+};
 
 class String_Pool {
 public:
     String_Pool();
 
     // lookup string in string table & insert if not found
-    VMEXPORT String * lookup(const char *str);
+    String * lookup(const char *str);
     String * lookup(const char *str, unsigned len);
 
     // Iterators for GC

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h Wed Nov  8 20:52:12 2006
@@ -36,6 +36,7 @@
 #include "hashtable.h"
 #include "loggerstring.h"
 #include "jarfile_support.h"
+#include "type.h"
 
 class ClassTable : public MapEx<const String*, Class* > {};
 
@@ -187,12 +188,13 @@
     }
     void InsertClass(Class* clss) {
         LMAutoUnlock aulock(&m_lock);
-        m_loadedClasses->Insert(clss->name, clss);
-        m_initiatedClasses->Insert(clss->name, clss);
+        m_loadedClasses->Insert(clss->get_name(), clss);
+        m_initiatedClasses->Insert(clss->get_name(), clss);
     }
     Class* AllocateAndReportInstance(const Global_Env* env, Class* klass);
     Class* NewClass(const Global_Env* env, const String* name);
     ManagedObject** RegisterClassInstance(const String* className, ManagedObject* instance);
+    Package* ProvidePackage(Global_Env* env, const String *class_name, const char *jar);
     Class* DefineClass(Global_Env* env, const char* class_name,
         uint8* bytecode, unsigned offset, unsigned length, const String** res_name = NULL);
     Class* LoadClass( Global_Env* UNREF env, const String* UNREF name);
@@ -221,8 +223,6 @@
 protected:
     virtual Class* DoLoadClass( Global_Env* UNREF env, const String* UNREF name) = 0;
     Class* StartLoadingClass(Global_Env* env, const String* className);
-    bool FinishLoadingClass(Global_Env *env, Class* clss,
-        unsigned int* super_class_cp_index);
     void RemoveLoadingClass(const String* className, LoadingClass* loading);
     void SuccessLoadingClass(const String* className);
     void AddFailedClass(const String* className, const jthrowable exn);
@@ -298,10 +298,8 @@
     // methods
     Class* WaitDefinition(Global_Env* env, const String* className);
     Class* SetupAsArray(Global_Env* env, const String* klass);
-    Package* ProvidePackage(Global_Env* env, const String *class_name, const char *jar);
 
 private:
-    Class* InitClassFields(const Global_Env* env, Class* clss, const String* name);
     void FieldClearInternals(Class*); // clean Field internals in Class
 }; // class ClassLoader
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h Wed Nov  8 20:52:12 2006
@@ -68,6 +68,27 @@
     bool verify_all;                // psrebriy 20050815 Verify all classes including loaded by bootstrap class loader
     bool pin_interned_strings;      // if true, interned strings are never moved
 
+    // If set to true by the "-compact_fields" command line option,
+    // the VM will not pad out fields of less than 32 bits to four bytes.
+    // However, fields will still be aligned to a natural boundary,
+    // and the num_field_padding_bytes field will reflect those alignment padding bytes.
+    bool compact_fields;
+
+    // If set to true by the "-sort_fields" command line option,
+    // the VM will sort fields by size before assigning their offset during
+    // class preparation.
+    bool sort_fields;
+
+    // Base address of Java heap
+    Byte* heap_base;
+    // Ceiling of Java heap.
+    // NOTE: we assume Java heap uses one continuous memory block.
+    Byte* heap_end;
+
+    // This will be set to either NULL or heap_base depending
+    // on whether compressed references are used.
+    Byte* managed_null;
+
     //
     // preloaded strings
     //

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_direct.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_direct.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_direct.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_direct.h Wed Nov  8 20:52:12 2006
@@ -29,7 +29,8 @@
 #include "open/types.h"
 
 #include "jni.h"
-#include "Class.h"
+#include "open/types.h"
+#include "class_member.h"
 
 typedef struct JavaVM_Internal JavaVM_Internal;
 typedef struct JNIEnv_Internal JNIEnv_Internal;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jni_utils.h Wed Nov  8 20:52:12 2006
@@ -23,9 +23,7 @@
 #ifndef _JNI_UTILS_H_
 #define _JNI_UTILS_H_
 
-#include "environment.h"
 #include "object_handles.h"
-#include "platform.h"
 #include "jni_direct.h"
 #include "ini.h"
 #include "String_Pool.h"
@@ -53,8 +51,6 @@
 VMEXPORT char* ParameterTypesToMethodSignature (JNIEnv*, jobjectArray, const char *name);
 VMEXPORT char PrimitiveNameToSignature (const char*);
 
-VMEXPORT Boolean class_is_subclass(Class_Handle subclss, Class_Handle superclss);
-
 #ifdef __cplusplus
 }
 #endif
@@ -81,9 +77,6 @@
 
 const char* SignatureToName (const char* sig);
 void SignatureToName (const char* sig, char *name);
-
-jclass struct_Class_to_jclass(Class *c);
-Class *jclass_to_struct_Class(jclass jc);
 
 jclass FindClassWithClassLoader(JNIEnv* env_ext, const char *name, ClassLoader *loader);
 jclass FindClassWithClassLoader(JNIEnv* env_ext, String*name, ClassLoader *loader);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h Wed Nov  8 20:52:12 2006
@@ -25,6 +25,7 @@
 #include "jni_direct.h"
 #include "jvmti.h"
 #include "open/hythread_ext.h"
+#include "vm_core_types.h"
 
 struct TIEventThread
 {

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h Wed Nov  8 20:52:12 2006
@@ -33,11 +33,11 @@
 class Lock_Manager {
 
 public:
-    VMEXPORT Lock_Manager();
-    VMEXPORT ~Lock_Manager();
+    Lock_Manager();
+    ~Lock_Manager();
 
-    VMEXPORT void _lock();
-    VMEXPORT void _unlock();
+    void _lock();
+    void _unlock();
     bool _tryLock();
 
     void _lock_enum();

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h Wed Nov  8 20:52:12 2006
@@ -33,8 +33,8 @@
 };
 
 
-VMEXPORT VM_Code_Type vm_identify_eip(void *addr);
-VM_Code_Type           vm_identify_eip_deadlock_free(void *addr);
+VM_Code_Type vm_identify_eip(void *addr);
+VM_Code_Type vm_identify_eip_deadlock_free(void *addr);
 
 
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_handles.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_handles.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_handles.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_handles.h Wed Nov  8 20:52:12 2006
@@ -38,9 +38,8 @@
  * A function creates handles for the references and passes the handles rather than the references.
  */
 
-
-#include "object_layout.h"
 #include "vm_core_types.h"
+#include "object_layout.h"
 #include "jni.h"
 
 /**

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h Wed Nov  8 20:52:12 2006
@@ -39,6 +39,51 @@
 extern "C" {
 #endif
 
+/// Raw and compressed reference pointers
+
+typedef ManagedObject*  RAW_REFERENCE;
+typedef uint32          COMPRESSED_REFERENCE;
+
+VMEXPORT bool is_compressed_reference(COMPRESSED_REFERENCE value);
+VMEXPORT bool is_null_compressed_reference(COMPRESSED_REFERENCE value);
+
+VMEXPORT COMPRESSED_REFERENCE compress_reference(ManagedObject *obj);
+VMEXPORT ManagedObject* uncompress_compressed_reference(COMPRESSED_REFERENCE compressed_ref);
+VMEXPORT ManagedObject* get_raw_reference_pointer(ManagedObject **slot_addr);
+
+// Store the reference "VALUE" in the slot at address "SLOT_ADDR"
+// in the object "CONTAINING_OBJECT".
+// Signature: void store_reference(ManagedObject* CONTAINING_OBJECT,
+//                                 ManagedObject** SLOT_ADDR,
+//                                 ManagedObject* VALUE);
+#define STORE_REFERENCE(CONTAINING_OBJECT, SLOT_ADDR, VALUE)                                  \
+    {                                                                                         \
+        if (VM_Global_State::loader_env->compress_references) {                               \
+            gc_heap_slot_write_ref_compressed((Managed_Object_Handle)(CONTAINING_OBJECT),     \
+                                              (uint32*)(SLOT_ADDR),                           \
+                                              (Managed_Object_Handle)(VALUE));                \
+        } else {                                                                              \
+            gc_heap_slot_write_ref((Managed_Object_Handle)(CONTAINING_OBJECT),                \
+                                   (Managed_Object_Handle*)(SLOT_ADDR),                      \
+                                   (Managed_Object_Handle)(VALUE));                           \
+        }                                                                                     \
+    }
+
+// Store the reference "VALUE" in the static field or
+// other global slot at address "SLOT_ADDR".
+// Signature: void store_global_reference(COMPRESSED_REFERENCE* SLOT_ADDR,
+//                                        ManagedObject* VALUE);
+#define STORE_GLOBAL_REFERENCE(SLOT_ADDR, VALUE)                              \
+    {                                                                         \
+        if (VM_Global_State::loader_env->compress_references) {               \
+            gc_heap_write_global_slot_compressed((uint32*)(SLOT_ADDR),        \
+                (Managed_Object_Handle)(VALUE));                              \
+        } else {                                                              \
+            gc_heap_write_global_slot((Managed_Object_Handle*)(SLOT_ADDR),    \
+                                      (Managed_Object_Handle)(VALUE));        \
+        }                                                                     \
+    }
+
 
 // The object layout is currently as follows
 //

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_arrays.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_arrays.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_arrays.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_arrays.h Wed Nov  8 20:52:12 2006
@@ -30,21 +30,10 @@
 #include "open/vm_util.h"
 #include "heap.h"
 
-inline unsigned vm_array_size(VTable *vector_vtable, int length)
-{
-    unsigned array_element_size = vector_vtable->array_element_size;
-    assert(array_element_size);
-    unsigned first_elem_offset;
-    if(array_element_size < 8) {
-        first_elem_offset = VM_VECTOR_FIRST_ELEM_OFFSET_1_2_4;
-    } else {
-        first_elem_offset = VM_VECTOR_FIRST_ELEM_OFFSET_8;
-    }
-    unsigned size = first_elem_offset + length * array_element_size;
-    size = ( ((size + (GC_OBJECT_ALIGNMENT - 1)) & (~(GC_OBJECT_ALIGNMENT - 1))) );
-    assert((size % GC_OBJECT_ALIGNMENT) == 0);
-    return size;
-} //vm_array_size
+
+#define HIGH_BIT_SET_MASK (1<<((sizeof(unsigned) * BITS_PER_BYTE)-1))
+#define HIGH_BIT_CLEAR_MASK (~HIGH_BIT_SET_MASK)
+#define TWO_HIGHEST_BITS_SET_MASK (HIGH_BIT_SET_MASK|NEXT_TO_HIGH_BIT_SET_MASK)
 
 
 inline VTable *get_vector_vtable(Vector_Handle vector)

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h Wed Nov  8 20:52:12 2006
@@ -22,8 +22,12 @@
 #define _VM_LOG_H_
 
 #include "loggerstring.h"
-#include "Class.h"
+#include "object_layout.h"
 #include "object_handles.h"
+#include "vtable.h"
+#include "String_Pool.h"
+#include "class_member.h"
+#include "Class.h"
 
 /**
  * @file
@@ -47,7 +51,7 @@
  */
 inline LoggerString& operator<<(LoggerString& log, const Class* clss) {
     if (clss) {
-        log << clss->name; 
+        log << clss->get_name(); 
     } else {
         log << "<null class>";
     }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_stats.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_stats.h?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_stats.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_stats.h Wed Nov  8 20:52:12 2006
@@ -14,10 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
+/**
  * @author Intel, Alexei Fedotov
  * @version $Revision: 1.1.2.1.4.3 $
- */  
+ */
 
 #ifndef _VM_STATS_H_
 #define _VM_STATS_H_
@@ -223,9 +223,23 @@
     uint64 codemgr_total_code_allocated;
     uint64 codemgr_total_data_pool_size;
     uint64 codemgr_total_data_allocated;
-    
+
     uint64 num_compileme_generated;
     uint64 num_compileme_used;
+
+    // Total number of allocations and total number of bytes for class-related
+    // data structures. This includes any rounding added to make each item
+    // aligned (current alignment is to the next 16 byte boundary).
+    uint64 num_statics_allocations;
+    uint64 num_nonempty_statics_allocations;
+    uint64 num_vtable_allocations;
+    uint64 num_hot_statics_allocations;
+    uint64 num_hot_vtable_allocations;
+
+    uint64 total_statics_bytes;
+    uint64 total_vtable_bytes;
+    uint64 total_hot_statics_bytes;
+    uint64 total_hot_vtable_bytes;
 
     SimpleHashtable rt_function_map;
     SimpleHashtable rt_function_requests;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Wed Nov  8 20:52:12 2006
@@ -32,42 +32,41 @@
 
 #include "open/hythread_ext.h"
 #include "thread_manager.h"
+#include "cci.h"
 
-#include "Verifier_stub.h"
 #include "class_interface.h"
 #include "Package.h"
 
-Boolean     class_property_is_final(Class_Handle cl) {
+Boolean class_property_is_final(Class_Handle cl) {
     assert(cl);
-    return class_is_final((Class*)cl);
+    return cl->is_final();
 }
 
-Boolean     class_property_is_abstract(Class_Handle cl) {
+Boolean class_property_is_abstract(Class_Handle cl) {
     assert(cl);
-    return class_is_abstract((Class*)cl);
+    return cl->is_abstract();
 }
 
-Boolean     class_property_is_interface2(Class_Handle cl) {
+Boolean class_property_is_interface2(Class_Handle cl) {
     assert(cl);
-    return class_is_interface((Class*)cl);
+    return cl->is_interface();
 }
 
 
-
 Boolean class_is_array(Class_Handle cl) {
     assert(cl);
-    return ((Class*)cl)->is_array;
+    return cl->is_array();
 } //class_is_array
 
 
 Boolean     class_get_array_num_dimensions(Class_Handle cl) {
     assert(cl);
-    return ((Class*)cl)->n_dimensions;
+    return cl->get_number_of_dimensions();
 }
 
 const char* class_get_package_name(Class_Handle cl) {
     assert(cl);
-    return ((Class*)cl)->package->get_name()->bytes;
+    return cl->get_package()->get_name()->bytes;
 }
 
 Boolean     method_is_abstract(Method_Handle m) {
@@ -125,12 +124,12 @@
 
 
 
-void *field_get_addr(Field_Handle f)
+void* field_get_address(Field_Handle f)
 {
     assert(f);
-    assert(((Field *)f)->is_static());
-    return ((Field *)f)->get_address();
-} //field_get_addr
+    assert(f->is_static());
+    return f->get_address();
+} // field_get_address
 
 
 
@@ -522,40 +521,36 @@
 const char* class_get_name(Class_Handle cl)
 {
     assert(cl);
-    return ((Class *)cl)->name->bytes;
+    return cl->get_name()->bytes;
 } //class_get_name
 
-char* class_get_java_name(Class_Handle ch)
-{
-    assert(ch);
-    return class_get_java_name((Class *)ch, VM_Global_State::loader_env)->bytes;
-}
+
 unsigned class_get_flags(Class_Handle cl)
 {
     assert(cl);
-    return ((Class *)cl)->access_flags;
+    return cl->get_access_flags();
 } //class_get_flags
 
 
 int class_get_super_offset()
 {
-    return sizeof(VTable *);
+    return sizeof(VTable*);
 } //class_get_super_offset
 
 
-//#ifdef FAST_INSTOF
 int vtable_get_super_array_offset()
 {
     VTable *vtable = 0;
     return (int) (((Byte *)&vtable->superclasses) - (Byte *)vtable);
 }//vtable_get_super_array_offset
 
+
 int class_get_depth(Class_Handle cl)
 {
     assert(cl);
-    return ((Class *)cl)->depth;
+    return cl->get_depth();
 } //class_get_depth
-//#endif
+
 
 VMEXPORT
 Class_Handle vtable_get_class(VTable_Handle vh) {
@@ -565,8 +560,7 @@
 Boolean class_is_initialized(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    return clss->state == ST_Initialized;
+    return ch->is_initialized();
 } //class_is_initialized
 
 
@@ -574,9 +568,7 @@
 Boolean class_needs_initialization(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    //LMAutoUnlock init_state_lock(clss->m_lock);
-    return clss->state != ST_Initialized;
+    return !ch->is_initialized();
 } //class_needs_initialization
 
 
@@ -584,7 +576,7 @@
 Boolean class_has_non_default_finalizer(Class_Handle cl)
 {
     assert(cl);
-    return ((Class *)cl)->has_finalizer == 1;
+    return cl->has_finalizer();
 } //class_has_non_default_finalizer
 
 
@@ -592,57 +584,51 @@
 Class_Handle class_get_super_class(Class_Handle cl)
 {
     assert(cl);
-//sundr    printf("class %p %p\n", cl, cl->super_class);
-    return (Class_Handle)((Class *)cl)->super_class;
+    return cl->get_super_class();
 } //class_get_super_class
 
 unsigned class_number_implements(Class_Handle ch)
 {
     assert(ch);
-    return ((Class*)ch)->n_superinterfaces;
+    return ch->get_number_of_superinterfaces();
 }
 
 Class_Handle class_get_implements(Class_Handle ch, unsigned idx)
 {
     assert(ch);
-    return (Class_Handle)((Class*)ch)->superinterfaces[idx].clss;
+    return ch->get_superinterface(idx);
 }
 
 
 Class_Handle class_get_declaring_class(Class_Handle ch)
 {
-    Class* clss = (Class*)ch;
-    assert(clss);
-    uint16 cp_index = clss->declaringclass_index;
-    if (cp_index==0) return NULL;
-    return class_resolve_class(clss, cp_index);
+    return ch->resolve_declaring_class(VM_Global_State::loader_env);
 }
 
 unsigned class_number_inner_classes(Class_Handle ch)
 {
     assert(ch);
-    return ((Class*)ch)->n_innerclasses;
+    return ch->get_number_of_inner_classes();
 }
 
 Boolean class_is_inner_class_public(Class_Handle ch, unsigned idx)
 {
     assert(ch);
-    return ((Class*)ch)->innerclass_indexes[2*idx+1] & ACC_PUBLIC;
+    return (ch->get_inner_class_access_flags(idx) & ACC_PUBLIC) != 0;
 }
 
 Class_Handle class_get_inner_class(Class_Handle ch, unsigned idx)
 {
     assert(ch);
-    Class* clss = (Class*)ch;
-    uint16 cp_index = clss->innerclass_indexes[2*idx];
-    return class_resolve_class(clss, cp_index);
+    uint16 cp_index = ch->get_inner_class_index(idx);
+    return ch->_resolve_class(VM_Global_State::loader_env, cp_index);
 }
 
 Boolean class_is_instanceof(Class_Handle s, Class_Handle t)
 {
     assert(s);
     assert(t);
-    return class_is_subtype((Class *)s, (Class *)t);
+    return class_is_subtype(s, t);
 } //class_get_super_class
 
 
@@ -650,7 +636,7 @@
 Class_Handle class_get_array_element_class(Class_Handle cl)
 {
     assert(cl);
-    return (Class_Handle)((Class *)cl)->array_element_class;
+    return cl->get_array_element_class();
 } //class_get_array_element_class
 
 
@@ -730,41 +716,23 @@
 VTable_Handle class_get_vtable(Class_Handle cl)
 {
     assert(cl);
-    return ((Class *)cl)->vtable;
+    return cl->get_vtable();
 } //class_get_vtable
 
 
-const char *class_get_source_file_name(Class_Handle cl)
-{
-    if (cl == 0) return 0;
-    if (  ((Class *)cl)->src_file_name == 0  )
-        return 0;
-    return ((Class *)cl)->src_file_name->bytes;
-} //class_get_source_file_name
-
-
-
-// If this function was exported through the public interface, we should
-// change the return type to something like String_Handle.
-String *class_get_const_string_handle(Class_Handle cl, unsigned index)
+const char* class_get_source_file_name(Class_Handle cl)
 {
     assert(cl);
-    Class *clss = (Class *)cl;
-    String *str = 0;
-    assert(index < clss->cp_size);
-    Const_Pool *cp = clss->const_pool;
-    str = cp[index].CONSTANT_String.string;
-    return str;
-} //class_get_const_string_handle
-
+    if(!cl->has_source_information())
+        return NULL;
+    return cl->get_source_file_name();
+} // class_get_source_file_name
 
 
-const char *class_get_const_string(Class_Handle cl, unsigned index)
+const char* class_get_const_string(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    String *str = class_get_const_string_handle(cl, index);
-    assert(str);
-    return str->bytes;
+    return cl->get_constant_pool().get_string_chars(index);
 } //class_get_const_string
 
 
@@ -775,8 +743,8 @@
 void *class_get_const_string_intern_addr(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Global_Env *env = VM_Global_State::loader_env;
-    String *str = class_get_const_string_handle(cl, index);
+    Global_Env* env = VM_Global_State::loader_env;
+    String* str = cl->get_constant_pool().get_string(index);
     assert(str);
 
     bool must_instantiate;
@@ -794,7 +762,6 @@
         vm_instantiate_cp_string_resolved(str);
         END_RAISE_AREA;
         tmn_suspend_enable();
-
     }
 
     if (env->compress_references) {
@@ -808,23 +775,21 @@
 const char* class_get_cp_entry_signature(Class_Handle src_class, unsigned short index)
 {
     Class* clss = (Class*)src_class;
-    // TODO: check that index is valid for src_class; assert for now
-    assert(index < clss->cp_size);
-    assert(cp_is_methodref(clss->const_pool, index)
-        || cp_is_interfacemethodref(clss->const_pool, index)
-        || cp_is_fieldref(clss->const_pool, index));
-
-    index = clss->const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = clss->const_pool[index].CONSTANT_NameAndType.descriptor_index;
-    return clss->const_pool[index].CONSTANT_Utf8.string->bytes;
+    ConstantPool& cp = src_class->get_constant_pool();
+
+    assert(cp.is_fieldref(index)
+        || cp.is_methodref(index)
+        || cp.is_interfacemethodref(index));
+
+    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_get_cp_entry_signature
 
 
 VM_Data_Type class_get_cp_field_type(Class_Handle src_class, unsigned short cp_index)
 {
-    // TODO: check that cp_index is valid for src_class; assert for now
-    assert(cp_index < ((Class*)src_class)->cp_size);
-    assert(cp_is_fieldref(((Class*)src_class)->const_pool, cp_index));
+    assert(src_class->get_constant_pool().is_fieldref(cp_index));
 
     char class_id = (class_get_cp_entry_signature(src_class, cp_index))[0];
     switch(class_id)
@@ -858,7 +823,32 @@
 VM_Data_Type class_get_const_type(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    return (VM_Data_Type)class_get_cp_const_type((Class *)cl, index);
+    Java_Type jt = JAVA_TYPE_INVALID;
+    ConstantPool& cp = cl->get_constant_pool();
+    switch(cp.get_tag(index)) {
+    case CONSTANT_String:
+        jt = JAVA_TYPE_STRING;
+        break;
+    case CONSTANT_Integer:
+        jt = JAVA_TYPE_INT;
+        break;
+    case CONSTANT_Float:
+        jt = JAVA_TYPE_FLOAT;
+        break;
+    case CONSTANT_Long:
+        jt = JAVA_TYPE_LONG;
+        break;
+    case CONSTANT_Double:
+        jt = JAVA_TYPE_DOUBLE;
+        break;
+    case CONSTANT_Class:
+        jt = JAVA_TYPE_CLASS;
+        break;
+    default:
+        DIE("non-constant type is requested from constant pool : " << cp.get_tag(index));
+    }
+
+    return (VM_Data_Type)jt;
 } //class_get_const_type
 
 
@@ -866,7 +856,7 @@
 const void *class_get_const_addr(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    return class_get_addr_of_constant((Class *)cl, index);
+    return cl->get_constant_pool().get_address_of_constant(index);
 } //class_get_const_addr
 
 
@@ -907,7 +897,7 @@
 Class_Handle resolve_class_from_constant_pool(Class_Handle c_handle, unsigned index)
 {
     assert(c_handle);
-    return class_resolve_class(c_handle, index);
+    return c_handle->_resolve_class(VM_Global_State::loader_env, index);
 }
 
 
@@ -916,20 +906,19 @@
 class_get_class_loader(Class_Handle ch)
 {
     assert(ch);
-    return ch->class_loader;
+    return ch->get_class_loader();
 } //class_get_class_loader
 
 
 
 Class_Handle
 class_load_class_by_name(const char *name,
-                         Class_Handle c)
+                         Class_Handle ch)
 {
-    assert(c);
+    assert(ch);
     Global_Env *env = VM_Global_State::loader_env;
     String *n = env->string_pool.lookup(name);
-    Class *clss = ((Class *)c)->class_loader->LoadClass(env, n);
-    return (Class_Handle)clss;
+    return ch->get_class_loader()->LoadClass(env, n);
 } //class_load_class_by_name
 
 
@@ -947,9 +936,9 @@
 
 Class_Handle
 class_load_class_by_descriptor(const char *descr,
-                               Class_Handle c)
+                               Class_Handle ch)
 {
-    assert(c);
+    assert(ch);
     Global_Env *env = VM_Global_State::loader_env;
     String *n;
     switch(descr[0]) {
@@ -982,8 +971,7 @@
         n = 0;
     }
     assert(n);
-    Class *clss = ((Class *)c)->class_loader->LoadClass( env, n);
-    return (Class_Handle)clss;
+    return ch->get_class_loader()->LoadClass(env, n);;
 } //class_load_class_by_descriptor
 
 
@@ -1050,148 +1038,148 @@
 // The following do not cause constant pools to be resolve, if they are not
 // resolved already
 //
-const char *const_pool_get_field_name(Class_Handle cl, unsigned index)
+const char* const_pool_get_field_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_fieldref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if(!const_pool.is_fieldref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = const_pool[index].CONSTANT_NameAndType.name_index;
-    return const_pool[index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_field_name
+    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);
+} // const_pool_get_field_name
 
 
 
-const char *const_pool_get_field_class_name(Class_Handle cl, unsigned index)
+const char* const_pool_get_field_class_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_fieldref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if(!const_pool.is_fieldref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.class_index;
-    return const_pool_get_class_name(cl,index);
+    index = const_pool.get_ref_class_index(index);
+    return const_pool_get_class_name(cl, index);
 } //const_pool_get_field_class_name
 
 
 
-const char *const_pool_get_field_descriptor(Class_Handle cl, unsigned index)
+const char* const_pool_get_field_descriptor(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_fieldref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_fieldref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
-    return const_pool[index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_field_descriptor
+    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);
+} // const_pool_get_field_descriptor
 
 
 
-const char *const_pool_get_method_name(Class_Handle cl, unsigned index)
+const char* const_pool_get_method_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_methodref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_methodref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = const_pool[index].CONSTANT_NameAndType.name_index;
-    return const_pool[index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_method_name
+    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);
+} // const_pool_get_method_name
 
 
 
 const char *const_pool_get_method_class_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_methodref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_methodref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.class_index;
+    index = const_pool.get_ref_class_index(index);
     return const_pool_get_class_name(cl,index);
 } //const_pool_get_method_class_name
 
 
 
-const char *const_pool_get_interface_method_name(Class_Handle cl, unsigned index)
+const char* const_pool_get_interface_method_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_interfacemethodref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if(!const_pool.is_interfacemethodref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = const_pool[index].CONSTANT_NameAndType.name_index;
-    return const_pool[index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_interface_method_name
+    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);
+} // const_pool_get_interface_method_name
 
 
 
-const char *const_pool_get_interface_method_class_name(Class_Handle cl, unsigned index)
+const char* const_pool_get_interface_method_class_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_interfacemethodref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_interfacemethodref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.class_index;
+    index = const_pool.get_ref_class_index(index);
     return const_pool_get_class_name(cl,index);
 } //const_pool_get_interface_method_class_name
 
 
 
-const char *const_pool_get_method_descriptor(Class_Handle cl, unsigned index)
+const char* const_pool_get_method_descriptor(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_methodref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_methodref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
-    return const_pool[index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_method_descriptor
+    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);
+} // const_pool_get_method_descriptor
 
 
 
-const char *const_pool_get_interface_method_descriptor(Class_Handle cl, unsigned index)
+const char* const_pool_get_interface_method_descriptor(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_interfacemethodref(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_interfacemethodref(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    index = const_pool[index].CONSTANT_ref.name_and_type_index;
-    index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
-    return const_pool[index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_interface_method_descriptor
+    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);
+} // const_pool_get_interface_method_descriptor
 
 
 
-const char *const_pool_get_class_name(Class_Handle cl, unsigned index)
+const char* const_pool_get_class_name(Class_Handle cl, unsigned index)
 {
     assert(cl);
-    Const_Pool *const_pool = ((Class *)cl)->const_pool;
-    if (!cp_is_class(const_pool,index)) {
+    ConstantPool& const_pool = cl->get_constant_pool();
+    if (!const_pool.is_class(index)) {
         ABORT("Wrong index");
         return 0;
     }
-    return const_pool[const_pool[index].CONSTANT_Class.name_index].CONSTANT_Utf8.string->bytes;
-} //const_pool_get_class_name
+    return const_pool.get_utf8_chars(const_pool.get_class_name_index(index));
+} // const_pool_get_class_name
 
 
 unsigned method_number_throws(Method_Handle m)
@@ -1207,7 +1195,7 @@
     Method* m = (Method*)mh;
     String* exn_name = m->get_exception_name(idx);
     if (!exn_name) return NULL;
-    ClassLoader* class_loader = m->get_class()->class_loader;
+    ClassLoader* class_loader = m->get_class()->get_class_loader();
     Class *c =
         class_loader->LoadVerifyAndPrepareClass(VM_Global_State::loader_env, exn_name);
     if (!c && !exn_raised()) {
@@ -1392,7 +1380,7 @@
     assert(element_type);
     Class *clss = (Class *)element_type;
     int offset = 0;
-    if(clss->is_primitive) {
+    if(clss->is_primitive()) {
         Global_Env *env = VM_Global_State::loader_env;
         if(clss == env->Double_Class) {
             offset = VM_VECTOR_FIRST_ELEM_OFFSET_8;
@@ -1472,7 +1460,7 @@
 Boolean class_is_enum(Class_Handle ch)
 {
     assert(ch);
-    return ((ch->access_flags & ACC_ENUM) == 0) ? FALSE : TRUE;
+    return ch->is_enum() ? TRUE : FALSE;
 } //class_is_enum
 
 
@@ -1549,8 +1537,7 @@
 Boolean class_is_primitive(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    return clss->is_primitive;
+    return ch->is_primitive();
 } //class_is_primitive
 
 
@@ -1620,7 +1607,7 @@
     assert(meth);
     num_args = meth->get_num_args();
 
-    ClassLoader* cl = meth->get_class()->class_loader;
+    ClassLoader* cl = meth->get_class()->get_class_loader();
     const char* d = meth->get_descriptor()->bytes;
     assert(d[0]=='(');
     d++;
@@ -1702,14 +1689,13 @@
 unsigned class_number_fields(Class_Handle ch)
 {
     assert(ch);
-    return ((Class*)ch)->n_fields;
+    return ch->get_number_of_fields();
 }
 
 unsigned class_num_instance_fields(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    return clss->n_fields - clss->n_static_fields;
+    return ch->get_number_of_fields() - ch->get_number_of_static_fields();
 } //class_num_instance_fields
 
 
@@ -1723,25 +1709,21 @@
         ch = class_get_super_class(ch);
     }
     return num_inst_fields;
-} //class_num_instance_fields_recursive
+} // class_num_instance_fields_recursive
 
 
 Field_Handle class_get_field(Class_Handle ch, unsigned idx)
 {
     assert(ch);
-    Class* clss = (Class*)ch;
-    if (idx>=clss->n_fields) return NULL;
-    return clss->fields+idx;
-}
+    if(idx >= ch->get_number_of_fields()) return NULL;
+    return ch->get_field(idx);
+} // class_get_field
 
 Field_Handle class_get_instance_field(Class_Handle ch, unsigned idx)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    assert( (unsigned short)idx < clss->n_fields - clss->n_static_fields);
-    Field *f = clss->fields + clss->n_static_fields + idx;
-    return f;
-} //class_get_instance_field
+    return ch->get_field(ch->get_number_of_static_fields() + idx);
+} // class_get_instance_field
 
 
 
@@ -1750,7 +1732,7 @@
     assert(ch);
     unsigned num_fields_recursive = class_num_instance_fields_recursive(ch);
     assert(idx < num_fields_recursive);
-    while (ch) {
+    while(ch) {
         unsigned num_fields = class_num_instance_fields(ch);
         unsigned num_inherited_fields = num_fields_recursive - num_fields;
         if(idx >= num_inherited_fields) {
@@ -1761,25 +1743,23 @@
         ch = class_get_super_class(ch);
     }
     return 0;
-} //class_get_instance_field_recursive
+} // class_get_instance_field_recursive
 
 
 unsigned class_get_number_methods(Class_Handle ch)
 {
     assert(ch);
-    return ((Class*)ch)->n_methods;
-} //class_get_number_methods
+    return ch->get_number_of_methods();
+} // class_get_number_methods
 
 
 Method_Handle class_get_method(Class_Handle ch, unsigned index)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    if (index >= clss->n_methods) {
+    if(index >= ch->get_number_of_methods())
         return NULL;
-    }
-    return (clss->methods + index);
-} //class_get_method
+    return ch->get_method(index);
+} // class_get_method
 
 
 // -gc magic needs this to do the recursive load.
@@ -1789,9 +1769,9 @@
     assert(fh);
     Class_Handle ch = class_load_class_by_descriptor(field_get_descriptor(fh),
                                           field_get_class(fh));
-    if(!class_verify(VM_Global_State::loader_env, ch))
+    if(!ch->verify(VM_Global_State::loader_env))
         return NULL;
-    if(!class_prepare(VM_Global_State::loader_env, ch))
+    if(!ch->prepare(VM_Global_State::loader_env))
         return NULL;
     return ch;
 } //field_get_class_of_field_value
@@ -2033,8 +2013,8 @@
     assert(td);
     Class* c = td->load_type_desc();
     if(!c) return NULL;
-    if(!class_verify(VM_Global_State::loader_env, c)) return NULL;
-    if(!class_prepare(VM_Global_State::loader_env, c)) return NULL;
+    if(!c->verify(VM_Global_State::loader_env)) return NULL;
+    if(!c->prepare(VM_Global_State::loader_env)) return NULL;
     return c;
 } //type_info_get_class
 
@@ -2098,8 +2078,7 @@
 Type_Info_Handle class_get_element_type_info(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    TypeDesc* td = clss->array_element_type_desc;
+    TypeDesc* td = ch->get_array_element_type_desc();
     assert(td);
     return td;
 } //class_get_element_type_info
@@ -2109,46 +2088,34 @@
 /////////////////////////////////////////////////////
 // New GC stuff
 
-
-
 Boolean class_is_non_ref_array(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
     // Use the if statement to normalize the value of TRUE
-    if(get_prop_non_ref_array(clss->class_properties)) {
-        assert (class_is_array(ch));
+    if((ch->get_vtable()->class_properties & CL_PROP_NON_REF_ARRAY_MASK) != 0)
+    {
+        assert(ch->is_array());
         return TRUE;
     } else {
         return FALSE;
     }
-} //class_is_pinned
+} // class_is_non_ref_array
+
 
 Boolean class_is_pinned(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    // Use the if statement to normalize the value of TRUE
-    if(get_prop_pinned(clss->class_properties)) {
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-} //class_is_pinned
-
+    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);
-    Class *clss = (Class *)ch;
-    // Use the if statement to normalize the value of TRUE
-    if(get_prop_finalizable(clss->class_properties)) {
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-} //class_is_finalizable
+    return (ch->get_vtable()->class_properties & CL_PROP_FINALIZABLE_MASK) != 0
+        ? TRUE : FALSE;
+} // class_is_finalizable
 
 WeakReferenceType class_is_reference(Class_Handle clss)
 {
@@ -2170,16 +2137,15 @@
     if (!referent) {
         DIE("Class " << class_get_name(ch) << " have no 'Object referent' field");
     }
-    int offset =  field_get_offset(referent);
-    return offset;
+    return referent->get_offset();
 }
 
 
 unsigned class_get_alignment(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    return get_prop_alignment(clss->class_properties);
+    return (unsigned)(ch->get_vtable()->class_properties
+        & CL_PROP_ALIGNMENT_MASK);
 } //class_get_alignment
 
 
@@ -2197,9 +2163,7 @@
 unsigned class_element_size(Class_Handle ch)
 {
     assert(ch);
-    assert (class_is_array(ch));
-    Class *clss = (Class *)ch;
-    return clss->array_element_size;
+    return ch->get_array_element_size();
 } //class_element_size
 
 
@@ -2207,8 +2171,7 @@
 unsigned class_get_boxed_data_size(Class_Handle ch)
 {
     assert(ch);
-    Class *clss = (Class *)ch;
-    return clss->allocated_size;
+    return ch->get_allocated_size();
 } //class_get_boxed_data_size
 
 
@@ -2257,19 +2220,18 @@
 {
     assert(ch);
     assert(mh);
-    Class *clss = (Class *)ch;
     Method *method = (Method *)mh;
-    assert(!class_is_interface(clss));   // ch cannot be an interface
+    assert(!ch->is_interface());   // ch cannot be an interface
 
     const String *name = method->get_name();
     const String *desc = method->get_descriptor();
     Method *m = NULL;
-    for(;  clss;  clss = clss->super_class) {
-        m = class_lookup_method(clss, name, desc);
+    for(; ch;  ch = ch->get_super_class()) {
+        m = ch->lookup_method(name, desc);
         if (m != NULL) {
-            // The method m can only override mh/method if m's class can access mh/method (JLS 6.6.5).
-            Class *m_clss = m->get_class();
-            if (check_member_access(method, m_clss) == 1) {
+            // The method m can only override mh/method
+            // if m's class can access mh/method (JLS 6.6.5).
+            if(m->get_class()->can_access_member(method)) {
                 break;
             }
         }
@@ -2307,8 +2269,8 @@
 unsigned vm_vector_size(Class_Handle vector_class, int length)
 {
     assert(vector_class);
-    return vm_array_size(((Class *) vector_class)->vtable, length);
-} //vm_vector_size
+    return vector_class->calculate_array_size(length);
+} // vm_vector_size
 
 
 
@@ -2361,13 +2323,13 @@
 
 VMEXPORT void *vm_heap_base_address()
 {
-    return (void *)Class::heap_base;
+    return (void*)VM_Global_State::loader_env->heap_base;
 } //vm_heap_base_address
 
 
 VMEXPORT void *vm_heap_ceiling_address()
 {
-    return (void *)Class::heap_end;
+    return (void *)VM_Global_State::loader_env->heap_end;
 } //vm_heap_ceiling_address
 
 
@@ -2397,20 +2359,20 @@
 Allocation_Handle class_get_allocation_handle(Class_Handle ch)
 {
     assert(ch);
-    return ((Class *) ch)->allocation_handle;
+    return ch->get_allocation_handle();
 }
 
 
 Runtime_Type_Handle class_get_runtime_type_handle(Class_Handle ch)
 {
     assert(ch);
-    return (Runtime_Type_Handle) ((Class *) ch)->allocation_handle;
+    return (Runtime_Type_Handle)ch->get_allocation_handle();
 }
 
 
 unsigned vm_get_runtime_type_handle_width()
 {
-    if (vm_vtable_pointers_are_compressed())
+    if(vm_vtable_pointers_are_compressed())
     {
         return sizeof(uint32);
     }
@@ -2466,25 +2428,24 @@
 // is extended. The callback_data pointer will be passed back to the JIT during the callback.
 // The callback function is JIT_extended_class_callback.
 void vm_register_jit_extended_class_callback(JIT_Handle jit, Class_Handle clss,
-                                              void *callback_data)
+                                             void* callback_data)
 {
     assert(clss);
-    JIT *jit_to_be_notified = (JIT *)jit;
+    JIT* jit_to_be_notified = (JIT*)jit;
     Class *c = (Class *)clss;
-    class_register_jit_extended_class_callback(c, jit_to_be_notified, callback_data);
-} //vm_register_jit_extended_class_callback
+    clss->register_jit_extended_class_callback(jit_to_be_notified, callback_data);
+} // vm_register_jit_extended_class_callback
 
 
 // Called by a JIT in order to be notified whenever the given method is overridden by a newly
 // loaded class. The callback_data pointer will be passed back to the JIT during the callback.
 // The callback function is JIT_overridden_method_callback.
 void vm_register_jit_overridden_method_callback(JIT_Handle jit, Method_Handle method,
-                                                 void *callback_data)
+                                                void* callback_data)
 {
     assert(method);
-    JIT *jit_to_be_notified = (JIT *)jit;
-    Method *m = (Method *)method;
-    m->register_jit_overridden_method_callback(jit_to_be_notified, callback_data);
+    JIT* jit_to_be_notified = (JIT*)jit;
+    method->register_jit_overridden_method_callback(jit_to_be_notified, callback_data);
 } //vm_register_jit_overridden_method_callback
 
 
@@ -2547,7 +2508,7 @@
     chaClassIterator->_root_class = root_class;
 
     // Partial implementation for now.
-    if (!class_is_interface((Class *)root_class) && !class_is_array(root_class))
+    if (!root_class->is_interface() && !root_class->is_array())
     {
         chaClassIterator->_is_valid = TRUE;
         chaClassIterator->_current = root_class;
@@ -2563,29 +2524,29 @@
 } // class_iterator_get_current
 
 
-void class_iterator_advance(ChaClassIterator *chaClassIterator)
+void class_iterator_advance(ChaClassIterator* chaClassIterator)
 {
     if (!chaClassIterator->_is_valid)
         return;
     if (chaClassIterator->_current == NULL)
         return;
-    Class *clss = (Class *) chaClassIterator->_current;
-    if (clss->cha_first_child != NULL)
+    Class* clss = (Class*)chaClassIterator->_current;
+    if(clss->get_first_child() != NULL)
     {
-        chaClassIterator->_current = (Class_Handle) clss->cha_first_child;
+        chaClassIterator->_current = (Class_Handle)clss->get_first_child();
         return;
     }
-    Class *next = clss;
-    while (next != NULL)
+    Class* next = clss;
+    while(next != NULL)
     {
-        if (next->cha_next_sibling != NULL)
+        if(next->get_next_sibling() != NULL)
         {
-            next = next->cha_next_sibling;
+            next = next->get_next_sibling();
             break;
         }
-        next = next->super_class;
+        next = next->get_super_class();
     }
-    if (next != NULL && next->depth <= ((Class *) chaClassIterator->_root_class)->depth)
+    if(next != NULL && next->get_depth() <= chaClassIterator->_root_class->get_depth())
         next = NULL;
     chaClassIterator->_current = next;
 } // class_iterator_advance
@@ -2650,7 +2611,7 @@
             chaClassIterator->_current = NULL;
             return;
         }
-        Method *next = class_lookup_method(c, name, desc);
+        Method *next = c->lookup_method(name, desc);
         if (next != NULL && next->get_class() == c)
         {
             chaClassIterator->_current = (Method_Handle) next;



Mime
View raw message