summaryrefslogtreecommitdiffstats
path: root/vm/compiler/codegen
diff options
context:
space:
mode:
authorUdayan Banerji <udayan.banerji@intel.com>2013-03-29 13:32:10 -0700
committerUdayan Banerji <udayan.banerji@intel.com>2013-03-29 13:32:10 -0700
commit4eb6d969de37f9b82aaa4089490900f620e50f46 (patch)
treeea40b68418c78f2ddd83a312322e6b03d76c0405 /vm/compiler/codegen
parent8d8a7958a7aa0c73273161ddacfad34d1b9a97fe (diff)
downloadandroid_dalvik-4eb6d969de37f9b82aaa4089490900f620e50f46.tar.gz
android_dalvik-4eb6d969de37f9b82aaa4089490900f620e50f46.tar.bz2
android_dalvik-4eb6d969de37f9b82aaa4089490900f620e50f46.zip
[x86] Terminate trace if SGET/SPUT have unresolved fields in codegen
The interpreter doesn't allow SGET/SPUT bytecodes in a trace till the field is resolved. However, exhaustTrace can pick up bytecodes beyond the trace sent by the interpreter. Terminate the loop formation if this is seen. Change-Id: I0f38d6690b3501111bd16103623fa545d0ec1873 Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
Diffstat (limited to 'vm/compiler/codegen')
-rw-r--r--vm/compiler/codegen/x86/LowerGetPut.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/vm/compiler/codegen/x86/LowerGetPut.cpp b/vm/compiler/codegen/x86/LowerGetPut.cpp
index c87b17403..be519b124 100644
--- a/vm/compiler/codegen/x86/LowerGetPut.cpp
+++ b/vm/compiler/codegen/x86/LowerGetPut.cpp
@@ -668,7 +668,17 @@ int sget_sput_common(int flag, u2 vA, u2 tmp, bool isObj, bool isVolatile) {
void *fieldPtr = (void*)
(currentMethod->clazz->pDvmDex->pResFields[tmp]);
#endif
- assert(fieldPtr != NULL);
+
+ /* Usually, fieldPtr should not be null. The interpreter should resolve
+ * it before we come here, or not allow this opcode in a trace. However,
+ * we can be in a loop trace and this opcode might have been picked up
+ * by exhaustTrace. Sending a -1 here will terminate the loop formation
+ * and fall back to normal trace, which will not have this opcode.
+ */
+ if (!fieldPtr) {
+ return -1;
+ }
+
move_imm_to_reg(OpndSize_32, (int)fieldPtr, PhysicalReg_EAX, true);
if(flag == SGET) {
move_mem_to_reg(OpndSize_32, offStaticField_value, PhysicalReg_EAX, true, 7, false); //access field