mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
split code.stackMap out of code.pool use
This commit is contained in:
parent
083dc17810
commit
4754a92b75
@ -6844,7 +6844,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
|
|||||||
object code = context->method->code();
|
object code = context->method->code();
|
||||||
|
|
||||||
code = reinterpret_cast<object>(makeCode
|
code = reinterpret_cast<object>(makeCode
|
||||||
(t, 0, newExceptionHandlerTable, cast<GcLineNumberTable>(t, newLineNumberTable),
|
(t, 0, 0, newExceptionHandlerTable, cast<GcLineNumberTable>(t, newLineNumberTable),
|
||||||
reinterpret_cast<uintptr_t>(start), codeSize, codeMaxStack(t, code),
|
reinterpret_cast<uintptr_t>(start), codeSize, codeMaxStack(t, code),
|
||||||
codeMaxLocals(t, code), 0));
|
codeMaxLocals(t, code), 0));
|
||||||
|
|
||||||
@ -6877,7 +6877,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(), CodePool, map);
|
set(t, context->method->code(), CodeStackMap, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
logCompile
|
logCompile
|
||||||
@ -7385,73 +7385,12 @@ findFrameMapInSimpleTable(MyThread* t, GcMethod* method, object table,
|
|||||||
abort(t);
|
abort(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
|
||||||
findFrameMap(MyThread* t, void* stack, GcMethod* method, object table,
|
|
||||||
unsigned pathIndex)
|
|
||||||
{
|
|
||||||
if (pathIndex) {
|
|
||||||
FrameMapTablePath* path = reinterpret_cast<FrameMapTablePath*>
|
|
||||||
(&byteArrayBody(t, table, pathIndex));
|
|
||||||
|
|
||||||
void* address = static_cast<void**>(stack)[path->stackIndex];
|
|
||||||
uint8_t* base = reinterpret_cast<uint8_t*>(methodAddress(t, method));
|
|
||||||
for (unsigned i = 0; i < path->elementCount; ++i) {
|
|
||||||
if (address == base + path->elements[i]) {
|
|
||||||
return i + (path->elementCount * findFrameMap
|
|
||||||
(t, stack, method, table, path->next));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abort(t);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
findFrameMapInGeneralTable(MyThread* t, void* stack, GcMethod* method,
|
findFrameMap(MyThread* t, void* stack UNUSED, GcMethod* method, int32_t offset,
|
||||||
object table, int32_t offset, int32_t** map,
|
|
||||||
unsigned* start)
|
|
||||||
{
|
|
||||||
FrameMapTableHeader* header = reinterpret_cast<FrameMapTableHeader*>
|
|
||||||
(&byteArrayBody(t, table, 0));
|
|
||||||
|
|
||||||
FrameMapTableIndexElement* index
|
|
||||||
= reinterpret_cast<FrameMapTableIndexElement*>
|
|
||||||
(&byteArrayBody(t, table, sizeof(FrameMapTableHeader)));
|
|
||||||
|
|
||||||
*map = reinterpret_cast<int32_t*>(index + header->indexCount);
|
|
||||||
|
|
||||||
unsigned bottom = 0;
|
|
||||||
unsigned top = header->indexCount;
|
|
||||||
for (unsigned span = top - bottom; span; span = top - bottom) {
|
|
||||||
unsigned middle = bottom + (span / 2);
|
|
||||||
FrameMapTableIndexElement* v = index + middle;
|
|
||||||
|
|
||||||
if (offset == v->offset) {
|
|
||||||
*start = v->base + (findFrameMap(t, stack, method, table, v->path)
|
|
||||||
* frameMapSizeInBits(t, method));
|
|
||||||
return;
|
|
||||||
} else if (offset < v->offset) {
|
|
||||||
top = middle;
|
|
||||||
} else {
|
|
||||||
bottom = middle + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abort(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
findFrameMap(MyThread* t, void* stack, GcMethod* method, int32_t offset,
|
|
||||||
int32_t** map, unsigned* start)
|
int32_t** map, unsigned* start)
|
||||||
{
|
{
|
||||||
object table = codePool(t, method->code());
|
object table = reinterpret_cast<object>(codeStackMap(t, method->code()));
|
||||||
if (objectClass(t, table) == type(t, GcIntArray::Type)) {
|
findFrameMapInSimpleTable(t, method, table, offset, map, start);
|
||||||
findFrameMapInSimpleTable(t, method, table, offset, map, start);
|
|
||||||
} else {
|
|
||||||
findFrameMapInGeneralTable(t, stack, method, table, offset, map, start);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1914,7 +1914,7 @@ parseCode(Thread* t, Stream& s, GcSingleton* pool)
|
|||||||
fprintf(stderr, " code: maxStack %d maxLocals %d length %d\n", maxStack, maxLocals, length);
|
fprintf(stderr, " code: maxStack %d maxLocals %d length %d\n", maxStack, maxLocals, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
object code = reinterpret_cast<object>(makeCode(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, maxStack, maxLocals, length));
|
object code = reinterpret_cast<object>(makeCode(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0, maxStack, maxLocals, length));
|
||||||
s.read(&codeBody(t, code, 0), length);
|
s.read(&codeBody(t, code, 0), length);
|
||||||
PROTECT(t, code);
|
PROTECT(t, code);
|
||||||
|
|
||||||
@ -2935,7 +2935,7 @@ boot(Thread* t)
|
|||||||
|
|
||||||
m->processor->boot(t, 0, 0);
|
m->processor->boot(t, 0, 0);
|
||||||
|
|
||||||
{ object bootCode = reinterpret_cast<object>(makeCode(t, 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, bootCode));
|
||||||
|
@ -328,6 +328,7 @@
|
|||||||
|
|
||||||
(type code avian/Code
|
(type code avian/Code
|
||||||
(object pool)
|
(object pool)
|
||||||
|
(intArray stackMap)
|
||||||
(object exceptionHandlerTable)
|
(object exceptionHandlerTable)
|
||||||
(lineNumberTable lineNumberTable)
|
(lineNumberTable lineNumberTable)
|
||||||
(intptr_t compiled)
|
(intptr_t compiled)
|
||||||
|
Loading…
Reference in New Issue
Block a user