Commit 4017ae6e by Jeff Sturm Committed by Jeff Sturm

exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit of catch_type.

* exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit
of catch_type.
* java/lang/natClass.cc (initializeClass): Link vtable, otable,
idt tables after initializing superclass.
* java/lang/natClassLoader.cc (uaddr): New typedef.
(_Jv_PrepareCompiledClass): Resolve superclass, interfaces
if they are constant pool indicies.  Don't link vtable, otable yet.

From-SVN: r60450
parent d3ab697b
2002-12-23 Jeff Sturm <jsturm@one-point.com>
* exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit
of catch_type.
* java/lang/natClass.cc (initializeClass): Link vtable, otable,
idt tables after initializing superclass.
* java/lang/natClassLoader.cc (uaddr): New typedef.
(_Jv_PrepareCompiledClass): Resolve superclass, interfaces
if they are constant pool indicies. Don't link vtable, otable yet.
2002-12-21 Anthony Green <green@redhat.com> 2002-12-21 Anthony Green <green@redhat.com>
* Makefile.am: Move org.xml.sax and org.w3c.dom into their own * Makefile.am: Move org.xml.sax and org.w3c.dom into their own
......
...@@ -338,7 +338,7 @@ PERSONALITY_FUNCTION (int version, ...@@ -338,7 +338,7 @@ PERSONALITY_FUNCTION (int version,
// The catch_type is either a (java::lang::Class*) or // The catch_type is either a (java::lang::Class*) or
// is one more than a (Utf8Const*). // is one more than a (Utf8Const*).
if ((size_t)catch_type & 1) if ((size_t)catch_type & 1)
catch_type = _Jv_FindClass ((Utf8Const*)catch_type - 1, NULL); catch_type = _Jv_FindClass ((Utf8Const*)((size_t)catch_type ^ 1), NULL);
if (_Jv_IsInstanceOf (xh->value, catch_type)) if (_Jv_IsInstanceOf (xh->value, catch_type))
{ {
......
...@@ -758,9 +758,6 @@ java::lang::Class::initializeClass (void) ...@@ -758,9 +758,6 @@ java::lang::Class::initializeClass (void)
} }
} }
if (state <= JV_STATE_LINKED)
_Jv_PrepareConstantTimeTables (this);
// Step 2. // Step 2.
java::lang::Thread *self = java::lang::Thread::currentThread(); java::lang::Thread *self = java::lang::Thread::currentThread();
// FIXME: `self' can be null at startup. Hence this nasty trick. // FIXME: `self' can be null at startup. Hence this nasty trick.
...@@ -805,6 +802,14 @@ java::lang::Class::initializeClass (void) ...@@ -805,6 +802,14 @@ java::lang::Class::initializeClass (void)
} }
} }
_Jv_PrepareConstantTimeTables (this);
if (vtable == NULL)
_Jv_MakeVTable(this);
if (otable != NULL && otable->state == 0)
_Jv_LinkOffsetTable(this);
// Steps 8, 9, 10, 11. // Steps 8, 9, 10, 11.
try try
{ {
......
...@@ -178,6 +178,8 @@ java::lang::VMClassLoader::getPrimitiveClass (jchar type) ...@@ -178,6 +178,8 @@ java::lang::VMClassLoader::getPrimitiveClass (jchar type)
return _Jv_FindClassFromSignature (sig, NULL); return _Jv_FindClassFromSignature (sig, NULL);
} }
typedef unsigned int uaddr __attribute__ ((mode (pointer)));
/** This function does class-preparation for compiled classes. /** This function does class-preparation for compiled classes.
NOTE: It contains replicated functionality from NOTE: It contains replicated functionality from
_Jv_ResolvePoolEntry, and this is intentional, since that function _Jv_ResolvePoolEntry, and this is intentional, since that function
...@@ -193,6 +195,9 @@ _Jv_PrepareCompiledClass (jclass klass) ...@@ -193,6 +195,9 @@ _Jv_PrepareCompiledClass (jclass klass)
klass->state = JV_STATE_LINKED; klass->state = JV_STATE_LINKED;
_Jv_Constants *pool = &klass->constants; _Jv_Constants *pool = &klass->constants;
// Resolve class constants first, since other constant pool
// entries may rely on these.
for (int index = 1; index < pool->size; ++index) for (int index = 1; index < pool->size; ++index)
{ {
if (pool->tags[index] == JV_CONSTANT_Class) if (pool->tags[index] == JV_CONSTANT_Class)
...@@ -215,7 +220,22 @@ _Jv_PrepareCompiledClass (jclass klass) ...@@ -215,7 +220,22 @@ _Jv_PrepareCompiledClass (jclass klass)
pool->data[index].clazz = found; pool->data[index].clazz = found;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag; pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
} }
else if (pool->tags[index] == JV_CONSTANT_String) }
// If superclass looks like a constant pool entry,
// resolve it now.
if ((uaddr) klass->superclass < pool->size)
klass->superclass = pool->data[(int) klass->superclass].clazz;
// Likewise for interfaces.
for (int i = 0; i < klass->interface_count; i++)
if ((uaddr) klass->interfaces[i] < pool->size)
klass->interfaces[i] = pool->data[(int) klass->interfaces[i]].clazz;
// Resolve the remaining constant pool entries.
for (int index = 1; index < pool->size; ++index)
{
if (pool->tags[index] == JV_CONSTANT_String)
{ {
jstring str; jstring str;
...@@ -251,12 +271,6 @@ _Jv_PrepareCompiledClass (jclass klass) ...@@ -251,12 +271,6 @@ _Jv_PrepareCompiledClass (jclass klass)
} }
#endif /* INTERPRETER */ #endif /* INTERPRETER */
if (klass->vtable == NULL)
_Jv_MakeVTable(klass);
if (klass->otable != NULL && klass->otable->state == 0)
_Jv_LinkOffsetTable(klass);
klass->notifyAll (); klass->notifyAll ();
_Jv_PushClass (klass); _Jv_PushClass (klass);
......
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