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;
}
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index e1f62fc..c86d551 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -78,12 +78,6 @@
}
void InvokeNopMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "nop", "()V");
@@ -91,12 +85,6 @@
}
void InvokeIdentityByteMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "identity", "(B)B");
@@ -126,12 +114,6 @@
}
void InvokeIdentityIntMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "identity", "(I)I");
@@ -161,12 +143,6 @@
}
void InvokeIdentityDoubleMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "identity", "(D)D");
@@ -196,12 +172,6 @@
}
void InvokeSumIntIntMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(II)I");
@@ -240,12 +210,6 @@
}
void InvokeSumIntIntIntMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(III)I");
@@ -289,12 +253,6 @@
}
void InvokeSumIntIntIntIntMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(IIII)I");
@@ -343,12 +301,6 @@
}
void InvokeSumIntIntIntIntIntMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(IIIII)I");
@@ -402,12 +354,6 @@
}
void InvokeSumDoubleDoubleMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(DD)D");
@@ -447,12 +393,6 @@
}
void InvokeSumDoubleDoubleDoubleMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(DDD)D");
@@ -483,12 +423,6 @@
}
void InvokeSumDoubleDoubleDoubleDoubleMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(DDDD)D");
@@ -522,12 +456,6 @@
}
void InvokeSumDoubleDoubleDoubleDoubleDoubleMethod(bool is_static) {
- // TODO: remove this when we have a working x86 compiler.
-#if !defined(__arm__)
- if (!is_static) {
- return;
- }
-#endif
Method* method;
Object* receiver;
Method::InvokeStub* stub = DoCompile(method, receiver, is_static, "sum", "(DDDDD)D");