mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
implement impdep1 instruction for lazily loading bootstrap classes
This commit is contained in:
parent
6c0e0c37e2
commit
19d36cc463
2
makefile
2
makefile
@ -28,7 +28,7 @@ src = src
|
||||
classpath = classpath
|
||||
test = test
|
||||
|
||||
input = $(test-build)/Reflection.class
|
||||
input = $(test-build)/References.class
|
||||
|
||||
build-cxx = g++
|
||||
build-cc = gcc
|
||||
|
@ -1082,8 +1082,9 @@ interpret(Thread* t)
|
||||
(t, className(t, objectClass(t, peekObject(t, sp - 1))), 0),
|
||||
&byteArrayBody(t, className(t, class_), 0));
|
||||
exception = makeClassCastException(t, message);
|
||||
goto throw_;
|
||||
}
|
||||
|
||||
if (UNLIKELY(exception)) goto throw_;
|
||||
}
|
||||
} goto loop;
|
||||
|
||||
@ -1784,6 +1785,8 @@ interpret(Thread* t)
|
||||
} else {
|
||||
pushInt(t, 0);
|
||||
}
|
||||
|
||||
if (UNLIKELY(exception)) goto throw_;
|
||||
} else {
|
||||
popObject(t);
|
||||
pushInt(t, 0);
|
||||
@ -1851,6 +1854,10 @@ interpret(Thread* t)
|
||||
|
||||
object method = resolveMethod(t, codePool(t, code), index - 1);
|
||||
if (UNLIKELY(exception)) goto throw_;
|
||||
|
||||
fprintf(stderr, "invokevirtual %s.%s\n",
|
||||
&byteArrayBody(t, className(t, methodClass(t, method)), 0),
|
||||
&byteArrayBody(t, methodName(t, method), 0));
|
||||
|
||||
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
||||
if (LIKELY(peekObject(t, sp - parameterFootprint))) {
|
||||
@ -2571,9 +2578,27 @@ interpret(Thread* t)
|
||||
|
||||
case impdep1: {
|
||||
// this means we're invoking a virtual method on an instance of a
|
||||
// bootstrap class, so we need to load the real class.
|
||||
abort(t);
|
||||
} break;
|
||||
// bootstrap class, so we need to load the real class to get the
|
||||
// real method and call it.
|
||||
|
||||
assert(t, frameNext(t, frame) >= base);
|
||||
popFrame(t);
|
||||
|
||||
assert(t, codeBody(t, code, ip - 3) == invokevirtual);
|
||||
ip -= 2;
|
||||
|
||||
uint16_t index = codeReadInt16(t, code, ip);
|
||||
object method = resolveMethod(t, codePool(t, code), index - 1);
|
||||
|
||||
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
||||
object class_ = objectClass(t, peekObject(t, sp - parameterFootprint));
|
||||
assert(t, classVmFlags(t, class_) & BootstrapFlag);
|
||||
|
||||
resolveClass(t, className(t, class_));
|
||||
if (UNLIKELY(exception)) goto throw_;
|
||||
|
||||
ip -= 3;
|
||||
} goto loop;
|
||||
|
||||
default: abort(t);
|
||||
}
|
||||
@ -2738,6 +2763,10 @@ invoke(Thread* t, object method)
|
||||
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
||||
class_ = objectClass(t, peekObject(t, t->sp - parameterFootprint));
|
||||
|
||||
if (classVmFlags(t, class_) & BootstrapFlag) {
|
||||
resolveClass(t, className(t, class_));
|
||||
}
|
||||
|
||||
if (classFlags(t, methodClass(t, method)) & ACC_INTERFACE) {
|
||||
method = findInterfaceMethod(t, method, class_);
|
||||
} else {
|
||||
|
@ -2131,6 +2131,7 @@ isAssignableFrom(Thread* t, object a, object b)
|
||||
if (classFlags(t, a) & ACC_INTERFACE) {
|
||||
if (classVmFlags(t, b) & BootstrapFlag) {
|
||||
resolveClass(t, className(t, b));
|
||||
if (UNLIKELY(t->exception)) return false;
|
||||
}
|
||||
|
||||
for (; b; b = classSuper(t, b)) {
|
||||
|
@ -29,7 +29,7 @@ const bool Verbose = false;
|
||||
const bool DebugRun = false;
|
||||
const bool DebugStack = false;
|
||||
const bool DebugMonitors = false;
|
||||
const bool DebugReferences = false;
|
||||
const bool DebugReferences = true;
|
||||
|
||||
const uintptr_t HashTakenMark = 1;
|
||||
const uintptr_t ExtendedMark = 2;
|
||||
|
@ -17,6 +17,8 @@ public class Misc {
|
||||
public static void main(String[] args) {
|
||||
boolean v = Boolean.valueOf("true");
|
||||
|
||||
ClassLoader.getSystemClassLoader().toString();
|
||||
|
||||
int a = 2;
|
||||
int b = 2;
|
||||
int c = a + b;
|
||||
|
Loading…
Reference in New Issue
Block a user