change Compiler::register_ to Compiler::threadRegister, since it was only used as such

This commit is contained in:
Joshua Warner 2014-04-30 22:27:19 -06:00 committed by Joshua Warner
parent 2d444830d0
commit 8af9bb8297
6 changed files with 107 additions and 96 deletions

View File

@ -72,7 +72,7 @@ class Compiler {
Operand* index = 0,
unsigned scale = 1) = 0;
virtual Operand* register_(int number) = 0;
virtual Operand* threadRegister() = 0;
virtual void push(ir::Type type, Operand* value) = 0;
virtual void save(ir::Type type, Operand* value) = 0;

View File

@ -1237,17 +1237,10 @@ loadLocal(Context* c, unsigned footprint, unsigned index)
return c->locals[index].value;
}
Value*
register_(Context* c, int number)
Value* threadRegister(Context* c)
{
assert(c, (1 << number) & (c->regFile->generalRegisters.mask
| c->regFile->floatRegisters.mask));
Site* s = registerSite(c, number);
lir::ValueType type = ((1 << number) & c->regFile->floatRegisters.mask)
? lir::ValueFloat: lir::ValueGeneral;
return value(c, type, s, s);
Site* s = registerSite(c, c->arch->thread());
return value(c, ir::Type(ir::Type::Address, TargetBytesPerWord), s, s);
}
unsigned
@ -2319,7 +2312,9 @@ class MyCompiler: public Compiler {
}
virtual Operand* address(Promise* address) {
return value(&c, lir::ValueGeneral, compiler::addressSite(&c, address));
return value(&c,
ir::Type(ir::Type::Address, TargetBytesPerWord),
compiler::addressSite(&c, address));
}
virtual Operand* memory(Operand* base,
@ -2336,8 +2331,9 @@ class MyCompiler: public Compiler {
return result;
}
virtual Operand* register_(int number) {
return compiler::register_(&c, number);
virtual Operand* threadRegister()
{
return compiler::threadRegister(&c);
}
Promise* machineIp() {
@ -2378,7 +2374,7 @@ class MyCompiler: public Compiler {
}
virtual void pushed() {
Value* v = value(&c, lir::ValueGeneral);
Value* v = value(&c, ir::Type(ir::Type::Object, TargetBytesPerWord));
appendFrameSite
(&c, v, frameIndex
(&c, (c.stack ? c.stack->index : 0) + c.localFootprint));

View File

@ -82,8 +82,7 @@ Site*
pickTargetSite(Context* c, Read* read, bool intersectRead = false,
unsigned registerReserveCount = 0,
CostCalculator* costCalculator = 0);
Value*
register_(Context* c, int number);
Value* threadRegister(Context* c);
Event::Event(Context* c):
next(0), stackBefore(c->stack), localsBefore(c->locals),
@ -929,15 +928,23 @@ appendCombine(Context* c, lir::TernaryOperation type,
if (threadParameter) {
++ stackSize;
compiler::push(c, 1, register_(c, c->arch->thread()));
compiler::push(c, 1, threadRegister(c));
}
Stack* argumentStack = c->stack;
c->stack = oldStack;
appendCall
(c, value(c, lir::ValueGeneral, constantSite(c, handler)), 0, 0, resultValue,
resultSize, argumentStack, stackSize, 0);
appendCall(c,
value(c,
ir::Type(ir::Type::Address, vm::TargetBytesPerWord),
constantSite(c, handler)),
0,
0,
resultValue,
resultSize,
argumentStack,
stackSize,
0);
} else {
append
(c, new(c->zone)
@ -1049,12 +1056,18 @@ appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
Stack* argumentStack = c->stack;
c->stack = oldStack;
appendCall
(c, value
(c, lir::ValueGeneral, constantSite
(c, c->client->getThunk(type, firstSize, resultSize))),
0, 0, resultValue, resultSize, argumentStack,
ceilingDivide(firstSize, vm::TargetBytesPerWord), 0);
appendCall(c,
value(c,
ir::Type(ir::Type::Address, vm::TargetBytesPerWord),
constantSite(
c, c->client->getThunk(type, firstSize, resultSize))),
0,
0,
resultValue,
resultSize,
argumentStack,
ceilingDivide(firstSize, vm::TargetBytesPerWord),
0);
} else {
append(c, new(c->zone)
TranslateEvent
@ -1407,15 +1420,28 @@ appendBranch(Context* c, lir::TernaryOperation type, unsigned size, Value* first
Stack* argumentStack = c->stack;
c->stack = oldStack;
Value* result = value(c, lir::ValueGeneral);
appendCall
(c, value
(c, lir::ValueGeneral, constantSite(c, handler)), 0, 0, result, 4,
argumentStack, ceilingDivide(size, vm::TargetBytesPerWord) * 2, 0);
Value* result
= value(c, ir::Type(ir::Type::Address, vm::TargetBytesPerWord));
appendCall(c,
value(c,
ir::Type(ir::Type::Address, vm::TargetBytesPerWord),
constantSite(c, handler)),
0,
0,
result,
4,
argumentStack,
ceilingDivide(size, vm::TargetBytesPerWord) * 2,
0);
appendBranch(c, thunkBranch(c, type), 4, value
(c, lir::ValueGeneral, constantSite(c, static_cast<int64_t>(0))),
result, addressValue);
appendBranch(c,
thunkBranch(c, type),
4,
value(c,
ir::Type(ir::Type::Address, vm::TargetBytesPerWord),
constantSite(c, static_cast<int64_t>(0))),
result,
addressValue);
} else {
append
(c, new(c->zone)

View File

@ -162,16 +162,6 @@ bool Value::hasBuddy(Context* c, Value* b) {
}
#endif // not NDEBUG
Value* value(Context* c, lir::ValueType type, Site* site, Site* target) {
return value(
c,
ir::Type(type == lir::ValueGeneral ? ir::Type::Integer : ir::Type::Float,
vm::TargetBytesPerWord),
site,
target);
}
Value* value(Context* c, ir::Type type, Site* site, Site* target)
{
return new(c->zone) Value(site, target, type);

View File

@ -77,7 +77,6 @@ inline bool isGeneralValue(Compiler::Operand* a)
return !isFloatValue(a);
}
Value* value(Context* c, lir::ValueType type, Site* site = 0, Site* target = 0);
Value* value(Context* c, ir::Type type, Site* site = 0, Site* target = 0);
} // namespace compiler

View File

@ -1410,12 +1410,12 @@ class Frame {
object pointer = makePointer(t, p);
bc->constants = makeTriple(t, o, pointer, bc->constants);
return c->binaryOp(lir::Add,
types.address,
c->memory(c->register_(t->arch->thread()),
types.address,
TARGET_THREAD_HEAPIMAGE),
c->promiseConstant(p, types.address));
return c->binaryOp(
lir::Add,
types.address,
c->memory(
c->threadRegister(), types.address, TARGET_THREAD_HEAPIMAGE),
c->promiseConstant(p, types.address));
} else {
for (PoolElement* e = context->objectPool; e; e = e->next) {
if (o == e->target) {
@ -1644,7 +1644,7 @@ class Frame {
? c->binaryOp(
lir::Add,
types.address,
c->memory(c->register_(t->arch->thread()),
c->memory(c->threadRegister(),
types.address,
TARGET_THREAD_CODEIMAGE),
c->promiseConstant(
@ -3160,7 +3160,7 @@ void compileSafePoint(MyThread* t, Compiler* c, Frame* frame) {
0,
types.void_,
1,
c->register_(t->arch->thread()));
c->threadRegister());
}
Compiler::Operand*
@ -3204,12 +3204,12 @@ compileDirectInvoke(MyThread* t, Frame* frame, object target, bool tailCall,
operandTypeForFieldCode(t, methodReturnCode(t, target)),
methodParameterFootprint(t, target));
c->store(TargetBytesPerWord,
frame->absoluteAddressOperand(returnAddressPromise),
TargetBytesPerWord,
c->memory(c->register_(t->arch->thread()),
types.address,
TARGET_THREAD_TAILADDRESS));
c->store(
TargetBytesPerWord,
frame->absoluteAddressOperand(returnAddressPromise),
TargetBytesPerWord,
c->memory(
c->threadRegister(), types.address, TARGET_THREAD_TAILADDRESS));
c->exit(c->constant((methodFlags(t, target) & ACC_NATIVE)
? nativeThunk(t)
@ -3363,7 +3363,7 @@ compileDirectReferenceInvoke(MyThread* t, Frame* frame, Thunk thunk,
TargetBytesPerWord,
types.address,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair)),
reference,
isStatic,
@ -3411,7 +3411,7 @@ compileDirectAbstractInvoke(MyThread* t, Frame* frame, Thunk thunk,
TargetBytesPerWord,
types.address,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(target)),
target,
tailCall);
@ -3440,7 +3440,7 @@ handleMonitorEvent(MyThread* t, Frame* frame, intptr_t function)
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
lock);
}
}
@ -4093,7 +4093,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
1,
c->register_(t->arch->thread()));
c->threadRegister());
}
// fprintf(stderr, "ip: %d map: %ld\n", ip, *(frame->map));
@ -4222,7 +4222,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
array,
c->binaryOp(
lir::Add,
@ -4328,7 +4328,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.object,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(argument),
length));
} break;
@ -4374,7 +4374,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
target);
c->nullaryOp(lir::Trap);
@ -4413,7 +4413,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(argument),
instance);
} break;
@ -4624,7 +4624,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(field));
}
@ -4642,7 +4642,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(fieldClass(t, field)));
}
@ -4748,7 +4748,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(field));
} else {
c->nullaryOp(lir::LoadBarrier);
@ -4773,7 +4773,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair));
} else {
Compiler::Operand* instance = frame->popObject();
@ -4786,7 +4786,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
instance);
}
@ -5050,7 +5050,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
4,
types.i4,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(argument),
instance));
} break;
@ -5100,7 +5100,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.address,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(argument),
c->peek(1, parameterFootprint - 1)),
tailCall ? Compiler::TailJump : 0,
@ -5250,7 +5250,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.address,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
c->peek(1,
methodReferenceParameterFootprint(t, reference, false)
@ -5420,7 +5420,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.object,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(makePair(t, context->method, reference))));
}
}
@ -5434,7 +5434,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.object,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(v)));
} else {
frame->pushObject(frame->append(v));
@ -5553,7 +5553,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
c->jmp(context->bootContext
? c->binaryOp(lir::Add,
types.address,
c->memory(c->register_(t->arch->thread()),
c->memory(c->threadRegister(),
types.address,
TARGET_THREAD_CODEIMAGE),
address)
@ -5636,7 +5636,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
target);
} break;
@ -5649,7 +5649,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
target);
} break;
@ -5686,7 +5686,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.object,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(argument),
c->constant(dimensions, types.i4),
c->constant(offset, types.i4));
@ -5725,7 +5725,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.object,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(argument)));
} break;
@ -5741,7 +5741,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
TargetBytesPerWord,
types.object,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
c->constant(type, types.i4),
length));
} break;
@ -5784,7 +5784,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(fieldClass(t, field)));
}
@ -5811,7 +5811,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(field));
} else {
c->nullaryOp(lir::StoreStoreBarrier);
@ -5895,7 +5895,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
table,
c->constant(targetFieldOffset(context, field), types.i4),
value);
@ -5906,7 +5906,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
table,
c->constant(targetFieldOffset(context, field), types.i4),
value);
@ -5927,7 +5927,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
0,
types.void_,
2,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(field));
} else {
c->nullaryOp(lir::StoreLoadBarrier);
@ -5959,7 +5959,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
value);
} else {
@ -5972,7 +5972,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
instance,
value);
@ -5990,7 +5990,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
static_cast<Compiler::Operand*>(0),
value);
@ -6005,7 +6005,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
5,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
instance,
static_cast<Compiler::Operand*>(0),
@ -6024,7 +6024,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
3,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
value);
} else {
@ -6038,7 +6038,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
rSize,
rType,
4,
c->register_(t->arch->thread()),
c->threadRegister(),
frame->append(pair),
instance,
value);
@ -6234,7 +6234,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
context->bootContext
? c->binaryOp(lir::Add,
types.address,
c->memory(c->register_(t->arch->thread()),
c->memory(c->threadRegister(),
types.address,
TARGET_THREAD_CODEIMAGE),
entry)