add asserts

This commit is contained in:
Joshua Warner
2014-05-01 12:37:01 -06:00
parent 42fec084b0
commit 865041b688
3 changed files with 18 additions and 12 deletions

View File

@ -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);
}
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;
}
@ -2311,10 +2318,9 @@ class MyCompiler: public Compiler {
return compiler::value(&c, type, compiler::constantSite(&c, value));
}
virtual Operand* address(Promise* address) {
return value(&c,
ir::Type(ir::Type::Address, TargetBytesPerWord),
compiler::addressSite(&c, address));
virtual Operand* address(ir::Type type, Promise* address)
{
return value(&c, type, compiler::addressSite(&c, address));
}
virtual Operand* memory(Operand* base,