mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
add type asserts in appendCombine and appendTranslate
This commit is contained in:
parent
008bb6b86e
commit
d67820054e
@ -2668,9 +2668,9 @@ class MyCompiler: public Compiler {
|
||||
|
||||
appendCombine(&c,
|
||||
op,
|
||||
type.size(),
|
||||
a->type.size(),
|
||||
static_cast<Value*>(a),
|
||||
type.size(),
|
||||
b->type.size(),
|
||||
static_cast<Value*>(b),
|
||||
type.size(),
|
||||
result);
|
||||
|
@ -1008,29 +1008,32 @@ class CombineEvent: public Event {
|
||||
Value* resultValue;
|
||||
};
|
||||
|
||||
void
|
||||
appendCombine(Context* c, lir::TernaryOperation type,
|
||||
unsigned firstSize, Value* firstValue,
|
||||
unsigned secondSize, Value* secondValue,
|
||||
unsigned resultSize, Value* resultValue)
|
||||
void appendCombine(Context* c,
|
||||
lir::TernaryOperation op,
|
||||
unsigned firstSize,
|
||||
Value* firstValue,
|
||||
unsigned secondSize,
|
||||
Value* secondValue,
|
||||
unsigned resultSize,
|
||||
Value* resultValue)
|
||||
{
|
||||
assert(c, firstSize == firstValue->type.size());
|
||||
assert(c, secondSize == secondValue->type.size());
|
||||
assert(c, resultSize == resultValue->type.size());
|
||||
bool thunk;
|
||||
OperandMask firstMask;
|
||||
OperandMask secondMask;
|
||||
|
||||
c->arch->planSource(type,
|
||||
firstSize, firstMask,
|
||||
secondSize, secondMask,
|
||||
resultSize,
|
||||
&thunk);
|
||||
c->arch->planSource(
|
||||
op, firstSize, firstMask, secondSize, secondMask, resultSize, &thunk);
|
||||
|
||||
if (thunk) {
|
||||
FixedSliceStack<ir::Value*, 6> slice;
|
||||
size_t stackBase = c->stack ? c->stack->index + 1 : 0;
|
||||
|
||||
bool threadParameter;
|
||||
intptr_t handler = c->client->getThunk
|
||||
(type, firstSize, resultSize, &threadParameter);
|
||||
intptr_t handler
|
||||
= c->client->getThunk(op, firstSize, resultSize, &threadParameter);
|
||||
|
||||
unsigned stackSize = ceilingDivide(secondSize, vm::TargetBytesPerWord)
|
||||
+ ceilingDivide(firstSize, vm::TargetBytesPerWord);
|
||||
@ -1063,17 +1066,19 @@ appendCombine(Context* c, lir::TernaryOperation type,
|
||||
resultSize,
|
||||
slice);
|
||||
} else {
|
||||
append
|
||||
(c, new(c->zone)
|
||||
CombineEvent
|
||||
(c, type,
|
||||
firstSize, firstValue,
|
||||
secondSize, secondValue,
|
||||
resultSize, resultValue,
|
||||
SiteMask::lowPart(firstMask),
|
||||
SiteMask::highPart(firstMask),
|
||||
SiteMask::lowPart(secondMask),
|
||||
SiteMask::highPart(secondMask)));
|
||||
append(c,
|
||||
new (c->zone) CombineEvent(c,
|
||||
op,
|
||||
firstSize,
|
||||
firstValue,
|
||||
secondSize,
|
||||
secondValue,
|
||||
resultSize,
|
||||
resultValue,
|
||||
SiteMask::lowPart(firstMask),
|
||||
SiteMask::highPart(firstMask),
|
||||
SiteMask::lowPart(secondMask),
|
||||
SiteMask::highPart(secondMask)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1155,15 +1160,20 @@ class TranslateEvent: public Event {
|
||||
SiteMask resultHighMask;
|
||||
};
|
||||
|
||||
void
|
||||
appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
|
||||
Value* firstValue, unsigned resultSize, Value* resultValue)
|
||||
void appendTranslate(Context* c,
|
||||
lir::BinaryOperation op,
|
||||
unsigned firstSize,
|
||||
Value* firstValue,
|
||||
unsigned resultSize,
|
||||
Value* resultValue)
|
||||
{
|
||||
assert(c, firstSize == firstValue->type.size());
|
||||
assert(c, resultSize == resultValue->type.size());
|
||||
|
||||
bool thunk;
|
||||
OperandMask first;
|
||||
|
||||
c->arch->planSource(type, firstSize, first,
|
||||
resultSize, &thunk);
|
||||
c->arch->planSource(op, firstSize, first, resultSize, &thunk);
|
||||
|
||||
if (thunk) {
|
||||
size_t stackBase = c->stack ? c->stack->index + 1 : 0;
|
||||
@ -1175,23 +1185,27 @@ appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
|
||||
stackBase,
|
||||
slice);
|
||||
|
||||
appendCall(c,
|
||||
value(c,
|
||||
ir::Type(ir::Type::Address, vm::TargetBytesPerWord),
|
||||
constantSite(
|
||||
c, c->client->getThunk(type, firstSize, resultSize))),
|
||||
ir::NativeCallingConvention,
|
||||
0,
|
||||
0,
|
||||
resultValue,
|
||||
resultSize,
|
||||
slice);
|
||||
appendCall(
|
||||
c,
|
||||
value(c,
|
||||
ir::Type(ir::Type::Address, vm::TargetBytesPerWord),
|
||||
constantSite(c, c->client->getThunk(op, firstSize, resultSize))),
|
||||
ir::NativeCallingConvention,
|
||||
0,
|
||||
0,
|
||||
resultValue,
|
||||
resultSize,
|
||||
slice);
|
||||
} else {
|
||||
append(c, new(c->zone)
|
||||
TranslateEvent
|
||||
(c, type, firstSize, firstValue, resultSize, resultValue,
|
||||
SiteMask::lowPart(first),
|
||||
SiteMask::highPart(first)));
|
||||
append(c,
|
||||
new (c->zone) TranslateEvent(c,
|
||||
op,
|
||||
firstSize,
|
||||
firstValue,
|
||||
resultSize,
|
||||
resultValue,
|
||||
SiteMask::lowPart(first),
|
||||
SiteMask::highPart(first)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5178,12 +5178,13 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
||||
ir::Value* instance = c->peek(1, parameterFootprint - 1);
|
||||
|
||||
frame->stackCall(
|
||||
c->memory(c->binaryOp(lir::And,
|
||||
types.address,
|
||||
c->constant(TargetPointerMask, types.i4),
|
||||
c->memory(instance, types.object)),
|
||||
types.object,
|
||||
offset),
|
||||
c->memory(
|
||||
c->binaryOp(lir::And,
|
||||
types.address,
|
||||
c->constant(TargetPointerMask, types.address),
|
||||
c->memory(instance, types.object)),
|
||||
types.object,
|
||||
offset),
|
||||
target,
|
||||
tailCall ? Compiler::TailJump : 0,
|
||||
frame->trace(0, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user