# $(eval $(call declare-test-test-target,StackWalk,))
# $(eval $(call declare-test-test-target,StackWalk2,))
-# TODO: Re-enable this when RegisterMap is working for thread run.
-# $(eval $(call declare-test-test-target,MemUsage,))
+ $(eval $(call declare-test-test-target,MemUsage,))
########################################################################
return gThread_daemon->GetBoolean(peer_);
}
+// blx is 2-byte in Thumb2. Need to offset PC back to a call site.
+static const int kThumb2InstSize = 2;
+
class ReferenceMapVisitor : public Thread::StackVisitor {
public:
ReferenceMapVisitor(Context* context, Heap::RootVisitor* root_visitor, void* arg) :
void VisitFrame(const Frame& frame, uintptr_t pc) {
Method* m = frame.GetMethod();
- LOG(INFO) << "Visiting stack roots in " << PrettyMethod(m, false);
// Process register map (which native and callee save methods don't have)
if (!m->IsNative() && !m->IsPhony()) {
UniquePtr<art::DexVerifier::RegisterMap> map(art::DexVerifier::GetExpandedRegisterMap(m));
- const uint8_t* reg_bitmap = art::DexVerifier::RegisterMapGetLine(map.get(), m->ToDexPC(pc));
+ const uint8_t* reg_bitmap = art::DexVerifier::RegisterMapGetLine(
+ map.get(),
+ m->ToDexPC(pc -kThumb2InstSize));
+
+ LOG(INFO) << "Visiting stack roots in " << PrettyMethod(m, false)
+ << "@ PC: " << m->ToDexPC(pc - kThumb2InstSize);
+
CHECK(reg_bitmap != NULL);
ShortArray* vmap = m->GetVMapTable();
// For all dex registers
} else {
ref = reinterpret_cast<Object*>(frame.GetVReg(m ,reg));
}
- root_visitor_(ref, arg_);
+ if (ref != NULL) {
+ root_visitor_(ref, arg_);
+ }
}
}
}
-
public class MemUsage {
- public static final int NUM_1D_ARRAYS = 1000;
- public static final int INCREMENT = 300;
+ public static final int ROUNDS = 8;
+ public static final int SIZE = 2000;
public static void main(String [] args) {
- int sz = 1000;
- double[][] RelocationArray = new double[NUM_1D_ARRAYS][];
- while (true) {
- for (int i = 0; i < NUM_1D_ARRAYS; i++) {
- RelocationArray[i] = new double[sz];
- if (sz + INCREMENT > 0) {
- sz += INCREMENT;
- }
+ String s;
+ for (int j = 0; j < ROUNDS; j++) {
+ s = "";
+ for (int i = 0; i < SIZE; i++) {
+ s += "x";
}
}
}