mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
add stronger typing to method.code
This commit is contained in:
parent
9248f8f8ad
commit
9f5912c2b6
@ -23,7 +23,7 @@ public class VMMethod {
|
|||||||
public byte[] spec;
|
public byte[] spec;
|
||||||
public MethodAddendum addendum;
|
public MethodAddendum addendum;
|
||||||
public VMClass class_;
|
public VMClass class_;
|
||||||
public Object code;
|
public Code code;
|
||||||
|
|
||||||
public boolean hasAnnotations() {
|
public boolean hasAnnotations() {
|
||||||
return addendum != null && addendum.annotationTable != null;
|
return addendum != null && addendum.annotationTable != null;
|
||||||
|
@ -2610,11 +2610,11 @@ GcClass*
|
|||||||
findLoadedClass(Thread* t, object loader, object spec);
|
findLoadedClass(Thread* t, object loader, object spec);
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
emptyMethod(Thread* t, GcMethod* method)
|
emptyMethod(Thread* t UNUSED, GcMethod* method)
|
||||||
{
|
{
|
||||||
return ((method->flags() & ACC_NATIVE) == 0)
|
return ((method->flags() & ACC_NATIVE) == 0)
|
||||||
and (codeLength(t, method->code()) == 1)
|
and (method->code()->length() == 1)
|
||||||
and (codeBody(t, method->code(), 0) == return_);
|
and (method->code()->body()[0] == return_);
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
@ -3627,7 +3627,7 @@ inline GcClass*
|
|||||||
resolveClassInPool(Thread* t, object loader, GcMethod* method, unsigned index,
|
resolveClassInPool(Thread* t, object loader, GcMethod* method, unsigned index,
|
||||||
bool throw_ = true)
|
bool throw_ = true)
|
||||||
{
|
{
|
||||||
object o = singletonObject(t, codePool(t, method->code()), index);
|
object o = singletonObject(t, method->code()->pool(), index);
|
||||||
|
|
||||||
loadMemoryBarrier();
|
loadMemoryBarrier();
|
||||||
|
|
||||||
@ -3639,7 +3639,7 @@ resolveClassInPool(Thread* t, object loader, GcMethod* method, unsigned index,
|
|||||||
if (c) {
|
if (c) {
|
||||||
storeStoreMemoryBarrier();
|
storeStoreMemoryBarrier();
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(codePool(t, method->code())),
|
set(t, reinterpret_cast<object>(method->code()->pool()),
|
||||||
SingletonBody + (index * BytesPerWord), reinterpret_cast<object>(c));
|
SingletonBody + (index * BytesPerWord), reinterpret_cast<object>(c));
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
@ -3660,7 +3660,7 @@ resolve(Thread* t, object loader, GcMethod* method, unsigned index,
|
|||||||
object (*find)(vm::Thread*, GcClass*, object, object),
|
object (*find)(vm::Thread*, GcClass*, object, object),
|
||||||
Gc::Type errorType, bool throw_ = true)
|
Gc::Type errorType, bool throw_ = true)
|
||||||
{
|
{
|
||||||
object o = singletonObject(t, codePool(t, method->code()), index);
|
object o = singletonObject(t, method->code()->pool(), index);
|
||||||
|
|
||||||
loadMemoryBarrier();
|
loadMemoryBarrier();
|
||||||
|
|
||||||
@ -3680,7 +3680,7 @@ resolve(Thread* t, object loader, GcMethod* method, unsigned index,
|
|||||||
if (o) {
|
if (o) {
|
||||||
storeStoreMemoryBarrier();
|
storeStoreMemoryBarrier();
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(codePool(t, method->code())),
|
set(t, reinterpret_cast<object>(method->code()->pool()),
|
||||||
SingletonBody + (index * BytesPerWord), o);
|
SingletonBody + (index * BytesPerWord), o);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
109
src/compile.cpp
109
src/compile.cpp
@ -365,15 +365,15 @@ void
|
|||||||
setRoot(Thread* t, Root root, object value);
|
setRoot(Thread* t, Root root, object value);
|
||||||
|
|
||||||
intptr_t
|
intptr_t
|
||||||
methodCompiled(Thread* t, GcMethod* method)
|
methodCompiled(Thread* t UNUSED, GcMethod* method)
|
||||||
{
|
{
|
||||||
return codeCompiled(t, method->code());
|
return method->code()->compiled();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
methodCompiledSize(Thread* t, GcMethod* method)
|
methodCompiledSize(Thread* t UNUSED, GcMethod* method)
|
||||||
{
|
{
|
||||||
return codeCompiledSize(t, method->code());
|
return method->code()->compiledSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t
|
intptr_t
|
||||||
@ -417,9 +417,9 @@ methodForIp(MyThread* t, void* ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
localSize(MyThread* t, GcMethod* method)
|
localSize(MyThread* t UNUSED, GcMethod* method)
|
||||||
{
|
{
|
||||||
unsigned size = codeMaxLocals(t, method->code());
|
unsigned size = method->code()->maxLocals();
|
||||||
if ((method->flags() & (ACC_SYNCHRONIZED | ACC_STATIC))
|
if ((method->flags() & (ACC_SYNCHRONIZED | ACC_STATIC))
|
||||||
== ACC_SYNCHRONIZED)
|
== ACC_SYNCHRONIZED)
|
||||||
{
|
{
|
||||||
@ -434,7 +434,7 @@ alignedFrameSize(MyThread* t, GcMethod* method)
|
|||||||
return t->arch->alignFrameSize
|
return t->arch->alignFrameSize
|
||||||
(localSize(t, method)
|
(localSize(t, method)
|
||||||
- method->parameterFootprint()
|
- method->parameterFootprint()
|
||||||
+ codeMaxStack(t, method->code())
|
+ method->code()->maxStack()
|
||||||
+ t->arch->frameFootprint(MaxNativeCallFootprint));
|
+ t->arch->frameFootprint(MaxNativeCallFootprint));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ void
|
|||||||
nextFrame(MyThread* t, void** ip, void** sp, GcMethod* method, GcMethod* target,
|
nextFrame(MyThread* t, void** ip, void** sp, GcMethod* method, GcMethod* target,
|
||||||
bool mostRecent)
|
bool mostRecent)
|
||||||
{
|
{
|
||||||
object code = method->code();
|
object code = reinterpret_cast<object>(method->code());
|
||||||
intptr_t start = codeCompiled(t, code);
|
intptr_t start = codeCompiled(t, code);
|
||||||
void* link;
|
void* link;
|
||||||
bool methodIsMostRecent;
|
bool methodIsMostRecent;
|
||||||
@ -862,7 +862,7 @@ enum Event {
|
|||||||
unsigned
|
unsigned
|
||||||
frameMapSizeInBits(MyThread* t, GcMethod* method)
|
frameMapSizeInBits(MyThread* t, GcMethod* method)
|
||||||
{
|
{
|
||||||
return localSize(t, method) + codeMaxStack(t, method->code());
|
return localSize(t, method) + method->code()->maxStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
@ -1141,11 +1141,11 @@ class Context {
|
|||||||
traceLog(0),
|
traceLog(0),
|
||||||
visitTable(
|
visitTable(
|
||||||
Slice<uint16_t>::allocAndSet(&zone,
|
Slice<uint16_t>::allocAndSet(&zone,
|
||||||
codeLength(t, method->code()),
|
method->code()->length(),
|
||||||
0)),
|
0)),
|
||||||
rootTable(
|
rootTable(
|
||||||
Slice<uintptr_t>::allocAndSet(&zone,
|
Slice<uintptr_t>::allocAndSet(&zone,
|
||||||
codeLength(t, method->code())
|
method->code()->length()
|
||||||
* frameMapSizeInWords(t, method),
|
* frameMapSizeInWords(t, method),
|
||||||
~(uintptr_t)0)),
|
~(uintptr_t)0)),
|
||||||
executableAllocator(0),
|
executableAllocator(0),
|
||||||
@ -1355,7 +1355,7 @@ class Frame {
|
|||||||
{
|
{
|
||||||
memset(stackMap,
|
memset(stackMap,
|
||||||
0,
|
0,
|
||||||
codeMaxStack(t, context->method->code()) * sizeof(ir::Type));
|
context->method->code()->maxStack() * sizeof(ir::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame(Frame* f, ir::Type* stackMap)
|
Frame(Frame* f, ir::Type* stackMap)
|
||||||
@ -1370,7 +1370,7 @@ class Frame {
|
|||||||
{
|
{
|
||||||
memcpy(stackMap,
|
memcpy(stackMap,
|
||||||
f->stackMap,
|
f->stackMap,
|
||||||
codeMaxStack(t, context->method->code()) * sizeof(ir::Type));
|
context->method->code()->maxStack() * sizeof(ir::Type));
|
||||||
|
|
||||||
if (level > 1) {
|
if (level > 1) {
|
||||||
context->eventLog.append(PushContextEvent);
|
context->eventLog.append(PushContextEvent);
|
||||||
@ -1423,7 +1423,7 @@ class Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned stackSize() {
|
unsigned stackSize() {
|
||||||
return codeMaxStack(t, context->method->code());
|
return context->method->code()->maxStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned frameSize() {
|
unsigned frameSize() {
|
||||||
@ -1919,10 +1919,10 @@ class Frame {
|
|||||||
Subroutine* subroutine = new (&context->zone)
|
Subroutine* subroutine = new (&context->zone)
|
||||||
Subroutine(context->subroutineCount++,
|
Subroutine(context->subroutineCount++,
|
||||||
returnAddress,
|
returnAddress,
|
||||||
codeLength(t, context->method->code()),
|
context->method->code()->length(),
|
||||||
this->subroutine);
|
this->subroutine);
|
||||||
|
|
||||||
context->extendLogicalCode(codeLength(t, context->method->code()));
|
context->extendLogicalCode(context->method->code()->length());
|
||||||
|
|
||||||
this->subroutine = subroutine;
|
this->subroutine = subroutine;
|
||||||
}
|
}
|
||||||
@ -1958,9 +1958,9 @@ class Frame {
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
savedTargetIndex(MyThread* t, GcMethod* method)
|
savedTargetIndex(MyThread* t UNUSED, GcMethod* method)
|
||||||
{
|
{
|
||||||
return codeMaxLocals(t, method->code());
|
return method->code()->maxLocals();
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
@ -1973,7 +1973,7 @@ void*
|
|||||||
findExceptionHandler(Thread* t, GcMethod* method, void* ip)
|
findExceptionHandler(Thread* t, GcMethod* method, void* ip)
|
||||||
{
|
{
|
||||||
if (t->exception) {
|
if (t->exception) {
|
||||||
object table = codeExceptionHandlerTable(t, method->code());
|
object table = method->code()->exceptionHandlerTable();
|
||||||
if (table) {
|
if (table) {
|
||||||
object index = arrayBody(t, table, 0);
|
object index = arrayBody(t, table, 0);
|
||||||
|
|
||||||
@ -3833,7 +3833,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
Frame* frame = initialFrame;
|
Frame* frame = initialFrame;
|
||||||
avian::codegen::Compiler* c = frame->c;
|
avian::codegen::Compiler* c = frame->c;
|
||||||
Context* context = frame->context;
|
Context* context = frame->context;
|
||||||
unsigned stackSize = codeMaxStack(t, context->method->code());
|
unsigned stackSize = context->method->code()->maxStack();
|
||||||
Stack stack(t);
|
Stack stack(t);
|
||||||
unsigned ip = initialIp;
|
unsigned ip = initialIp;
|
||||||
unsigned newIp;
|
unsigned newIp;
|
||||||
@ -3846,7 +3846,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
frame = new (stack.push(sizeof(Frame))) Frame(frame, stackMap);
|
frame = new (stack.push(sizeof(Frame))) Frame(frame, stackMap);
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
object code = context->method->code();
|
object code = reinterpret_cast<object>(context->method->code());
|
||||||
PROTECT(t, code);
|
PROTECT(t, code);
|
||||||
|
|
||||||
while (ip < codeLength(t, code)) {
|
while (ip < codeLength(t, code)) {
|
||||||
@ -4105,7 +4105,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -4191,7 +4191,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -4422,7 +4422,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -4869,7 +4869,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -4905,7 +4905,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
ip += 2;
|
ip += 2;
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -4963,7 +4963,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -4998,7 +4998,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -5024,7 +5024,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -5522,7 +5522,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint8_t dimensions = codeBody(t, code, ip++);
|
uint8_t dimensions = codeBody(t, code, ip++);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -5562,7 +5562,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -5624,7 +5624,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
uint16_t index = codeReadInt16(t, code, ip);
|
uint16_t index = codeReadInt16(t, code, ip);
|
||||||
|
|
||||||
object reference = singletonObject
|
object reference = singletonObject
|
||||||
(t, codePool(t, context->method->code()), index - 1);
|
(t, context->method->code()->pool(), index - 1);
|
||||||
|
|
||||||
PROTECT(t, reference);
|
PROTECT(t, reference);
|
||||||
|
|
||||||
@ -6178,10 +6178,9 @@ resolveIpForwards(Context* context, int start, int end)
|
|||||||
int
|
int
|
||||||
resolveIpBackwards(Context* context, int start, int end)
|
resolveIpBackwards(Context* context, int start, int end)
|
||||||
{
|
{
|
||||||
Thread* t = context->thread;
|
if (start >= static_cast<int>(context->method->code()->length()
|
||||||
if (start >= static_cast<int>(codeLength(t, context->method->code())
|
|
||||||
* (context->subroutineCount + 1))) {
|
* (context->subroutineCount + 1))) {
|
||||||
start = codeLength(t, context->method->code());
|
start = context->method->code()->length();
|
||||||
} else {
|
} else {
|
||||||
while (start >= end and context->visitTable[start] == 0) {
|
while (start >= end and context->visitTable[start] == 0) {
|
||||||
-- start;
|
-- start;
|
||||||
@ -6251,8 +6250,7 @@ object translateExceptionHandlerTable(MyThread* t,
|
|||||||
{
|
{
|
||||||
avian::codegen::Compiler* c = context->compiler;
|
avian::codegen::Compiler* c = context->compiler;
|
||||||
|
|
||||||
object oldTable = codeExceptionHandlerTable
|
object oldTable = context->method->code()->exceptionHandlerTable();
|
||||||
(t, context->method->code());
|
|
||||||
|
|
||||||
if (oldTable) {
|
if (oldTable) {
|
||||||
PROTECT(t, oldTable);
|
PROTECT(t, oldTable);
|
||||||
@ -6269,7 +6267,7 @@ object translateExceptionHandlerTable(MyThread* t,
|
|||||||
unsigned ni = 0;
|
unsigned ni = 0;
|
||||||
for (unsigned subI = 0; subI <= context->subroutineCount; ++subI) {
|
for (unsigned subI = 0; subI <= context->subroutineCount; ++subI) {
|
||||||
unsigned duplicatedBaseIp
|
unsigned duplicatedBaseIp
|
||||||
= subI * codeLength(t, context->method->code());
|
= subI * context->method->code()->length();
|
||||||
|
|
||||||
for (unsigned oi = 0; oi < length; ++oi) {
|
for (unsigned oi = 0; oi < length; ++oi) {
|
||||||
uint64_t oldHandler = exceptionHandlerTableBody(t, oldTable, oi);
|
uint64_t oldHandler = exceptionHandlerTableBody(t, oldTable, oi);
|
||||||
@ -6283,7 +6281,7 @@ object translateExceptionHandlerTable(MyThread* t,
|
|||||||
assertT(
|
assertT(
|
||||||
t,
|
t,
|
||||||
handlerStart
|
handlerStart
|
||||||
< static_cast<int>(codeLength(t, context->method->code())
|
< static_cast<int>(context->method->code()->length()
|
||||||
* (context->subroutineCount + 1)));
|
* (context->subroutineCount + 1)));
|
||||||
|
|
||||||
int handlerEnd = resolveIpBackwards(
|
int handlerEnd = resolveIpBackwards(
|
||||||
@ -6294,15 +6292,14 @@ object translateExceptionHandlerTable(MyThread* t,
|
|||||||
assertT(t, handlerEnd >= 0);
|
assertT(t, handlerEnd >= 0);
|
||||||
assertT(t,
|
assertT(t,
|
||||||
handlerEnd <= static_cast<int>(
|
handlerEnd <= static_cast<int>(
|
||||||
codeLength(t, context->method->code())
|
context->method->code()->length()
|
||||||
* (context->subroutineCount + 1)));
|
* (context->subroutineCount + 1)));
|
||||||
|
|
||||||
intArrayBody(t, newIndex, ni* 3) = c->machineIp(handlerStart)->value()
|
intArrayBody(t, newIndex, ni* 3) = c->machineIp(handlerStart)->value()
|
||||||
- start;
|
- start;
|
||||||
|
|
||||||
intArrayBody(t, newIndex, (ni* 3) + 1)
|
intArrayBody(t, newIndex, (ni* 3) + 1)
|
||||||
= (handlerEnd == static_cast<int>(codeLength(
|
= (handlerEnd == static_cast<int>(context->method->code()->length())
|
||||||
t, context->method->code()))
|
|
||||||
? end
|
? end
|
||||||
: c->machineIp(handlerEnd)->value()) - start;
|
: c->machineIp(handlerEnd)->value()) - start;
|
||||||
|
|
||||||
@ -6340,7 +6337,7 @@ object translateExceptionHandlerTable(MyThread* t,
|
|||||||
object
|
object
|
||||||
translateLineNumberTable(MyThread* t, Context* context, intptr_t start)
|
translateLineNumberTable(MyThread* t, Context* context, intptr_t start)
|
||||||
{
|
{
|
||||||
object oldTable = reinterpret_cast<object>(codeLineNumberTable(t, context->method->code()));
|
object oldTable = reinterpret_cast<object>(context->method->code()->lineNumberTable());
|
||||||
if (oldTable) {
|
if (oldTable) {
|
||||||
PROTECT(t, oldTable);
|
PROTECT(t, oldTable);
|
||||||
|
|
||||||
@ -6841,7 +6838,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
|
|||||||
object newLineNumberTable = translateLineNumberTable
|
object newLineNumberTable = translateLineNumberTable
|
||||||
(t, context, reinterpret_cast<intptr_t>(start));
|
(t, context, reinterpret_cast<intptr_t>(start));
|
||||||
|
|
||||||
object code = context->method->code();
|
object code = reinterpret_cast<object>(context->method->code());
|
||||||
|
|
||||||
code = reinterpret_cast<object>(makeCode
|
code = reinterpret_cast<object>(makeCode
|
||||||
(t, 0, 0, newExceptionHandlerTable, cast<GcLineNumberTable>(t, newLineNumberTable),
|
(t, 0, 0, newExceptionHandlerTable, cast<GcLineNumberTable>(t, newLineNumberTable),
|
||||||
@ -6877,7 +6874,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
|
|||||||
object map = makeSimpleFrameMapTable(
|
object map = makeSimpleFrameMapTable(
|
||||||
t, context, start, RUNTIME_ARRAY_BODY(elements), index);
|
t, context, start, RUNTIME_ARRAY_BODY(elements), index);
|
||||||
|
|
||||||
set(t, context->method->code(), CodeStackMap, map);
|
set(t, reinterpret_cast<object>(context->method->code()), CodeStackMap, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
logCompile
|
logCompile
|
||||||
@ -6919,11 +6916,11 @@ compile(MyThread* t, Context* context)
|
|||||||
|
|
||||||
unsigned footprint = context->method->parameterFootprint();
|
unsigned footprint = context->method->parameterFootprint();
|
||||||
unsigned locals = localSize(t, context->method);
|
unsigned locals = localSize(t, context->method);
|
||||||
c->init(codeLength(t, context->method->code()), footprint, locals,
|
c->init(context->method->code()->length(), footprint, locals,
|
||||||
alignedFrameSize(t, context->method));
|
alignedFrameSize(t, context->method));
|
||||||
|
|
||||||
ir::Type* stackMap = (ir::Type*)malloc(
|
ir::Type* stackMap = (ir::Type*)malloc(
|
||||||
sizeof(ir::Type) * codeMaxStack(t, context->method->code()));
|
sizeof(ir::Type) * context->method->code()->maxStack());
|
||||||
Frame frame(context, stackMap);
|
Frame frame(context, stackMap);
|
||||||
|
|
||||||
unsigned index = context->method->parameterFootprint();
|
unsigned index = context->method->parameterFootprint();
|
||||||
@ -6977,7 +6974,7 @@ compile(MyThread* t, Context* context)
|
|||||||
context->dirtyRoots = false;
|
context->dirtyRoots = false;
|
||||||
unsigned eventIndex = calculateFrameMaps(t, context, 0, 0, 0);
|
unsigned eventIndex = calculateFrameMaps(t, context, 0, 0, 0);
|
||||||
|
|
||||||
object eht = codeExceptionHandlerTable(t, context->method->code());
|
object eht = context->method->code()->exceptionHandlerTable();
|
||||||
if (eht) {
|
if (eht) {
|
||||||
PROTECT(t, eht);
|
PROTECT(t, eht);
|
||||||
|
|
||||||
@ -6992,7 +6989,7 @@ compile(MyThread* t, Context* context)
|
|||||||
|
|
||||||
for (unsigned subI = 0; subI <= context->subroutineCount; ++subI) {
|
for (unsigned subI = 0; subI <= context->subroutineCount; ++subI) {
|
||||||
unsigned duplicatedBaseIp
|
unsigned duplicatedBaseIp
|
||||||
= subI * codeLength(t, context->method->code());
|
= subI * context->method->code()->length();
|
||||||
|
|
||||||
for (unsigned i = 0; i < exceptionHandlerTableLength(t, eht); ++i) {
|
for (unsigned i = 0; i < exceptionHandlerTableLength(t, eht); ++i) {
|
||||||
uint64_t eh = exceptionHandlerTableBody(t, eht, i);
|
uint64_t eh = exceptionHandlerTableBody(t, eht, i);
|
||||||
@ -7010,7 +7007,7 @@ compile(MyThread* t, Context* context)
|
|||||||
|
|
||||||
ir::Type* stackMap = (ir::Type*)malloc(
|
ir::Type* stackMap = (ir::Type*)malloc(
|
||||||
sizeof(ir::Type)
|
sizeof(ir::Type)
|
||||||
* codeMaxStack(t, context->method->code()));
|
* context->method->code()->maxStack());
|
||||||
Frame frame2(&frame, stackMap);
|
Frame frame2(&frame, stackMap);
|
||||||
|
|
||||||
unsigned end = duplicatedBaseIp + exceptionHandlerEnd(eh);
|
unsigned end = duplicatedBaseIp + exceptionHandlerEnd(eh);
|
||||||
@ -7024,7 +7021,7 @@ compile(MyThread* t, Context* context)
|
|||||||
context->eventLog.append2(end);
|
context->eventLog.append2(end);
|
||||||
|
|
||||||
for (unsigned i = 1;
|
for (unsigned i = 1;
|
||||||
i < codeMaxStack(t, context->method->code());
|
i < context->method->code()->maxStack();
|
||||||
++i) {
|
++i) {
|
||||||
frame2.set(localSize(t, context->method) + i, ir::Type::i4());
|
frame2.set(localSize(t, context->method) + i, ir::Type::i4());
|
||||||
}
|
}
|
||||||
@ -7389,7 +7386,7 @@ void
|
|||||||
findFrameMap(MyThread* t, void* stack UNUSED, GcMethod* method, int32_t offset,
|
findFrameMap(MyThread* t, void* stack UNUSED, GcMethod* method, int32_t offset,
|
||||||
int32_t** map, unsigned* start)
|
int32_t** map, unsigned* start)
|
||||||
{
|
{
|
||||||
object table = reinterpret_cast<object>(codeStackMap(t, method->code()));
|
object table = reinterpret_cast<object>(method->code()->stackMap());
|
||||||
findFrameMapInSimpleTable(t, method, table, offset, map, start);
|
findFrameMapInSimpleTable(t, method, table, offset, map, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8401,7 +8398,7 @@ class MyProcessor: public Processor {
|
|||||||
spec,
|
spec,
|
||||||
cast<GcMethodAddendum>(t, addendum),
|
cast<GcMethodAddendum>(t, addendum),
|
||||||
class_,
|
class_,
|
||||||
reinterpret_cast<object>(code));
|
code);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual GcClass*
|
virtual GcClass*
|
||||||
@ -9420,7 +9417,7 @@ fixupMethods(Thread* t, GcHashMap* map, BootImage* image UNUSED, uint8_t* code)
|
|||||||
assertT(t, methodCompiled(t, method)
|
assertT(t, methodCompiled(t, method)
|
||||||
<= static_cast<int32_t>(image->codeSize));
|
<= static_cast<int32_t>(image->codeSize));
|
||||||
|
|
||||||
codeCompiled(t, method->code())
|
method->code()->compiled()
|
||||||
= methodCompiled(t, method) + reinterpret_cast<uintptr_t>(code);
|
= methodCompiled(t, method) + reinterpret_cast<uintptr_t>(code);
|
||||||
|
|
||||||
if (DebugCompile) {
|
if (DebugCompile) {
|
||||||
@ -9981,7 +9978,7 @@ compile(MyThread* t, FixedAllocator* allocator, BootContext* bootContext,
|
|||||||
Context context(t, bootContext, clone);
|
Context context(t, bootContext, clone);
|
||||||
compile(t, &context);
|
compile(t, &context);
|
||||||
|
|
||||||
{ object ehTable = codeExceptionHandlerTable(t, clone->code());
|
{ object ehTable = clone->code()->exceptionHandlerTable();
|
||||||
|
|
||||||
if (ehTable) {
|
if (ehTable) {
|
||||||
PROTECT(t, ehTable);
|
PROTECT(t, ehTable);
|
||||||
@ -10033,7 +10030,7 @@ compile(MyThread* t, FixedAllocator* allocator, BootContext* bootContext,
|
|||||||
|
|
||||||
storeStoreMemoryBarrier();
|
storeStoreMemoryBarrier();
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(method), MethodCode, clone->code());
|
set(t, reinterpret_cast<object>(method), MethodCode, reinterpret_cast<object>(clone->code()));
|
||||||
|
|
||||||
if (methodVirtual(t, method)) {
|
if (methodVirtual(t, method)) {
|
||||||
classVtable(t, reinterpret_cast<object>(method->class_()), method->offset())
|
classVtable(t, reinterpret_cast<object>(method->class_()), method->offset())
|
||||||
|
@ -330,7 +330,7 @@ pushFrame(Thread* t, GcMethod* method)
|
|||||||
t->ip = 0;
|
t->ip = 0;
|
||||||
|
|
||||||
if ((method->flags() & ACC_NATIVE) == 0) {
|
if ((method->flags() & ACC_NATIVE) == 0) {
|
||||||
t->code = method->code();
|
t->code = reinterpret_cast<object>(method->code());
|
||||||
|
|
||||||
locals = codeMaxLocals(t, t->code);
|
locals = codeMaxLocals(t, t->code);
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ popFrame(Thread* t)
|
|||||||
t->sp = frameBase(t, t->frame);
|
t->sp = frameBase(t, t->frame);
|
||||||
t->frame = frameNext(t, t->frame);
|
t->frame = frameNext(t, t->frame);
|
||||||
if (t->frame >= 0) {
|
if (t->frame >= 0) {
|
||||||
t->code = frameMethod(t, t->frame)->code();
|
t->code = reinterpret_cast<object>(frameMethod(t, t->frame)->code());
|
||||||
t->ip = frameIp(t, t->frame);
|
t->ip = frameIp(t, t->frame);
|
||||||
} else {
|
} else {
|
||||||
t->code = 0;
|
t->code = 0;
|
||||||
@ -411,9 +411,9 @@ checkStack(Thread* t, GcMethod* method)
|
|||||||
{
|
{
|
||||||
if (UNLIKELY(t->sp
|
if (UNLIKELY(t->sp
|
||||||
+ method->parameterFootprint()
|
+ method->parameterFootprint()
|
||||||
+ codeMaxLocals(t, method->code())
|
+ method->code()->maxLocals()
|
||||||
+ FrameFootprint
|
+ FrameFootprint
|
||||||
+ codeMaxStack(t, method->code())
|
+ method->code()->maxStack()
|
||||||
> stackSizeInWords(t) / 2))
|
> stackSizeInWords(t) / 2))
|
||||||
{
|
{
|
||||||
throwNew(t, GcStackOverflowError::Type);
|
throwNew(t, GcStackOverflowError::Type);
|
||||||
@ -688,7 +688,7 @@ findExceptionHandler(Thread* t, GcMethod* method, unsigned ip)
|
|||||||
{
|
{
|
||||||
PROTECT(t, method);
|
PROTECT(t, method);
|
||||||
|
|
||||||
object eht = codeExceptionHandlerTable(t, method->code());
|
object eht = method->code()->exceptionHandlerTable();
|
||||||
|
|
||||||
if (eht) {
|
if (eht) {
|
||||||
for (unsigned i = 0; i < exceptionHandlerTableLength(t, eht); ++i) {
|
for (unsigned i = 0; i < exceptionHandlerTableLength(t, eht); ++i) {
|
||||||
@ -782,7 +782,7 @@ interpret3(Thread* t, const int base)
|
|||||||
object& exception = t->exception;
|
object& exception = t->exception;
|
||||||
uintptr_t* stack = t->stack;
|
uintptr_t* stack = t->stack;
|
||||||
|
|
||||||
code = frameMethod(t, frame)->code();
|
code = reinterpret_cast<object>(frameMethod(t, frame)->code());
|
||||||
|
|
||||||
if (UNLIKELY(exception)) {
|
if (UNLIKELY(exception)) {
|
||||||
goto throw_;
|
goto throw_;
|
||||||
@ -3000,7 +3000,7 @@ class MyProcessor: public Processor {
|
|||||||
spec,
|
spec,
|
||||||
cast<GcMethodAddendum>(t, addendum),
|
cast<GcMethodAddendum>(t, addendum),
|
||||||
class_,
|
class_,
|
||||||
reinterpret_cast<object>(code));
|
code);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual GcClass*
|
virtual GcClass*
|
||||||
|
@ -2938,7 +2938,7 @@ boot(Thread* t)
|
|||||||
{ object bootCode = reinterpret_cast<object>(makeCode(t, 0, 0, 0, 0, 0, 0, 0, 0, 1));
|
{ object bootCode = reinterpret_cast<object>(makeCode(t, 0, 0, 0, 0, 0, 0, 0, 0, 1));
|
||||||
codeBody(t, bootCode, 0) = impdep1;
|
codeBody(t, bootCode, 0) = impdep1;
|
||||||
object bootMethod = reinterpret_cast<object>(makeMethod
|
object bootMethod = reinterpret_cast<object>(makeMethod
|
||||||
(t, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bootCode));
|
(t, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, cast<GcCode>(t, bootCode)));
|
||||||
PROTECT(t, bootMethod);
|
PROTECT(t, bootMethod);
|
||||||
|
|
||||||
#include "type-java-initializations.cpp"
|
#include "type-java-initializations.cpp"
|
||||||
|
@ -266,7 +266,7 @@ findLineNumber(Thread* t, GcMethod* method, unsigned ip)
|
|||||||
// about, so we back up first:
|
// about, so we back up first:
|
||||||
-- ip;
|
-- ip;
|
||||||
|
|
||||||
object code = method->code();
|
object code = reinterpret_cast<object>(method->code());
|
||||||
object lnt = reinterpret_cast<object>(codeLineNumberTable(t, code));
|
object lnt = reinterpret_cast<object>(codeLineNumberTable(t, code));
|
||||||
if (lnt) {
|
if (lnt) {
|
||||||
unsigned bottom = 0;
|
unsigned bottom = 0;
|
||||||
|
@ -674,7 +674,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
|||||||
if (method->flags() & ACC_NATIVE) {
|
if (method->flags() & ACC_NATIVE) {
|
||||||
address = reinterpret_cast<uintptr_t>(code + image->thunks.native.start);
|
address = reinterpret_cast<uintptr_t>(code + image->thunks.native.start);
|
||||||
} else {
|
} else {
|
||||||
address = codeCompiled(t, method->code());
|
address = method->code()->compiled();
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<ListenPromise*>(pointerValue(t, tripleSecond(t, calls)))
|
static_cast<ListenPromise*>(pointerValue(t, tripleSecond(t, calls)))
|
||||||
|
Loading…
Reference in New Issue
Block a user