use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class OSRListener method handleOSRFromOpt.
public static void handleOSRFromOpt(Address yieldpointServiceMethodFP) {
Address tsFromFP = yieldpointServiceMethodFP;
Address realFP = Magic.getCallerFramePointer(tsFromFP);
int ypTakenInCMID = Magic.getCompiledMethodID(realFP);
Address stackbeg = Magic.objectAsAddress(RVMThread.getCurrentThread().getStack());
Offset tsFromFPoff = tsFromFP.diff(stackbeg);
Offset realFPoff = realFP.diff(stackbeg);
OnStackReplacementTrigger.trigger(ypTakenInCMID, tsFromFPoff, realFPoff, RVMThread.OSROPT);
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class BaselineExceptionDeliverer method unwindStackFrame.
/**
* Unwind a stackframe.
*/
@Override
@Unpreemptible("Unwind stack possibly from unpreemptible code")
public void unwindStackFrame(CompiledMethod compiledMethod, AbstractRegisters registers) {
NormalMethod method = (NormalMethod) compiledMethod.getMethod();
ArchBaselineCompiledMethod bcm = (ArchBaselineCompiledMethod) compiledMethod;
if (method.isSynchronized()) {
Address ip = registers.getInnermostInstructionAddress();
Offset instr = compiledMethod.getInstructionOffset(ip);
Offset lockOffset = bcm.getLockAcquisitionOffset();
if (instr.sGT(lockOffset)) {
// we actually have the lock, so must unlock it.
Object lock;
if (method.isStatic()) {
lock = method.getDeclaringClass().getResolvedClassForType();
} else {
Address fp = registers.getInnermostFramePointer();
short location = bcm.getGeneralLocalLocation(0);
Address addr;
if (BaselineCompilerImpl.isRegister(location)) {
lock = Magic.addressAsObject(registers.getGPRs().get(location).toAddress());
} else {
addr = fp.plus(BaselineCompilerImpl.locationToOffset(location) - // location offsets are positioned on top of their stackslot
BYTES_IN_ADDRESS);
lock = Magic.addressAsObject(addr.loadAddress());
}
}
if (ObjectModel.holdsLock(lock, RVMThread.getCurrentThread())) {
ObjectModel.genericUnlock(lock);
}
}
}
// restore non-volatile registers
Address fp = registers.getInnermostFramePointer();
Offset frameOffset = Offset.fromIntSignExtend(bcm.getFrameSize());
for (int i = bcm.getLastFloatStackRegister(); i >= FIRST_FLOAT_LOCAL_REGISTER.value(); --i) {
frameOffset = frameOffset.minus(BYTES_IN_DOUBLE);
long temp = Magic.getLongAtOffset(Magic.addressAsObject(fp), frameOffset);
registers.getFPRs()[i] = Magic.longBitsAsDouble(temp);
}
for (int i = bcm.getLastFixedStackRegister(); i >= FIRST_FIXED_LOCAL_REGISTER.value(); --i) {
frameOffset = frameOffset.minus(BYTES_IN_ADDRESS);
registers.getGPRs().set(i, fp.loadWord(frameOffset));
}
registers.unwindStackFrame();
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class BaselineGCMapIterator method setupIterator.
/**
* Set the iterator to scan the map at the machine instruction offset
* provided. The iterator is positioned to the beginning of the map. NOTE: An
* iterator may be reused to scan a different method and map.
*
* @param compiledMethod
* identifies the method and class
* @param instructionOffset
* identifies the map to be scanned.
* @param fp
* identifies a specific occurrance of this method and allows for
* processing instance specific information i.e JSR return address
* values
*/
@Override
public void setupIterator(CompiledMethod compiledMethod, Offset instructionOffset, Address fp) {
currentCompiledMethod = (ArchBaselineCompiledMethod) compiledMethod;
currentMethod = (NormalMethod) compiledMethod.getMethod();
currentNumLocals = currentMethod.getLocalWords();
// setup superclass
//
framePtr = fp;
// setup stackframe mapping
//
mapReader.setMethod(currentMethod, compiledMethod);
mapReader.locateGCPoint(instructionOffset);
if (mapReader.currentMapIsForJSR()) {
mapReader.acquireLockForJSRProcessing();
int JSRindex = mapReader.setupJSRSubroutineMap();
while (JSRindex != 0) {
Address nextCallerAddress;
short location = convertIndexToLocation(JSRindex);
if (BaselineCompilerImpl.isRegister(location)) {
nextCallerAddress = registerLocations.get(location);
} else {
nextCallerAddress = framePtr.plus(BaselineCompilerImpl.locationToOffset(location) - // location offsets are positioned on top of stackslot
BYTES_IN_ADDRESS);
}
nextCallerAddress = nextCallerAddress.loadAddress();
Offset nextMachineCodeOffset = compiledMethod.getInstructionOffset(nextCallerAddress);
if (VM.TraceStkMaps) {
traceSetupJSRsubroutineMap(JSRindex, nextCallerAddress, nextMachineCodeOffset);
}
JSRindex = mapReader.getNextJSRAddressIndex(nextMachineCodeOffset);
}
}
if (VM.TraceStkMaps || TRACE_ALL) {
VM.sysWrite("BaselineGCMapIterator setupIterator mapId = ");
VM.sysWrite(mapReader.getMapId());
VM.sysWrite(" for ");
VM.sysWrite(currentMethod);
VM.sysWriteln(".");
}
bridgeData.setupDynamicBridgeMapping(currentMethod, fp);
reset();
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class BaselineGCMapIterator method resetArchitectureSpecificBridgeSState.
@Override
protected void resetArchitectureSpecificBridgeSState() {
bridgeData.resetBridgeRegisterIndex();
bridgeData.setBridgeRegisterLocation(framePtr.loadAddress());
// point to first saved gpr
bridgeData.decBrigeRegisterLocation(BYTES_IN_DOUBLE * (LAST_NONVOLATILE_FPR.value() - FIRST_VOLATILE_FPR.value() + 1) + BYTES_IN_ADDRESS * (LAST_NONVOLATILE_GPR.value() - FIRST_VOLATILE_GPR.value() + 1));
// get to my caller's frameptr and then walk up to the spill area
Address callersFP = Magic.getCallerFramePointer(framePtr);
bridgeData.resetBridgeSpilledParamLocation(callersFP);
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class CompiledMethod method containsReturnAddress.
/**
* Does the code for the compiled method contain the given return address?
* @param ip a return address
* @return {@code true} if it belongs to this method's code, {@code false} otherwise.
*/
@Uninterruptible
public final boolean containsReturnAddress(Address ip) {
Address beg = Magic.objectAsAddress(instructions);
Address end = beg.plus(instructions.length() << ArchConstants.getLogInstructionWidth());
//
return !(ip.LE(beg) || ip.GT(end));
}
Aggregations