PR156: Preparation
[cacao.git] / src / vm / javaobjects.hpp
index 068ac583190cd976d3fdbbd89bd56b5155623831..d4463d33f7562da5e868d420b6fb6366e21cf35e 100644 (file)
@@ -1,6 +1,8 @@
 /* src/vm/javaobjects.hpp - functions to create and access Java objects
 
-   Copyright (C) 2008 Theobroma Systems Ltd.
+   Copyright (C) 2010, 2011
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+   Copyright (C) 2008, 2009 Theobroma Systems Ltd.
 
    This file is part of CACAO.
 
 
 #include <stdint.h>
 
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
 #include "native/llni.h"
 
 #include "threads/atomic.hpp"
 
-#include "vm/class.h"
+#include "vm/class.hpp"
 #include "vm/field.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
-#include "vm/method.h"
+#include "vm/method.hpp"
 
 
 #ifdef __cplusplus
@@ -92,100 +94,85 @@ public:
 
 template<class T> inline T FieldAccess::get(java_handle_t* h, const off_t offset)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be _handle->get_object();
        java_object_t* ho = LLNI_UNWRAP(h);
-       T result = raw_get<T>(ho, offset);
-
-       GC::critical_leave();
-
-       return result;
+       return raw_get<T>(ho, offset);
 }
 
 template<> inline java_handle_t* FieldAccess::get(java_handle_t* h, const off_t offset)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be _handle->get_object();
        java_object_t* o = LLNI_UNWRAP(h);
        java_object_t* result = raw_get<java_object_t*>(o, offset);
-       java_handle_t* hresult = LLNI_WRAP(result);
-
-       GC::critical_leave();
-
-       return hresult;
+       return LLNI_WRAP(result);
 }      
 
 
 template<class T> inline void FieldAccess::set(java_handle_t* h, const off_t offset, T value)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        java_object_t* ho = LLNI_UNWRAP(h);
        raw_set(ho, offset, value);
-
-       GC::critical_leave();
 }
 
 template<> inline void FieldAccess::set<java_handle_t*>(java_handle_t* h, const off_t offset, java_handle_t* value)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be h->get_object();
        java_object_t* o      = LLNI_UNWRAP(h);
        java_object_t* ovalue = LLNI_UNWRAP(value);
-
        raw_set(o, offset, ovalue);
-
-       GC::critical_leave();
 }
 
 
 template<class T> inline T FieldAccess::get_volatile(java_handle_t* h, const off_t offset)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be _handle->get_object();
        java_object_t* ho = LLNI_UNWRAP(h);
-       T result = raw_get<volatile T>(ho, offset);
-
-       GC::critical_leave();
-
-       return result;
+       return raw_get<volatile T>(ho, offset);
 }
 
 template<> inline java_handle_t* FieldAccess::get_volatile(java_handle_t* h, const off_t offset)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be _handle->get_object();
        java_object_t* o = LLNI_UNWRAP(h);
        java_object_t* result = (java_object_t*) raw_get<volatile java_object_t*>(o, offset);
-       java_handle_t* hresult = LLNI_WRAP(result);
-
-       GC::critical_leave();
-
-       return hresult;
+       return LLNI_WRAP(result);
 }      
 
 
 template<class T> inline void FieldAccess::set_volatile(java_handle_t* h, const off_t offset, T value)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        java_object_t* ho = LLNI_UNWRAP(h);
        raw_set(ho, offset, (volatile T) value);
 
        // Memory barrier for the Java Memory Model.
        Atomic::memory_barrier();
-
-       GC::critical_leave();
 }
 
 template<> inline void FieldAccess::set_volatile<java_handle_t*>(java_handle_t* h, const off_t offset, java_handle_t* value)
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be h->get_object();
        java_object_t* o      = LLNI_UNWRAP(h);
@@ -194,8 +181,6 @@ template<> inline void FieldAccess::set_volatile<java_handle_t*>(java_handle_t*
 
        // Memory barrier for the Java Memory Model.
        Atomic::memory_barrier();
-
-       GC::critical_leave();
 }
 
 
@@ -217,27 +202,24 @@ public:
        virtual ~java_lang_Object() {}
 
        // Getters.
-       virtual inline java_handle_t* get_handle  () const { return _handle; }
-       inline vftbl_t*               get_vftbl   () const;
-       inline classinfo*             get_Class   () const;
-       inline int32_t                get_hashcode() const;
+       virtual java_handle_t* get_handle  () const { return _handle; }
+       vftbl_t*               get_vftbl   () const;
+       classinfo*             get_Class   () const;
+       int32_t                get_hashcode() const;
 
-       inline bool is_null    () const;
-       inline bool is_non_null() const;
+       bool is_null    () const;
+       bool is_non_null() const;
 };
 
 
 inline vftbl_t* java_lang_Object::get_vftbl() const
 {
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be h->get_object();
        java_object_t* o = LLNI_UNWRAP(_handle);
-       vftbl_t* vftbl = o->vftbl;
-
-       GC::critical_leave();
-
-       return vftbl;
+       return o->vftbl;
 }
 
 inline classinfo* java_lang_Object::get_Class() const
@@ -250,19 +232,12 @@ inline int32_t java_lang_Object::get_hashcode() const
 #if defined(ENABLE_GC_CACAO)
        return heap_get_hashcode(_handle);
 #else
-       java_object_t* o;
-       int32_t hashcode;
-
-       GC::critical_enter();
+       // This function is inside a critical section.
+       GCCriticalSection cs;
 
        // XXX This should be h->get_object();
-       o = LLNI_UNWRAP(_handle);
-
-       hashcode = (int32_t)(intptr_t) o;
-
-       GC::critical_leave();
-       
-       return hashcode;
+       java_object_t* o = LLNI_UNWRAP(_handle);
+       return (int32_t) (intptr_t) o;
 #endif
 }
 
@@ -295,8 +270,8 @@ private:
 public:
        java_lang_Boolean(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline uint8_t get_value();
-       inline void    set_value(uint8_t value);
+       uint8_t get_value();
+       void    set_value(uint8_t value);
 };
 
 inline uint8_t java_lang_Boolean::get_value()
@@ -327,8 +302,8 @@ private:
 public:
        java_lang_Byte(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline int8_t get_value();
-       inline void   set_value(int8_t value);
+       int8_t get_value();
+       void   set_value(int8_t value);
 };
 
 inline int8_t java_lang_Byte::get_value()
@@ -359,8 +334,8 @@ private:
 public:
        java_lang_Character(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline uint16_t get_value();
-       inline void     set_value(uint16_t value);
+       uint16_t get_value();
+       void     set_value(uint16_t value);
 };
 
 inline uint16_t java_lang_Character::get_value()
@@ -391,8 +366,8 @@ private:
 public:
        java_lang_Short(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline int16_t get_value();
-       inline void    set_value(int16_t value);
+       int16_t get_value();
+       void    set_value(int16_t value);
 };
 
 inline int16_t java_lang_Short::get_value()
@@ -423,8 +398,8 @@ private:
 public:
        java_lang_Integer(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline int32_t get_value();
-       inline void    set_value(int32_t value);
+       int32_t get_value();
+       void    set_value(int32_t value);
 };
 
 inline int32_t java_lang_Integer::get_value()
@@ -455,8 +430,8 @@ private:
 public:
        java_lang_Long(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline int64_t get_value();
-       inline void    set_value(int64_t value);
+       int64_t get_value();
+       void    set_value(int64_t value);
 };
 
 inline int64_t java_lang_Long::get_value()
@@ -487,8 +462,8 @@ private:
 public:
        java_lang_Float(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline float get_value();
-       inline void  set_value(float value);
+       float get_value();
+       void  set_value(float value);
 };
 
 inline float java_lang_Float::get_value()
@@ -519,8 +494,8 @@ private:
 public:
        java_lang_Double(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline double get_value();
-       inline void   set_value(double value);
+       double get_value();
+       void   set_value(double value);
 };
 
 inline double java_lang_Double::get_value()
@@ -536,6 +511,21 @@ inline void java_lang_Double::set_value(double value)
 
 #if defined(ENABLE_JAVASE)
 
+/**
+ * java/lang/management/MemoryUsage
+ *
+ * Object layout:
+ *
+ * 0. object header
+ * [other fields are not used]
+ */
+class java_lang_management_MemoryUsage : public java_lang_Object, private FieldAccess {
+public:
+       java_lang_management_MemoryUsage(java_handle_t* h) : java_lang_Object(h) {}
+       java_lang_management_MemoryUsage(int64_t init, int64_t used, int64_t commited, int64_t maximum);
+};
+
+
 # if defined(ENABLE_ANNOTATIONS)
 /**
  * OpenJDK sun/reflect/ConstantPool
@@ -556,8 +546,8 @@ public:
        sun_reflect_ConstantPool(java_handle_t* h, jclass constantPoolOop);
 
        // Setters.
-       inline void set_constantPoolOop(classinfo* value);
-       inline void set_constantPoolOop(jclass value);
+       void set_constantPoolOop(classinfo* value);
+       void set_constantPoolOop(jclass value);
 };
 
 
@@ -581,6 +571,8 @@ inline void sun_reflect_ConstantPool::set_constantPoolOop(jclass value)
 
 #endif // ENABLE_JAVASE
 
+void jobjects_register_dyn_offsets();
+bool jobjects_run_dynoffsets_hook(classinfo *c);
 
 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
 
@@ -608,7 +600,7 @@ public:
        java_lang_Class(java_handle_t* h) : java_lang_Object(h) {}
 
        // Setters.
-       inline void set_pd(java_handle_t* value);
+       void set_pd(java_handle_t* value);
 };
 
 inline void java_lang_Class::set_pd(java_handle_t* value)
@@ -617,6 +609,39 @@ inline void java_lang_Class::set_pd(java_handle_t* value)
 }
 
 
+/**
+ * GNU Classpath java/lang/ClassLoader
+ *
+ * Object layout:
+ *
+ * 0. object header
+ * 1. java.util.HashMap     definedPackages
+ * 2. java.lang.ClassLoader parent
+ * [other fields are not used]
+ */
+class java_lang_ClassLoader : public java_lang_Object, private FieldAccess {
+private:
+       // Static offsets of the object's instance fields.
+       // TODO These offsets need to be checked on VM startup.
+       static const off_t offset_definedPackages = MEMORY_ALIGN(sizeof(java_object_t),                  SIZEOF_VOID_P);
+       static const off_t offset_parent          = MEMORY_ALIGN(offset_definedPackages + SIZEOF_VOID_P, SIZEOF_VOID_P);
+
+public:
+       java_lang_ClassLoader(java_handle_t* h) : java_lang_Object(h) {}
+
+       // Getters.
+       java_handle_t* get_parent() const;
+
+       // Invocation wrappers for static methods.
+       static java_handle_t* invoke_getSystemClassLoader();
+};
+
+inline java_handle_t* java_lang_ClassLoader::get_parent() const
+{
+       return get<java_handle_t*>(_handle, offset_parent);
+}
+
+
 /**
  * GNU Classpath java/lang/StackTraceElement
  *
@@ -681,14 +706,14 @@ public:
        java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset = 0);
 
        // Getters.
-       inline java_handle_chararray_t* get_value () const;
-       inline int32_t                  get_count () const;
-       inline int32_t                  get_offset() const;
+       java_handle_chararray_t* get_value () const;
+       int32_t                  get_count () const;
+       int32_t                  get_offset() const;
 
        // Setters.
-       inline void set_value (java_handle_chararray_t* value);
-       inline void set_count (int32_t value);
-       inline void set_offset(int32_t value);
+       void set_value (java_handle_chararray_t* value);
+       void set_count (int32_t value);
+       void set_offset(int32_t value);
 };
 
 inline java_lang_String::java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset) : java_lang_Object(h)
@@ -774,15 +799,15 @@ public:
 //     java_lang_Thread(threadobject* t);
 
        // Getters.
-       inline java_handle_t* get_vmThread        () const;
-       inline java_handle_t* get_group           () const;
-       inline java_handle_t* get_name            () const;
-       inline int32_t        get_daemon          () const;
-       inline int32_t        get_priority        () const;
-       inline java_handle_t* get_exceptionHandler() const;
+       java_handle_t* get_vmThread        () const;
+       java_handle_t* get_group           () const;
+       java_handle_t* get_name            () const;
+       int32_t        get_daemon          () const;
+       int32_t        get_priority        () const;
+       java_handle_t* get_exceptionHandler() const;
 
        // Setters.
-       inline void set_group(java_handle_t* value);
+       void set_group(java_handle_t* value);
 };
 
 
@@ -852,12 +877,12 @@ public:
        java_lang_VMThread(java_handle_t* h, java_handle_t* thread, threadobject* vmdata);
 
        // Getters.
-       inline java_handle_t* get_thread() const;
-       inline threadobject*  get_vmdata() const;
+       java_handle_t* get_thread() const;
+       threadobject*  get_vmdata() const;
 
        // Setters.
-       inline void set_thread(java_handle_t* value);
-       inline void set_vmdata(threadobject* value);
+       void set_thread(java_handle_t* value);
+       void set_vmdata(threadobject* value);
 };
 
 
@@ -914,9 +939,9 @@ public:
        java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {}
 
        // Getters.
-       inline java_handle_t* get_detailMessage() const;
-       inline java_handle_t* get_cause        () const;
-       inline java_handle_t* get_vmState      () const;
+       java_handle_t* get_detailMessage() const;
+       java_handle_t* get_cause        () const;
+       java_handle_t* get_vmState      () const;
 };
 
 
@@ -953,8 +978,8 @@ private:
 public:
        java_lang_VMThrowable(java_handle_t* h) : java_lang_Object(h) {}
 
-       inline java_handle_bytearray_t* get_vmdata() const;
-       inline void                     set_vmdata(java_handle_bytearray_t* value);
+       java_handle_bytearray_t* get_vmdata() const;
+       void                     set_vmdata(java_handle_bytearray_t* value);
 };
 
 
@@ -998,23 +1023,23 @@ public:
        java_lang_reflect_VMConstructor(methodinfo* m);
 
        // Getters.
-       inline classinfo*               get_clazz               () const;
-       inline int32_t                  get_slot                () const;
-       inline java_handle_bytearray_t* get_annotations         () const;
-       inline java_handle_bytearray_t* get_parameterAnnotations() const;
-       inline java_handle_t*           get_declaredAnnotations () const;
-       inline java_handle_t*           get_cons                () const;
+       classinfo*               get_clazz               () const;
+       int32_t                  get_slot                () const;
+       java_handle_bytearray_t* get_annotations         () const;
+       java_handle_bytearray_t* get_parameterAnnotations() const;
+       java_handle_t*           get_declaredAnnotations () const;
+       java_handle_t*           get_cons                () const;
 
        // Setters.
-       inline void set_clazz               (classinfo* value);
-       inline void set_slot                (int32_t value);
-       inline void set_annotations         (java_handle_bytearray_t* value);
-       inline void set_parameterAnnotations(java_handle_bytearray_t* value);
-       inline void set_declaredAnnotations (java_handle_t* value);
-       inline void set_cons                (java_handle_t* value);
+       void set_clazz               (classinfo* value);
+       void set_slot                (int32_t value);
+       void set_annotations         (java_handle_bytearray_t* value);
+       void set_parameterAnnotations(java_handle_bytearray_t* value);
+       void set_declaredAnnotations (java_handle_t* value);
+       void set_cons                (java_handle_t* value);
 
        // Convenience functions.
-       inline methodinfo* get_method();
+       methodinfo* get_method();
 };
 
 
@@ -1130,15 +1155,15 @@ public:
        java_handle_t* new_instance(java_handle_objectarray_t* args);
 
        // Getters.
-       inline int32_t        get_flag() const;
-       inline java_handle_t* get_cons() const;
+       int32_t        get_flag() const;
+       java_handle_t* get_cons() const;
 
        // Setters.
-       inline void set_cons(java_handle_t* value);
+       void set_cons(java_handle_t* value);
 
        // Convenience functions.
-       inline methodinfo* get_method  () const;
-       inline int32_t     get_override() const;
+       methodinfo* get_method  () const;
+       int32_t     get_override() const;
 };
 
 
@@ -1218,22 +1243,22 @@ public:
        java_lang_reflect_VMField(fieldinfo* f);
 
        // Getters.
-       inline classinfo*               get_clazz              () const;
-       inline int32_t                  get_slot               () const;
-       inline java_handle_bytearray_t* get_annotations        () const;
-       inline java_handle_t*           get_declaredAnnotations() const;
-       inline java_handle_t*           get_f                  () const;
+       classinfo*               get_clazz              () const;
+       int32_t                  get_slot               () const;
+       java_handle_bytearray_t* get_annotations        () const;
+       java_handle_t*           get_declaredAnnotations() const;
+       java_handle_t*           get_f                  () const;
 
        // Setters.
-       inline void set_clazz              (classinfo* value);
-       inline void set_name               (java_handle_t* value);
-       inline void set_slot               (int32_t value);
-       inline void set_annotations        (java_handle_bytearray_t* value);
-       inline void set_declaredAnnotations(java_handle_t* value);
-       inline void set_f                  (java_handle_t* value);
+       void set_clazz              (classinfo* value);
+       void set_name               (java_handle_t* value);
+       void set_slot               (int32_t value);
+       void set_annotations        (java_handle_bytearray_t* value);
+       void set_declaredAnnotations(java_handle_t* value);
+       void set_f                  (java_handle_t* value);
 
        // Convenience functions.
-       inline fieldinfo* get_field() const;
+       fieldinfo* get_field() const;
 };
 
 
@@ -1343,14 +1368,14 @@ public:
        java_lang_reflect_Field(fieldinfo* f);
 
        // Getters.
-       inline int32_t        get_flag() const;
-       inline java_handle_t* get_f() const;
+       int32_t        get_flag() const;
+       java_handle_t* get_f() const;
 
        // Setters.
-       inline void set_f(java_handle_t* value);
+       void set_f(java_handle_t* value);
 
        // Convenience functions.
-       inline fieldinfo* get_field() const;
+       fieldinfo* get_field() const;
 };
 
 
@@ -1429,26 +1454,26 @@ public:
        java_lang_reflect_VMMethod(methodinfo* m);
 
        // Getters.
-       inline classinfo*               get_clazz               () const;
-       inline int32_t                  get_slot                () const;
-       inline java_handle_bytearray_t* get_annotations         () const;
-       inline java_handle_bytearray_t* get_parameterAnnotations() const;
-       inline java_handle_bytearray_t* get_annotationDefault   () const;
-       inline java_handle_t*           get_declaredAnnotations () const;
-       inline java_handle_t*           get_m                   () const;
+       classinfo*               get_clazz               () const;
+       int32_t                  get_slot                () const;
+       java_handle_bytearray_t* get_annotations         () const;
+       java_handle_bytearray_t* get_parameterAnnotations() const;
+       java_handle_bytearray_t* get_annotationDefault   () const;
+       java_handle_t*           get_declaredAnnotations () const;
+       java_handle_t*           get_m                   () const;
 
        // Setters.
-       inline void set_clazz               (classinfo* value);
-       inline void set_name                (java_handle_t* value);
-       inline void set_slot                (int32_t value);
-       inline void set_annotations         (java_handle_bytearray_t* value);
-       inline void set_parameterAnnotations(java_handle_bytearray_t* value);
-       inline void set_annotationDefault   (java_handle_bytearray_t* value);
-       inline void set_declaredAnnotations (java_handle_t* value);
-       inline void set_m                   (java_handle_t* value);
+       void set_clazz               (classinfo* value);
+       void set_name                (java_handle_t* value);
+       void set_slot                (int32_t value);
+       void set_annotations         (java_handle_bytearray_t* value);
+       void set_parameterAnnotations(java_handle_bytearray_t* value);
+       void set_annotationDefault   (java_handle_bytearray_t* value);
+       void set_declaredAnnotations (java_handle_t* value);
+       void set_m                   (java_handle_t* value);
 
        // Convenience functions.
-       inline methodinfo* get_method() const;
+       methodinfo* get_method() const;
 };
 
 
@@ -1582,15 +1607,15 @@ public:
        java_handle_t* invoke(java_handle_t* o, java_handle_objectarray_t* args);
 
        // Getters.
-       inline int32_t        get_flag() const;
-       inline java_handle_t* get_m() const;
+       int32_t        get_flag() const;
+       java_handle_t* get_m() const;
 
        // Setters.
-       inline void set_m(java_handle_t* value);
+       void set_m(java_handle_t* value);
 
        // Convenience functions.
-       inline methodinfo* get_method  () const;
-       inline int32_t     get_override() const;
+       methodinfo* get_method  () const;
+       int32_t     get_override() const;
 };
 
 
@@ -1667,7 +1692,7 @@ public:
        java_nio_Buffer(java_handle_t* h) : java_lang_Object(h) {}
 
        // Getters.
-       inline int32_t get_cap() const;
+       int32_t get_cap() const;
 };
 
 inline int32_t java_nio_Buffer::get_cap() const
@@ -1710,7 +1735,7 @@ public:
        java_nio_DirectByteBufferImpl(java_handle_t* h) : java_lang_Object(h) {}
 
        // Getters.
-       inline java_handle_t* get_address() const;
+       java_handle_t* get_address() const;
 };
 
 
@@ -1742,11 +1767,11 @@ public:
        gnu_classpath_Pointer(java_handle_t* h) : java_lang_Object(h) {}
        gnu_classpath_Pointer(java_handle_t* h, void* data);
 
-       // Setters.
-       inline void* get_data() const;
+       // Getters.
+       void* get_data() const;
 
        // Setters.
-       inline void set_data(void* value);
+       void set_data(void* value);
 };
 
 inline gnu_classpath_Pointer::gnu_classpath_Pointer(java_handle_t* h, void* data) : java_lang_Object(h)
@@ -1815,6 +1840,39 @@ inline java_lang_AssertionStatusDirectives::java_lang_AssertionStatusDirectives(
 }
 
 
+/**
+ * OpenJDK java/lang/ClassLoader
+ *
+ * Object layout:
+ *
+ * 0. object header
+ * 1. boolean               initialized
+ * 2. java.lang.ClassLoader parent
+ * [other fields are not used]
+ */
+class java_lang_ClassLoader : public java_lang_Object, private FieldAccess {
+private:
+       // Static offsets of the object's instance fields.
+       // TODO These offsets need to be checked on VM startup.
+       static const off_t offset_initialized = MEMORY_ALIGN(sizeof(java_object_t),                sizeof(int32_t));
+       static const off_t offset_parent      = MEMORY_ALIGN(offset_initialized + sizeof(int32_t), SIZEOF_VOID_P);
+
+public:
+       java_lang_ClassLoader(java_handle_t* h) : java_lang_Object(h) {}
+
+       // Getters.
+       java_handle_t* get_parent() const;
+
+       // Invocation wrappers for static methods.
+       static java_handle_t* invoke_getSystemClassLoader();
+};
+
+inline java_handle_t* java_lang_ClassLoader::get_parent() const
+{
+       return get<java_handle_t*>(_handle, offset_parent);
+}
+
+
 /**
  * OpenJDK java/lang/StackTraceElement
  *
@@ -1879,14 +1937,14 @@ public:
        java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset = 0);
 
        // Getters.
-       inline java_handle_chararray_t* get_value () const;
-       inline int32_t                  get_offset() const;
-       inline int32_t                  get_count () const;
+       java_handle_chararray_t* get_value () const;
+       int32_t                  get_offset() const;
+       int32_t                  get_count () const;
 
        // Setters.
-       inline void set_value (java_handle_chararray_t* value);
-       inline void set_offset(int32_t value);
-       inline void set_count (int32_t value);
+       void set_value (java_handle_chararray_t* value);
+       void set_offset(int32_t value);
+       void set_count (int32_t value);
 };
 
 inline java_lang_String::java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset) : java_lang_Object(h)
@@ -1990,14 +2048,15 @@ public:
 //     java_lang_Thread(threadobject* t);
 
        // Getters.
-       inline int32_t        get_priority                () const;
-       inline int32_t        get_daemon                  () const;
-       inline java_handle_t* get_group                   () const;
-       inline java_handle_t* get_uncaughtExceptionHandler() const;
+       int32_t        get_priority                () const;
+       int32_t        get_daemon                  () const;
+       java_handle_t* get_group                   () const;
+       java_handle_t* get_uncaughtExceptionHandler() const;
 
        // Setters.
-       inline void set_priority(int32_t value);
-       inline void set_group   (java_handle_t* value);
+       void set_priority    (int32_t value);
+       void set_group       (java_handle_t* value);
+       void set_threadStatus(int32_t value);
 };
 
 
@@ -2032,6 +2091,11 @@ inline void java_lang_Thread::set_group(java_handle_t* value)
        set(_handle, offset_group, value);
 }
 
+inline void java_lang_Thread::set_threadStatus(int32_t value)
+{
+       set(_handle, offset_threadStatus, value);
+}
+
 
 
 /**
@@ -2059,12 +2123,12 @@ public:
        java_lang_Throwable(java_handle_t* h, java_handle_bytearray_t* backtrace);
 
        // Getters.
-       inline java_handle_bytearray_t* get_backtrace    () const;
-       inline java_handle_t*           get_detailMessage() const;
-       inline java_handle_t*           get_cause        () const;
+       java_handle_bytearray_t* get_backtrace    () const;
+       java_handle_t*           get_detailMessage() const;
+       java_handle_t*           get_cause        () const;
 
        // Setters.
-       inline void set_backtrace(java_handle_bytearray_t* value);
+       void set_backtrace(java_handle_bytearray_t* value);
 };
 
 
@@ -2143,23 +2207,23 @@ public:
        java_handle_t* new_instance(java_handle_objectarray_t* args);
 
        // Getters.
-       inline int32_t                  get_override   () const;
-       inline classinfo*               get_clazz      () const;
-       inline int32_t                  get_slot       () const;
-       inline java_handle_bytearray_t* get_annotations() const;
+       int32_t                  get_override   () const;
+       classinfo*               get_clazz      () const;
+       int32_t                  get_slot       () const;
+       java_handle_bytearray_t* get_annotations() const;
 
        // Setters.
-       inline void set_clazz               (classinfo* value);
-       inline void set_slot                (int32_t value);
-       inline void set_parameterTypes      (java_handle_objectarray_t* value);
-       inline void set_exceptionTypes      (java_handle_objectarray_t* value);
-       inline void set_modifiers           (int32_t value);
-       inline void set_signature           (java_handle_t* value);
-       inline void set_annotations         (java_handle_bytearray_t* value);
-       inline void set_parameterAnnotations(java_handle_bytearray_t* value);
+       void set_clazz               (classinfo* value);
+       void set_slot                (int32_t value);
+       void set_parameterTypes      (java_handle_objectarray_t* value);
+       void set_exceptionTypes      (java_handle_objectarray_t* value);
+       void set_modifiers           (int32_t value);
+       void set_signature           (java_handle_t* value);
+       void set_annotations         (java_handle_bytearray_t* value);
+       void set_parameterAnnotations(java_handle_bytearray_t* value);
 
        // Convenience functions.
-       inline methodinfo* get_method();
+       methodinfo* get_method();
 };
 
 
@@ -2305,22 +2369,22 @@ public:
        java_lang_reflect_Field(fieldinfo* f);
 
        // Getters.
-       inline int32_t                  get_override   () const;
-       inline classinfo*               get_clazz      () const;
-       inline int32_t                  get_slot       () const;
-       inline java_handle_bytearray_t* get_annotations() const;
+       int32_t                  get_override   () const;
+       classinfo*               get_clazz      () const;
+       int32_t                  get_slot       () const;
+       java_handle_bytearray_t* get_annotations() const;
 
        // Setters.
-       inline void set_clazz      (classinfo* value);
-       inline void set_slot       (int32_t value);
-       inline void set_name       (java_handle_t* value);
-       inline void set_type       (classinfo* value);
-       inline void set_modifiers  (int32_t value);
-       inline void set_signature  (java_handle_t* value);
-       inline void set_annotations(java_handle_bytearray_t* value);
+       void set_clazz      (classinfo* value);
+       void set_slot       (int32_t value);
+       void set_name       (java_handle_t* value);
+       void set_type       (classinfo* value);
+       void set_modifiers  (int32_t value);
+       void set_signature  (java_handle_t* value);
+       void set_annotations(java_handle_bytearray_t* value);
 
        // Convenience functions.
-       inline fieldinfo* get_field() const;
+       fieldinfo* get_field() const;
 };
 
 
@@ -2463,17 +2527,17 @@ public:
        java_handle_t* invoke(java_handle_t* o, java_handle_objectarray_t* args);
 
        // Getters.
-       inline int32_t                  get_override            () const;
-       inline classinfo*               get_clazz               () const;
-       inline int32_t                  get_slot                () const;
-       inline java_handle_bytearray_t* get_annotations         () const;
-       inline java_handle_bytearray_t* get_parameterAnnotations() const;
-       inline java_handle_bytearray_t* get_annotationDefault   () const;
+       int32_t                  get_override            () const;
+       classinfo*               get_clazz               () const;
+       int32_t                  get_slot                () const;
+       java_handle_bytearray_t* get_annotations         () const;
+       java_handle_bytearray_t* get_parameterAnnotations() const;
+       java_handle_bytearray_t* get_annotationDefault   () const;
 
        // Setters.
 
        // Convenience functions.
-       inline methodinfo* get_method() const;
+       methodinfo* get_method() const;
 };
 
 
@@ -2564,7 +2628,7 @@ public:
        java_nio_Buffer(java_handle_t* h) : java_lang_Object(h) {}
 
        // Getters.
-       inline void* get_address() const;
+       void* get_address() const;
 };
 
 
@@ -2602,14 +2666,14 @@ public:
        com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h, com_sun_cldchi_jvm_FileDescriptor& fd);
 
        // Getters.
-       inline int64_t get_pointer () const;
-       inline int32_t get_position() const;
-       inline int32_t get_length  () const;
+       int64_t get_pointer () const;
+       int32_t get_position() const;
+       int32_t get_length  () const;
 
        // Setters.
-       inline void set_pointer (int64_t value);
-       inline void set_position(int32_t value);
-       inline void set_length  (int32_t value);
+       void set_pointer (int64_t value);
+       void set_position(int32_t value);
+       void set_length  (int32_t value);
 };
 
 
@@ -2681,14 +2745,14 @@ public:
        java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset = 0);
 
        // Getters.
-       inline java_handle_chararray_t* get_value () const;
-       inline int32_t                  get_offset() const;
-       inline int32_t                  get_count () const;
+       java_handle_chararray_t* get_value () const;
+       int32_t                  get_offset() const;
+       int32_t                  get_count () const;
 
        // Setters.
-       inline void set_value (java_handle_chararray_t* value);
-       inline void set_offset(int32_t value);
-       inline void set_count (int32_t value);
+       void set_value (java_handle_chararray_t* value);
+       void set_offset(int32_t value);
+       void set_count (int32_t value);
 };
 
 
@@ -2759,12 +2823,12 @@ public:
 //     java_lang_Thread(threadobject* t);
 
        // Getters.
-       inline int32_t                  get_priority () const;
-       inline threadobject*            get_vm_thread() const;
-       inline java_handle_chararray_t* get_name     () const;
+       int32_t                  get_priority () const;
+       threadobject*            get_vm_thread() const;
+       java_handle_chararray_t* get_name     () const;
 
        // Setters.
-       inline void set_vm_thread(threadobject* value);
+       void set_vm_thread(threadobject* value);
 };
 
 
@@ -2816,11 +2880,11 @@ public:
        java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {}
 
        // Getters.
-       inline java_handle_t*           get_detailMessage() const;
-       inline java_handle_bytearray_t* get_backtrace    () const;
+       java_handle_t*           get_detailMessage() const;
+       java_handle_bytearray_t* get_backtrace    () const;
 
        // Setters.
-       inline void set_backtrace(java_handle_bytearray_t* value);
+       void set_backtrace(java_handle_bytearray_t* value);
 };
 
 
@@ -2842,13 +2906,6 @@ inline void java_lang_Throwable::set_backtrace(java_handle_bytearray_t* value)
 
 #endif // WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1
 
-#else
-
-// Legacy C interface.
-java_handle_t* java_lang_reflect_Constructor_create(methodinfo* m);
-java_handle_t* java_lang_reflect_Field_create(fieldinfo* f);
-java_handle_t* java_lang_reflect_Method_create(methodinfo* m);
-
 #endif
 
 #endif // _JAVAOBJECTS_HPP
@@ -2865,4 +2922,5 @@ java_handle_t* java_lang_reflect_Method_create(methodinfo* m);
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */