} else { VM_Thread t = VM_Thread.getCurrentThread(); Address fp = VM_Magic.getFramePointer(); while (true) { Address caller_ip = VM_Magic.getReturnAddress(fp); Address caller_fp = VM_Magic.getCallerFramePointer(fp); if (VM_Magic.getCallerFramePointer(caller_fp).EQ(STACKFRAME_SENTINEL_FP)) VM.sysFail("prepareMutator (participating): Could not locate VM_CollectorThread.run"); int compiledMethodId = VM_Magic.getCompiledMethodID(caller_fp); VM_CompiledMethod compiledMethod = VM_CompiledMethods.getCompiledMethod(compiledMethodId); VM_Method method = compiledMethod.getMethod(); VM_Atom cls = method.getDeclaringClass().getDescriptor(); VM_Atom name = method.getName(); if (name == runAtom && cls == collectorThreadAtom) { t.contextRegisters.setInnermost(caller_ip, caller_fp); break; } fp = caller_fp; }
  public static void prepareMutator(MutatorContext m) {    /*     * The collector threads of processors currently running threads     * off in JNI-land cannot run.     */    VM_Processor vp = ((SelectedMutatorContext) m).getProcessor();    int vpStatus = vp.vpStatus;    if (vpStatus == VM_Processor.BLOCKED_IN_NATIVE) {            /* processor & its running thread are blocked in C for this GC.       Its stack needs to be scanned, starting from the "top" java       frame, which has been saved in the running threads JNIEnv.  Put       the saved frame pointer into the threads saved context regs,       which is where the stack scan starts. */      VM_Thread t = vp.activeThread;      t.contextRegisters.setInnermost(Address.zero(), t.jniEnv.topJavaFP());    } else {      VM_Thread t = VM_Thread.getCurrentThread();      Address fp = VM_Magic.getFramePointer();      while (true) {        Address caller_ip = VM_Magic.getReturnAddress(fp);        Address caller_fp = VM_Magic.getCallerFramePointer(fp);        if (VM_Magic.getCallerFramePointer(caller_fp).EQ(STACKFRAME_SENTINEL_FP))           VM.sysFail("prepareMutator (participating): Could not locate VM_CollectorThread.run");        int compiledMethodId = VM_Magic.getCompiledMethodID(caller_fp);        VM_CompiledMethod compiledMethod = VM_CompiledMethods.getCompiledMethod(compiledMethodId);        VM_Method method = compiledMethod.getMethod();        VM_Atom cls = method.getDeclaringClass().getDescriptor();        VM_Atom name = method.getName();        if (name == runAtom && cls == collectorThreadAtom) {          t.contextRegisters.setInnermost(caller_ip, caller_fp);          break;        }        fp = caller_fp;       }    }  }