diff options
author | Bryce McKinlay <bryce@waitaki.otago.ac.nz> | 2001-05-06 13:42:11 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2001-05-06 14:42:11 +0100 |
commit | 7026707d152f30b0615dd3c6eabd62bedd5c30a4 (patch) | |
tree | f62a0ac2c76e3f6fc5e76e82edf15c3f0d846aa4 /libjava | |
parent | 2a7f63c4366e4dea8e122f33cc83ccc24d20ed57 (diff) | |
download | gcc-7026707d152f30b0615dd3c6eabd62bedd5c30a4.zip gcc-7026707d152f30b0615dd3c6eabd62bedd5c30a4.tar.gz gcc-7026707d152f30b0615dd3c6eabd62bedd5c30a4.tar.bz2 |
Class.h (_Jv_Self): New union type.
* java/lang/Class.h (_Jv_Self): New union type.
(Class): Manipulate vtable pointer via _Jv_Self union. Thanks to
Jeff Sturm and Fergus Henderson.
* java/lang/ClassLoader.java: Remove dead code fragment.
From-SVN: r41876
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 10 | ||||
-rw-r--r-- | libjava/java/lang/Class.h | 12 | ||||
-rw-r--r-- | libjava/java/lang/ClassLoader.java | 4 |
3 files changed, 19 insertions, 7 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 018b62b..5a95e2f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,13 @@ +2001-05-06 Bryce McKinlay <bryce@waitaki.otago.ac.nz> + + * java/lang/Class.h (_Jv_Self): New union type. + (Class): Manipulate vtable pointer via _Jv_Self union. Thanks to + Jeff Sturm and Fergus Henderson. + +2001-05-06 Bryce McKinlay <bryce@waitaki.otago.ac.nz> + + * java/lang/ClassLoader.java: Remove dead code fragment. + 2001-05-03 Martin Kahlert <martin.kahlert@infineon.com> * jni.cc (_Jv_JNI_GetPrimitiveArrayRegion): Fixed bounds diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index a0cd730..8cce30f 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -99,6 +99,13 @@ struct _Jv_ifaces jshort count; }; +// Used for vtable pointer manipulation. +union _Jv_Self +{ + char *vtable_ptr; + jclass self; +}; + #define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1) #define JV_CLASS(Obj) ((jclass) (*(_Jv_VTable **) Obj)->clas) @@ -211,9 +218,8 @@ public: // C++ ctors set the vtbl pointer to point at an offset inside the vtable // object. That doesn't work for Java, so this hack adjusts it back. - void *p = ((void **)this)[0]; - ((void **)this)[0] = (void *)((char *)p-2*sizeof (void *)); - + ((_Jv_Self *)this)->vtable_ptr -= 2 * sizeof (void *); + // We must initialize every field of the class. We do this in the // same order they are declared in Class.h, except for fields that // are initialized to NULL. diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java index 56d73e6..9c4b3c8 100644 --- a/libjava/java/lang/ClassLoader.java +++ b/libjava/java/lang/ClassLoader.java @@ -91,10 +91,6 @@ public abstract class ClassLoader return loadClass (name, false); } - /* findClass implementation for the system classloader. - native Class systemFindClass(String name) - throws java.lang.ClassNotFoundException; - /** * Loads the class by the given name. The default implementation * will search for the class in the following order (similar to jdk 1.2) |