don't skip move when MoveEvent is followed by a PushEvent which is not active; use existing register site in ValueSite when possible

This commit is contained in:
Joel Dice 2008-04-29 08:59:12 -06:00
parent 7791b1df80
commit c96f44d77d
2 changed files with 14 additions and 7 deletions

View File

@ -3875,11 +3875,11 @@ finish(MyThread* t, Context* context)
strcmp strcmp
(reinterpret_cast<const char*> (reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)), (&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
"java/lang/Class") == 0 and "java/lang/Number") == 0 and
strcmp strcmp
(reinterpret_cast<const char*> (reinterpret_cast<const char*>
(&byteArrayBody(t, methodName(t, context->method), 0)), (&byteArrayBody(t, methodName(t, context->method), 0)),
"replace") == 0) "<init>") == 0)
{ {
asm("int3"); asm("int3");
} }

View File

@ -332,7 +332,7 @@ class Event {
virtual void compile(Context* c) = 0; virtual void compile(Context* c) = 0;
virtual bool isBranch() { return false; }; virtual bool skipMove(unsigned) { return false; }
Event* next; Event* next;
Stack* stack; Stack* stack;
@ -682,6 +682,11 @@ class ValueSite: public AbstractSite {
if (s and s->type(c) == RegisterOperand) { if (s and s->type(c) == RegisterOperand) {
return s; return s;
} else { } else {
for (Site* s = r->value->sites; s; s = s->next) {
if (s->type(c) == RegisterOperand) {
return s;
}
}
return freeRegister(c, r->size, true); return freeRegister(c, r->size, true);
} }
} }
@ -988,6 +993,10 @@ class PushEvent: public Event {
nextRead(c, s->value); nextRead(c, s->value);
} }
virtual bool skipMove(unsigned size) {
return active and size >= 4;
}
Stack* s; Stack* s;
bool active; bool active;
}; };
@ -1182,9 +1191,9 @@ class MoveEvent: public Event {
Site* target; Site* target;
unsigned cost; unsigned cost;
if (type == Move if (type == Move
and size >= BytesPerWord
and dst->reads and dst->reads
and next == dst->reads->event) and next == dst->reads->event
and dst->reads->event->skipMove(size))
{ {
target = src->source; target = src->source;
cost = 0; cost = 0;
@ -1575,8 +1584,6 @@ class BranchEvent: public Event {
nextRead(c, address); nextRead(c, address);
} }
virtual bool isBranch() { return true; };
UnaryOperation type; UnaryOperation type;
Value* address; Value* address;
}; };