Remove boilerplate code (nullaryOp methods in Compiler)

This commit is contained in:
Joshua Warner 2013-12-18 16:51:20 -07:00
parent bd7b66a898
commit eab36b3a23
3 changed files with 8 additions and 25 deletions

View File

@ -132,17 +132,12 @@ class Compiler {
virtual Operand* binaryOp(lir::TernaryOperation type, unsigned size, Operand* a, Operand* b) = 0; virtual Operand* binaryOp(lir::TernaryOperation type, unsigned size, Operand* a, Operand* b) = 0;
virtual Operand* unaryOp(lir::BinaryOperation type, unsigned size, Operand* a) = 0; virtual Operand* unaryOp(lir::BinaryOperation type, unsigned size, Operand* a) = 0;
virtual void nullaryOp(lir::Operation type) = 0;
virtual Operand* f2f(unsigned aSize, unsigned resSize, Operand* a) = 0; virtual Operand* f2f(unsigned aSize, unsigned resSize, Operand* a) = 0;
virtual Operand* f2i(unsigned aSize, unsigned resSize, Operand* a) = 0; virtual Operand* f2i(unsigned aSize, unsigned resSize, Operand* a) = 0;
virtual Operand* i2f(unsigned aSize, unsigned resSize, Operand* a) = 0; virtual Operand* i2f(unsigned aSize, unsigned resSize, Operand* a) = 0;
virtual void trap() = 0;
virtual void loadBarrier() = 0;
virtual void storeStoreBarrier() = 0;
virtual void storeLoadBarrier() = 0;
virtual void compile(uintptr_t stackOverflowHandler, virtual void compile(uintptr_t stackOverflowHandler,
unsigned stackLimitOffset) = 0; unsigned stackLimitOffset) = 0;
virtual unsigned resolve(uint8_t* dst) = 0; virtual unsigned resolve(uint8_t* dst) = 0;

View File

@ -2655,20 +2655,8 @@ class MyCompiler: public Compiler {
return result; return result;
} }
virtual void trap() { virtual void nullaryOp(lir::Operation type) {
appendOperation(&c, lir::Trap); appendOperation(&c, type);
}
virtual void loadBarrier() {
appendOperation(&c, lir::LoadBarrier);
}
virtual void storeStoreBarrier() {
appendOperation(&c, lir::StoreStoreBarrier);
}
virtual void storeLoadBarrier() {
appendOperation(&c, lir::StoreLoadBarrier);
} }
virtual void compile(uintptr_t stackOverflowHandler, virtual void compile(uintptr_t stackOverflowHandler,

View File

@ -4530,7 +4530,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
2, c->register_(t->arch->thread()), target); 2, c->register_(t->arch->thread()), target);
if (ip == codeLength(t, code)) { if (ip == codeLength(t, code)) {
c->trap(); c->nullaryOp(lir::Trap);
} }
} goto next; } goto next;
@ -4926,7 +4926,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
c->register_(t->arch->thread()), c->register_(t->arch->thread()),
frame->append(field)); frame->append(field));
} else { } else {
c->loadBarrier(); c->nullaryOp(lir::LoadBarrier);
} }
} }
} else { } else {
@ -6057,7 +6057,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0, frame->trace(0, 0), 0, Compiler::VoidType, 2, 0, frame->trace(0, 0), 0, Compiler::VoidType, 2,
c->register_(t->arch->thread()), frame->append(field)); c->register_(t->arch->thread()), frame->append(field));
} else { } else {
c->storeStoreBarrier(); c->nullaryOp(lir::StoreStoreBarrier);
} }
} }
@ -6156,7 +6156,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0, frame->trace(0, 0), 0, Compiler::VoidType, 2, 0, frame->trace(0, 0), 0, Compiler::VoidType, 2,
c->register_(t->arch->thread()), frame->append(field)); c->register_(t->arch->thread()), frame->append(field));
} else { } else {
c->storeLoadBarrier(); c->nullaryOp(lir::StoreLoadBarrier);
} }
} }
} else { } else {
@ -6254,7 +6254,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
case return_: case return_:
if (needsReturnBarrier(t, context->method)) { if (needsReturnBarrier(t, context->method)) {
c->storeStoreBarrier(); c->nullaryOp(lir::StoreStoreBarrier);
} }
handleExit(t, frame); handleExit(t, frame);