fix build

This commit is contained in:
Joel Dice 2008-04-17 16:07:32 -06:00
parent 4d5a57671a
commit a7134a2cd7
5 changed files with 561 additions and 492 deletions

View File

@ -55,10 +55,10 @@ enum OperandType {
AddressOperand, AddressOperand,
RegisterOperand, RegisterOperand,
MemoryOperand, MemoryOperand,
StackOperand StackOperand // for compiler use; not used in assembler
}; };
const unsigned OperandTypeCount = Memory + 1; const unsigned OperandTypeCount = MemoryOperand + 1;
const int NoRegister = -1; const int NoRegister = -1;
const int AnyRegister = -2; const int AnyRegister = -2;

View File

@ -847,7 +847,7 @@ class Frame {
} }
void dup() { void dup() {
c->push(BytesPerWord, c->dup(BytesPerWord, c->peek(BytesPerWord, 0))); c->push(BytesPerWord, c->peek(BytesPerWord, 0));
dupped(); dupped();
} }
@ -858,7 +858,7 @@ class Frame {
c->push(BytesPerWord, s0); c->push(BytesPerWord, s0);
c->push(BytesPerWord, s1); c->push(BytesPerWord, s1);
c->push(BytesPerWord, c->dup(BytesPerWord, s0)); c->push(BytesPerWord, s0);
duppedX1(); duppedX1();
} }
@ -871,7 +871,7 @@ class Frame {
c->push(BytesPerWord, s0); c->push(BytesPerWord, s0);
pushLongQuiet(s1); pushLongQuiet(s1);
c->push(BytesPerWord, c->dup(BytesPerWord, s0)); c->push(BytesPerWord, s0);
} else { } else {
Compiler::Operand* s1 = c->pop(BytesPerWord); Compiler::Operand* s1 = c->pop(BytesPerWord);
Compiler::Operand* s2 = c->pop(BytesPerWord); Compiler::Operand* s2 = c->pop(BytesPerWord);
@ -879,7 +879,7 @@ class Frame {
c->push(BytesPerWord, s0); c->push(BytesPerWord, s0);
c->push(BytesPerWord, s2); c->push(BytesPerWord, s2);
c->push(BytesPerWord, s1); c->push(BytesPerWord, s1);
c->push(BytesPerWord, c->dup(BytesPerWord, s0)); c->push(BytesPerWord, s0);
} }
duppedX2(); duppedX2();
@ -887,15 +887,15 @@ class Frame {
void dup2() { void dup2() {
if (get(sp - 1) == Long) { if (get(sp - 1) == Long) {
pushLongQuiet(c->dup(8, peekLong(0))); pushLongQuiet(peekLong(0));
} else { } else {
Compiler::Operand* s0 = c->pop(BytesPerWord); Compiler::Operand* s0 = c->pop(BytesPerWord);
Compiler::Operand* s1 = c->pop(BytesPerWord); Compiler::Operand* s1 = c->pop(BytesPerWord);
c->push(BytesPerWord, s1); c->push(BytesPerWord, s1);
c->push(BytesPerWord, s0); c->push(BytesPerWord, s0);
c->push(BytesPerWord, c->dup(BytesPerWord, s1)); c->push(BytesPerWord, s1);
c->push(BytesPerWord, c->dup(BytesPerWord, s0)); c->push(BytesPerWord, s0);
} }
dupped2(); dupped2();
@ -908,7 +908,7 @@ class Frame {
pushLongQuiet(s0); pushLongQuiet(s0);
c->push(BytesPerWord, s1); c->push(BytesPerWord, s1);
pushLongQuiet(c->dup(8, s0)); pushLongQuiet(s0);
} else { } else {
Compiler::Operand* s0 = c->pop(BytesPerWord); Compiler::Operand* s0 = c->pop(BytesPerWord);
Compiler::Operand* s1 = c->pop(BytesPerWord); Compiler::Operand* s1 = c->pop(BytesPerWord);
@ -917,8 +917,8 @@ class Frame {
c->push(BytesPerWord, s1); c->push(BytesPerWord, s1);
c->push(BytesPerWord, s0); c->push(BytesPerWord, s0);
c->push(BytesPerWord, s2); c->push(BytesPerWord, s2);
c->push(BytesPerWord, c->dup(BytesPerWord, s1)); c->push(BytesPerWord, s1);
c->push(BytesPerWord, c->dup(BytesPerWord, s0)); c->push(BytesPerWord, s0);
} }
dupped2X1(); dupped2X1();
@ -933,7 +933,7 @@ class Frame {
pushLongQuiet(s0); pushLongQuiet(s0);
pushLongQuiet(s1); pushLongQuiet(s1);
pushLongQuiet(c->dup(8, s0)); pushLongQuiet(s0);
} else { } else {
Compiler::Operand* s1 = c->pop(BytesPerWord); Compiler::Operand* s1 = c->pop(BytesPerWord);
Compiler::Operand* s2 = c->pop(BytesPerWord); Compiler::Operand* s2 = c->pop(BytesPerWord);
@ -941,7 +941,7 @@ class Frame {
pushLongQuiet(s0); pushLongQuiet(s0);
c->push(BytesPerWord, s2); c->push(BytesPerWord, s2);
c->push(BytesPerWord, s1); c->push(BytesPerWord, s1);
pushLongQuiet(c->dup(8, s0)); pushLongQuiet(s0);
} }
} else { } else {
Compiler::Operand* s0 = c->pop(BytesPerWord); Compiler::Operand* s0 = c->pop(BytesPerWord);
@ -953,8 +953,8 @@ class Frame {
c->push(BytesPerWord, s0); c->push(BytesPerWord, s0);
c->push(BytesPerWord, s3); c->push(BytesPerWord, s3);
c->push(BytesPerWord, s2); c->push(BytesPerWord, s2);
c->push(BytesPerWord, c->dup(BytesPerWord, s1)); c->push(BytesPerWord, s1);
c->push(BytesPerWord, c->dup(BytesPerWord, s0)); c->push(BytesPerWord, s0);
} }
dupped2X2(); dupped2X2();
@ -1710,9 +1710,12 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
} else if (exceptionHandler) { } else if (exceptionHandler) {
exceptionHandler = false; exceptionHandler = false;
c->indirectCall c->call
(c->constant(reinterpret_cast<intptr_t>(gcIfNecessary)), (c->constant(reinterpret_cast<intptr_t>(gcIfNecessary)),
context->indirection,
0,
frame->trace(0, false), frame->trace(0, false),
0,
1, c->thread()); 1, c->thread());
} }
@ -2098,7 +2101,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
frame->pushLong frame->pushLong
(c->call (c->call
(c->constant(reinterpret_cast<intptr_t>(doubleToInt)), (c->constant(reinterpret_cast<intptr_t>(addDouble)),
0, 0, 0, 8, 2, a, b)); 0, 0, 0, 8, 2, a, b));
} break; } break;
@ -2833,27 +2836,17 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
} break; } break;
case l2d: { case l2d: {
Operand* a = frame->popLong(); frame->pushLong
(c->call
c->directCall (c->constant(reinterpret_cast<intptr_t>(longToDouble)),
(c->constant(reinterpret_cast<intptr_t>(longToDouble)), 2, 0, a); 0, 0, 0, 8, 1, frame->popLong()));
Operand* result = c->result8();
frame->pushLong(result);
c->release(result);
c->release(a);
} break; } break;
case l2f: { case l2f: {
Operand* a = frame->popLong(); frame->pushInt
(c->call
c->directCall (c->constant(reinterpret_cast<intptr_t>(longToFloat)),
(c->constant(reinterpret_cast<intptr_t>(longToDouble)), 2, 0, a); 0, 0, 0, 4, 1, frame->popLong()));
Operand* result = c->result4();
frame->pushInt(result);
c->release(result);
c->release(a);
} break; } break;
case l2i: case l2i:
@ -3819,7 +3812,7 @@ finish(MyThread* t, Context* context)
if (Verbose) { if (Verbose) {
logCompile logCompile
(start, c->codeSize(), (start, codeSize,
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)),
reinterpret_cast<const char*> reinterpret_cast<const char*>
@ -4332,11 +4325,13 @@ saveStackAndBase(MyThread* t, Assembler* a)
{ {
Assembler::Register base(a->base()); Assembler::Register base(a->base());
Assembler::Memory baseDst(a->thread(), difference(&(t->base), t)); Assembler::Memory baseDst(a->thread(), difference(&(t->base), t));
a->apply(Move, BytesPerWord, Register, &base, Memory, &baseDst); a->apply(Move, BytesPerWord, RegisterOperand, &base,
MemoryOperand, &baseDst);
Assembler::Register stack(a->stack()); Assembler::Register stack(a->stack());
Assembler::Memory stackDst(a->thread(), difference(&(t->stack), t)); Assembler::Memory stackDst(a->thread(), difference(&(t->stack), t));
a->apply(Move, BytesPerWord, Register, &stack, Memory, &stackDst); a->apply(Move, BytesPerWord, RegisterOperand, &stack,
MemoryOperand, &stackDst);
} }
void void
@ -4346,9 +4341,10 @@ pushThread(MyThread*, Assembler* a)
if (a->argumentRegisterCount()) { if (a->argumentRegisterCount()) {
Assembler::Register arg(a->argumentRegister(0)); Assembler::Register arg(a->argumentRegister(0));
a->apply(Move, BytesPerWord, Register, &thread, Register, &arg); a->apply(Move, BytesPerWord, RegisterOperand, &thread,
RegisterOperand, &arg);
} else { } else {
a->apply(Push, BytesPerWord, Register, &thread); a->apply(Push, BytesPerWord, RegisterOperand, &thread);
} }
} }
@ -4359,7 +4355,8 @@ popThread(MyThread*, Assembler* a)
ResolvedPromise bpwPromise(BytesPerWord); ResolvedPromise bpwPromise(BytesPerWord);
Assembler::Constant bpw(&bpwPromise); Assembler::Constant bpw(&bpwPromise);
Assembler::Register stack(a->stack()); Assembler::Register stack(a->stack());
a->apply(Add, BytesPerWord, Constant, &bpw, Register, &stack); a->apply(Add, BytesPerWord, ConstantOperand, &bpw,
RegisterOperand, &stack);
} }
} }
@ -4371,12 +4368,12 @@ compileDefault(MyThread* t, Assembler* a)
ResolvedPromise procPromise(reinterpret_cast<intptr_t>(compileMethod)); ResolvedPromise procPromise(reinterpret_cast<intptr_t>(compileMethod));
Assembler::Constant proc(&procPromise); Assembler::Constant proc(&procPromise);
a->apply(Call, BytesPerWord, Constant, &proc); a->apply(Call, BytesPerWord, ConstantOperand, &proc);
popThread(t, a); popThread(t, a);
Assembler::Register result(a->returnLow()); Assembler::Register result(a->returnLow());
a->apply(Jump, BytesPerWord, Register, &result); a->apply(Jump, BytesPerWord, RegisterOperand, &result);
return finish(t, a, "default"); return finish(t, a, "default");
} }
@ -4389,7 +4386,7 @@ compileNative(MyThread* t, Assembler* a)
ResolvedPromise promise(reinterpret_cast<intptr_t>(invokeNative)); ResolvedPromise promise(reinterpret_cast<intptr_t>(invokeNative));
Assembler::Constant proc(&promise); Assembler::Constant proc(&promise);
a->apply(Call, BytesPerWord, Constant, &proc); a->apply(Call, BytesPerWord, ConstantOperand, &proc);
popThread(t, a); popThread(t, a);
@ -5003,7 +5000,7 @@ processor(MyThread* t)
saveStackAndBase(t, a); saveStackAndBase(t, a);
Assembler::Register proc(a->returnLow()); Assembler::Register proc(a->returnLow());
a->apply(Jump, BytesPerWord, Register, &proc); a->apply(Jump, BytesPerWord, RegisterOperand, &proc);
p->indirectCallerSize = a->length(); p->indirectCallerSize = a->length();
p->indirectCaller = static_cast<uint8_t*> p->indirectCaller = static_cast<uint8_t*>

