/** * Gets the compiled code of a given stackframe. * * @param sf Stackframe pointer * @return The compiled code */ final VmCompiledCode getCompiledCode(Address sf) { final int ccid = sf.loadInt(getMethodIdOffset(sf)); if (ccid == 0) { return null; } else { return VmUtils.getVm().getCompiledMethods().get(ccid); } }
/** * Gets the method of a given stackframe. * * @param sf Stackframe pointer * @return The method */ @KernelSpace final VmMethod getMethod(Address sf) { final int ccid = sf.loadInt(getMethodIdOffset(sf)); if (ccid == 0) { return null; } else { final VmCompiledCode cc = VmUtils.getVm().getCompiledMethods().get(ccid); if (cc == null) { // (This can happen if an exception is thrown while a frame // for a 'native' method call is on the stack. A panic is not a // good idea. It is better to generate a stack trace with a missing // method name.) // Unsafe.die("Unknown ccid found on stack"); return null; } else { return cc.getMethod(); } } }
/** * Gets (creates if needed) a compiled code id. * * @return a compiled code id. */ public final int getCompiledCodeId() { if (ccId < 0) { ccId = VmUtils.getVm().getCompiledMethods().createId(); } return ccId; }