misc. bugfixes and tweaks

This commit is contained in:
Joel Dice
2007-07-28 10:10:13 -06:00
parent 363801af1c
commit 41bee5829e
12 changed files with 228 additions and 141 deletions

View File

@ -939,7 +939,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
if (strcmp(reinterpret_cast<const int8_t*>("<clinit>"),
&byteArrayBody(t, methodName(t, method), 0)) == 0)
{
set(t, classInitializer(t, class_), method);
classVmFlags(t, class_) |= NeedInitFlag;
}
} else {
++ declaredVirtualCount;
@ -1096,8 +1096,7 @@ parseClass(Thread* t, const uint8_t* data, unsigned size)
0, // vtable
0, // fields
0, // methods
0, // static table
0); // initializer
0); // static table
PROTECT(t, class_);
unsigned super = s.read2();
@ -1107,7 +1106,8 @@ parseClass(Thread* t, const uint8_t* data, unsigned size)
set(t, classSuper(t, class_), sc);
classVmFlags(t, class_) |= classVmFlags(t, sc);
classVmFlags(t, class_)
|= (classVmFlags(t, sc) & (ReferenceFlag | WeakReferenceFlag));
}
parseInterfaceTable(t, s, class_, pool);
@ -1143,6 +1143,7 @@ updateBootstrapClass(Thread* t, object bootstrapClass, object class_)
ENTER(t, Thread::ExclusiveState);
classFlags(t, bootstrapClass) = classFlags(t, class_);
classVmFlags(t, bootstrapClass) |= classVmFlags(t, class_);
set(t, classSuper(t, bootstrapClass), classSuper(t, class_));
set(t, classInterfaceTable(t, bootstrapClass),
@ -1151,7 +1152,6 @@ updateBootstrapClass(Thread* t, object bootstrapClass, object class_)
set(t, classFieldTable(t, bootstrapClass), classFieldTable(t, class_));
set(t, classMethodTable(t, bootstrapClass), classMethodTable(t, class_));
set(t, classStaticTable(t, bootstrapClass), classStaticTable(t, class_));
set(t, classInitializer(t, bootstrapClass), classInitializer(t, class_));
object fieldTable = classFieldTable(t, class_);
if (fieldTable) {
@ -1186,7 +1186,6 @@ makeArrayClass(Thread* t, unsigned dimensions, object spec,
classVirtualTable(t, arrayBody(t, t->vm->types, Machine::JobjectType)),
0,
0,
0,
0);
}
@ -1376,7 +1375,7 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
populateBuiltinMap(t, m->builtinMap);
t->javaThread = makeThread(t, 0, 0, reinterpret_cast<int64_t>(t));
t->javaThread = makeThread(t, 0, 0, 0, reinterpret_cast<int64_t>(t));
} else {
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
parent->child = this;
@ -1680,6 +1679,21 @@ instanceOf(Thread* t, object class_, object o)
}
}
object
classInitializer(Thread* t, object class_)
{
for (unsigned i = 0; i < arrayLength(t, classMethodTable(t, class_)); ++i) {
object o = arrayBody(t, classMethodTable(t, class_), i);
if (strcmp(reinterpret_cast<const int8_t*>("<clinit>"),
&byteArrayBody(t, methodName(t, o), 0)) == 0)
{
return o;
}
}
abort(t);
}
unsigned
parameterFootprint(const char* s)
{