stack mapping progress

This commit is contained in:
Joel Dice 2007-10-12 08:26:36 -06:00
parent 3e1dbab0f0
commit 5a92852f74
2 changed files with 14 additions and 12 deletions

View File

@ -142,7 +142,8 @@ clearBit(uintptr_t* map, unsigned i)
inline unsigned inline unsigned
getBit(uintptr_t* map, unsigned i) getBit(uintptr_t* map, unsigned i)
{ {
return map[wordOf(i)] & (static_cast<uintptr_t>(1) << bitOf(i)); return (map[wordOf(i)] & (static_cast<uintptr_t>(1) << bitOf(i)))
>> bitOf(i);
} }
template <class T> template <class T>

View File

@ -300,9 +300,6 @@ class StackMapper {
unsigned i = index[ip]; unsigned i = index[ip];
while (true) { while (true) {
// fprintf(stderr, "event %d; ip %d; sp %d; local size %d; map size %d\n",
// log.get(i), ip, sp, localSize(), mapSize());
switch (log.get(i++)) { switch (log.get(i++)) {
case Call: { case Call: {
assert(t, callIndex < callCount); assert(t, callIndex < callCount);
@ -445,7 +442,7 @@ class StackMapper {
assert(t, getBit(mask, exceptionHandlerStart(eh))); assert(t, getBit(mask, exceptionHandlerStart(eh)));
memcpy(map, memcpy(map,
table + (exceptionHandlerStart(eh) * mapSizeInBytes()), table + (exceptionHandlerStart(eh) * mapSizeInWords()),
mapSizeInBytes()); mapSizeInBytes());
for (unsigned j = localSize() + 1; j < mapSize(); ++j) { for (unsigned j = localSize() + 1; j < mapSize(); ++j) {
@ -460,6 +457,7 @@ class StackMapper {
} }
t->m->system->free(mask); t->m->system->free(mask);
t->m->system->free(table);
assert(t, callIndex == callCount); assert(t, callIndex == callCount);
qsort(calls, callCount, mapSizeInBytes() + BytesPerWord, compareCalls); qsort(calls, callCount, mapSizeInBytes() + BytesPerWord, compareCalls);
@ -2828,7 +2826,6 @@ class JavaCompiler: public Compiler {
case l2i: case l2i:
if (BytesPerWord == 8) { if (BytesPerWord == 8) {
popInt(); popInt();
stackMapper.poppedInt();
} else { } else {
popInt(rax); popInt(rax);
mov(rax, rsp, 0); mov(rax, rsp, 0);
@ -2913,17 +2910,19 @@ class JavaCompiler: public Compiler {
jl(less); jl(less);
jg(greater); jg(greater);
pushInt(0); push(0);
jmp(next); jmp(next);
less.mark(); less.mark();
pushInt(-1); push(-1);
jmp(next); jmp(next);
greater.mark(); greater.mark();
pushInt(1); push(1);
next.mark(); next.mark();
stackMapper.pushedInt();
} else { } else {
popLong(rax, rdx); popLong(rax, rdx);
popLong(rcx, rbx); popLong(rcx, rbx);
@ -2936,17 +2935,19 @@ class JavaCompiler: public Compiler {
jb(less); jb(less);
ja(greater); ja(greater);
pushInt(0); push(0);
jmp(next); jmp(next);
less.mark(); less.mark();
pushInt(-1); push(-1);
jmp(next); jmp(next);
greater.mark(); greater.mark();
pushInt(1); push(1);
next.mark(); next.mark();
stackMapper.pushedInt();
} }
} break; } break;