offsets[stackFrameCount] = compiledMethod.getInstructionOffset(ip);
offsets[stackFrameCount] = compiledMethod.getInstructionOffset(ip).toInt();
  private int walkFrames(boolean record, int skip) {    int stackFrameCount = 0;    VM.disableGC(); // so fp & ip don't change under our feet    Address fp = VM_Magic.getFramePointer();    Address ip = VM_Magic.getReturnAddress(fp);    for (int i=0; i<skip; i++) {      fp = VM_Magic.getCallerFramePointer(fp);      ip = VM_Magic.getReturnAddress(fp);    }    fp = VM_Magic.getCallerFramePointer(fp);    while (VM_Magic.getCallerFramePointer(fp).NE(STACKFRAME_SENTINEL_FP)) {      int compiledMethodId = VM_Magic.getCompiledMethodID(fp);      if (compiledMethodId != INVISIBLE_METHOD_ID) {        VM_CompiledMethod compiledMethod = VM_CompiledMethods.getCompiledMethod(compiledMethodId);        if (record) compiledMethods[stackFrameCount] = compiledMethod;        if (compiledMethod.getCompilerType() != VM_CompiledMethod.TRAP) {          if (record) {            offsets[stackFrameCount] = compiledMethod.getInstructionOffset(ip);          }          if (compiledMethod.getMethod().getDeclaringClass().isBridgeFromNative()) {            // skip native frames, stopping at last native frame preceeding the            // Java To C transition frame            fp = VM_Runtime.unwindNativeStackFrame(fp);            }        }       }      stackFrameCount++;      ip = VM_Magic.getReturnAddress(fp);      fp = VM_Magic.getCallerFramePointer(fp);    }    VM.enableGC();    return stackFrameCount;  }