diff --git a/src/compile.cpp b/src/compile.cpp index 8610df194e..32b15f3267 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -3881,7 +3881,7 @@ finish(MyThread* t, Context* context) strcmp (reinterpret_cast (&byteArrayBody(t, methodName(t, context->method), 0)), - "getName") == 0) + "replace") == 0) { asm("int3"); } diff --git a/src/compiler.cpp b/src/compiler.cpp index e33e8f57b3..89a8e3582e 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -19,7 +19,7 @@ const bool DebugAppend = true; const bool DebugCompile = true; const bool DebugStack = false; const bool DebugRegisters = true; -const bool DebugFrameIndexes = false; +const bool DebugFrameIndexes = true; const int AnyFrameIndex = -2; const int NoFrameIndex = -1; @@ -506,6 +506,8 @@ class Event { virtual void compilePostsync(Context*) { } + virtual bool isBranch() { return false; } + Event* next; Stack* stackBefore; Local* localsBefore; @@ -1635,8 +1637,6 @@ validate(Context* c, uint32_t mask, Stack* stack, Local* locals, current->value = value; current->site = site; return current; - } else { - removeSite(c, current->value, current->site); } } @@ -2565,6 +2565,8 @@ class BranchEvent: public Event { nextRead(c, this, address); } + virtual bool isBranch() { return true; } + UnaryOperation type; Value* address; }; @@ -2775,7 +2777,7 @@ resolveJunctionSite(Context* c, Event* e, Value* v, unsigned index, Site* target = e->junctionSites[index]; unsigned copyCost; Site* site = pick(c, v->sites, target, ©Cost); - if (v->visited or copyCost) { + if ((v->visited and target->type(c) == RegisterOperand) or copyCost) { move(c, e->stackAfter, e->localsAfter, r->size, v, site, target); } else { target = site; @@ -2931,7 +2933,8 @@ setSites(Context* c, Event* e, Site** sites) if (live(v)) { // fprintf(stderr, "set sites %p for %p at %d\n", sites[i], v, i); - addSite(c, 0, 0, v->reads->size, v, sites[i]); + addSite(c, e->stackBefore, e->localsBefore, v->reads->size, v, + sites[i]); } } } @@ -2944,7 +2947,8 @@ setSites(Context* c, Event* e, Site** sites) if (live(v)) { // fprintf(stderr, "set sites %p for %p at %d\n", sites[i], v, i); - addSite(c, 0, 0, v->reads->size, v, sites[i]); + addSite(c, e->stackBefore, e->localsBefore, v->reads->size, v, + sites[i]); } i -= stack->size; } @@ -3120,9 +3124,14 @@ compile(Context* c) populateSources(c, e); + bool branch = e->isBranch(); + if (branch and e->successors) { + populateSiteTables(c, e); + } + e->compile(c); - if (e->successors) { + if ((not branch) and e->successors) { populateSiteTables(c, e); }