X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjavaobjects.hpp;h=f60026b97deffd601c0f8c6df31cca6d280c7641;hb=ac631c42adf26cee868135fc74401039099fe5ee;hp=c3b7a6d9a7ee3dbeb22b114ee161ded7412d1a8c;hpb=bf89824bc40714a11244f5f577936ba527977e65;p=cacao.git diff --git a/src/vm/javaobjects.hpp b/src/vm/javaobjects.hpp index c3b7a6d9a..f60026b97 100644 --- a/src/vm/javaobjects.hpp +++ b/src/vm/javaobjects.hpp @@ -1,6 +1,8 @@ /* src/vm/javaobjects.hpp - functions to create and access Java objects - Copyright (C) 2008 Theobroma Systems Ltd. + Copyright (C) 1996-2011 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO + Copyright (C) 2008, 2009 Theobroma Systems Ltd. This file is part of CACAO. @@ -29,15 +31,17 @@ #include -#include "mm/memory.h" +#include "mm/memory.hpp" #include "native/llni.h" -#include "vm/class.h" -#include "vm/field.h" +#include "threads/atomic.hpp" + +#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 @@ -77,93 +81,106 @@ template inline void RawFieldAccess::raw_set(void* address, const off_t * afterwards. */ class FieldAccess : private RawFieldAccess { -protected: +public: + // Normal field accessors. template static inline T get(java_handle_t* h, const off_t offset); template static inline void set(java_handle_t* h, const off_t offset, T value); + + // Volatile field accessors. + template static inline T get_volatile(java_handle_t* h, const off_t offset); + template static inline void set_volatile(java_handle_t* h, const off_t offset, T value); }; + template inline T FieldAccess::get(java_handle_t* h, const off_t offset) { - java_object_t* o; - T result; - - // XXX Move this to a GC inline function, e.g. - // gc->enter_critical(); - LLNI_CRITICAL_START; + // This function is inside a critical section. + GCCriticalSection cs; // XXX This should be _handle->get_object(); - o = LLNI_UNWRAP(h); - - result = raw_get(o, offset); + java_object_t* ho = LLNI_UNWRAP(h); + return raw_get(ho, offset); +} - // XXX Move this to a GC inline function. - // gc->leave_critical(); - LLNI_CRITICAL_END; +template<> inline java_handle_t* FieldAccess::get(java_handle_t* h, const off_t offset) +{ + // This function is inside a critical section. + GCCriticalSection cs; - return result; + // XXX This should be _handle->get_object(); + java_object_t* o = LLNI_UNWRAP(h); + java_object_t* result = raw_get(o, offset); + return LLNI_WRAP(result); } -template<> inline java_handle_t* FieldAccess::get(java_handle_t* h, const off_t offset) + +template inline void FieldAccess::set(java_handle_t* h, const off_t offset, T value) { - java_object_t* o; - java_object_t* result; - java_handle_t* hresult; - - // XXX Move this to a GC inline function, e.g. - // gc->enter_critical(); - LLNI_CRITICAL_START; + // This function is inside a critical section. + GCCriticalSection cs; - // XXX This should be _handle->get_object(); - o = LLNI_UNWRAP(h); + java_object_t* ho = LLNI_UNWRAP(h); + raw_set(ho, offset, value); +} - result = raw_get(o, offset); +template<> inline void FieldAccess::set(java_handle_t* h, const off_t offset, java_handle_t* value) +{ + // This function is inside a critical section. + GCCriticalSection cs; - hresult = LLNI_WRAP(result); + // 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); +} - // XXX Move this to a GC inline function. - // gc->leave_critical(); - LLNI_CRITICAL_END; - return hresult; -} +template inline T FieldAccess::get_volatile(java_handle_t* h, const off_t offset) +{ + // This function is inside a critical section. + GCCriticalSection cs; + // XXX This should be _handle->get_object(); + java_object_t* ho = LLNI_UNWRAP(h); + return raw_get(ho, offset); +} -template inline void FieldAccess::set(java_handle_t* h, const off_t offset, T value) +template<> inline java_handle_t* FieldAccess::get_volatile(java_handle_t* h, const off_t offset) { - java_object_t* o; + // This function is inside a critical section. + GCCriticalSection cs; - // XXX Move this to a GC inline function, e.g. - // gc->enter_critical(); - LLNI_CRITICAL_START; + // XXX This should be _handle->get_object(); + java_object_t* o = LLNI_UNWRAP(h); + java_object_t* result = (java_object_t*) raw_get(o, offset); + return LLNI_WRAP(result); +} - // XXX This should be h->get_object(); - o = LLNI_UNWRAP(h); - raw_set(o, offset, value); +template inline void FieldAccess::set_volatile(java_handle_t* h, const off_t offset, T value) +{ + // This function is inside a critical section. + GCCriticalSection cs; + + java_object_t* ho = LLNI_UNWRAP(h); + raw_set(ho, offset, (volatile T) value); - // XXX Move this to a GC inline function. - // gc->leave_critical(); - LLNI_CRITICAL_END; + // Memory barrier for the Java Memory Model. + Atomic::memory_barrier(); } -template<> inline void FieldAccess::set(java_handle_t* h, const off_t offset, java_handle_t* value) +template<> inline void FieldAccess::set_volatile(java_handle_t* h, const off_t offset, java_handle_t* value) { - java_object_t* o; - java_object_t* ovalue; - - // XXX Move this to a GC inline function, e.g. - // gc->enter_critical(); - LLNI_CRITICAL_START; + // This function is inside a critical section. + GCCriticalSection cs; // XXX This should be h->get_object(); - o = LLNI_UNWRAP(h); - ovalue = LLNI_UNWRAP(value); + java_object_t* o = LLNI_UNWRAP(h); + java_object_t* ovalue = LLNI_UNWRAP(value); + raw_set(o, offset, (volatile java_object_t*) ovalue); - raw_set(o, offset, ovalue); - - // XXX Move this to a GC inline function. - // gc->leave_critical(); - LLNI_CRITICAL_END; + // Memory barrier for the Java Memory Model. + Atomic::memory_barrier(); } @@ -182,34 +199,27 @@ protected: public: java_lang_Object() : _handle(NULL) {} java_lang_Object(java_handle_t* h) : _handle(h) {} - java_lang_Object(jobject h) : _handle((java_handle_t*) h) {} 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; + 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 { - // XXX Move this to a GC inline function, e.g. - // gc->enter_critical(); - LLNI_CRITICAL_START; + // 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; - - // XXX Move this to a GC inline function. - // gc->leave_critical(); - LLNI_CRITICAL_END; - - return vftbl; + return o->vftbl; } inline classinfo* java_lang_Object::get_Class() const @@ -217,6 +227,20 @@ inline classinfo* java_lang_Object::get_Class() const return get_vftbl()->clazz; } +inline int32_t java_lang_Object::get_hashcode() const +{ +#if defined(ENABLE_GC_CACAO) + return heap_get_hashcode(_handle); +#else + // This function is inside a critical section. + GCCriticalSection cs; + + // XXX This should be h->get_object(); + java_object_t* o = LLNI_UNWRAP(_handle); + return (int32_t) (intptr_t) o; +#endif +} + inline bool java_lang_Object::is_null() const { @@ -246,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() @@ -278,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() @@ -310,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() @@ -342,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() @@ -374,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() @@ -406,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() @@ -438,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() @@ -470,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() @@ -487,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 @@ -507,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); }; @@ -532,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) @@ -559,8 +600,7 @@ public: java_lang_Class(java_handle_t* h) : java_lang_Object(h) {} // Setters. - inline void set_pd(java_handle_t* value); - inline void set_pd(jobject value); + void set_pd(java_handle_t* value); }; inline void java_lang_Class::set_pd(java_handle_t* value) @@ -568,9 +608,37 @@ inline void java_lang_Class::set_pd(java_handle_t* value) set(_handle, offset_pd, value); } -inline void java_lang_Class::set_pd(jobject 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 { - set_pd((java_handle_t*) value); + return get(_handle, offset_parent); } @@ -635,25 +703,19 @@ private: public: java_lang_String(java_handle_t* h) : java_lang_Object(h) {} - java_lang_String(jstring h); 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(jstring h) : java_lang_Object(h) -{ - java_lang_String((java_handle_t*) h); -} - 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) { set_value(value); @@ -694,67 +756,41 @@ inline void java_lang_String::set_offset(int32_t value) /** * GNU Classpath java/lang/Thread - * - * Object layout: - * - * 0. object header - * 1. java.lang.VMThread vmThread; - * 2. java.lang.ThreadGroup group; - * 3. java.lang.Runnable runnable; - * 4. java.lang.String name; - * 5. boolean daemon; - * 6. int priority; - * 7. long stacksize; - * 8. java.lang.Throwable stillborn; - * 9. java.lang.ClassLoader contextClassLoader; - * 10. boolean contextClassLoaderIsSystemClassLoader; - * 11. long threadId; - * 12. java.lang.Object parkBlocker; - * 13. gnu.java.util.WeakIdentityHashMap locals; - * 14. java_lang_Thread_UncaughtExceptionHandler exceptionHandler; */ class java_lang_Thread : 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_vmThread = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P); - static const off_t offset_group = MEMORY_ALIGN(offset_vmThread + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_runnable = MEMORY_ALIGN(offset_group + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_name = MEMORY_ALIGN(offset_runnable + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_daemon = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, sizeof(int32_t)); - static const off_t offset_priority = MEMORY_ALIGN(offset_daemon + sizeof(int32_t), sizeof(int32_t)); - static const off_t offset_stacksize = MEMORY_ALIGN(offset_priority + sizeof(int32_t), sizeof(int64_t)); - static const off_t offset_stillborn = MEMORY_ALIGN(offset_stacksize + sizeof(int64_t), SIZEOF_VOID_P); - static const off_t offset_contextClassLoader = MEMORY_ALIGN(offset_stillborn + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_contextClassLoaderIsSystemClassLoader = MEMORY_ALIGN(offset_contextClassLoader + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_threadId = MEMORY_ALIGN(offset_contextClassLoaderIsSystemClassLoader + sizeof(int32_t), sizeof(int64_t)); - static const off_t offset_parkBlocker = MEMORY_ALIGN(offset_threadId + sizeof(int64_t), SIZEOF_VOID_P); - static const off_t offset_locals = MEMORY_ALIGN(offset_parkBlocker + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_exceptionHandler = MEMORY_ALIGN(offset_locals + SIZEOF_VOID_P, SIZEOF_VOID_P); + static off_t offset_vmThread; + static off_t offset_group; + static off_t offset_name; + static off_t offset_daemon; + static off_t offset_priority; + static off_t offset_exceptionHandler; public: java_lang_Thread(java_handle_t* h) : java_lang_Object(h) {} -// 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); + + // Offset initializers + static void set_vmThread_offset(int32_t off) { offset_vmThread = off; } + static void set_group_offset(int32_t off) { offset_group = off; } + static void set_name_offset(int32_t off) { offset_name = off; } + static void set_daemon_offset(int32_t off) { offset_daemon = off; } + static void set_priority_offset(int32_t off) { offset_priority = off; } + static void set_exceptionHandler_offset(int32_t off) { offset_exceptionHandler = off; } }; -// inline java_lang_Thread::java_lang_Thread(threadobject* t) : java_lang_Object(h) -// { -// java_lang_Thread(thread_get_object(t)); -// } - - inline java_handle_t* java_lang_Thread::get_vmThread() const { return get(_handle, offset_vmThread); @@ -812,24 +848,18 @@ private: public: java_lang_VMThread(java_handle_t* h) : java_lang_Object(h) {} - java_lang_VMThread(jobject h); 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); }; -inline java_lang_VMThread::java_lang_VMThread(jobject h) : java_lang_Object(h) -{ - java_lang_VMThread((java_handle_t*) h); -} - inline java_lang_VMThread::java_lang_VMThread(java_handle_t* h, java_handle_t* thread, threadobject* vmdata) : java_lang_Object(h) { set_thread(thread); @@ -883,9 +913,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; }; @@ -921,16 +951,11 @@ private: public: java_lang_VMThrowable(java_handle_t* h) : java_lang_Object(h) {} - java_lang_VMThrowable(jobject 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); }; -inline java_lang_VMThrowable::java_lang_VMThrowable(jobject h) : java_lang_Object(h) -{ - java_lang_VMThrowable((java_handle_t*) h); -} inline java_handle_bytearray_t* java_lang_VMThrowable::get_vmdata() const { @@ -969,35 +994,29 @@ private: public: java_lang_reflect_VMConstructor(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_VMConstructor(jobject h); 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(); }; -inline java_lang_reflect_VMConstructor::java_lang_reflect_VMConstructor(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_VMConstructor((java_handle_t*) h); -} - inline java_lang_reflect_VMConstructor::java_lang_reflect_VMConstructor(methodinfo* m) { _handle = builtin_new(class_java_lang_reflect_VMConstructor); @@ -1105,29 +1124,23 @@ private: public: java_lang_reflect_Constructor(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_Constructor(jobject h); java_lang_reflect_Constructor(methodinfo* m); 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; }; -inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_Constructor((java_handle_t*) h); -} - inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(methodinfo* m) { java_lang_reflect_VMConstructor jlrvmc(m); @@ -1201,34 +1214,28 @@ private: public: java_lang_reflect_VMField(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_VMField(jobject h); 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; }; -inline java_lang_reflect_VMField::java_lang_reflect_VMField(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_VMField((java_handle_t*) h); -} - inline java_lang_reflect_VMField::java_lang_reflect_VMField(fieldinfo* f) { _handle = builtin_new(class_java_lang_reflect_VMField); @@ -1332,26 +1339,20 @@ private: public: java_lang_reflect_Field(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_Field(jobject h); 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; }; -inline java_lang_reflect_Field::java_lang_reflect_Field(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_Field((java_handle_t*) h); -} - inline java_lang_reflect_Field::java_lang_reflect_Field(fieldinfo* f) { java_lang_reflect_VMField jlrvmf(f); @@ -1424,36 +1425,31 @@ private: public: java_lang_reflect_VMMethod(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_VMMethod(jobject h); 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; }; -inline java_lang_reflect_VMMethod::java_lang_reflect_VMMethod(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_VMMethod((java_handle_t*) h); -} inline java_lang_reflect_VMMethod::java_lang_reflect_VMMethod(methodinfo* m) { @@ -1580,29 +1576,23 @@ private: public: java_lang_reflect_Method(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_Method(jobject h); java_lang_reflect_Method(methodinfo* m); 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; }; -inline java_lang_reflect_Method::java_lang_reflect_Method(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_Method((java_handle_t*) h); -} - inline java_lang_reflect_Method::java_lang_reflect_Method(methodinfo* m) { java_lang_reflect_VMMethod jlrvmm(m); @@ -1676,7 +1666,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 @@ -1717,16 +1707,11 @@ private: public: java_nio_DirectByteBufferImpl(java_handle_t* h) : java_lang_Object(h) {} - java_nio_DirectByteBufferImpl(jobject h); // Getters. - inline java_handle_t* get_address() const; + java_handle_t* get_address() const; }; -inline java_nio_DirectByteBufferImpl::java_nio_DirectByteBufferImpl(jobject h) : java_lang_Object(h) -{ - java_nio_DirectByteBufferImpl((java_handle_t*) h); -} inline java_handle_t* java_nio_DirectByteBufferImpl::get_address() const { @@ -1756,11 +1741,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) @@ -1829,6 +1814,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(_handle, offset_parent); +} + + /** * OpenJDK java/lang/StackTraceElement * @@ -1890,25 +1908,19 @@ private: public: java_lang_String(java_handle_t* h) : java_lang_Object(h) {} - java_lang_String(jstring h); 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(jstring h) : java_lang_Object(h) -{ - java_lang_String((java_handle_t*) h); -} - 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) { set_value(value); @@ -1949,75 +1961,38 @@ inline void java_lang_String::set_count(int32_t value) /** * OpenJDK java/lang/Thread - * - * Object layout: - * - * 0. object header - * 1. char[] name; - * 2. int priority; - * 3. java_lang_Thread threadQ; - * 4. long eetop; - * 5. boolean single_step; - * 6. boolean daemon; - * 7. boolean stillborn; - * 8. java_lang_Runnable target; - * 9. java_lang_ThreadGroup group; - * 10. java_lang_ClassLoader contextClassLoader; - * 11. java_security_AccessControlContext inheritedAccessControlContext; - * 12. java_lang_ThreadLocal_ThreadLocalMap threadLocals; - * 13. java_lang_ThreadLocal_ThreadLocalMap inheritableThreadLocals; - * 14. long stackSize; - * 15. long nativeParkEventPointer; - * 16. long tid; - * 17. int threadStatus; - * 18. java_lang_Object parkBlocker; - * 19. sun_nio_ch_Interruptible blocker; - * 20. java_lang_Object blockerLock; - * 21. boolean stopBeforeStart; - * 22. java_lang_Throwable throwableFromStop; - * 23. java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler; */ class java_lang_Thread : 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_name = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P); - static const off_t offset_priority = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, sizeof(int32_t)); - static const off_t offset_threadQ = MEMORY_ALIGN(offset_priority + sizeof(int32_t), SIZEOF_VOID_P); - static const off_t offset_eetop = MEMORY_ALIGN(offset_threadQ + SIZEOF_VOID_P, sizeof(int64_t)); - static const off_t offset_single_step = MEMORY_ALIGN(offset_eetop + sizeof(int64_t), sizeof(int32_t)); - static const off_t offset_daemon = MEMORY_ALIGN(offset_single_step + sizeof(int32_t), sizeof(int32_t)); - static const off_t offset_stillborn = MEMORY_ALIGN(offset_daemon + sizeof(int32_t), sizeof(int32_t)); - static const off_t offset_target = MEMORY_ALIGN(offset_stillborn + sizeof(int32_t), SIZEOF_VOID_P); - static const off_t offset_group = MEMORY_ALIGN(offset_target + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_contextClassLoader = MEMORY_ALIGN(offset_group + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_inheritedAccessControlContext = MEMORY_ALIGN(offset_contextClassLoader + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_threadLocals = MEMORY_ALIGN(offset_inheritedAccessControlContext + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_inheritableThreadLocals = MEMORY_ALIGN(offset_threadLocals + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_stackSize = MEMORY_ALIGN(offset_inheritableThreadLocals + SIZEOF_VOID_P, sizeof(int64_t)); - static const off_t offset_nativeParkEventPointer = MEMORY_ALIGN(offset_stackSize + sizeof(int64_t), sizeof(int64_t)); - static const off_t offset_tid = MEMORY_ALIGN(offset_nativeParkEventPointer + sizeof(int64_t), sizeof(int64_t)); - static const off_t offset_threadStatus = MEMORY_ALIGN(offset_tid + sizeof(int64_t), sizeof(int32_t)); - static const off_t offset_parkBlocker = MEMORY_ALIGN(offset_threadStatus + sizeof(int32_t), SIZEOF_VOID_P); - static const off_t offset_blocker = MEMORY_ALIGN(offset_parkBlocker + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_blockerLock = MEMORY_ALIGN(offset_blocker + SIZEOF_VOID_P, SIZEOF_VOID_P); - static const off_t offset_stopBeforeStart = MEMORY_ALIGN(offset_blockerLock + SIZEOF_VOID_P, sizeof(int32_t)); - static const off_t offset_throwableFromStop = MEMORY_ALIGN(offset_stopBeforeStart + sizeof(int32_t), SIZEOF_VOID_P); - static const off_t offset_uncaughtExceptionHandler = MEMORY_ALIGN(offset_throwableFromStop + SIZEOF_VOID_P, SIZEOF_VOID_P); + static off_t offset_priority; + static off_t offset_daemon; + static off_t offset_group; + static off_t offset_uncaughtExceptionHandler; + static off_t offset_threadStatus; + static off_t offset_me; public: java_lang_Thread(java_handle_t* h) : java_lang_Object(h) {} -// 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); + void set_me (java_handle_t* value); + + // Offset initializers + static void set_priority_offset(int32_t off) { offset_priority = off; } + static void set_daemon_offset(int32_t off) { offset_daemon = off; } + static void set_group_offset(int32_t off) { offset_group = off; } + static void set_uncaughtExceptionHandler_offset(int32_t off) { offset_uncaughtExceptionHandler = off; } + static void set_threadStatus_offset(int32_t off) { offset_threadStatus = off; } + static void set_me_offset(int32_t off) { offset_me = off; } }; @@ -2052,6 +2027,16 @@ 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); +} + +inline void java_lang_Thread::set_me(java_handle_t* value) +{ + set(_handle, offset_me, value); +} + /** @@ -2076,27 +2061,20 @@ private: public: java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {} - java_lang_Throwable(jobject h); - java_lang_Throwable(jobject h, java_handle_bytearray_t* backtrace); + 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); }; -inline java_lang_Throwable::java_lang_Throwable(jobject h) : java_lang_Object(h) -{ - java_lang_Throwable((java_handle_t*) h); -} - -inline java_lang_Throwable::java_lang_Throwable(jobject h, java_handle_bytearray_t* backtrace) : java_lang_Object(h) +inline java_lang_Throwable::java_lang_Throwable(java_handle_t* h, java_handle_bytearray_t* backtrace) : java_lang_Object(h) { - java_lang_Throwable((java_handle_t*) h); set_backtrace(backtrace); } @@ -2165,37 +2143,31 @@ private: public: java_lang_reflect_Constructor(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_Constructor(jobject h); java_lang_reflect_Constructor(methodinfo* m); 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(); }; -inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_Constructor((java_handle_t*) h); -} - inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(methodinfo* m) { _handle = builtin_new(class_java_lang_reflect_Constructor); @@ -2335,34 +2307,28 @@ private: public: java_lang_reflect_Field(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_Field(jobject h); 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; }; -inline java_lang_reflect_Field::java_lang_reflect_Field(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_Field((java_handle_t*) h); -} - inline java_lang_reflect_Field::java_lang_reflect_Field(fieldinfo* f) { _handle = builtin_new(class_java_lang_reflect_Field); @@ -2497,31 +2463,25 @@ private: public: java_lang_reflect_Method(java_handle_t* h) : java_lang_Object(h) {} - java_lang_reflect_Method(jobject h); java_lang_reflect_Method(methodinfo* m); 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; }; -inline java_lang_reflect_Method::java_lang_reflect_Method(jobject h) : java_lang_Object(h) -{ - java_lang_reflect_Method((java_handle_t*) h); -} - inline java_lang_reflect_Method::java_lang_reflect_Method(methodinfo* m) { _handle = builtin_new(class_java_lang_reflect_Method); @@ -2529,13 +2489,13 @@ inline java_lang_reflect_Method::java_lang_reflect_Method(methodinfo* m) if (is_null()) return; - set(_handle, offset_clazz, m->clazz); - set(_handle, offset_slot, m - m->clazz->methods); - set(_handle, offset_name, javastring_intern(javastring_new(m->name))); + set(_handle, offset_clazz, m->clazz); + set(_handle, offset_slot, (int32_t) (m - m->clazz->methods)); // This cast is important (see PR100). + set(_handle, offset_name, javastring_intern(javastring_new(m->name))); set(_handle, offset_returnType, method_returntype_get(m)); set(_handle, offset_parameterTypes, method_get_parametertypearray(m)); set(_handle, offset_exceptionTypes, method_get_exceptionarray(m)); - set(_handle, offset_modifiers, m->flags & ACC_CLASS_REFLECT_MASK); + set(_handle, offset_modifiers, (int32_t) (m->flags & ACC_CLASS_REFLECT_MASK)); set(_handle, offset_signature, m->signature ? javastring_new(m->signature) : NULL); set(_handle, offset_annotations, method_get_annotations(m)); set(_handle, offset_parameterAnnotations, method_get_parameterannotations(m)); @@ -2607,10 +2567,9 @@ private: public: java_nio_Buffer(java_handle_t* h) : java_lang_Object(h) {} - java_nio_Buffer(jobject h) : java_lang_Object(h) {} // Getters. - inline void* get_address() const; + void* get_address() const; }; @@ -2644,27 +2603,21 @@ private: public: com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h) : java_lang_Object(h) {} - com_sun_cldchi_jvm_FileDescriptor(jobject h); com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h, int64_t pointer, int32_t position, int32_t length); 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); }; -inline com_sun_cldchi_jvm_FileDescriptor::com_sun_cldchi_jvm_FileDescriptor(jobject h) : java_lang_Object(h) -{ - com_sun_cldchi_jvm_FileDescriptor((java_handle_t*) h); -} - inline com_sun_cldchi_jvm_FileDescriptor::com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h, int64_t pointer, int32_t position, int32_t length) : java_lang_Object(h) { set_pointer(pointer); @@ -2730,24 +2683,19 @@ private: public: java_lang_String(java_handle_t* h) : java_lang_Object(h) {} - java_lang_String(jstring h); 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(jstring h) : java_lang_Object(h) -{ - java_lang_String((java_handle_t*) h); -} 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) { @@ -2813,30 +2761,18 @@ private: public: java_lang_Thread(java_handle_t* h) : java_lang_Object(h) {} - java_lang_Thread(jobject h); // 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); }; -inline java_lang_Thread::java_lang_Thread(jobject h) : java_lang_Object(h) -{ - java_lang_Thread((java_handle_t*) h); -} - -// inline java_lang_Thread::java_lang_Thread(threadobject* t) : java_lang_Object(h) -// { -// java_lang_Thread(thread_get_object(t)); -// } - - inline int32_t java_lang_Thread::get_priority() const { return get(_handle, offset_priority); @@ -2877,23 +2813,16 @@ private: public: java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {} - java_lang_Throwable(jobject 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); }; -inline java_lang_Throwable::java_lang_Throwable(jobject h) : java_lang_Object(h) -{ - java_lang_Throwable((java_handle_t*) h); -} - - inline java_handle_t* java_lang_Throwable::get_detailMessage() const { return get(_handle, offset_detailMessage); @@ -2912,13 +2841,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 @@ -2935,4 +2857,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: */