mirror of
https://github.com/corda/corda.git
synced 2025-01-23 04:48:09 +00:00
fix process=interpret build
This commit is contained in:
parent
758325ae27
commit
43f5c3f382
@ -410,8 +410,7 @@ makeNativeMethodData(Thread* t, object method, void* function)
|
|||||||
object data = makeNativeMethodData(t,
|
object data = makeNativeMethodData(t,
|
||||||
function,
|
function,
|
||||||
0, // argument table size
|
0, // argument table size
|
||||||
count,
|
count);
|
||||||
false);
|
|
||||||
|
|
||||||
unsigned argumentTableSize = BytesPerWord * 2;
|
unsigned argumentTableSize = BytesPerWord * 2;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
@ -475,7 +474,6 @@ resolveNativeMethodData(Thread* t, object method)
|
|||||||
memoryBarrier();
|
memoryBarrier();
|
||||||
|
|
||||||
set(t, method, MethodCode, data);
|
set(t, method, MethodCode, data);
|
||||||
return data;
|
|
||||||
} else {
|
} else {
|
||||||
object message = makeString
|
object message = makeString
|
||||||
(t, "%s.%s%s",
|
(t, "%s.%s%s",
|
||||||
@ -483,7 +481,6 @@ resolveNativeMethodData(Thread* t, object method)
|
|||||||
&byteArrayBody(t, methodName(t, method), 0),
|
&byteArrayBody(t, methodName(t, method), 0),
|
||||||
&byteArrayBody(t, methodSpec(t, method), 0));
|
&byteArrayBody(t, methodSpec(t, method), 0));
|
||||||
t->exception = makeUnsatisfiedLinkError(t, message);
|
t->exception = makeUnsatisfiedLinkError(t, message);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -503,7 +500,7 @@ checkStack(Thread* t, object method)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pushResult(Thread* t, unsigned returnCode, uint64_t result)
|
pushResult(Thread* t, unsigned returnCode, uint64_t result, bool indirect)
|
||||||
{
|
{
|
||||||
switch (returnCode) {
|
switch (returnCode) {
|
||||||
case ByteField:
|
case ByteField:
|
||||||
@ -545,14 +542,21 @@ pushResult(Thread* t, unsigned returnCode, uint64_t result)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ObjectField:
|
case ObjectField:
|
||||||
if (DebugRun) {
|
if (indirect) {
|
||||||
fprintf(stderr, "result: %p at %p\n",
|
if (DebugRun) {
|
||||||
static_cast<uintptr_t>(result) == 0 ? 0 :
|
fprintf(stderr, "result: %p at %p\n",
|
||||||
*reinterpret_cast<object*>(static_cast<uintptr_t>(result)),
|
static_cast<uintptr_t>(result) == 0 ? 0 :
|
||||||
reinterpret_cast<object*>(static_cast<uintptr_t>(result)));
|
*reinterpret_cast<object*>(static_cast<uintptr_t>(result)),
|
||||||
|
reinterpret_cast<object*>(static_cast<uintptr_t>(result)));
|
||||||
|
}
|
||||||
|
pushObject(t, static_cast<uintptr_t>(result) == 0 ? 0 :
|
||||||
|
*reinterpret_cast<object*>(static_cast<uintptr_t>(result)));
|
||||||
|
} else {
|
||||||
|
if (DebugRun) {
|
||||||
|
fprintf(stderr, "result: %p\n", reinterpret_cast<object>(result));
|
||||||
|
}
|
||||||
|
pushObject(t, reinterpret_cast<object>(result));
|
||||||
}
|
}
|
||||||
pushObject(t, static_cast<uintptr_t>(result) == 0 ? 0 :
|
|
||||||
*reinterpret_cast<object*>(static_cast<uintptr_t>(result)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VoidField:
|
case VoidField:
|
||||||
@ -670,13 +674,13 @@ invokeNativeSlow(Thread* t, object method)
|
|||||||
return VoidField;
|
return VoidField;
|
||||||
}
|
}
|
||||||
|
|
||||||
pushResult(t, returnCode, result);
|
pushResult(t, returnCode, result, true);
|
||||||
|
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
invokeNative(MyThread* t, object method)
|
invokeNative(Thread* t, object method)
|
||||||
{
|
{
|
||||||
PROTECT(t, method);
|
PROTECT(t, method);
|
||||||
|
|
||||||
@ -689,20 +693,24 @@ invokeNative(MyThread* t, object method)
|
|||||||
if (methodVmFlags(t, method) & FastNative) {
|
if (methodVmFlags(t, method) & FastNative) {
|
||||||
pushFrame(t, method);
|
pushFrame(t, method);
|
||||||
|
|
||||||
uint64_t result = reinterpret_cast<FastNativeFunction>
|
unsigned footprint = methodParameterFootprint(t, method);
|
||||||
(methodCompiled(t, method))
|
uintptr_t arguments[footprint];
|
||||||
(t, method,
|
unsigned sp = frameBase(t, t->frame);
|
||||||
static_cast<uintptr_t*>(t->stack)
|
for (unsigned i = 0; i < footprint; ++i) {
|
||||||
+ t->arch->frameFooterSize()
|
arguments[i] = t->stack[((sp + i) * 2) + 1];
|
||||||
+ t->arch->frameReturnAddressSize());
|
}
|
||||||
|
|
||||||
|
uint64_t result = reinterpret_cast<FastNativeFunction>
|
||||||
|
(nativeMethodDataFunction(t, methodCode(t, method)))
|
||||||
|
(t, method, arguments);
|
||||||
|
|
||||||
popFrame(t);
|
popFrame(t);
|
||||||
|
|
||||||
if (UNLIKELY(t->exception)) {
|
if (UNLIKELY(t->exception)) {
|
||||||
return VoidField;
|
return VoidField;
|
||||||
}
|
}
|
||||||
|
|
||||||
pushResult(t, methodReturnCode(t, method), result);
|
pushResult(t, methodReturnCode(t, method), result, false);
|
||||||
|
|
||||||
return methodReturnCode(t, method);
|
return methodReturnCode(t, method);
|
||||||
} else {
|
} else {
|
||||||
@ -952,7 +960,7 @@ interpret(Thread* t)
|
|||||||
object class_ = resolveClassInPool(t, codePool(t, code), index - 1);
|
object class_ = resolveClassInPool(t, codePool(t, code), index - 1);
|
||||||
if (UNLIKELY(exception)) goto throw_;
|
if (UNLIKELY(exception)) goto throw_;
|
||||||
|
|
||||||
pushObject(t, makeObjectArray(t, class_, count, true));
|
pushObject(t, makeObjectArray(t, class_, count));
|
||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d", count);
|
object message = makeString(t, "%d", count);
|
||||||
exception = makeNegativeArraySizeException(t, message);
|
exception = makeNegativeArraySizeException(t, message);
|
||||||
@ -2393,7 +2401,7 @@ interpret(Thread* t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object array = makeArray(t, counts[0], true);
|
object array = makeArray(t, counts[0]);
|
||||||
setObjectClass(t, array, class_);
|
setObjectClass(t, array, class_);
|
||||||
PROTECT(t, array);
|
PROTECT(t, array);
|
||||||
|
|
||||||
@ -2424,35 +2432,35 @@ interpret(Thread* t)
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case T_BOOLEAN:
|
case T_BOOLEAN:
|
||||||
array = makeBooleanArray(t, count, true);
|
array = makeBooleanArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
array = makeCharArray(t, count, true);
|
array = makeCharArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_FLOAT:
|
case T_FLOAT:
|
||||||
array = makeFloatArray(t, count, true);
|
array = makeFloatArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_DOUBLE:
|
case T_DOUBLE:
|
||||||
array = makeDoubleArray(t, count, true);
|
array = makeDoubleArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_BYTE:
|
case T_BYTE:
|
||||||
array = makeByteArray(t, count, true);
|
array = makeByteArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_SHORT:
|
case T_SHORT:
|
||||||
array = makeShortArray(t, count, true);
|
array = makeShortArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_INT:
|
case T_INT:
|
||||||
array = makeIntArray(t, count, true);
|
array = makeIntArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_LONG:
|
case T_LONG:
|
||||||
array = makeLongArray(t, count, true);
|
array = makeLongArray(t, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: abort(t);
|
default: abort(t);
|
||||||
@ -3042,7 +3050,7 @@ class MyProcessor: public Processor {
|
|||||||
return vm::makeClass
|
return vm::makeClass
|
||||||
(t, flags, vmFlags, arrayDimensions, fixedSize, arrayElementSize,
|
(t, flags, vmFlags, arrayDimensions, fixedSize, arrayElementSize,
|
||||||
objectMask, name, super, interfaceTable, virtualTable, fieldTable,
|
objectMask, name, super, interfaceTable, virtualTable, fieldTable,
|
||||||
methodTable, staticTable, loader, 0, false);
|
methodTable, staticTable, loader, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
@ -3198,14 +3206,12 @@ class MyProcessor: public Processor {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void compileThunks(vm::Thread*, BootImage*, uint8_t*, unsigned*,
|
virtual void initialize(vm::Thread*, BootImage*, uint8_t*, unsigned) {
|
||||||
unsigned)
|
|
||||||
{
|
|
||||||
abort(s);
|
abort(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void compileMethod(vm::Thread*, Zone*, uint8_t*, unsigned*, unsigned,
|
virtual void compileMethod(vm::Thread*, Zone*, object*, object*,
|
||||||
object*, object*, DelayedPromise**, object)
|
DelayedPromise**, object)
|
||||||
{
|
{
|
||||||
abort(s);
|
abort(s);
|
||||||
}
|
}
|
||||||
@ -3224,6 +3230,29 @@ class MyProcessor: public Processor {
|
|||||||
expect(s, image == 0);
|
expect(s, image == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void callWithCurrentContinuation(vm::Thread*, object) {
|
||||||
|
abort(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void dynamicWind(vm::Thread*, object, object, object) {
|
||||||
|
abort(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void feedResultToContinuation(vm::Thread*, object, object){
|
||||||
|
abort(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void feedExceptionToContinuation(vm::Thread*, object, object) {
|
||||||
|
abort(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void walkContinuationBody(vm::Thread*, Heap::Walker*, object,
|
||||||
|
unsigned)
|
||||||
|
{
|
||||||
|
abort(s);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void dispose(vm::Thread* t) {
|
virtual void dispose(vm::Thread* t) {
|
||||||
t->m->heap->free(t, sizeof(Thread));
|
t->m->heap->free(t, sizeof(Thread));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user