mirror of
https://github.com/corda/corda.git
synced 2025-02-01 08:48:09 +00:00
add asserts
This commit is contained in:
parent
42fec084b0
commit
865041b688
@ -73,7 +73,7 @@ class Compiler {
|
|||||||
|
|
||||||
virtual Operand* constant(int64_t value, ir::Type type) = 0;
|
virtual Operand* constant(int64_t value, ir::Type type) = 0;
|
||||||
virtual Operand* promiseConstant(Promise* value, ir::Type type) = 0;
|
virtual Operand* promiseConstant(Promise* value, ir::Type type) = 0;
|
||||||
virtual Operand* address(Promise* address) = 0;
|
virtual Operand* address(ir::Type type, Promise* address) = 0;
|
||||||
virtual Operand* memory(Operand* base,
|
virtual Operand* memory(Operand* base,
|
||||||
ir::Type type,
|
ir::Type type,
|
||||||
int displacement = 0,
|
int displacement = 0,
|
||||||
|
@ -1252,6 +1252,13 @@ Value* loadLocal(Context* c, ir::Type type, unsigned index)
|
|||||||
fprintf(stderr, "load local %p at %d\n", c->locals[index].value, index);
|
fprintf(stderr, "load local %p at %d\n", c->locals[index].value, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(c,
|
||||||
|
type.flavor() != ir::Type::Object
|
||||||
|
|| c->locals[index].value->type.flavor() == ir::Type::Object
|
||||||
|
// TODO: this is a very java-specific hole in the type system. Get
|
||||||
|
// rid of it:
|
||||||
|
|| c->locals[index].value->type.flavor() == ir::Type::Address);
|
||||||
|
|
||||||
return c->locals[index].value;
|
return c->locals[index].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2311,10 +2318,9 @@ class MyCompiler: public Compiler {
|
|||||||
return compiler::value(&c, type, compiler::constantSite(&c, value));
|
return compiler::value(&c, type, compiler::constantSite(&c, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* address(Promise* address) {
|
virtual Operand* address(ir::Type type, Promise* address)
|
||||||
return value(&c,
|
{
|
||||||
ir::Type(ir::Type::Address, TargetBytesPerWord),
|
return value(&c, type, compiler::addressSite(&c, address));
|
||||||
compiler::addressSite(&c, address));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* memory(Operand* base,
|
virtual Operand* memory(Operand* base,
|
||||||
|
@ -1414,14 +1414,14 @@ class Frame {
|
|||||||
|
|
||||||
return c->binaryOp(
|
return c->binaryOp(
|
||||||
lir::Add,
|
lir::Add,
|
||||||
types.address,
|
types.object,
|
||||||
c->memory(
|
c->memory(
|
||||||
c->threadRegister(), types.address, TARGET_THREAD_HEAPIMAGE),
|
c->threadRegister(), types.object, TARGET_THREAD_HEAPIMAGE),
|
||||||
c->promiseConstant(p, types.address));
|
c->promiseConstant(p, types.object));
|
||||||
} else {
|
} else {
|
||||||
for (PoolElement* e = context->objectPool; e; e = e->next) {
|
for (PoolElement* e = context->objectPool; e; e = e->next) {
|
||||||
if (o == e->target) {
|
if (o == e->target) {
|
||||||
return c->address(e);
|
return c->address(types.object, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,7 +1429,7 @@ class Frame {
|
|||||||
|
|
||||||
++ context->objectPoolCount;
|
++ context->objectPoolCount;
|
||||||
|
|
||||||
return c->address(context->objectPool);
|
return c->address(types.object, context->objectPool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1711,7 +1711,7 @@ class Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pushObject(Value o) {
|
void pushObject(Value o) {
|
||||||
// assert(t, o->type == types.object);
|
assert(t, o->type == types.object || o->type.flavor() == ir::Type::Address);
|
||||||
pushQuiet(types.object, o);
|
pushQuiet(types.object, o);
|
||||||
pushedObject();
|
pushedObject();
|
||||||
}
|
}
|
||||||
@ -3130,7 +3130,7 @@ ir::Type operandTypeForFieldCode(Thread* t, unsigned code)
|
|||||||
return types.i8;
|
return types.i8;
|
||||||
|
|
||||||
case ObjectField:
|
case ObjectField:
|
||||||
return types.address;
|
return types.object;
|
||||||
|
|
||||||
case FloatField:
|
case FloatField:
|
||||||
return types.f4;
|
return types.f4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user