mirror of
https://github.com/corda/corda.git
synced 2025-06-19 15:43:52 +00:00
fix process=interpret build
This commit is contained in:
@ -6131,37 +6131,6 @@ compileVirtualMethod(MyThread* t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
resolveNative(MyThread* t, object method)
|
|
||||||
{
|
|
||||||
PROTECT(t, method);
|
|
||||||
|
|
||||||
assert(t, methodFlags(t, method) & ACC_NATIVE);
|
|
||||||
|
|
||||||
initClass(t, methodClass(t, method));
|
|
||||||
|
|
||||||
if (LIKELY(t->exception == 0) and methodCode(t, method) == 0) {
|
|
||||||
object native = resolveNativeMethod(t, method);
|
|
||||||
if (UNLIKELY(native == 0)) {
|
|
||||||
object message = makeString
|
|
||||||
(t, "%s.%s%s",
|
|
||||||
&byteArrayBody(t, className(t, methodClass(t, method)), 0),
|
|
||||||
&byteArrayBody(t, methodName(t, method), 0),
|
|
||||||
&byteArrayBody(t, methodSpec(t, method), 0));
|
|
||||||
|
|
||||||
t->exception = t->m->classpath->makeThrowable
|
|
||||||
(t, Machine::UnsatisfiedLinkErrorType, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure other threads only see the methodCode field populated
|
|
||||||
// once the object it points do has been populated:
|
|
||||||
storeStoreMemoryBarrier();
|
|
||||||
|
|
||||||
set(t, method, MethodCode, native);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
invokeNativeFast(MyThread* t, object method, void* function)
|
invokeNativeFast(MyThread* t, object method, void* function)
|
||||||
{
|
{
|
||||||
|
@ -376,10 +376,9 @@ popFrame(Thread* t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (UNLIKELY(methodVmFlags(t, method) & ClassInitFlag)
|
if (UNLIKELY(methodVmFlags(t, method) & ClassInitFlag)
|
||||||
and t->classInitList)
|
and t->classInitList
|
||||||
|
and t->classInitList->class_ == methodClass(t, method))
|
||||||
{
|
{
|
||||||
assert(t, t->classInitList->class_ == methodClass(t, method));
|
|
||||||
|
|
||||||
t->classInitList->pop();
|
t->classInitList->pop();
|
||||||
|
|
||||||
postInitClass(t, methodClass(t, method));
|
postInitClass(t, methodClass(t, method));
|
||||||
@ -429,30 +428,6 @@ class MyStackWalker: public Processor::StackWalker {
|
|||||||
int frame;
|
int frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void
|
|
||||||
resolveNative(Thread* t, object method)
|
|
||||||
{
|
|
||||||
if (methodCode(t, method) == 0) {
|
|
||||||
object native = resolveNativeMethod(t, method);
|
|
||||||
if (LIKELY(native)) {
|
|
||||||
// ensure other threads only see the methodCode field populated
|
|
||||||
// once the object it points do has been populated:
|
|
||||||
storeStoreMemoryBarrier();
|
|
||||||
|
|
||||||
set(t, method, MethodCode, native);
|
|
||||||
} else {
|
|
||||||
object message = makeString
|
|
||||||
(t, "%s.%s%s",
|
|
||||||
&byteArrayBody(t, className(t, methodClass(t, method)), 0),
|
|
||||||
&byteArrayBody(t, methodName(t, method), 0),
|
|
||||||
&byteArrayBody(t, methodSpec(t, method), 0));
|
|
||||||
|
|
||||||
t->exception = t->m->classpath->makeThrowable
|
|
||||||
(t, Machine::UnsatisfiedLinkErrorType, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
checkStack(Thread* t, object method)
|
checkStack(Thread* t, object method)
|
||||||
{
|
{
|
||||||
@ -538,7 +513,7 @@ pushResult(Thread* t, unsigned returnCode, uint64_t result, bool indirect)
|
|||||||
|
|
||||||
void
|
void
|
||||||
marshalArguments(Thread* t, uintptr_t* args, uint8_t* types, unsigned sp,
|
marshalArguments(Thread* t, uintptr_t* args, uint8_t* types, unsigned sp,
|
||||||
object method, bool indirect)
|
object method, bool fastCallingConvention)
|
||||||
{
|
{
|
||||||
MethodSpecIterator it
|
MethodSpecIterator it
|
||||||
(t, reinterpret_cast<const char*>
|
(t, reinterpret_cast<const char*>
|
||||||
@ -565,19 +540,19 @@ marshalArguments(Thread* t, uintptr_t* args, uint8_t* types, unsigned sp,
|
|||||||
case INT64_TYPE: {
|
case INT64_TYPE: {
|
||||||
uint64_t v = peekLong(t, sp);
|
uint64_t v = peekLong(t, sp);
|
||||||
memcpy(args + argOffset, &v, 8);
|
memcpy(args + argOffset, &v, 8);
|
||||||
argOffset += (8 / BytesPerWord);
|
argOffset += fastCallingConvention ? 2 : (8 / BytesPerWord);
|
||||||
sp += 2;
|
sp += 2;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case POINTER_TYPE: {
|
case POINTER_TYPE: {
|
||||||
if (indirect) {
|
if (fastCallingConvention) {
|
||||||
|
args[argOffset++] = reinterpret_cast<uintptr_t>(peekObject(t, sp++));
|
||||||
|
} else {
|
||||||
object* v = reinterpret_cast<object*>(t->stack + ((sp++) * 2) + 1);
|
object* v = reinterpret_cast<object*>(t->stack + ((sp++) * 2) + 1);
|
||||||
if (*v == 0) {
|
if (*v == 0) {
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
args[argOffset++] = reinterpret_cast<uintptr_t>(v);
|
args[argOffset++] = reinterpret_cast<uintptr_t>(v);
|
||||||
} else {
|
|
||||||
args[argOffset++] = reinterpret_cast<uintptr_t>(peekObject(t, sp++));
|
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -628,7 +603,7 @@ invokeNativeSlow(Thread* t, object method, void* function)
|
|||||||
|
|
||||||
marshalArguments
|
marshalArguments
|
||||||
(t, RUNTIME_ARRAY_BODY(args) + argOffset,
|
(t, RUNTIME_ARRAY_BODY(args) + argOffset,
|
||||||
RUNTIME_ARRAY_BODY(types) + typeOffset, sp, method, true);
|
RUNTIME_ARRAY_BODY(types) + typeOffset, sp, method, false);
|
||||||
|
|
||||||
unsigned returnCode = methodReturnCode(t, method);
|
unsigned returnCode = methodReturnCode(t, method);
|
||||||
unsigned returnType = fieldType(t, returnCode);
|
unsigned returnType = fieldType(t, returnCode);
|
||||||
@ -685,19 +660,17 @@ invokeNative(Thread* t, object method)
|
|||||||
if (nativeFast(t, native)) {
|
if (nativeFast(t, native)) {
|
||||||
pushFrame(t, method);
|
pushFrame(t, method);
|
||||||
|
|
||||||
unsigned footprint = methodParameterFootprint(t, method) + 1;
|
unsigned footprint = methodParameterFootprint(t, method);
|
||||||
RUNTIME_ARRAY(uintptr_t, args, footprint);
|
RUNTIME_ARRAY(uintptr_t, args, footprint);
|
||||||
unsigned sp = frameBase(t, t->frame);
|
unsigned sp = frameBase(t, t->frame);
|
||||||
unsigned argOffset = 0;
|
unsigned argOffset = 0;
|
||||||
if (methodFlags(t, method) & ACC_STATIC) {
|
if ((methodFlags(t, method) & ACC_STATIC) == 0) {
|
||||||
++ footprint;
|
|
||||||
} else {
|
|
||||||
RUNTIME_ARRAY_BODY(args)[argOffset++]
|
RUNTIME_ARRAY_BODY(args)[argOffset++]
|
||||||
= reinterpret_cast<uintptr_t>(peekObject(t, sp++));
|
= reinterpret_cast<uintptr_t>(peekObject(t, sp++));
|
||||||
}
|
}
|
||||||
|
|
||||||
marshalArguments
|
marshalArguments
|
||||||
(t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, false);
|
(t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, true);
|
||||||
|
|
||||||
uint64_t result = reinterpret_cast<FastNativeFunction>
|
uint64_t result = reinterpret_cast<FastNativeFunction>
|
||||||
(nativeFunction(t, native))(t, method, RUNTIME_ARRAY_BODY(args));
|
(nativeFunction(t, native))(t, method, RUNTIME_ARRAY_BODY(args));
|
||||||
@ -2829,7 +2802,7 @@ interpret(Thread* t)
|
|||||||
|
|
||||||
case iinc: {
|
case iinc: {
|
||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
uint16_t count = codeReadInt16(t, code, ip);
|
int16_t count = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
setLocalInt(t, index, localInt(t, index) + count);
|
setLocalInt(t, index, localInt(t, index) + count);
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -3072,7 +3045,7 @@ class MyProcessor: public Processor {
|
|||||||
{
|
{
|
||||||
return vm::makeMethod
|
return vm::makeMethod
|
||||||
(t, vmFlags, returnCode, parameterCount, parameterFootprint, flags,
|
(t, vmFlags, returnCode, parameterCount, parameterFootprint, flags,
|
||||||
offset, 0, name, spec, addendum, class_, code, 0);
|
offset, 0, name, spec, addendum, class_, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual object
|
virtual object
|
||||||
|
@ -203,10 +203,6 @@ resolveNativeMethod(Thread* t, object method, const char* prefix,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace vm {
|
|
||||||
|
|
||||||
object
|
object
|
||||||
resolveNativeMethod(Thread* t, object method)
|
resolveNativeMethod(Thread* t, object method)
|
||||||
{
|
{
|
||||||
@ -223,6 +219,41 @@ resolveNativeMethod(Thread* t, object method)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace vm {
|
||||||
|
|
||||||
|
void
|
||||||
|
resolveNative(Thread* t, object method)
|
||||||
|
{
|
||||||
|
PROTECT(t, method);
|
||||||
|
|
||||||
|
assert(t, methodFlags(t, method) & ACC_NATIVE);
|
||||||
|
|
||||||
|
initClass(t, methodClass(t, method));
|
||||||
|
|
||||||
|
if (LIKELY(t->exception == 0) and methodCode(t, method) == 0) {
|
||||||
|
object native = resolveNativeMethod(t, method);
|
||||||
|
if (UNLIKELY(native == 0)) {
|
||||||
|
object message = makeString
|
||||||
|
(t, "%s.%s%s",
|
||||||
|
&byteArrayBody(t, className(t, methodClass(t, method)), 0),
|
||||||
|
&byteArrayBody(t, methodName(t, method), 0),
|
||||||
|
&byteArrayBody(t, methodSpec(t, method), 0));
|
||||||
|
|
||||||
|
t->exception = t->m->classpath->makeThrowable
|
||||||
|
(t, Machine::UnsatisfiedLinkErrorType, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure other threads only see the methodCode field populated
|
||||||
|
// once the object it points do has been populated:
|
||||||
|
storeStoreMemoryBarrier();
|
||||||
|
|
||||||
|
set(t, method, MethodCode, native);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
findLineNumber(Thread* t, object method, unsigned ip)
|
findLineNumber(Thread* t, object method, unsigned ip)
|
||||||
{
|
{
|
||||||
|
@ -56,9 +56,6 @@ isSpecialMethod(Thread* t, object method, object class_)
|
|||||||
and isSuperclass(t, methodClass(t, method), class_);
|
and isSuperclass(t, methodClass(t, method), class_);
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
|
||||||
resolveNativeMethod(Thread* t, object method);
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
populateMultiArray(Thread* t, object array, int32_t* counts,
|
populateMultiArray(Thread* t, object array, int32_t* counts,
|
||||||
unsigned index, unsigned dimensions)
|
unsigned index, unsigned dimensions)
|
||||||
@ -90,6 +87,9 @@ populateMultiArray(Thread* t, object array, int32_t* counts,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
resolveNative(Thread* t, object method);
|
||||||
|
|
||||||
int
|
int
|
||||||
findLineNumber(Thread* t, object method, unsigned ip);
|
findLineNumber(Thread* t, object method, unsigned ip);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user