diff options
Diffstat (limited to 'test/StackWalk/stack_walk_jni.cc')
-rw-r--r-- | test/StackWalk/stack_walk_jni.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/StackWalk/stack_walk_jni.cc b/test/StackWalk/stack_walk_jni.cc index ad9c674..06b3d41 100644 --- a/test/StackWalk/stack_walk_jni.cc +++ b/test/StackWalk/stack_walk_jni.cc @@ -6,19 +6,20 @@ #include "class_linker.h" #include "dex_verifier.h" #include "object.h" +#include "object_utils.h" #include "jni.h" namespace art { -#define REG(method, reg_bitmap, reg) \ - ( ((reg) < (method)->NumRegisters()) && \ +#define REG(mh, reg_bitmap, reg) \ + ( ((reg) < mh.GetCodeItem()->registers_size_) && \ (( *((reg_bitmap) + (reg)/8) >> ((reg) % 8) ) & 0x01) ) #define CHECK_REGS(...) do { \ int t[] = {__VA_ARGS__}; \ int t_size = sizeof(t) / sizeof(*t); \ for (int i = 0; i < t_size; ++i) \ - CHECK(REG(m, reg_bitmap, t[i])) << "Error: Reg " << i << " is not in RegisterMap"; \ + CHECK(REG(mh, reg_bitmap, t[i])) << "Error: Reg " << i << " is not in RegisterMap"; \ } while(false) static int gJava_StackWalk_refmap_calls = 0; @@ -39,12 +40,13 @@ struct ReferenceMapVisitor : public Thread::StackVisitor { } verifier::PcToReferenceMap map(m); const uint8_t* reg_bitmap = map.FindBitMap(m->ToDexPC(pc)); - String* m_name = m->GetName(); + MethodHelper mh(m); + StringPiece m_name(mh.GetName()); // Given the method name and the number of times the method has been called, // we know the Dex registers with live reference values. Assert that what we // find is what is expected. - if (m_name->Equals("f")) { + if (m_name == "f") { if (gJava_StackWalk_refmap_calls == 1) { CHECK_EQ(1U, m->ToDexPC(pc)); CHECK_REGS(1); @@ -53,7 +55,7 @@ struct ReferenceMapVisitor : public Thread::StackVisitor { CHECK_EQ(5U, m->ToDexPC(pc)); CHECK_REGS(1); } - } else if (m_name->Equals("g")) { + } else if (m_name == "g") { if (gJava_StackWalk_refmap_calls == 1) { CHECK_EQ(0xcU, m->ToDexPC(pc)); CHECK_REGS(0, 2); // Note that v1 is not in the minimal root set @@ -62,7 +64,7 @@ struct ReferenceMapVisitor : public Thread::StackVisitor { CHECK_EQ(0xcU, m->ToDexPC(pc)); CHECK_REGS(0, 2); } - } else if (m_name->Equals("shlemiel")) { + } else if (m_name == "shlemiel") { if (gJava_StackWalk_refmap_calls == 1) { CHECK_EQ(0x380U, m->ToDexPC(pc)); CHECK_REGS(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 25); |