This commit is contained in:
Joel Dice 2007-11-04 16:10:33 -07:00
parent 94e9bd0fd2
commit 514be2dc87
5 changed files with 22 additions and 6 deletions

View File

@ -28,7 +28,7 @@ src = src
classpath = classpath classpath = classpath
test = test test = test
input = $(test-build)/Reflection.class input = $(test-build)/Misc.class
build-cxx = g++ build-cxx = g++
build-cc = gcc build-cc = gcc

View File

@ -1371,6 +1371,8 @@ updateBootstrapClass(Thread* t, object bootstrapClass, object class_)
and classObjectMask(t, class_) == 0) and classObjectMask(t, class_) == 0)
or intArrayEqual(t, classObjectMask(t, bootstrapClass), or intArrayEqual(t, classObjectMask(t, bootstrapClass),
classObjectMask(t, class_))); classObjectMask(t, class_)));
expect(t, arrayLength(t, classVirtualTable(t, bootstrapClass))
== arrayLength(t, classVirtualTable(t, class_)));
PROTECT(t, bootstrapClass); PROTECT(t, bootstrapClass);
PROTECT(t, class_); PROTECT(t, class_);
@ -1528,8 +1530,9 @@ bootClass(Thread* t, Machine::Type type, int superType, uint32_t objectMask,
object super = (superType >= 0 ? arrayBody(t, t->m->types, superType) : 0); object super = (superType >= 0 ? arrayBody(t, t->m->types, superType) : 0);
object class_ = makeClass(t, 0, 0, 0, fixedSize, arrayElementSize, mask, 0, object class_ = makeClass
super, 0, 0, 0, 0, 0, t->m->loader); (t, 0, BootstrapFlag, 0, fixedSize, arrayElementSize, mask, 0, super, 0, 0
, 0, 0, 0, t->m->loader);
set(t, t->m->types, ArrayBody + (type * BytesPerWord), class_); set(t, t->m->types, ArrayBody + (type * BytesPerWord), class_);
} }
@ -2119,9 +2122,13 @@ stringChars(Thread* t, object string, char* chars)
bool bool
isAssignableFrom(Thread* t, object a, object b) isAssignableFrom(Thread* t, object a, object b)
{ {
if (a == b) return true; if (a == b) {
return true;
} else if (classFlags(t, a) & ACC_INTERFACE) {
if (classVmFlags(t, b) & BootstrapFlag) {
resolveClass(t, className(t, b));
}
if (classFlags(t, a) & ACC_INTERFACE) {
for (; b; b = classSuper(t, b)) { for (; b; b = classSuper(t, b)) {
object itable = classInterfaceTable(t, b); object itable = classInterfaceTable(t, b);
if (itable) { if (itable) {

View File

@ -62,6 +62,7 @@ const unsigned NeedInitFlag = 1 << 2;
const unsigned InitFlag = 1 << 3; const unsigned InitFlag = 1 << 3;
const unsigned PrimitiveFlag = 1 << 4; const unsigned PrimitiveFlag = 1 << 4;
const unsigned SingletonFlag = 1 << 5; const unsigned SingletonFlag = 1 << 5;
const unsigned BootstrapFlag = 1 << 6;
// method flags: // method flags:
const unsigned ClassInitFlag = 1 << 0; const unsigned ClassInitFlag = 1 << 0;

View File

@ -1295,6 +1295,12 @@ parseJavaClass(Object* type, Stream* s, Object* declarations)
unsigned interfaceCount = s->read2(); unsigned interfaceCount = s->read2();
s->skip(interfaceCount * 2); s->skip(interfaceCount * 2);
// for (unsigned i = 0; i < interfaceCount; ++i) {
// const char* name = reinterpret_cast<const char*>
// (pool[pool[s->read2() - 1] - 1]);
// fprintf(stderr, "%s implements %s\n", typeJavaName(type), name);
// }
unsigned fieldCount = s->read2(); unsigned fieldCount = s->read2();
for (unsigned i = 0; i < fieldCount; ++i) { for (unsigned i = 0; i < fieldCount; ++i) {

View File

@ -14,9 +14,11 @@ public class Misc {
return s; return s;
} }
public static void main(String[] args) { public static void main(String[] args) throws Exception {
boolean v = Boolean.valueOf("true"); boolean v = Boolean.valueOf("true");
ClassLoader.getSystemClassLoader().toString();
int a = 2; int a = 2;
int b = 2; int b = 2;
int c = a + b; int c = a + b;