mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
store frame locals on stack and avoid need to copy parameters
This commit is contained in:
parent
d3735e9e58
commit
8acb32e4cb
@ -70,8 +70,7 @@
|
|||||||
(object method)
|
(object method)
|
||||||
(object next)
|
(object next)
|
||||||
(uint32_t ip)
|
(uint32_t ip)
|
||||||
(uint32_t stackBase)
|
(uint32_t stackBase))
|
||||||
(array object locals))
|
|
||||||
|
|
||||||
(type reference
|
(type reference
|
||||||
(object class)
|
(object class)
|
||||||
|
29
src/vm.cpp
29
src/vm.cpp
@ -2471,6 +2471,12 @@ invokeNative(Thread* t, object method)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object
|
||||||
|
frameLocals(Thread* t, object frame, unsigned index)
|
||||||
|
{
|
||||||
|
return t->stack[frameStackBase(t, frame) + index];
|
||||||
|
}
|
||||||
|
|
||||||
namespace builtin {
|
namespace builtin {
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -4086,7 +4092,7 @@ run(Thread* t)
|
|||||||
unsigned base = sp - parameterCount;
|
unsigned base = sp - parameterCount;
|
||||||
|
|
||||||
if (methodFlags(t, code) & ACC_NATIVE) {
|
if (methodFlags(t, code) & ACC_NATIVE) {
|
||||||
frame = makeFrame(t, code, frame, 0, base, 0, false);
|
frame = makeFrame(t, code, frame, 0, base);
|
||||||
|
|
||||||
object r = invokeNative(t, code);
|
object r = invokeNative(t, code);
|
||||||
|
|
||||||
@ -4103,7 +4109,8 @@ run(Thread* t)
|
|||||||
|
|
||||||
code = methodCode(t, frameMethod(t, frame));
|
code = methodCode(t, frameMethod(t, frame));
|
||||||
} else {
|
} else {
|
||||||
if (UNLIKELY(codeMaxStack(t, methodCode(t, code)) + base
|
if (UNLIKELY(codeMaxStack(t, methodCode(t, code))
|
||||||
|
+ codeMaxLocals(t, methodCode(t, code)) + base
|
||||||
> Thread::StackSizeInWords))
|
> Thread::StackSizeInWords))
|
||||||
{
|
{
|
||||||
exception = makeStackOverflowError(t);
|
exception = makeStackOverflowError(t);
|
||||||
@ -4113,21 +4120,10 @@ run(Thread* t)
|
|||||||
frameIp(t, frame) = ip;
|
frameIp(t, frame) = ip;
|
||||||
ip = 0;
|
ip = 0;
|
||||||
|
|
||||||
frame = makeFrame(t, code, frame, 0, base,
|
frame = makeFrame(t, code, frame, 0, base);
|
||||||
codeMaxLocals(t, methodCode(t, code)), false);
|
|
||||||
code = methodCode(t, code);
|
code = methodCode(t, code);
|
||||||
|
|
||||||
if (parameterCount) {
|
sp = base + codeMaxLocals(t, methodCode(t, code));
|
||||||
memcpy(&frameLocals(t, frame, 0), stack + base,
|
|
||||||
parameterCount * BytesPerWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frameLength(t, frame) - parameterCount) {
|
|
||||||
memset(&frameLocals(t, frame, 0) + parameterCount, 0,
|
|
||||||
(frameLength(t, frame) - parameterCount) * BytesPerWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
sp = base;
|
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
|
|
||||||
@ -4224,8 +4220,7 @@ run(Thread* t, const char* className, int argc, const char** argv)
|
|||||||
object method = findMethodInClass(t, class_, reference);
|
object method = findMethodInClass(t, class_, reference);
|
||||||
if (LIKELY(t->exception == 0)) {
|
if (LIKELY(t->exception == 0)) {
|
||||||
t->code = methodCode(t, method);
|
t->code = methodCode(t, method);
|
||||||
t->frame = makeFrame
|
t->frame = makeFrame(t, method, 0, 0, 0);
|
||||||
(t, method, 0, 0, 0, codeMaxLocals(t, t->code), true);
|
|
||||||
|
|
||||||
object args = makeObjectArray
|
object args = makeObjectArray
|
||||||
(t, arrayBody(t, t->vm->types, Machine::StringType), argc, true);
|
(t, arrayBody(t, t->vm->types, Machine::StringType), argc, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user