1 /* src/vmcore/javaobjects.hpp - functions to create and access Java objects
3 Copyright (C) 2008 Theobroma Systems Ltd.
5 This file is part of CACAO.
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #ifndef _JAVAOBJECTS_HPP
26 #define _JAVAOBJECTS_HPP
32 #include "mm/memory.h"
34 #include "native/llni.h"
36 #include "vm/global.h"
38 #include "vmcore/class.h"
39 #include "vmcore/field.h"
40 #include "vmcore/globals.hpp"
41 #include "vmcore/method.h"
47 * This class provides low-level functions to access Java object
50 * These functions do NOT take care about the GC critical section!
51 * Please use FieldAccess wherever possible.
53 class RawFieldAccess {
55 template<class T> static inline T raw_get(void* address, const off_t offset);
56 template<class T> static inline void raw_set(void* address, const off_t offset, T value);
60 template<class T> inline T RawFieldAccess::raw_get(void* address, const off_t offset)
62 T* p = (T*) (((uintptr_t) address) + offset);
67 template<class T> inline void RawFieldAccess::raw_set(void* address, const off_t offset, T value)
69 T* p = (T*) (((uintptr_t) address) + offset);
75 * This classes provides functions to access Java object instance
76 * fields. These functions enter a critical GC section before
77 * accessing the Java object throught the handle and leave it
80 class FieldAccess : private RawFieldAccess {
82 template<class T> static inline T get(java_handle_t* h, const off_t offset);
83 template<class T> static inline void set(java_handle_t* h, const off_t offset, T value);
86 template<class T> inline T FieldAccess::get(java_handle_t* h, const off_t offset)
91 // XXX Move this to a GC inline function, e.g.
92 // gc->enter_critical();
95 // XXX This should be _handle->get_object();
98 result = raw_get<T>(o, offset);
100 // XXX Move this to a GC inline function.
101 // gc->leave_critical();
107 template<> inline java_handle_t* FieldAccess::get(java_handle_t* h, const off_t offset)
110 java_object_t* result;
111 java_handle_t* hresult;
113 // XXX Move this to a GC inline function, e.g.
114 // gc->enter_critical();
117 // XXX This should be _handle->get_object();
120 result = raw_get<java_object_t*>(o, offset);
122 hresult = LLNI_WRAP(result);
124 // XXX Move this to a GC inline function.
125 // gc->leave_critical();
132 template<class T> inline void FieldAccess::set(java_handle_t* h, const off_t offset, T value)
136 // XXX Move this to a GC inline function, e.g.
137 // gc->enter_critical();
140 // XXX This should be h->get_object();
143 raw_set(o, offset, value);
145 // XXX Move this to a GC inline function.
146 // gc->leave_critical();
150 template<> inline void FieldAccess::set<java_handle_t*>(java_handle_t* h, const off_t offset, java_handle_t* value)
153 java_object_t* ovalue;
155 // XXX Move this to a GC inline function, e.g.
156 // gc->enter_critical();
159 // XXX This should be h->get_object();
161 ovalue = LLNI_UNWRAP(value);
163 raw_set(o, offset, ovalue);
165 // XXX Move this to a GC inline function.
166 // gc->leave_critical();
178 class java_lang_Object {
180 // Handle of Java object.
181 java_handle_t* _handle;
184 java_lang_Object() : _handle(NULL) {}
185 java_lang_Object(java_handle_t* h) : _handle(h) {}
186 java_lang_Object(jobject h) : _handle((java_handle_t*) h) {}
190 virtual inline java_handle_t* get_handle() const { return _handle; }
191 inline vftbl_t* get_vftbl () const;
192 inline classinfo* get_Class () const;
194 inline bool is_null () const;
195 inline bool is_non_null() const;
199 inline vftbl_t* java_lang_Object::get_vftbl() const
201 // XXX Move this to a GC inline function, e.g.
202 // gc->enter_critical();
205 // XXX This should be h->get_object();
206 java_object_t* o = LLNI_UNWRAP(_handle);
207 vftbl_t* vftbl = o->vftbl;
209 // XXX Move this to a GC inline function.
210 // gc->leave_critical();
216 inline classinfo* java_lang_Object::get_Class() const
218 return get_vftbl()->clazz;
222 inline bool java_lang_Object::is_null() const
224 return (_handle == NULL);
227 inline bool java_lang_Object::is_non_null() const
229 return (_handle != NULL);
241 class java_lang_Boolean : public java_lang_Object, private FieldAccess {
243 // Static offsets of the object's instance fields.
244 // TODO These offsets need to be checked on VM startup.
245 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
248 java_lang_Boolean(java_handle_t* h) : java_lang_Object(h) {}
250 inline uint8_t get_value();
251 inline void set_value(uint8_t value);
254 inline uint8_t java_lang_Boolean::get_value()
256 return get<int32_t>(_handle, offset_value);
259 inline void java_lang_Boolean::set_value(uint8_t value)
261 set(_handle, offset_value, (uint32_t) value);
273 class java_lang_Byte : public java_lang_Object, private FieldAccess {
275 // Static offsets of the object's instance fields.
276 // TODO These offsets need to be checked on VM startup.
277 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
280 java_lang_Byte(java_handle_t* h) : java_lang_Object(h) {}
282 inline int8_t get_value();
283 inline void set_value(int8_t value);
286 inline int8_t java_lang_Byte::get_value()
288 return get<int32_t>(_handle, offset_value);
291 inline void java_lang_Byte::set_value(int8_t value)
293 set(_handle, offset_value, (int32_t) value);
298 * java/lang/Character
305 class java_lang_Character : public java_lang_Object, private FieldAccess {
307 // Static offsets of the object's instance fields.
308 // TODO These offsets need to be checked on VM startup.
309 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
312 java_lang_Character(java_handle_t* h) : java_lang_Object(h) {}
314 inline uint16_t get_value();
315 inline void set_value(uint16_t value);
318 inline uint16_t java_lang_Character::get_value()
320 return get<int32_t>(_handle, offset_value);
323 inline void java_lang_Character::set_value(uint16_t value)
325 set(_handle, offset_value, (uint32_t) value);
337 class java_lang_Short : public java_lang_Object, private FieldAccess {
339 // Static offsets of the object's instance fields.
340 // TODO These offsets need to be checked on VM startup.
341 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
344 java_lang_Short(java_handle_t* h) : java_lang_Object(h) {}
346 inline int16_t get_value();
347 inline void set_value(int16_t value);
350 inline int16_t java_lang_Short::get_value()
352 return get<int32_t>(_handle, offset_value);
355 inline void java_lang_Short::set_value(int16_t value)
357 set(_handle, offset_value, (int32_t) value);
369 class java_lang_Integer : public java_lang_Object, private FieldAccess {
371 // Static offsets of the object's instance fields.
372 // TODO These offsets need to be checked on VM startup.
373 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
376 java_lang_Integer(java_handle_t* h) : java_lang_Object(h) {}
378 inline int32_t get_value();
379 inline void set_value(int32_t value);
382 inline int32_t java_lang_Integer::get_value()
384 return get<int32_t>(_handle, offset_value);
387 inline void java_lang_Integer::set_value(int32_t value)
389 set(_handle, offset_value, value);
401 class java_lang_Long : public java_lang_Object, private FieldAccess {
403 // Static offsets of the object's instance fields.
404 // TODO These offsets need to be checked on VM startup.
405 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int64_t));
408 java_lang_Long(java_handle_t* h) : java_lang_Object(h) {}
410 inline int64_t get_value();
411 inline void set_value(int64_t value);
414 inline int64_t java_lang_Long::get_value()
416 return get<int64_t>(_handle, offset_value);
419 inline void java_lang_Long::set_value(int64_t value)
421 set(_handle, offset_value, value);
433 class java_lang_Float : public java_lang_Object, private FieldAccess {
435 // Static offsets of the object's instance fields.
436 // TODO These offsets need to be checked on VM startup.
437 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(float));
440 java_lang_Float(java_handle_t* h) : java_lang_Object(h) {}
442 inline float get_value();
443 inline void set_value(float value);
446 inline float java_lang_Float::get_value()
448 return get<float>(_handle, offset_value);
451 inline void java_lang_Float::set_value(float value)
453 set(_handle, offset_value, value);
465 class java_lang_Double : public java_lang_Object, private FieldAccess {
467 // Static offsets of the object's instance fields.
468 // TODO These offsets need to be checked on VM startup.
469 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), sizeof(double));
472 java_lang_Double(java_handle_t* h) : java_lang_Object(h) {}
474 inline double get_value();
475 inline void set_value(double value);
478 inline double java_lang_Double::get_value()
480 return get<double>(_handle, offset_value);
483 inline void java_lang_Double::set_value(double value)
485 set(_handle, offset_value, value);
489 #if defined(ENABLE_JAVASE)
491 # if defined(ENABLE_ANNOTATIONS)
493 * OpenJDK sun/reflect/ConstantPool
498 * 1. java.lang.Object constantPoolOop;
500 class sun_reflect_ConstantPool : public java_lang_Object, private FieldAccess {
502 // Static offsets of the object's instance fields.
503 // TODO These offsets need to be checked on VM startup.
504 static const off_t offset_constantPoolOop = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
507 sun_reflect_ConstantPool(java_handle_t* h) : java_lang_Object(h) {}
508 sun_reflect_ConstantPool(java_handle_t* h, jclass constantPoolOop);
511 inline void set_constantPoolOop(classinfo* value);
512 inline void set_constantPoolOop(jclass value);
516 inline sun_reflect_ConstantPool::sun_reflect_ConstantPool(java_handle_t* h, jclass constantPoolOop) : java_lang_Object(h)
518 set_constantPoolOop(constantPoolOop);
522 inline void sun_reflect_ConstantPool::set_constantPoolOop(classinfo* value)
524 set(_handle, offset_constantPoolOop, value);
527 inline void sun_reflect_ConstantPool::set_constantPoolOop(jclass value)
529 // XXX jclass is a boxed object.
530 set_constantPoolOop(LLNI_classinfo_unwrap(value));
532 # endif // ENABLE_ANNOTATIONS
534 #endif // ENABLE_JAVASE
537 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
540 * GNU Classpath java/lang/Class
545 * 1. java.lang.Object[] signers;
546 * 2. java.security.ProtectionDomain pd;
547 * 3. java.lang.Object vmdata;
548 * 4. java.lang.reflect.Constructor constructor;
550 class java_lang_Class : public java_lang_Object, private FieldAccess {
552 // Static offsets of the object's instance fields.
553 // TODO These offsets need to be checked on VM startup.
554 static const off_t offset_signers = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
555 static const off_t offset_pd = MEMORY_ALIGN(offset_signers + SIZEOF_VOID_P, SIZEOF_VOID_P);
556 static const off_t offset_vmdata = MEMORY_ALIGN(offset_pd + SIZEOF_VOID_P, SIZEOF_VOID_P);
557 static const off_t offset_constructor = MEMORY_ALIGN(offset_vmdata + SIZEOF_VOID_P, SIZEOF_VOID_P);
560 java_lang_Class(java_handle_t* h) : java_lang_Object(h) {}
563 inline void set_pd(java_handle_t* value);
564 inline void set_pd(jobject value);
567 inline void java_lang_Class::set_pd(java_handle_t* value)
569 set(_handle, offset_pd, value);
572 inline void java_lang_Class::set_pd(jobject value)
574 set_pd((java_handle_t*) value);
579 * GNU Classpath java/lang/StackTraceElement
584 * 1. java.lang.String fileName;
586 * 3. java.lang.String declaringClass;
587 * 4. java.lang.String methodName;
588 * 5. boolean isNative;
590 class java_lang_StackTraceElement : public java_lang_Object, private FieldAccess {
592 // Static offsets of the object's instance fields.
593 // TODO These offsets need to be checked on VM startup.
594 static const off_t offset_fileName = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
595 static const off_t offset_lineNumber = MEMORY_ALIGN(offset_fileName + SIZEOF_VOID_P, sizeof(int32_t));
596 static const off_t offset_declaringClass = MEMORY_ALIGN(offset_lineNumber + sizeof(int32_t), SIZEOF_VOID_P);
597 static const off_t offset_methodName = MEMORY_ALIGN(offset_declaringClass + SIZEOF_VOID_P, SIZEOF_VOID_P);
598 static const off_t offset_isNative = MEMORY_ALIGN(offset_methodName + SIZEOF_VOID_P, SIZEOF_VOID_P);
601 java_lang_StackTraceElement(java_handle_t* h) : java_lang_Object(h) {}
602 java_lang_StackTraceElement(java_handle_t* h, java_handle_t* fileName, int32_t lineNumber, java_handle_t* declaringClass, java_handle_t* methodName, uint8_t isNative);
605 inline java_lang_StackTraceElement::java_lang_StackTraceElement(java_handle_t* h, java_handle_t* fileName, int32_t lineNumber, java_handle_t* declaringClass, java_handle_t* methodName, uint8_t isNative) : java_lang_Object(h)
607 java_lang_StackTraceElement((java_handle_t*) h);
609 set(_handle, offset_fileName, fileName);
610 set(_handle, offset_lineNumber, lineNumber);
611 set(_handle, offset_declaringClass, declaringClass);
612 set(_handle, offset_methodName, methodName);
613 set(_handle, offset_isNative, isNative);
618 * GNU Classpath java/lang/String
625 * 3. int cachedHashCode;
628 class java_lang_String : public java_lang_Object, private FieldAccess {
630 // Static offsets of the object's instance fields.
631 // TODO These offsets need to be checked on VM startup.
632 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
633 static const off_t offset_count = MEMORY_ALIGN(offset_value + SIZEOF_VOID_P, sizeof(int32_t));
634 static const off_t offset_cachedHashCode = MEMORY_ALIGN(offset_count + sizeof(int32_t), sizeof(int32_t));
635 static const off_t offset_offset = MEMORY_ALIGN(offset_cachedHashCode + sizeof(int32_t), sizeof(int32_t));
638 java_lang_String(java_handle_t* h) : java_lang_Object(h) {}
639 java_lang_String(jstring h);
640 java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset = 0);
643 inline java_handle_chararray_t* get_value () const;
644 inline int32_t get_count () const;
645 inline int32_t get_offset() const;
648 inline void set_value (java_handle_chararray_t* value);
649 inline void set_count (int32_t value);
650 inline void set_offset(int32_t value);
653 inline java_lang_String::java_lang_String(jstring h) : java_lang_Object(h)
655 java_lang_String((java_handle_t*) h);
658 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)
665 inline java_handle_chararray_t* java_lang_String::get_value() const
667 return get<java_handle_chararray_t*>(_handle, offset_value);
670 inline int32_t java_lang_String::get_count() const
672 return get<int32_t>(_handle, offset_count);
675 inline int32_t java_lang_String::get_offset() const
677 return get<int32_t>(_handle, offset_offset);
680 inline void java_lang_String::set_value(java_handle_chararray_t* value)
682 set(_handle, offset_value, value);
685 inline void java_lang_String::set_count(int32_t value)
687 set(_handle, offset_count, value);
690 inline void java_lang_String::set_offset(int32_t value)
692 set(_handle, offset_offset, value);
697 * GNU Classpath java/lang/Thread
702 * 1. java.lang.VMThread vmThread;
703 * 2. java.lang.ThreadGroup group;
704 * 3. java.lang.Runnable runnable;
705 * 4. java.lang.String name;
709 * 8. java.lang.Throwable stillborn;
710 * 9. java.lang.ClassLoader contextClassLoader;
711 * 10. boolean contextClassLoaderIsSystemClassLoader;
713 * 12. java.lang.Object parkBlocker;
714 * 13. gnu.java.util.WeakIdentityHashMap locals;
715 * 14. java_lang_Thread_UncaughtExceptionHandler exceptionHandler;
717 class java_lang_Thread : public java_lang_Object, private FieldAccess {
719 // Static offsets of the object's instance fields.
720 // TODO These offsets need to be checked on VM startup.
721 static const off_t offset_vmThread = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
722 static const off_t offset_group = MEMORY_ALIGN(offset_vmThread + SIZEOF_VOID_P, SIZEOF_VOID_P);
723 static const off_t offset_runnable = MEMORY_ALIGN(offset_group + SIZEOF_VOID_P, SIZEOF_VOID_P);
724 static const off_t offset_name = MEMORY_ALIGN(offset_runnable + SIZEOF_VOID_P, SIZEOF_VOID_P);
725 static const off_t offset_daemon = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, sizeof(int32_t));
726 static const off_t offset_priority = MEMORY_ALIGN(offset_daemon + sizeof(int32_t), sizeof(int32_t));
727 static const off_t offset_stacksize = MEMORY_ALIGN(offset_priority + sizeof(int32_t), sizeof(int64_t));
728 static const off_t offset_stillborn = MEMORY_ALIGN(offset_stacksize + sizeof(int64_t), SIZEOF_VOID_P);
729 static const off_t offset_contextClassLoader = MEMORY_ALIGN(offset_stillborn + SIZEOF_VOID_P, SIZEOF_VOID_P);
730 static const off_t offset_contextClassLoaderIsSystemClassLoader = MEMORY_ALIGN(offset_contextClassLoader + SIZEOF_VOID_P, SIZEOF_VOID_P);
731 static const off_t offset_threadId = MEMORY_ALIGN(offset_contextClassLoaderIsSystemClassLoader + sizeof(int32_t), sizeof(int64_t));
732 static const off_t offset_parkBlocker = MEMORY_ALIGN(offset_threadId + sizeof(int64_t), SIZEOF_VOID_P);
733 static const off_t offset_locals = MEMORY_ALIGN(offset_parkBlocker + SIZEOF_VOID_P, SIZEOF_VOID_P);
734 static const off_t offset_exceptionHandler = MEMORY_ALIGN(offset_locals + SIZEOF_VOID_P, SIZEOF_VOID_P);
737 java_lang_Thread(java_handle_t* h) : java_lang_Object(h) {}
738 // java_lang_Thread(threadobject* t);
741 inline java_handle_t* get_vmThread () const;
742 inline java_handle_t* get_group () const;
743 inline java_handle_t* get_name () const;
744 inline int32_t get_daemon () const;
745 inline int32_t get_priority () const;
746 inline java_handle_t* get_exceptionHandler() const;
749 inline void set_group(java_handle_t* value);
753 // inline java_lang_Thread::java_lang_Thread(threadobject* t) : java_lang_Object(h)
755 // java_lang_Thread(thread_get_object(t));
759 inline java_handle_t* java_lang_Thread::get_vmThread() const
761 return get<java_handle_t*>(_handle, offset_vmThread);
764 inline java_handle_t* java_lang_Thread::get_group() const
766 return get<java_handle_t*>(_handle, offset_group);
769 inline java_handle_t* java_lang_Thread::get_name() const
771 return get<java_handle_t*>(_handle, offset_name);
774 inline int32_t java_lang_Thread::get_daemon() const
776 return get<int32_t>(_handle, offset_daemon);
779 inline int32_t java_lang_Thread::get_priority() const
781 return get<int32_t>(_handle, offset_priority);
784 inline java_handle_t* java_lang_Thread::get_exceptionHandler() const
786 return get<java_handle_t*>(_handle, offset_exceptionHandler);
790 inline void java_lang_Thread::set_group(java_handle_t* value)
792 set(_handle, offset_group, value);
797 * GNU Classpath java/lang/VMThread
802 * 1. java.lang.Thread thread;
803 * 2. boolean running;
804 * 3. java.lang.VMThread vmdata;
806 class java_lang_VMThread : public java_lang_Object, private FieldAccess {
808 // Static offsets of the object's instance fields.
809 // TODO These offsets need to be checked on VM startup.
810 static const off_t offset_thread = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
811 static const off_t offset_running = MEMORY_ALIGN(offset_thread + SIZEOF_VOID_P, sizeof(int32_t));
812 static const off_t offset_vmdata = MEMORY_ALIGN(offset_running + sizeof(int32_t), SIZEOF_VOID_P);
815 java_lang_VMThread(java_handle_t* h) : java_lang_Object(h) {}
816 java_lang_VMThread(jobject h);
817 java_lang_VMThread(java_handle_t* h, java_handle_t* thread, threadobject* vmdata);
820 inline java_handle_t* get_thread() const;
821 inline threadobject* get_vmdata() const;
824 inline void set_thread(java_handle_t* value);
825 inline void set_vmdata(threadobject* value);
829 inline java_lang_VMThread::java_lang_VMThread(jobject h) : java_lang_Object(h)
831 java_lang_VMThread((java_handle_t*) h);
834 inline java_lang_VMThread::java_lang_VMThread(java_handle_t* h, java_handle_t* thread, threadobject* vmdata) : java_lang_Object(h)
841 inline java_handle_t* java_lang_VMThread::get_thread() const
843 return get<java_handle_t*>(_handle, offset_thread);
846 inline threadobject* java_lang_VMThread::get_vmdata() const
848 return get<threadobject*>(_handle, offset_vmdata);
852 inline void java_lang_VMThread::set_thread(java_handle_t* value)
854 set(_handle, offset_thread, value);
857 inline void java_lang_VMThread::set_vmdata(threadobject* value)
859 set(_handle, offset_vmdata, value);
864 * GNU Classpath java/lang/Throwable
869 * 1. java.lang.String detailMessage;
870 * 2. java.lang.Throwable cause;
871 * 3. java.lang.StackTraceElement[] stackTrace;
872 * 4. java.lang.VMThrowable vmState;
874 class java_lang_Throwable : public java_lang_Object, private FieldAccess {
876 // Static offsets of the object's instance fields.
877 // TODO These offsets need to be checked on VM startup.
878 static const off_t offset_detailMessage = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
879 static const off_t offset_cause = MEMORY_ALIGN(offset_detailMessage + SIZEOF_VOID_P, SIZEOF_VOID_P);
880 static const off_t offset_stackTrace = MEMORY_ALIGN(offset_cause + SIZEOF_VOID_P, SIZEOF_VOID_P);
881 static const off_t offset_vmState = MEMORY_ALIGN(offset_stackTrace + SIZEOF_VOID_P, SIZEOF_VOID_P);
884 java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {}
887 inline java_handle_t* get_detailMessage() const;
888 inline java_handle_t* get_cause () const;
889 inline java_handle_t* get_vmState () const;
893 inline java_handle_t* java_lang_Throwable::get_detailMessage() const
895 return get<java_handle_t*>(_handle, offset_detailMessage);
898 inline java_handle_t* java_lang_Throwable::get_cause() const
900 return get<java_handle_t*>(_handle, offset_cause);
903 inline java_handle_t* java_lang_Throwable::get_vmState() const
905 return get<java_handle_t*>(_handle, offset_vmState);
910 * GNU Classpath java/lang/VMThrowable
915 * 1. java.lang.Object vmdata;
917 class java_lang_VMThrowable : public java_lang_Object, private FieldAccess {
919 // Static offsets of the object's instance fields.
920 // TODO These offsets need to be checked on VM startup.
921 static const off_t offset_vmdata = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
924 java_lang_VMThrowable(java_handle_t* h) : java_lang_Object(h) {}
925 java_lang_VMThrowable(jobject h);
927 inline java_handle_bytearray_t* get_vmdata() const;
928 inline void set_vmdata(java_handle_bytearray_t* value);
931 inline java_lang_VMThrowable::java_lang_VMThrowable(jobject h) : java_lang_Object(h)
933 java_lang_VMThrowable((java_handle_t*) h);
936 inline java_handle_bytearray_t* java_lang_VMThrowable::get_vmdata() const
938 return get<java_handle_bytearray_t*>(_handle, offset_vmdata);
941 inline void java_lang_VMThrowable::set_vmdata(java_handle_bytearray_t* value)
943 set(_handle, offset_vmdata, value);
948 * GNU Classpath java/lang/reflect/VMConstructor
953 * 1. java.lang.Class clazz;
955 * 3. byte[] annotations;
956 * 4. byte[] parameterAnnotations;
957 * 5. java.util.Map declaredAnnotations;
958 * 6. java.lang.reflect.Constructor cons;
960 class java_lang_reflect_VMConstructor : public java_lang_Object, private FieldAccess {
962 // Static offsets of the object's instance fields.
963 // TODO These offsets need to be checked on VM startup.
964 static const off_t offset_clazz = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
965 static const off_t offset_slot = MEMORY_ALIGN(offset_clazz + SIZEOF_VOID_P, sizeof(int32_t));
966 static const off_t offset_annotations = MEMORY_ALIGN(offset_slot + sizeof(int32_t), SIZEOF_VOID_P);
967 static const off_t offset_parameterAnnotations = MEMORY_ALIGN(offset_annotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
968 static const off_t offset_declaredAnnotations = MEMORY_ALIGN(offset_parameterAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
969 static const off_t offset_cons = MEMORY_ALIGN(offset_declaredAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
972 java_lang_reflect_VMConstructor(java_handle_t* h) : java_lang_Object(h) {}
973 java_lang_reflect_VMConstructor(jobject h);
974 java_lang_reflect_VMConstructor(methodinfo* m);
977 inline classinfo* get_clazz () const;
978 inline int32_t get_slot () const;
979 inline java_handle_bytearray_t* get_annotations () const;
980 inline java_handle_bytearray_t* get_parameterAnnotations() const;
981 inline java_handle_t* get_declaredAnnotations () const;
982 inline java_handle_t* get_cons () const;
985 inline void set_clazz (classinfo* value);
986 inline void set_slot (int32_t value);
987 inline void set_annotations (java_handle_bytearray_t* value);
988 inline void set_parameterAnnotations(java_handle_bytearray_t* value);
989 inline void set_declaredAnnotations (java_handle_t* value);
990 inline void set_cons (java_handle_t* value);
992 // Convenience functions.
993 inline methodinfo* get_method();
997 inline java_lang_reflect_VMConstructor::java_lang_reflect_VMConstructor(jobject h) : java_lang_Object(h)
999 java_lang_reflect_VMConstructor((java_handle_t*) h);
1002 inline java_lang_reflect_VMConstructor::java_lang_reflect_VMConstructor(methodinfo* m)
1004 _handle = builtin_new(class_java_lang_reflect_VMConstructor);
1009 int slot = m - m->clazz->methods;
1010 java_handle_bytearray_t* annotations = method_get_annotations(m);
1011 java_handle_bytearray_t* parameterAnnotations = method_get_parameterannotations(m);
1013 set_clazz(m->clazz);
1015 set_annotations(annotations);
1016 set_parameterAnnotations(parameterAnnotations);
1020 inline classinfo* java_lang_reflect_VMConstructor::get_clazz() const
1022 return get<classinfo*>(_handle, offset_clazz);
1025 inline int32_t java_lang_reflect_VMConstructor::get_slot() const
1027 return get<int32_t>(_handle, offset_slot);
1030 inline java_handle_bytearray_t* java_lang_reflect_VMConstructor::get_annotations() const
1032 return get<java_handle_bytearray_t*>(_handle, offset_annotations);
1035 inline java_handle_bytearray_t* java_lang_reflect_VMConstructor::get_parameterAnnotations() const
1037 return get<java_handle_bytearray_t*>(_handle, offset_parameterAnnotations);
1040 inline java_handle_t* java_lang_reflect_VMConstructor::get_declaredAnnotations() const
1042 return get<java_handle_t*>(_handle, offset_declaredAnnotations);
1045 inline java_handle_t* java_lang_reflect_VMConstructor::get_cons() const
1047 return get<java_handle_t*>(_handle, offset_cons);
1050 inline void java_lang_reflect_VMConstructor::set_clazz(classinfo* value)
1052 set(_handle, offset_clazz, value);
1055 inline void java_lang_reflect_VMConstructor::set_slot(int32_t value)
1057 set(_handle, offset_slot, value);
1060 inline void java_lang_reflect_VMConstructor::set_annotations(java_handle_bytearray_t* value)
1062 set(_handle, offset_annotations, value);
1065 inline void java_lang_reflect_VMConstructor::set_parameterAnnotations(java_handle_bytearray_t* value)
1067 set(_handle, offset_parameterAnnotations, value);
1070 inline void java_lang_reflect_VMConstructor::set_declaredAnnotations(java_handle_t* value)
1072 set(_handle, offset_declaredAnnotations, value);
1075 inline void java_lang_reflect_VMConstructor::set_cons(java_handle_t* value)
1077 set(_handle, offset_cons, value);
1080 inline methodinfo* java_lang_reflect_VMConstructor::get_method()
1082 classinfo* c = get_clazz();
1083 int32_t slot = get_slot();
1084 methodinfo* m = &(c->methods[slot]);
1090 * GNU Classpath java/lang/reflect/Constructor
1096 * 2. gnu.java.lang.reflect.MethodSignatureParser p;
1097 * 3. java.lang.reflect.VMConstructor cons;
1099 class java_lang_reflect_Constructor : public java_lang_Object, private FieldAccess {
1101 // Static offsets of the object's instance fields.
1102 // TODO These offsets need to be checked on VM startup.
1103 static const off_t offset_flag = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
1104 static const off_t offset_p = MEMORY_ALIGN(offset_flag + sizeof(int32_t), SIZEOF_VOID_P);
1105 static const off_t offset_cons = MEMORY_ALIGN(offset_p + SIZEOF_VOID_P, SIZEOF_VOID_P);
1108 java_lang_reflect_Constructor(java_handle_t* h) : java_lang_Object(h) {}
1109 java_lang_reflect_Constructor(jobject h);
1110 java_lang_reflect_Constructor(methodinfo* m);
1112 java_handle_t* new_instance(java_handle_objectarray_t* args);
1115 inline int32_t get_flag() const;
1116 inline java_handle_t* get_cons() const;
1119 inline void set_cons(java_handle_t* value);
1121 // Convenience functions.
1122 inline methodinfo* get_method () const;
1123 inline int32_t get_override() const;
1127 inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(jobject h) : java_lang_Object(h)
1129 java_lang_reflect_Constructor((java_handle_t*) h);
1132 inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(methodinfo* m)
1134 java_lang_reflect_VMConstructor jlrvmc(m);
1136 if (jlrvmc.is_null())
1139 _handle = builtin_new(class_java_lang_reflect_Constructor);
1144 // Link the two Java objects.
1145 set_cons(jlrvmc.get_handle());
1146 jlrvmc.set_cons(get_handle());
1150 inline int32_t java_lang_reflect_Constructor::get_flag() const
1152 return get<int32_t>(_handle, offset_flag);
1155 inline java_handle_t* java_lang_reflect_Constructor::get_cons() const
1157 return get<java_handle_t*>(_handle, offset_cons);
1161 inline void java_lang_reflect_Constructor::set_cons(java_handle_t* value)
1163 set(_handle, offset_cons, value);
1167 inline methodinfo* java_lang_reflect_Constructor::get_method() const
1169 java_lang_reflect_VMConstructor jlrvmc(get_cons());
1170 return jlrvmc.get_method();
1173 inline int32_t java_lang_reflect_Constructor::get_override() const
1180 * GNU Classpath java/lang/reflect/VMField
1185 * 1. java.lang.Class clazz;
1186 * 2. java.lang.String name;
1188 * 4. byte[] annotations;
1189 * 5. java.lang.Map declaredAnnotations;
1190 * 6. java.lang.reflect.Field f;
1192 class java_lang_reflect_VMField : public java_lang_Object, private FieldAccess {
1194 // Static offsets of the object's instance fields.
1195 // TODO These offsets need to be checked on VM startup.
1196 static const off_t offset_clazz = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1197 static const off_t offset_name = MEMORY_ALIGN(offset_clazz + SIZEOF_VOID_P, SIZEOF_VOID_P);
1198 static const off_t offset_slot = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, sizeof(int32_t));
1199 static const off_t offset_annotations = MEMORY_ALIGN(offset_slot + sizeof(int32_t), SIZEOF_VOID_P);
1200 static const off_t offset_declaredAnnotations = MEMORY_ALIGN(offset_annotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
1201 static const off_t offset_f = MEMORY_ALIGN(offset_declaredAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
1204 java_lang_reflect_VMField(java_handle_t* h) : java_lang_Object(h) {}
1205 java_lang_reflect_VMField(jobject h);
1206 java_lang_reflect_VMField(fieldinfo* f);
1209 inline classinfo* get_clazz () const;
1210 inline int32_t get_slot () const;
1211 inline java_handle_bytearray_t* get_annotations () const;
1212 inline java_handle_t* get_declaredAnnotations() const;
1213 inline java_handle_t* get_f () const;
1216 inline void set_clazz (classinfo* value);
1217 inline void set_name (java_handle_t* value);
1218 inline void set_slot (int32_t value);
1219 inline void set_annotations (java_handle_bytearray_t* value);
1220 inline void set_declaredAnnotations(java_handle_t* value);
1221 inline void set_f (java_handle_t* value);
1223 // Convenience functions.
1224 inline fieldinfo* get_field() const;
1228 inline java_lang_reflect_VMField::java_lang_reflect_VMField(jobject h) : java_lang_Object(h)
1230 java_lang_reflect_VMField((java_handle_t*) h);
1233 inline java_lang_reflect_VMField::java_lang_reflect_VMField(fieldinfo* f)
1235 _handle = builtin_new(class_java_lang_reflect_VMField);
1240 java_handle_t* name = javastring_intern(javastring_new(f->name));
1241 int slot = f - f->clazz->fields;
1242 java_handle_bytearray_t* annotations = field_get_annotations(f);
1244 set_clazz(f->clazz);
1247 set_annotations(annotations);
1251 inline classinfo* java_lang_reflect_VMField::get_clazz() const
1253 return get<classinfo*>(_handle, offset_clazz);
1256 inline int32_t java_lang_reflect_VMField::get_slot() const
1258 return get<int32_t>(_handle, offset_slot);
1261 inline java_handle_bytearray_t* java_lang_reflect_VMField::get_annotations() const
1263 return get<java_handle_bytearray_t*>(_handle, offset_annotations);
1266 inline java_handle_t* java_lang_reflect_VMField::get_declaredAnnotations() const
1268 return get<java_handle_t*>(_handle, offset_declaredAnnotations);
1271 inline java_handle_t* java_lang_reflect_VMField::get_f() const
1273 return get<java_handle_t*>(_handle, offset_f);
1277 inline void java_lang_reflect_VMField::set_clazz(classinfo* value)
1279 set(_handle, offset_clazz, value);
1282 inline void java_lang_reflect_VMField::set_name(java_handle_t* value)
1284 set(_handle, offset_name, value);
1287 inline void java_lang_reflect_VMField::set_slot(int32_t value)
1289 set(_handle, offset_slot, value);
1292 inline void java_lang_reflect_VMField::set_annotations(java_handle_bytearray_t* value)
1294 set(_handle, offset_annotations, value);
1297 inline void java_lang_reflect_VMField::set_declaredAnnotations(java_handle_t* value)
1299 set(_handle, offset_declaredAnnotations, value);
1302 inline void java_lang_reflect_VMField::set_f(java_handle_t* value)
1304 set(_handle, offset_f, value);
1307 inline fieldinfo* java_lang_reflect_VMField::get_field() const
1309 classinfo* c = get_clazz();
1310 int32_t slot = get_slot();
1311 fieldinfo* f = &(c->fields[slot]);
1317 * GNU Classpath java/lang/reflect/Field
1323 * 2. gnu.java.lang.reflect.FieldSignatureParser p;
1324 * 3. java.lang.reflect.VMField f;
1326 class java_lang_reflect_Field : public java_lang_Object, private FieldAccess {
1328 // Static offsets of the object's instance fields.
1329 // TODO These offsets need to be checked on VM startup.
1330 static const off_t offset_flag = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
1331 static const off_t offset_p = MEMORY_ALIGN(offset_flag + sizeof(int32_t), SIZEOF_VOID_P);
1332 static const off_t offset_f = MEMORY_ALIGN(offset_p + SIZEOF_VOID_P, SIZEOF_VOID_P);
1335 java_lang_reflect_Field(java_handle_t* h) : java_lang_Object(h) {}
1336 java_lang_reflect_Field(jobject h);
1337 java_lang_reflect_Field(fieldinfo* f);
1340 inline int32_t get_flag() const;
1341 inline java_handle_t* get_f() const;
1344 inline void set_f(java_handle_t* value);
1348 inline java_lang_reflect_Field::java_lang_reflect_Field(jobject h) : java_lang_Object(h)
1350 java_lang_reflect_Field((java_handle_t*) h);
1353 inline java_lang_reflect_Field::java_lang_reflect_Field(fieldinfo* f)
1355 java_lang_reflect_VMField jlrvmf(f);
1357 if (jlrvmf.is_null())
1360 _handle = builtin_new(class_java_lang_reflect_Field);
1365 // Link the two Java objects.
1366 set_f(jlrvmf.get_handle());
1367 jlrvmf.set_f(get_handle());
1371 inline int32_t java_lang_reflect_Field::get_flag() const
1373 return get<int32_t>(_handle, offset_flag);
1376 inline java_handle_t* java_lang_reflect_Field::get_f() const
1378 return get<java_handle_t*>(_handle, offset_f);
1382 inline void java_lang_reflect_Field::set_f(java_handle_t* value)
1384 set(_handle, offset_f, value);
1389 * GNU Classpath java/lang/reflect/VMMethod
1394 * 1. java.lang.Class clazz;
1395 * 2. java.lang.String name;
1397 * 4. byte[] annotations;
1398 * 5. byte[] parameterAnnotations;
1399 * 6. byte[] annotationDefault;
1400 * 7. java.lang.Map declaredAnnotations;
1401 * 8. java.lang.reflect.Method m;
1403 class java_lang_reflect_VMMethod : public java_lang_Object, private FieldAccess {
1405 // Static offsets of the object's instance fields.
1406 // TODO These offsets need to be checked on VM startup.
1407 static const off_t offset_clazz = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1408 static const off_t offset_name = MEMORY_ALIGN(offset_clazz + SIZEOF_VOID_P, SIZEOF_VOID_P);
1409 static const off_t offset_slot = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, sizeof(int32_t));
1410 static const off_t offset_annotations = MEMORY_ALIGN(offset_slot + sizeof(int32_t), SIZEOF_VOID_P);
1411 static const off_t offset_parameterAnnotations = MEMORY_ALIGN(offset_annotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
1412 static const off_t offset_annotationDefault = MEMORY_ALIGN(offset_parameterAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
1413 static const off_t offset_declaredAnnotations = MEMORY_ALIGN(offset_annotationDefault + SIZEOF_VOID_P, SIZEOF_VOID_P);
1414 static const off_t offset_m = MEMORY_ALIGN(offset_declaredAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
1417 java_lang_reflect_VMMethod(java_handle_t* h) : java_lang_Object(h) {}
1418 java_lang_reflect_VMMethod(jobject h);
1419 java_lang_reflect_VMMethod(methodinfo* m);
1422 inline classinfo* get_clazz () const;
1423 inline int32_t get_slot () const;
1424 inline java_handle_bytearray_t* get_annotations () const;
1425 inline java_handle_bytearray_t* get_parameterAnnotations() const;
1426 inline java_handle_bytearray_t* get_annotationDefault () const;
1427 inline java_handle_t* get_declaredAnnotations () const;
1428 inline java_handle_t* get_m () const;
1431 inline void set_clazz (classinfo* value);
1432 inline void set_name (java_handle_t* value);
1433 inline void set_slot (int32_t value);
1434 inline void set_annotations (java_handle_bytearray_t* value);
1435 inline void set_parameterAnnotations(java_handle_bytearray_t* value);
1436 inline void set_annotationDefault (java_handle_bytearray_t* value);
1437 inline void set_declaredAnnotations (java_handle_t* value);
1438 inline void set_m (java_handle_t* value);
1440 // Convenience functions.
1441 inline methodinfo* get_method() const;
1444 inline java_lang_reflect_VMMethod::java_lang_reflect_VMMethod(jobject h) : java_lang_Object(h)
1446 java_lang_reflect_VMMethod((java_handle_t*) h);
1449 inline java_lang_reflect_VMMethod::java_lang_reflect_VMMethod(methodinfo* m)
1451 _handle = builtin_new(class_java_lang_reflect_VMMethod);
1456 java_handle_t* name = javastring_intern(javastring_new(m->name));
1457 int slot = m - m->clazz->methods;
1458 java_handle_bytearray_t* annotations = method_get_annotations(m);
1459 java_handle_bytearray_t* parameterAnnotations = method_get_parameterannotations(m);
1460 java_handle_bytearray_t* annotationDefault = method_get_annotationdefault(m);
1462 set_clazz(m->clazz);
1465 set_annotations(annotations);
1466 set_parameterAnnotations(parameterAnnotations);
1467 set_annotationDefault(annotationDefault);
1470 inline classinfo* java_lang_reflect_VMMethod::get_clazz() const
1472 return get<classinfo*>(_handle, offset_clazz);
1475 inline int32_t java_lang_reflect_VMMethod::get_slot() const
1477 return get<int32_t>(_handle, offset_slot);
1480 inline java_handle_bytearray_t* java_lang_reflect_VMMethod::get_annotations() const
1482 return get<java_handle_bytearray_t*>(_handle, offset_annotations);
1485 inline java_handle_bytearray_t* java_lang_reflect_VMMethod::get_parameterAnnotations() const
1487 return get<java_handle_bytearray_t*>(_handle, offset_parameterAnnotations);
1490 inline java_handle_bytearray_t* java_lang_reflect_VMMethod::get_annotationDefault() const
1492 return get<java_handle_bytearray_t*>(_handle, offset_annotationDefault);
1495 inline java_handle_t* java_lang_reflect_VMMethod::get_declaredAnnotations() const
1497 return get<java_handle_t*>(_handle, offset_declaredAnnotations);
1500 inline java_handle_t* java_lang_reflect_VMMethod::get_m() const
1502 return get<java_handle_t*>(_handle, offset_m);
1505 inline void java_lang_reflect_VMMethod::set_clazz(classinfo* value)
1507 set(_handle, offset_clazz, value);
1510 inline void java_lang_reflect_VMMethod::set_name(java_handle_t* value)
1512 set(_handle, offset_name, value);
1515 inline void java_lang_reflect_VMMethod::set_slot(int32_t value)
1517 set(_handle, offset_slot, value);
1520 inline void java_lang_reflect_VMMethod::set_annotations(java_handle_bytearray_t* value)
1522 set(_handle, offset_annotations, value);
1525 inline void java_lang_reflect_VMMethod::set_parameterAnnotations(java_handle_bytearray_t* value)
1527 set(_handle, offset_parameterAnnotations, value);
1530 inline void java_lang_reflect_VMMethod::set_annotationDefault(java_handle_bytearray_t* value)
1532 set(_handle, offset_annotationDefault, value);
1535 inline void java_lang_reflect_VMMethod::set_declaredAnnotations(java_handle_t* value)
1537 set(_handle, offset_declaredAnnotations, value);
1540 inline void java_lang_reflect_VMMethod::set_m(java_handle_t* value)
1542 set(_handle, offset_m, value);
1545 inline methodinfo* java_lang_reflect_VMMethod::get_method() const
1547 classinfo* c = get_clazz();
1548 int32_t slot = get_slot();
1549 methodinfo* m = &(c->methods[slot]);
1555 * GNU Classpath java/lang/reflect/Method
1561 * 2. gnu.java.lang.reflect.MethodSignatureParser p;
1562 * 3. java.lang.reflect.VMMethod m;
1564 class java_lang_reflect_Method : public java_lang_Object, private FieldAccess {
1566 // Static offsets of the object's instance fields.
1567 // TODO These offsets need to be checked on VM startup.
1568 static const off_t offset_flag = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
1569 static const off_t offset_p = MEMORY_ALIGN(offset_flag + sizeof(int32_t), SIZEOF_VOID_P);
1570 static const off_t offset_m = MEMORY_ALIGN(offset_p + SIZEOF_VOID_P, SIZEOF_VOID_P);
1573 java_lang_reflect_Method(java_handle_t* h) : java_lang_Object(h) {}
1574 java_lang_reflect_Method(jobject h);
1575 java_lang_reflect_Method(methodinfo* m);
1578 inline int32_t get_flag() const;
1579 inline java_handle_t* get_m() const;
1582 inline void set_m(java_handle_t* value);
1586 inline java_lang_reflect_Method::java_lang_reflect_Method(jobject h) : java_lang_Object(h)
1588 java_lang_reflect_Method((java_handle_t*) h);
1591 inline java_lang_reflect_Method::java_lang_reflect_Method(methodinfo* m)
1593 java_lang_reflect_VMMethod jlrvmm(m);
1595 if (jlrvmm.is_null())
1598 _handle = builtin_new(class_java_lang_reflect_Method);
1603 // Link the two Java objects.
1604 set_m(jlrvmm.get_handle());
1605 jlrvmm.set_m(get_handle());
1609 inline int32_t java_lang_reflect_Method::get_flag() const
1611 return get<int32_t>(_handle, offset_flag);
1614 inline java_handle_t* java_lang_reflect_Method::get_m() const
1616 return get<java_handle_t*>(_handle, offset_m);
1620 inline void java_lang_reflect_Method::set_m(java_handle_t* value)
1622 set(_handle, offset_m, value);
1627 * GNU Classpath java/nio/Buffer
1636 * 5. gnu.classpath.Pointer address;
1638 class java_nio_Buffer : public java_lang_Object, private FieldAccess {
1640 // Static offsets of the object's instance fields.
1641 // TODO These offsets need to be checked on VM startup.
1642 static const off_t offset_cap = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
1643 static const off_t offset_limit = MEMORY_ALIGN(offset_cap + sizeof(int32_t), sizeof(int32_t));
1644 static const off_t offset_pos = MEMORY_ALIGN(offset_limit + sizeof(int32_t), sizeof(int32_t));
1645 static const off_t offset_mark = MEMORY_ALIGN(offset_pos + sizeof(int32_t), sizeof(int32_t));
1646 static const off_t offset_address = MEMORY_ALIGN(offset_mark + sizeof(int32_t), SIZEOF_VOID_P);
1649 java_nio_Buffer(java_handle_t* h) : java_lang_Object(h) {}
1652 inline int32_t get_cap() const;
1655 inline int32_t java_nio_Buffer::get_cap() const
1657 return get<int32_t>(_handle, offset_cap);
1662 * GNU Classpath java/nio/DirectByteBufferImpl
1671 * 5. gnu.classpath.Pointer address;
1672 * 6. java.nio.ByteOrder endian;
1673 * 7. byte[] backing_buffer;
1674 * 8. int array_offset;
1675 * 9. java.lang.Object owner;
1677 class java_nio_DirectByteBufferImpl : public java_lang_Object, private FieldAccess {
1679 // Static offsets of the object's instance fields.
1680 // TODO These offsets need to be checked on VM startup.
1681 static const off_t offset_cap = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
1682 static const off_t offset_limit = MEMORY_ALIGN(offset_cap + sizeof(int32_t), sizeof(int32_t));
1683 static const off_t offset_pos = MEMORY_ALIGN(offset_limit + sizeof(int32_t), sizeof(int32_t));
1684 static const off_t offset_mark = MEMORY_ALIGN(offset_pos + sizeof(int32_t), sizeof(int32_t));
1685 static const off_t offset_address = MEMORY_ALIGN(offset_mark + sizeof(int32_t), SIZEOF_VOID_P);
1686 static const off_t offset_endian = MEMORY_ALIGN(offset_address + SIZEOF_VOID_P, SIZEOF_VOID_P);
1687 static const off_t offset_backing_buffer = MEMORY_ALIGN(offset_endian + SIZEOF_VOID_P, SIZEOF_VOID_P);
1688 static const off_t offset_array_offset = MEMORY_ALIGN(offset_backing_buffer + SIZEOF_VOID_P, sizeof(int32_t));
1689 static const off_t offset_owner = MEMORY_ALIGN(offset_array_offset + sizeof(int32_t), SIZEOF_VOID_P);
1692 java_nio_DirectByteBufferImpl(java_handle_t* h) : java_lang_Object(h) {}
1693 java_nio_DirectByteBufferImpl(jobject h);
1696 inline java_handle_t* get_address() const;
1699 inline java_nio_DirectByteBufferImpl::java_nio_DirectByteBufferImpl(jobject h) : java_lang_Object(h)
1701 java_nio_DirectByteBufferImpl((java_handle_t*) h);
1704 inline java_handle_t* java_nio_DirectByteBufferImpl::get_address() const
1706 return get<java_handle_t*>(_handle, offset_address);
1711 * GNU Classpath gnu/classpath/Pointer
1713 * Actually there are two classes, gnu.classpath.Pointer32 and
1714 * gnu.classpath.Pointer64, but we only define the abstract super
1715 * class and use the int/long field as void* type.
1722 class gnu_classpath_Pointer : public java_lang_Object, private FieldAccess {
1724 // Static offsets of the object's instance fields.
1725 // TODO These offsets need to be checked on VM startup.
1726 static const off_t offset_data = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1729 gnu_classpath_Pointer(java_handle_t* h) : java_lang_Object(h) {}
1730 gnu_classpath_Pointer(java_handle_t* h, void* data);
1733 inline void* get_data() const;
1736 inline void set_data(void* value);
1739 inline gnu_classpath_Pointer::gnu_classpath_Pointer(java_handle_t* h, void* data) : java_lang_Object(h)
1744 inline void* gnu_classpath_Pointer::get_data() const
1746 return get<void*>(_handle, offset_data);
1749 inline void gnu_classpath_Pointer::set_data(void* value)
1751 set(_handle, offset_data, value);
1754 #endif // WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH
1757 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
1760 * OpenJDK java/lang/AssertionStatusDirectives
1765 * 1. java.lang.String[] classes;
1766 * 2. boolean[] classEnabled;
1767 * 3. java.lang.String[] packages;
1768 * 4. boolean[] packageEnabled;
1771 class java_lang_AssertionStatusDirectives : public java_lang_Object, private FieldAccess {
1773 // Static offsets of the object's instance fields.
1774 // TODO These offsets need to be checked on VM startup.
1775 static const off_t offset_classes = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1776 static const off_t offset_classEnabled = MEMORY_ALIGN(offset_classes + SIZEOF_VOID_P, SIZEOF_VOID_P);
1777 static const off_t offset_packages = MEMORY_ALIGN(offset_classEnabled + SIZEOF_VOID_P, SIZEOF_VOID_P);
1778 static const off_t offset_packageEnabled = MEMORY_ALIGN(offset_packages + SIZEOF_VOID_P, SIZEOF_VOID_P);
1779 static const off_t offset_deflt = MEMORY_ALIGN(offset_packageEnabled + SIZEOF_VOID_P, sizeof(int32_t));
1782 java_lang_AssertionStatusDirectives(java_handle_objectarray_t* classes, java_handle_booleanarray_t* classEnabled, java_handle_objectarray_t* packages, java_handle_booleanarray_t* packageEnabled);
1785 inline java_lang_AssertionStatusDirectives::java_lang_AssertionStatusDirectives(java_handle_objectarray_t* classes, java_handle_booleanarray_t* classEnabled, java_handle_objectarray_t* packages, java_handle_booleanarray_t* packageEnabled)
1787 classinfo* c = load_class_bootstrap(utf_new_char("java/lang/AssertionStatusDirectives"));
1789 // FIXME Load the class at VM startup.
1793 _handle = builtin_new(c);
1798 set(_handle, offset_classes, classes);
1799 set(_handle, offset_classEnabled, classEnabled);
1800 set(_handle, offset_packages, packages);
1801 set(_handle, offset_packageEnabled, packageEnabled);
1806 * OpenJDK java/lang/StackTraceElement
1811 * 1. java.lang.String declaringClass;
1812 * 2. java.lang.String methodName;
1813 * 3. java.lang.String fileName;
1814 * 4. int lineNumber;
1816 class java_lang_StackTraceElement : public java_lang_Object, private FieldAccess {
1818 // Static offsets of the object's instance fields.
1819 // TODO These offsets need to be checked on VM startup.
1820 static const off_t offset_declaringClass = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1821 static const off_t offset_methodName = MEMORY_ALIGN(offset_declaringClass + SIZEOF_VOID_P, SIZEOF_VOID_P);
1822 static const off_t offset_fileName = MEMORY_ALIGN(offset_methodName + SIZEOF_VOID_P, SIZEOF_VOID_P);
1823 static const off_t offset_lineNumber = MEMORY_ALIGN(offset_fileName + SIZEOF_VOID_P, sizeof(int32_t));
1826 java_lang_StackTraceElement(java_handle_t* h) : java_lang_Object(h) {}
1827 java_lang_StackTraceElement(java_handle_t* declaringClass, java_handle_t* methodName, java_handle_t* fileName, int32_t lineNumber);
1830 inline java_lang_StackTraceElement::java_lang_StackTraceElement(java_handle_t* declaringClass, java_handle_t* methodName, java_handle_t* fileName, int32_t lineNumber)
1832 _handle = builtin_new(class_java_lang_StackTraceElement);
1837 set(_handle, offset_declaringClass, declaringClass);
1838 set(_handle, offset_methodName, methodName);
1839 set(_handle, offset_fileName, fileName);
1840 set(_handle, offset_lineNumber, lineNumber);
1845 * OpenJDK java/lang/String
1855 class java_lang_String : public java_lang_Object, private FieldAccess {
1857 // Static offsets of the object's instance fields.
1858 // TODO These offsets need to be checked on VM startup.
1859 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1860 static const off_t offset_offset = MEMORY_ALIGN(offset_value + SIZEOF_VOID_P, sizeof(int32_t));
1861 static const off_t offset_count = MEMORY_ALIGN(offset_offset + sizeof(int32_t), sizeof(int32_t));
1862 static const off_t offset_hash = MEMORY_ALIGN(offset_count + sizeof(int32_t), sizeof(int32_t));
1865 java_lang_String(java_handle_t* h) : java_lang_Object(h) {}
1866 java_lang_String(jstring h);
1867 java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset = 0);
1870 inline java_handle_chararray_t* get_value () const;
1871 inline int32_t get_offset() const;
1872 inline int32_t get_count () const;
1875 inline void set_value (java_handle_chararray_t* value);
1876 inline void set_offset(int32_t value);
1877 inline void set_count (int32_t value);
1880 inline java_lang_String::java_lang_String(jstring h) : java_lang_Object(h)
1882 java_lang_String((java_handle_t*) h);
1885 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)
1892 inline java_handle_chararray_t* java_lang_String::get_value() const
1894 return get<java_handle_chararray_t*>(_handle, offset_value);
1897 inline int32_t java_lang_String::get_offset() const
1899 return get<int32_t>(_handle, offset_offset);
1902 inline int32_t java_lang_String::get_count() const
1904 return get<int32_t>(_handle, offset_count);
1907 inline void java_lang_String::set_value(java_handle_chararray_t* value)
1909 set(_handle, offset_value, value);
1912 inline void java_lang_String::set_offset(int32_t value)
1914 set(_handle, offset_offset, value);
1917 inline void java_lang_String::set_count(int32_t value)
1919 set(_handle, offset_count, value);
1924 * OpenJDK java/lang/Thread
1931 * 3. java_lang_Thread threadQ;
1933 * 5. boolean single_step;
1934 * 6. boolean daemon;
1935 * 7. boolean stillborn;
1936 * 8. java_lang_Runnable target;
1937 * 9. java_lang_ThreadGroup group;
1938 * 10. java_lang_ClassLoader contextClassLoader;
1939 * 11. java_security_AccessControlContext inheritedAccessControlContext;
1940 * 12. java_lang_ThreadLocal_ThreadLocalMap threadLocals;
1941 * 13. java_lang_ThreadLocal_ThreadLocalMap inheritableThreadLocals;
1942 * 14. long stackSize;
1943 * 15. long nativeParkEventPointer;
1945 * 17. int threadStatus;
1946 * 18. java_lang_Object parkBlocker;
1947 * 19. sun_nio_ch_Interruptible blocker;
1948 * 20. java_lang_Object blockerLock;
1949 * 21. boolean stopBeforeStart;
1950 * 22. java_lang_Throwable throwableFromStop;
1951 * 23. java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
1953 class java_lang_Thread : public java_lang_Object, private FieldAccess {
1955 // Static offsets of the object's instance fields.
1956 // TODO These offsets need to be checked on VM startup.
1957 static const off_t offset_name = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
1958 static const off_t offset_priority = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, sizeof(int32_t));
1959 static const off_t offset_threadQ = MEMORY_ALIGN(offset_priority + sizeof(int32_t), SIZEOF_VOID_P);
1960 static const off_t offset_eetop = MEMORY_ALIGN(offset_threadQ + SIZEOF_VOID_P, sizeof(int64_t));
1961 static const off_t offset_single_step = MEMORY_ALIGN(offset_eetop + sizeof(int64_t), sizeof(int32_t));
1962 static const off_t offset_daemon = MEMORY_ALIGN(offset_single_step + sizeof(int32_t), sizeof(int32_t));
1963 static const off_t offset_stillborn = MEMORY_ALIGN(offset_daemon + sizeof(int32_t), sizeof(int32_t));
1964 static const off_t offset_target = MEMORY_ALIGN(offset_stillborn + sizeof(int32_t), SIZEOF_VOID_P);
1965 static const off_t offset_group = MEMORY_ALIGN(offset_target + SIZEOF_VOID_P, SIZEOF_VOID_P);
1966 static const off_t offset_contextClassLoader = MEMORY_ALIGN(offset_group + SIZEOF_VOID_P, SIZEOF_VOID_P);
1967 static const off_t offset_inheritedAccessControlContext = MEMORY_ALIGN(offset_contextClassLoader + SIZEOF_VOID_P, SIZEOF_VOID_P);
1968 static const off_t offset_threadLocals = MEMORY_ALIGN(offset_inheritedAccessControlContext + SIZEOF_VOID_P, SIZEOF_VOID_P);
1969 static const off_t offset_inheritableThreadLocals = MEMORY_ALIGN(offset_threadLocals + SIZEOF_VOID_P, SIZEOF_VOID_P);
1970 static const off_t offset_stackSize = MEMORY_ALIGN(offset_inheritableThreadLocals + SIZEOF_VOID_P, sizeof(int64_t));
1971 static const off_t offset_nativeParkEventPointer = MEMORY_ALIGN(offset_stackSize + sizeof(int64_t), sizeof(int64_t));
1972 static const off_t offset_tid = MEMORY_ALIGN(offset_nativeParkEventPointer + sizeof(int64_t), sizeof(int64_t));
1973 static const off_t offset_threadStatus = MEMORY_ALIGN(offset_tid + sizeof(int64_t), sizeof(int32_t));
1974 static const off_t offset_parkBlocker = MEMORY_ALIGN(offset_threadStatus + sizeof(int32_t), SIZEOF_VOID_P);
1975 static const off_t offset_blocker = MEMORY_ALIGN(offset_parkBlocker + SIZEOF_VOID_P, SIZEOF_VOID_P);
1976 static const off_t offset_blockerLock = MEMORY_ALIGN(offset_blocker + SIZEOF_VOID_P, SIZEOF_VOID_P);
1977 static const off_t offset_stopBeforeStart = MEMORY_ALIGN(offset_blockerLock + SIZEOF_VOID_P, sizeof(int32_t));
1978 static const off_t offset_throwableFromStop = MEMORY_ALIGN(offset_stopBeforeStart + sizeof(int32_t), SIZEOF_VOID_P);
1979 static const off_t offset_uncaughtExceptionHandler = MEMORY_ALIGN(offset_throwableFromStop + SIZEOF_VOID_P, SIZEOF_VOID_P);
1982 java_lang_Thread(java_handle_t* h) : java_lang_Object(h) {}
1983 // java_lang_Thread(threadobject* t);
1986 inline int32_t get_priority () const;
1987 inline int32_t get_daemon () const;
1988 inline java_handle_t* get_group () const;
1989 inline java_handle_t* get_uncaughtExceptionHandler() const;
1992 inline void set_priority(int32_t value);
1993 inline void set_group (java_handle_t* value);
1997 inline int32_t java_lang_Thread::get_priority() const
1999 return get<int32_t>(_handle, offset_priority);
2002 inline int32_t java_lang_Thread::get_daemon() const
2004 return get<int32_t>(_handle, offset_daemon);
2007 inline java_handle_t* java_lang_Thread::get_group() const
2009 return get<java_handle_t*>(_handle, offset_group);
2012 inline java_handle_t* java_lang_Thread::get_uncaughtExceptionHandler() const
2014 return get<java_handle_t*>(_handle, offset_uncaughtExceptionHandler);
2018 inline void java_lang_Thread::set_priority(int32_t value)
2020 set(_handle, offset_priority, value);
2023 inline void java_lang_Thread::set_group(java_handle_t* value)
2025 set(_handle, offset_group, value);
2031 * OpenJDK java/lang/Throwable
2036 * 1. java.lang.Object backtrace;
2037 * 2. java.lang.String detailMessage;
2038 * 3. java.lang.Throwable cause;
2039 * 4. java.lang.StackTraceElement[] stackTrace;
2041 class java_lang_Throwable : public java_lang_Object, private FieldAccess {
2043 // Static offsets of the object's instance fields.
2044 // TODO These offsets need to be checked on VM startup.
2045 static const off_t offset_backtrace = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
2046 static const off_t offset_detailMessage = MEMORY_ALIGN(offset_backtrace + SIZEOF_VOID_P, SIZEOF_VOID_P);
2047 static const off_t offset_cause = MEMORY_ALIGN(offset_detailMessage + SIZEOF_VOID_P, SIZEOF_VOID_P);
2048 static const off_t offset_stackTrace = MEMORY_ALIGN(offset_cause + SIZEOF_VOID_P, SIZEOF_VOID_P);
2051 java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {}
2052 java_lang_Throwable(jobject h);
2053 java_lang_Throwable(jobject h, java_handle_bytearray_t* backtrace);
2056 inline java_handle_bytearray_t* get_backtrace () const;
2057 inline java_handle_t* get_detailMessage() const;
2058 inline java_handle_t* get_cause () const;
2061 inline void set_backtrace(java_handle_bytearray_t* value);
2065 inline java_lang_Throwable::java_lang_Throwable(jobject h) : java_lang_Object(h)
2067 java_lang_Throwable((java_handle_t*) h);
2070 inline java_lang_Throwable::java_lang_Throwable(jobject h, java_handle_bytearray_t* backtrace) : java_lang_Object(h)
2072 java_lang_Throwable((java_handle_t*) h);
2073 set_backtrace(backtrace);
2077 inline java_handle_bytearray_t* java_lang_Throwable::get_backtrace() const
2079 return get<java_handle_bytearray_t*>(_handle, offset_backtrace);
2082 inline java_handle_t* java_lang_Throwable::get_detailMessage() const
2084 return get<java_handle_t*>(_handle, offset_detailMessage);
2087 inline java_handle_t* java_lang_Throwable::get_cause() const
2089 return get<java_handle_t*>(_handle, offset_cause);
2093 inline void java_lang_Throwable::set_backtrace(java_handle_bytearray_t* value)
2095 set(_handle, offset_backtrace, value);
2100 * OpenJDK java/lang/reflect/Constructor
2105 * 1. boolean override;
2106 * 2. java.lang.Class clazz;
2108 * 4. java.lang.Class[] parameterTypes;
2109 * 5. java.lang.Class[] exceptionTypes;
2111 * 7. java.lang.String signature;
2112 * 8. sun.reflect.generics.repository.ConstructorRepository genericInfo;
2113 * 9. byte[] annotations;
2114 * 10. byte[] parameterAnnotations;
2115 * 11. java.lang.Class securityCheckCache;
2116 * 12. sun.reflect.ConstructorAccessor constructorAccessor;
2117 * 13. java.lang.reflect.Constructor root;
2118 * 14. java.util.Map declaredAnnotations;
2120 class java_lang_reflect_Constructor : public java_lang_Object, private FieldAccess {
2122 // Static offsets of the object's instance fields.
2123 // TODO These offsets need to be checked on VM startup.
2124 static const off_t offset_override = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
2125 static const off_t offset_clazz = MEMORY_ALIGN(offset_override + sizeof(int32_t), SIZEOF_VOID_P);
2126 static const off_t offset_slot = MEMORY_ALIGN(offset_clazz + SIZEOF_VOID_P, sizeof(int32_t));
2127 static const off_t offset_parameterTypes = MEMORY_ALIGN(offset_slot + sizeof(int32_t), SIZEOF_VOID_P);
2128 static const off_t offset_exceptionTypes = MEMORY_ALIGN(offset_parameterTypes + SIZEOF_VOID_P, SIZEOF_VOID_P);
2129 static const off_t offset_modifiers = MEMORY_ALIGN(offset_exceptionTypes + SIZEOF_VOID_P, sizeof(int32_t));
2130 static const off_t offset_signature = MEMORY_ALIGN(offset_modifiers + sizeof(int32_t), SIZEOF_VOID_P);
2131 static const off_t offset_genericInfo = MEMORY_ALIGN(offset_signature + SIZEOF_VOID_P, SIZEOF_VOID_P);
2132 static const off_t offset_annotations = MEMORY_ALIGN(offset_genericInfo + SIZEOF_VOID_P, SIZEOF_VOID_P);
2133 static const off_t offset_parameterAnnotations = MEMORY_ALIGN(offset_annotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
2134 static const off_t offset_securityCheckCache = MEMORY_ALIGN(offset_parameterAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
2135 static const off_t offset_constructorAccessor = MEMORY_ALIGN(offset_securityCheckCache + SIZEOF_VOID_P, SIZEOF_VOID_P);
2136 static const off_t offset_root = MEMORY_ALIGN(offset_constructorAccessor + SIZEOF_VOID_P, SIZEOF_VOID_P);
2137 static const off_t offset_declaredAnnotations = MEMORY_ALIGN(offset_root + SIZEOF_VOID_P, SIZEOF_VOID_P);
2140 java_lang_reflect_Constructor(java_handle_t* h) : java_lang_Object(h) {}
2141 java_lang_reflect_Constructor(jobject h);
2142 java_lang_reflect_Constructor(methodinfo* m);
2144 java_handle_t* new_instance(java_handle_objectarray_t* args);
2147 inline int32_t get_override () const;
2148 inline classinfo* get_clazz () const;
2149 inline int32_t get_slot () const;
2150 inline java_handle_bytearray_t* get_annotations() const;
2153 inline void set_clazz (classinfo* value);
2154 inline void set_slot (int32_t value);
2155 inline void set_parameterTypes (java_handle_objectarray_t* value);
2156 inline void set_exceptionTypes (java_handle_objectarray_t* value);
2157 inline void set_modifiers (int32_t value);
2158 inline void set_signature (java_handle_t* value);
2159 inline void set_annotations (java_handle_bytearray_t* value);
2160 inline void set_parameterAnnotations(java_handle_bytearray_t* value);
2162 // Convenience functions.
2163 inline methodinfo* get_method();
2167 inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(jobject h) : java_lang_Object(h)
2169 java_lang_reflect_Constructor((java_handle_t*) h);
2172 inline java_lang_reflect_Constructor::java_lang_reflect_Constructor(methodinfo* m)
2174 _handle = builtin_new(class_java_lang_reflect_Constructor);
2179 int slot = m - m->clazz->methods;
2180 java_handle_objectarray_t* parameterTypes = method_get_parametertypearray(m);
2181 java_handle_objectarray_t* exceptionTypes = method_get_exceptionarray(m);
2182 java_handle_bytearray_t* annotations = method_get_annotations(m);
2183 java_handle_bytearray_t* parameterAnnotations = method_get_parameterannotations(m);
2185 set_clazz(m->clazz);
2187 set_parameterTypes(parameterTypes);
2188 set_exceptionTypes(exceptionTypes);
2189 set_modifiers(m->flags & ACC_CLASS_REFLECT_MASK);
2190 set_signature(m->signature ? javastring_new(m->signature) : NULL);
2191 set_annotations(annotations);
2192 set_parameterAnnotations(parameterAnnotations);
2196 inline int32_t java_lang_reflect_Constructor::get_override() const
2198 return get<int32_t>(_handle, offset_override);
2201 inline classinfo* java_lang_reflect_Constructor::get_clazz() const
2203 return get<classinfo*>(_handle, offset_clazz);
2206 inline int32_t java_lang_reflect_Constructor::get_slot() const
2208 return get<int32_t>(_handle, offset_slot);
2211 inline java_handle_bytearray_t* java_lang_reflect_Constructor::get_annotations() const
2213 return get<java_handle_bytearray_t*>(_handle, offset_annotations);
2217 inline void java_lang_reflect_Constructor::set_clazz(classinfo* value)
2219 set(_handle, offset_clazz, value);
2222 inline void java_lang_reflect_Constructor::set_slot(int32_t value)
2224 set(_handle, offset_slot, value);
2227 inline void java_lang_reflect_Constructor::set_parameterTypes(java_handle_objectarray_t* value)
2229 set(_handle, offset_parameterTypes, value);
2232 inline void java_lang_reflect_Constructor::set_exceptionTypes(java_handle_objectarray_t* value)
2234 set(_handle, offset_exceptionTypes, value);
2237 inline void java_lang_reflect_Constructor::set_modifiers(int32_t value)
2239 set(_handle, offset_modifiers, value);
2242 inline void java_lang_reflect_Constructor::set_signature(java_handle_t* value)
2244 set(_handle, offset_signature, value);
2247 inline void java_lang_reflect_Constructor::set_annotations(java_handle_bytearray_t* value)
2249 set(_handle, offset_annotations, value);
2252 inline void java_lang_reflect_Constructor::set_parameterAnnotations(java_handle_bytearray_t* value)
2254 set(_handle, offset_parameterAnnotations, value);
2258 inline methodinfo* java_lang_reflect_Constructor::get_method()
2260 classinfo* c = get_clazz();
2261 int32_t slot = get_slot();
2262 methodinfo* m = &(c->methods[slot]);
2268 * OpenJDK java/lang/reflect/Field
2273 * 1. boolean override;
2274 * 2. java.lang.Class clazz;
2276 * 4. java.lang.String name;
2277 * 5. java.lang.Class type;
2279 * 7. java.lang.String signature;
2280 * 8. sun.reflect.generics.repository.FieldRepository genericInfo;
2281 * 9. byte[] annotations;
2282 * 10. sun.reflect.FieldAccessor fieldAccessor;
2283 * 11. sun.reflect.FieldAccessor overrideFieldAccessor;
2284 * 12. java.lang.reflect.Field root;
2285 * 13. java.lang.Class securityCheckCache;
2286 * 14. java.lang.Class securityCheckTargetClassCache;
2287 * 15. java.util.Map declaredAnnotations;
2289 class java_lang_reflect_Field : public java_lang_Object, private FieldAccess {
2291 // Static offsets of the object's instance fields.
2292 // TODO These offsets need to be checked on VM startup.
2293 static const off_t offset_override = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
2294 static const off_t offset_clazz = MEMORY_ALIGN(offset_override + sizeof(int32_t), SIZEOF_VOID_P);
2295 static const off_t offset_slot = MEMORY_ALIGN(offset_clazz + SIZEOF_VOID_P, sizeof(int32_t));
2296 static const off_t offset_name = MEMORY_ALIGN(offset_slot + sizeof(int32_t), SIZEOF_VOID_P);
2297 static const off_t offset_type = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, SIZEOF_VOID_P);
2298 static const off_t offset_modifiers = MEMORY_ALIGN(offset_type + SIZEOF_VOID_P, sizeof(int32_t));
2299 static const off_t offset_signature = MEMORY_ALIGN(offset_modifiers + sizeof(int32_t), SIZEOF_VOID_P);
2300 static const off_t offset_genericInfo = MEMORY_ALIGN(offset_signature + SIZEOF_VOID_P, SIZEOF_VOID_P);
2301 static const off_t offset_annotations = MEMORY_ALIGN(offset_genericInfo + SIZEOF_VOID_P, SIZEOF_VOID_P);
2302 static const off_t offset_fieldAccessor = MEMORY_ALIGN(offset_annotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
2303 static const off_t offset_overrideFieldAccessor = MEMORY_ALIGN(offset_fieldAccessor + SIZEOF_VOID_P, SIZEOF_VOID_P);
2304 static const off_t offset_root = MEMORY_ALIGN(offset_overrideFieldAccessor + SIZEOF_VOID_P, SIZEOF_VOID_P);
2305 static const off_t offset_securityCheckCache = MEMORY_ALIGN(offset_root + SIZEOF_VOID_P, SIZEOF_VOID_P);
2306 static const off_t offset_securityCheckTargetClassCache = MEMORY_ALIGN(offset_securityCheckCache + SIZEOF_VOID_P, SIZEOF_VOID_P);
2307 static const off_t offset_declaredAnnotations = MEMORY_ALIGN(offset_securityCheckTargetClassCache + SIZEOF_VOID_P, SIZEOF_VOID_P);
2310 java_lang_reflect_Field(java_handle_t* h) : java_lang_Object(h) {}
2311 java_lang_reflect_Field(jobject h);
2312 java_lang_reflect_Field(fieldinfo* f);
2315 inline int32_t get_override () const;
2316 inline classinfo* get_clazz () const;
2317 inline int32_t get_slot () const;
2318 inline java_handle_bytearray_t* get_annotations() const;
2321 inline void set_clazz (classinfo* value);
2322 inline void set_slot (int32_t value);
2323 inline void set_name (java_handle_t* value);
2324 inline void set_type (classinfo* value);
2325 inline void set_modifiers (int32_t value);
2326 inline void set_signature (java_handle_t* value);
2327 inline void set_annotations(java_handle_bytearray_t* value);
2329 // Convenience functions.
2330 inline fieldinfo* get_field() const;
2334 inline java_lang_reflect_Field::java_lang_reflect_Field(jobject h) : java_lang_Object(h)
2336 java_lang_reflect_Field((java_handle_t*) h);
2339 inline java_lang_reflect_Field::java_lang_reflect_Field(fieldinfo* f)
2341 _handle = builtin_new(class_java_lang_reflect_Field);
2347 set_clazz(f->clazz);
2348 set_slot(f - f->clazz->fields);
2349 set_name(javastring_intern(javastring_new(f->name)));
2350 set_type(field_get_type(f));
2351 set_modifiers(f->flags);
2352 set_signature(f->signature ? javastring_new(f->signature) : NULL);
2353 set_annotations(field_get_annotations(f));
2357 inline int32_t java_lang_reflect_Field::get_override() const
2359 return get<int32_t>(_handle, offset_override);
2362 inline classinfo* java_lang_reflect_Field::get_clazz() const
2364 return get<classinfo*>(_handle, offset_clazz);
2367 inline int32_t java_lang_reflect_Field::get_slot() const
2369 return get<int32_t>(_handle, offset_slot);
2372 inline java_handle_bytearray_t* java_lang_reflect_Field::get_annotations() const
2374 return get<java_handle_bytearray_t*>(_handle, offset_annotations);
2378 inline void java_lang_reflect_Field::set_clazz(classinfo* value)
2380 set(_handle, offset_clazz, value);
2383 inline void java_lang_reflect_Field::set_slot(int32_t value)
2385 set(_handle, offset_slot, value);
2388 inline void java_lang_reflect_Field::set_name(java_handle_t* value)
2390 set(_handle, offset_name, value);
2393 inline void java_lang_reflect_Field::set_type(classinfo* value)
2395 set(_handle, offset_type, value);
2398 inline void java_lang_reflect_Field::set_modifiers(int32_t value)
2400 set(_handle, offset_modifiers, value);
2403 inline void java_lang_reflect_Field::set_signature(java_handle_t* value)
2405 set(_handle, offset_signature, value);
2408 inline void java_lang_reflect_Field::set_annotations(java_handle_bytearray_t* value)
2410 set(_handle, offset_annotations, value);
2414 inline fieldinfo* java_lang_reflect_Field::get_field() const
2416 classinfo* c = get_clazz();
2417 int32_t slot = get_slot();
2418 fieldinfo* f = &(c->fields[slot]);
2424 * OpenJDK java/lang/reflect/Method
2429 * 1. boolean override;
2430 * 2. java.lang.Class clazz;
2432 * 4. java.lang.String name;
2433 * 5. java.lang.Class returnType;
2434 * 6. java.lang.Class[] parameterTypes;
2435 * 7. java.lang.Class[] exceptionTypes;
2437 * 9. java.lang.String signature;
2438 * 10 sun.reflect.generics.repository.ConstructorRepository genericInfo;
2439 * 11. byte[] annotations;
2440 * 12. byte[] parameterAnnotations;
2441 * 13. byte[] annotationDefault;
2442 * 14. sun.reflect.MethodAccessor methodAccessor;
2443 * 15. java.lang.reflect.Method root;
2444 * 16. java.lang.Class securityCheckCache;
2445 * 17. java.lang.Class securityCheckTargetClassCache;
2446 * 18. java.util.Map declaredAnnotations;
2448 class java_lang_reflect_Method : public java_lang_Object, private FieldAccess {
2450 // Static offsets of the object's instance fields.
2451 // TODO These offsets need to be checked on VM startup.
2452 static const off_t offset_override = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
2453 static const off_t offset_clazz = MEMORY_ALIGN(offset_override + sizeof(int32_t), SIZEOF_VOID_P);
2454 static const off_t offset_slot = MEMORY_ALIGN(offset_clazz + SIZEOF_VOID_P, sizeof(int32_t));
2455 static const off_t offset_name = MEMORY_ALIGN(offset_slot + sizeof(int32_t), SIZEOF_VOID_P);
2456 static const off_t offset_returnType = MEMORY_ALIGN(offset_name + SIZEOF_VOID_P, SIZEOF_VOID_P);
2457 static const off_t offset_parameterTypes = MEMORY_ALIGN(offset_returnType + SIZEOF_VOID_P, SIZEOF_VOID_P);
2458 static const off_t offset_exceptionTypes = MEMORY_ALIGN(offset_parameterTypes + SIZEOF_VOID_P, SIZEOF_VOID_P);
2459 static const off_t offset_modifiers = MEMORY_ALIGN(offset_exceptionTypes + SIZEOF_VOID_P, sizeof(int32_t));
2460 static const off_t offset_signature = MEMORY_ALIGN(offset_modifiers + sizeof(int32_t), SIZEOF_VOID_P);
2461 static const off_t offset_genericInfo = MEMORY_ALIGN(offset_signature + SIZEOF_VOID_P, SIZEOF_VOID_P);
2462 static const off_t offset_annotations = MEMORY_ALIGN(offset_genericInfo + SIZEOF_VOID_P, SIZEOF_VOID_P);
2463 static const off_t offset_parameterAnnotations = MEMORY_ALIGN(offset_annotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
2464 static const off_t offset_annotationDefault = MEMORY_ALIGN(offset_parameterAnnotations + SIZEOF_VOID_P, SIZEOF_VOID_P);
2465 static const off_t offset_methodAccessor = MEMORY_ALIGN(offset_annotationDefault + SIZEOF_VOID_P, SIZEOF_VOID_P);
2466 static const off_t offset_root = MEMORY_ALIGN(offset_methodAccessor + SIZEOF_VOID_P, SIZEOF_VOID_P);
2467 static const off_t offset_securityCheckCache = MEMORY_ALIGN(offset_root + SIZEOF_VOID_P, SIZEOF_VOID_P);
2468 static const off_t offset_securityCheckTargetClassCache = MEMORY_ALIGN(offset_securityCheckCache + SIZEOF_VOID_P, SIZEOF_VOID_P);
2469 static const off_t offset_declaredAnnotations = MEMORY_ALIGN(offset_securityCheckTargetClassCache + SIZEOF_VOID_P, SIZEOF_VOID_P);
2472 java_lang_reflect_Method(java_handle_t* h) : java_lang_Object(h) {}
2473 java_lang_reflect_Method(jobject h);
2474 java_lang_reflect_Method(methodinfo* m);
2476 java_handle_t* invoke(java_handle_t* o, java_handle_objectarray_t* args);
2479 inline int32_t get_override () const;
2480 inline classinfo* get_clazz () const;
2481 inline int32_t get_slot () const;
2482 inline java_handle_bytearray_t* get_annotations () const;
2483 inline java_handle_bytearray_t* get_parameterAnnotations() const;
2484 inline java_handle_bytearray_t* get_annotationDefault () const;
2488 // Convenience functions.
2489 inline methodinfo* get_method() const;
2493 inline java_lang_reflect_Method::java_lang_reflect_Method(jobject h) : java_lang_Object(h)
2495 java_lang_reflect_Method((java_handle_t*) h);
2498 inline java_lang_reflect_Method::java_lang_reflect_Method(methodinfo* m)
2500 _handle = builtin_new(class_java_lang_reflect_Method);
2505 set(_handle, offset_clazz, m->clazz);
2506 set(_handle, offset_slot, m - m->clazz->methods);
2507 set(_handle, offset_name, javastring_intern(javastring_new(m->name)));
2508 set(_handle, offset_returnType, method_returntype_get(m));
2509 set(_handle, offset_parameterTypes, method_get_parametertypearray(m));
2510 set(_handle, offset_exceptionTypes, method_get_exceptionarray(m));
2511 set(_handle, offset_modifiers, m->flags & ACC_CLASS_REFLECT_MASK);
2512 set(_handle, offset_signature, m->signature ? javastring_new(m->signature) : NULL);
2513 set(_handle, offset_annotations, method_get_annotations(m));
2514 set(_handle, offset_parameterAnnotations, method_get_parameterannotations(m));
2515 set(_handle, offset_annotationDefault, method_get_annotationdefault(m));
2519 inline int32_t java_lang_reflect_Method::get_override() const
2521 return get<int32_t>(_handle, offset_override);
2524 inline classinfo* java_lang_reflect_Method::get_clazz() const
2526 return get<classinfo*>(_handle, offset_clazz);
2529 inline int32_t java_lang_reflect_Method::get_slot() const
2531 return get<int32_t>(_handle, offset_slot);
2534 inline java_handle_bytearray_t* java_lang_reflect_Method::get_annotations() const
2536 return get<java_handle_bytearray_t*>(_handle, offset_annotations);
2539 inline java_handle_bytearray_t* java_lang_reflect_Method::get_parameterAnnotations() const
2541 return get<java_handle_bytearray_t*>(_handle, offset_parameterAnnotations);
2544 inline java_handle_bytearray_t* java_lang_reflect_Method::get_annotationDefault() const
2546 return get<java_handle_bytearray_t*>(_handle, offset_annotationDefault);
2550 inline methodinfo* java_lang_reflect_Method::get_method() const
2552 classinfo* c = get_clazz();
2553 int32_t slot = get_slot();
2554 methodinfo* m = &(c->methods[slot]);
2560 * OpenJDK java/nio/Buffer
2571 class java_nio_Buffer : public java_lang_Object, private FieldAccess {
2573 // Static offsets of the object's instance fields.
2574 // TODO These offsets need to be checked on VM startup.
2575 static const off_t offset_mark = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
2576 static const off_t offset_position = MEMORY_ALIGN(offset_mark + sizeof(int32_t), sizeof(int32_t));
2577 static const off_t offset_limit = MEMORY_ALIGN(offset_position + sizeof(int32_t), sizeof(int32_t));
2578 static const off_t offset_capacity = MEMORY_ALIGN(offset_limit + sizeof(int32_t), sizeof(int32_t));
2579 static const off_t offset_address = MEMORY_ALIGN(offset_capacity + sizeof(int32_t), sizeof(int64_t));
2582 java_nio_Buffer(java_handle_t* h) : java_lang_Object(h) {}
2583 java_nio_Buffer(jobject h) : java_lang_Object(h) {}
2586 inline void* get_address() const;
2590 inline void* java_nio_Buffer::get_address() const
2592 return get<void*>(_handle, offset_address);
2595 #endif // WITH_JAVA_RUNTIME_LIBRARY_OPENJDK
2598 #if defined(WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1)
2601 * CLDC 1.1 com/sun/cldchi/jvm/FileDescriptor
2610 class com_sun_cldchi_jvm_FileDescriptor : public java_lang_Object, private FieldAccess {
2612 // Static offsets of the object's instance fields.
2613 // TODO These offsets need to be checked on VM startup.
2614 static const off_t offset_pointer = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int64_t));
2615 static const off_t offset_position = MEMORY_ALIGN(offset_pointer + sizeof(int64_t), sizeof(int32_t));
2616 static const off_t offset_length = MEMORY_ALIGN(offset_position + sizeof(int32_t), sizeof(int32_t));
2619 com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h) : java_lang_Object(h) {}
2620 com_sun_cldchi_jvm_FileDescriptor(jobject h);
2621 com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h, int64_t pointer, int32_t position, int32_t length);
2622 com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h, com_sun_cldchi_jvm_FileDescriptor& fd);
2625 inline int64_t get_pointer () const;
2626 inline int32_t get_position() const;
2627 inline int32_t get_length () const;
2630 inline void set_pointer (int64_t value);
2631 inline void set_position(int32_t value);
2632 inline void set_length (int32_t value);
2636 inline com_sun_cldchi_jvm_FileDescriptor::com_sun_cldchi_jvm_FileDescriptor(jobject h) : java_lang_Object(h)
2638 com_sun_cldchi_jvm_FileDescriptor((java_handle_t*) h);
2641 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)
2643 set_pointer(pointer);
2644 set_position(position);
2648 inline com_sun_cldchi_jvm_FileDescriptor::com_sun_cldchi_jvm_FileDescriptor(java_handle_t* h, com_sun_cldchi_jvm_FileDescriptor& fd) : java_lang_Object(h)
2650 com_sun_cldchi_jvm_FileDescriptor(h, fd.get_pointer(), fd.get_position(), fd.get_length());
2654 inline int64_t com_sun_cldchi_jvm_FileDescriptor::get_pointer() const
2656 return get<int64_t>(_handle, offset_pointer);
2659 inline int32_t com_sun_cldchi_jvm_FileDescriptor::get_position() const
2661 return get<int32_t>(_handle, offset_position);
2664 inline int32_t com_sun_cldchi_jvm_FileDescriptor::get_length() const
2666 return get<int32_t>(_handle, offset_length);
2670 inline void com_sun_cldchi_jvm_FileDescriptor::set_pointer(int64_t value)
2672 set(_handle, offset_pointer, value);
2675 inline void com_sun_cldchi_jvm_FileDescriptor::set_position(int32_t value)
2677 set(_handle, offset_position, value);
2680 inline void com_sun_cldchi_jvm_FileDescriptor::set_length(int32_t value)
2682 set(_handle, offset_length, value);
2687 * CLDC 1.1 java/lang/String
2696 class java_lang_String : public java_lang_Object, private FieldAccess {
2698 // Static offsets of the object's instance fields.
2699 // TODO These offsets need to be checked on VM startup.
2700 static const off_t offset_value = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
2701 static const off_t offset_offset = MEMORY_ALIGN(offset_value + SIZEOF_VOID_P, sizeof(int32_t));
2702 static const off_t offset_count = MEMORY_ALIGN(offset_offset + sizeof(int32_t), sizeof(int32_t));
2705 java_lang_String(java_handle_t* h) : java_lang_Object(h) {}
2706 java_lang_String(jstring h);
2707 java_lang_String(java_handle_t* h, java_handle_chararray_t* value, int32_t count, int32_t offset = 0);
2710 inline java_handle_chararray_t* get_value () const;
2711 inline int32_t get_offset() const;
2712 inline int32_t get_count () const;
2715 inline void set_value (java_handle_chararray_t* value);
2716 inline void set_offset(int32_t value);
2717 inline void set_count (int32_t value);
2720 inline java_lang_String::java_lang_String(jstring h) : java_lang_Object(h)
2722 java_lang_String((java_handle_t*) h);
2725 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)
2732 inline java_handle_chararray_t* java_lang_String::get_value() const
2734 return get<java_handle_chararray_t*>(_handle, offset_value);
2737 inline int32_t java_lang_String::get_offset() const
2739 return get<int32_t>(_handle, offset_offset);
2742 inline int32_t java_lang_String::get_count() const
2744 return get<int32_t>(_handle, offset_count);
2747 inline void java_lang_String::set_value(java_handle_chararray_t* value)
2749 set(_handle, offset_value, value);
2752 inline void java_lang_String::set_offset(int32_t value)
2754 set(_handle, offset_offset, value);
2757 inline void java_lang_String::set_count(int32_t value)
2759 set(_handle, offset_count, value);
2764 * CLDC 1.1 java/lang/Thread
2770 * 2. java.lang.Runnable runnable;
2771 * 3. java.lang.Object vm_thread;
2772 * 4. int is_terminated;
2773 * 5. int is_stillborn;
2776 class java_lang_Thread : public java_lang_Object, private FieldAccess {
2778 // Static offsets of the object's instance fields.
2779 // TODO These offsets need to be checked on VM startup.
2780 static const off_t offset_priority = MEMORY_ALIGN(sizeof(java_object_t), sizeof(int32_t));
2781 static const off_t offset_runnable = MEMORY_ALIGN(offset_priority + sizeof(int32_t), SIZEOF_VOID_P);
2782 static const off_t offset_vm_thread = MEMORY_ALIGN(offset_runnable + SIZEOF_VOID_P, SIZEOF_VOID_P);
2783 static const off_t offset_is_terminated = MEMORY_ALIGN(offset_vm_thread + SIZEOF_VOID_P, sizeof(int32_t));
2784 static const off_t offset_is_stillborn = MEMORY_ALIGN(offset_is_terminated + sizeof(int32_t), sizeof(int32_t));
2785 static const off_t offset_name = MEMORY_ALIGN(offset_is_stillborn + sizeof(int32_t), SIZEOF_VOID_P);
2788 java_lang_Thread(java_handle_t* h) : java_lang_Object(h) {}
2789 java_lang_Thread(jobject h);
2790 // java_lang_Thread(threadobject* t);
2793 inline int32_t get_priority () const;
2794 inline threadobject* get_vm_thread() const;
2795 inline java_handle_chararray_t* get_name () const;
2798 inline void set_vm_thread(threadobject* value);
2802 inline java_lang_Thread::java_lang_Thread(jobject h) : java_lang_Object(h)
2804 java_lang_Thread((java_handle_t*) h);
2807 // inline java_lang_Thread::java_lang_Thread(threadobject* t) : java_lang_Object(h)
2809 // java_lang_Thread(thread_get_object(t));
2813 inline int32_t java_lang_Thread::get_priority() const
2815 return get<int32_t>(_handle, offset_priority);
2818 inline threadobject* java_lang_Thread::get_vm_thread() const
2820 return get<threadobject*>(_handle, offset_vm_thread);
2823 inline java_handle_chararray_t* java_lang_Thread::get_name() const
2825 return get<java_handle_chararray_t*>(_handle, offset_name);
2829 inline void java_lang_Thread::set_vm_thread(threadobject* value)
2831 set(_handle, offset_vm_thread, value);
2836 * CLDC 1.1 java/lang/Throwable
2841 * 1. java.lang.String detailMessage;
2842 * 2. java.lang.Object backtrace;
2844 class java_lang_Throwable : public java_lang_Object, private FieldAccess {
2846 // Static offsets of the object's instance fields.
2847 // TODO These offsets need to be checked on VM startup.
2848 static const off_t offset_detailMessage = MEMORY_ALIGN(sizeof(java_object_t), SIZEOF_VOID_P);
2849 static const off_t offset_backtrace = MEMORY_ALIGN(offset_detailMessage + SIZEOF_VOID_P, SIZEOF_VOID_P);
2852 java_lang_Throwable(java_handle_t* h) : java_lang_Object(h) {}
2853 java_lang_Throwable(jobject h);
2856 inline java_handle_t* get_detailMessage() const;
2857 inline java_handle_bytearray_t* get_backtrace () const;
2860 inline void set_backtrace(java_handle_bytearray_t* value);
2864 inline java_lang_Throwable::java_lang_Throwable(jobject h) : java_lang_Object(h)
2866 java_lang_Throwable((java_handle_t*) h);
2870 inline java_handle_t* java_lang_Throwable::get_detailMessage() const
2872 return get<java_handle_t*>(_handle, offset_detailMessage);
2875 inline java_handle_bytearray_t* java_lang_Throwable::get_backtrace() const
2877 return get<java_handle_bytearray_t*>(_handle, offset_backtrace);
2881 inline void java_lang_Throwable::set_backtrace(java_handle_bytearray_t* value)
2883 set(_handle, offset_backtrace, value);
2886 #endif // WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1
2890 // Legacy C interface.
2891 java_handle_t* java_lang_reflect_Constructor_create(methodinfo* m);
2892 java_handle_t* java_lang_reflect_Field_create(fieldinfo* f);
2893 java_handle_t* java_lang_reflect_Method_create(methodinfo* m);
2897 #endif // _JAVAOBJECTS_HPP
2901 * These are local overrides for various environment variables in Emacs.
2902 * Please do not remove this and leave it at the end of the file, where
2903 * Emacs will automagically detect them.
2904 * ---------------------------------------------------------------------
2907 * indent-tabs-mode: t