Commit b0dccfba authored by Boxiang Sun's avatar Boxiang Sun

Stop to emit code if rewrite failed(failed == true)

If rewriter encounter a situation which can't be handled. It will set
the `failed` to `true`. In this situation, just stop to emit code. And
also don't check some assert.
parent 73eb4a8d
......@@ -448,8 +448,10 @@ void Rewriter::_getAttr(RewriterVar* result, RewriterVar* ptr, int offset, Locat
ptr->bumpUseEarlyIfPossible();
if (!failed) {
assembler::Register newvar_reg = result->initializeInReg(dest);
assembler->mov_generic(assembler::Indirect(ptr_reg, offset), newvar_reg, type);
}
result->releaseIfNoUses();
......@@ -2171,7 +2173,7 @@ assembler::Register RewriterVar::initializeInReg(Location l) {
// Add this to vars_by_locations
RewriterVar*& var = rewriter->vars_by_location[l];
assert(!var);
assert(!var || rewriter->failed);
var = this;
// Add the location to this
......
......@@ -577,6 +577,9 @@ protected:
void _callOptimalEncoding(assembler::Register tmp_reg, void* func_addr);
void assertConsistent() {
if (failed)
return;
#ifndef NDEBUG
for (RewriterVar& var : vars) {
for (Location l : var.locations) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment