Enable all tests on x86, add assertions
Enable jni_internal_test tests that were only enabled on ARM.
Emit "safe" unimplemented instructions that will die if run.
Assert that instruction sizes emitted by the assembler agree with the
expected size.
Change-Id: I5a99d473a7f4675142b17ad03132c1df55cb2c8f
diff --git a/src/compiler/codegen/x86/Assemble.cc b/src/compiler/codegen/x86/Assemble.cc
index 3d2b0e5..f3f3957 100644
--- a/src/compiler/codegen/x86/Assemble.cc
+++ b/src/compiler/codegen/x86/Assemble.cc
@@ -671,6 +671,12 @@
}
}
+void emitUnimplemented(CompilationUnit* cUnit, LIR* lir) {
+ for (int i = 0; i < oatGetInsnSize(lir); ++i) {
+ cUnit->codeBuffer.push_back(0xCC); // push breakpoint instruction - int 3
+ }
+}
+
/*
* Assemble the LIR into binary instruction format. Note that we may
* discover that pc-relative displacements may not fit the selected
@@ -705,6 +711,7 @@
continue;
}
const X86EncodingMap *entry = &EncodingMap[lir->opcode];
+ size_t starting_cbuf_size = cUnit->codeBuffer.size();
switch(entry->kind) {
case kData: // 4 bytes of data
cUnit->codeBuffer.push_back(lir->operands[0]);
@@ -742,9 +749,12 @@
emitRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
default:
- UNIMPLEMENTED(FATAL) << "Unimplemented encoding for: " << entry->name;
+ UNIMPLEMENTED(WARNING) << "Unimplemented encoding for: " << entry->name;
+ emitUnimplemented(cUnit, lir);
break;
}
+ CHECK_EQ(static_cast<size_t>(oatGetInsnSize(lir)),
+ cUnit->codeBuffer.size() - starting_cbuf_size);
}
return res;
}