fix VM abort when ClassLoader.defineClass is used in bootimage build

When loading a class which extends another class that contained a
field of primitive array type using defineClass in a bootimage=true
build, the VM was unable to find the primitive array class, and
makeArrayClass refused to create one since it should already have
existed.

The problem was that the bootimage=true build uses an empty
Machine::BootstrapClassMap, and resolveArrayClass expected to find the
primitive array classes there.  The fix is to check the
Machine::BootLoader map if we can't find it in
Machine::BootstrapClassMap.
This commit is contained in:
Joel Dice 2011-01-17 09:36:03 -07:00
parent d5ba7412cd
commit c855224d14
2 changed files with 11 additions and 1 deletions

View File

@ -1835,7 +1835,16 @@ resolveArrayClass(Thread* t, object loader, object spec, bool throw_)
return c;
} else {
return makeArrayClass(t, loader, spec, throw_);
PROTECT(t, loader);
PROTECT(t, spec);
c = findLoadedClass(t, root(t, Machine::BootLoader), spec);
if (c) {
return c;
} else {
return makeArrayClass(t, loader, spec, throw_);
}
}
}

View File

@ -72,6 +72,7 @@ public class DefineClass {
public abstract static class Base {
public int foo;
public int[] array;
public void bar() { }