File diff suppressed because it is too large Load Diff

View File

@ -77,7 +77,6 @@ class Compiler {
virtual Operand* load(unsigned size, Operand* src) = 0; virtual Operand* load(unsigned size, Operand* src) = 0;
virtual Operand* loadz(unsigned size, Operand* src) = 0; virtual Operand* loadz(unsigned size, Operand* src) = 0;
virtual Operand* load4To8(Operand* src) = 0; virtual Operand* load4To8(Operand* src) = 0;
virtual Operand* dup(unsigned size, Operand* src) = 0;
virtual void cmp(unsigned size, Operand* a, Operand* b) = 0; virtual void cmp(unsigned size, Operand* a, Operand* b) = 0;
virtual void jl(Operand* address) = 0; virtual void jl(Operand* address) = 0;
virtual void jg(Operand* address) = 0; virtual void jg(Operand* address) = 0;

View File

@ -287,6 +287,12 @@ conditional(Context* c, unsigned condition, Assembler::Constant* a)
c->code.append4(0); c->code.append4(0);
} }
void
moveCR(Context*, unsigned, Assembler::Constant*, Assembler::Register*);
void
callR(Context*, unsigned, Assembler::Register*);
void void
callC(Context* c, unsigned size, Assembler::Constant* a) callC(Context* c, unsigned size, Assembler::Constant* a)
{ {
@ -400,9 +406,6 @@ jumpIfLessOrEqualC(Context* c, unsigned size UNUSED, Assembler::Constant* a)
conditional(c, 0x8e, a); conditional(c, 0x8e, a);
} }
void
moveCR(Context*, unsigned, Assembler::Constant*, Assembler::Register*);
void void
pushR(Context*, unsigned, Assembler::Register*); pushR(Context*, unsigned, Assembler::Register*);
@ -951,6 +954,11 @@ populateTables()
{ {
Operations[Return] = return_; Operations[Return] = return_;
const int Constant = ConstantOperand;
const int Address = AddressOperand;
const int Register = RegisterOperand;
const int Memory = MemoryOperand;
UnaryOperations[INDEX1(Call, Constant)] = CAST1(callC); UnaryOperations[INDEX1(Call, Constant)] = CAST1(callC);
UnaryOperations[INDEX1(Call, Register)] = CAST1(callR); UnaryOperations[INDEX1(Call, Register)] = CAST1(callR);
UnaryOperations[INDEX1(Call, Memory)] = CAST1(callM); UnaryOperations[INDEX1(Call, Memory)] = CAST1(callM);