Fix invoke sequence and enable recursive Fibonacci
I was previously generating the wrong starting offset for the
resolved methods array.
Change-Id: Ia77800323df2872681b30f2869ef4b1131766f39
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 49529e1..6e2f285 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -350,8 +350,9 @@
INVALID_SREG);
break;
case 3: // Method->DeclaringClass()->GetDexCache()->methodsObjectArr
- loadBaseDisp(cUnit, mir, r0, art::DexCache::MethodsOffset(),
- r0, kWord, INVALID_SREG);
+ loadBaseDisp(cUnit, mir, r0,
+ art::DexCache::MethodsOffset().Int32Value(), r0,
+ kWord, INVALID_SREG);
break;
case 4: // Skip past the object header
opRegImm(cUnit, kOpAdd, r0, art::Array::DataOffset().Int32Value());
diff --git a/src/compiler_test.cc b/src/compiler_test.cc
index 5300026..63aeee2 100644
--- a/src/compiler_test.cc
+++ b/src/compiler_test.cc
@@ -204,12 +204,10 @@
(1.0/0.0) / (1.0/0.0));
}
-#if 0 // Re-enable when method resolution in place
TEST_F(CompilerTest, RecursiveFibonacci) {
CompileDex(kIntMathDex, "kIntMathDex");
AssertStaticIntMethod("IntMath", "fibonacci", "(I)I", 55,
10);
}
-#endif
} // namespace art
diff --git a/src/dex_cache.h b/src/dex_cache.h
index fdf179b..9e762e1 100644
--- a/src/dex_cache.h
+++ b/src/dex_cache.h
@@ -38,16 +38,19 @@
return Get(kLocation)->AsString();
}
- static size_t StringsOffset() {
- return kStrings * sizeof(Object*);
+ static MemberOffset StringsOffset() {
+ return MemberOffset(DataOffset().Int32Value() +
+ kStrings * sizeof(Object*));
}
- static size_t FieldsOffset() {
- return kFields * sizeof(Object*);
+ static MemberOffset FieldsOffset() {
+ return MemberOffset(DataOffset().Int32Value() +
+ kFields * sizeof(Object*));
}
- static size_t MethodsOffset() {
- return kMethods * sizeof(Object*);
+ static MemberOffset MethodsOffset() {
+ return MemberOffset(DataOffset().Int32Value() +
+ kMethods * sizeof(Object*));
}
size_t NumStrings() const {