Commit 607adf67 by Bryce McKinlay Committed by Bryce McKinlay

Class.h (isInterface): Move implementation from natClass.cc.

	* java/lang/Class.h (isInterface): Move implementation from
	natClass.cc. Declare inline.
	(Class): Add default constructor.
	* java/lang/Object.h: Update comments.
	* java/lang/natClass.cc (initializeClass): Use _Jv_InitClass to
	initialize superclass, saving a call if super is already initialized.

From-SVN: r39091
parent 61a24907
2001-01-17 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/Class.h (isInterface): Move implementation from
natClass.cc. Declare inline.
(Class): Add default constructor.
* java/lang/Object.h: Update comments.
* java/lang/natClass.cc (initializeClass): Use _Jv_InitClass to
initialize superclass, saving a call if super is already initialized.
2001-01-16 Alexandre Petit-Bianco <apbianco@cygnus.com> 2001-01-16 Alexandre Petit-Bianco <apbianco@cygnus.com>
* prims.cc (init_prim_class): Deleted. * prims.cc (init_prim_class): Deleted.
......
...@@ -174,7 +174,8 @@ public: ...@@ -174,7 +174,8 @@ public:
jboolean isAssignableFrom (jclass cls); jboolean isAssignableFrom (jclass cls);
jboolean isInstance (jobject obj); jboolean isInstance (jobject obj);
jboolean isInterface (void)
inline jboolean isInterface (void)
{ {
return (accflags & java::lang::reflect::Modifier::INTERFACE) != 0; return (accflags & java::lang::reflect::Modifier::INTERFACE) != 0;
} }
...@@ -196,16 +197,17 @@ public: ...@@ -196,16 +197,17 @@ public:
// finalization // finalization
void finalize (); void finalize ();
// This constructor is used to create Class object for the primitive Class () {};
// types.
Class (jobject cname, jbyte sig, jint len, jobject array_vtable) {
// This constructor is used to create Class object for the primitive
// types. See prims.cc.
Class (jobject cname, jbyte sig, jint len, jobject array_vtable)
{
using namespace java::lang::reflect; using namespace java::lang::reflect;
_Jv_Utf8Const *_Jv_makeUtf8Const (char *s, int len); _Jv_Utf8Const *_Jv_makeUtf8Const (char *s, int len);
// C++ ctors are fixing the vtbl in a way that doesn't fit Java. // C++ ctors set the vtbl pointer to point at an offset inside the vtable
// We can fix the C++ compiler, or we can hack our runtime. What's // object. That doesn't work for Java, so this hack adjusts it back.
// below fix the vtable so that it starts at -2.
void *p = ((void **)this)[0]; void *p = ((void **)this)[0];
((void **)this)[0] = (void *)((char *)p-2*sizeof (void *)); ((void **)this)[0] = (void *)((char *)p-2*sizeof (void *));
......
...@@ -16,15 +16,13 @@ details. */ ...@@ -16,15 +16,13 @@ details. */
#include <gcj/javaprims.h> #include <gcj/javaprims.h>
// This class is mainly here as a kludge to get G++ to allocate two // This class is mainly here as a kludge to get G++ to allocate two
// extra entries in the vtable. We will use them to store data. This // extra entries in each vtable.
// allows us to support the new C++ ABI.
struct _JvObjectPrefix struct _JvObjectPrefix
{ {
protected: protected:
// New ABI Compatibility Dummy, #1 and 2. // New ABI Compatibility Dummy, #1 and 2.
virtual void nacd_1 (void) {}; virtual void nacd_1 (void) {}; // This slot really contains the Class pointer.
virtual void nacd_2 (void) {}; virtual void nacd_2 (void) {}; // Actually the GC bitmap marking descriptor.
}; };
class java::lang::Object : public _JvObjectPrefix class java::lang::Object : public _JvObjectPrefix
......
...@@ -732,7 +732,7 @@ java::lang::Class::initializeClass (void) ...@@ -732,7 +732,7 @@ java::lang::Class::initializeClass (void)
{ {
try try
{ {
superclass->initializeClass (); _Jv_InitClass (superclass);
} }
catch (java::lang::Throwable *except) catch (java::lang::Throwable *except)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment