mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
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:
parent
d5ba7412cd
commit
c855224d14
@ -1833,10 +1833,19 @@ resolveArrayClass(Thread* t, object loader, object spec, bool throw_)
|
||||
set(t, c, ClassVirtualTable,
|
||||
classVirtualTable(t, type(t, Machine::JobjectType)));
|
||||
|
||||
return c;
|
||||
} else {
|
||||
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_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -72,6 +72,7 @@ public class DefineClass {
|
||||
|
||||
public abstract static class Base {
|
||||
public int foo;
|
||||
public int[] array;
|
||||
|
||||
public void bar() { }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user