Add thumb-specific code for invoke stub.
On LLVM-based compiler, we are compiling the invoke stubs
into Thumb2 instruction set. Thus, we should take care
of the thumb offset for invoke stub as well.
Change-Id: Ifc0b0099f2f035a64e89350086d6435e733224b8
diff --git a/src/object.h b/src/object.h
index 6334f8e..efdc3d7 100644
--- a/src/object.h
+++ b/src/object.h
@@ -840,11 +840,13 @@
}
uint32_t GetInvokeStubSize() const {
- const uint32_t* invoke_stub = reinterpret_cast<const uint32_t*>(GetInvokeStub());
- if (invoke_stub == NULL) {
+ uintptr_t invoke_stub = reinterpret_cast<uintptr_t>(GetInvokeStub());
+ if (invoke_stub == 0) {
return 0;
}
- return invoke_stub[-1];
+ // TODO: make this Thumb2 specific
+ invoke_stub &= ~0x1;
+ return reinterpret_cast<const uint32_t*>(invoke_stub)[-1];
}
uint32_t GetOatInvokeStubOffset() const {