Search in sources :

Example 1 with Address

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);
}
Also used : Address(org.vmmagic.unboxed.Address) Offset(org.vmmagic.unboxed.Offset)

Example 2 with Address

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();
}
Also used : Address(org.vmmagic.unboxed.Address) NormalMethod(org.jikesrvm.classloader.NormalMethod) Offset(org.vmmagic.unboxed.Offset) Unpreemptible(org.vmmagic.pragma.Unpreemptible)

Example 3 with Address

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();
}
Also used : Address(org.vmmagic.unboxed.Address) Offset(org.vmmagic.unboxed.Offset)

Example 4 with Address

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);
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 5 with Address

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));
}
Also used : Address(org.vmmagic.unboxed.Address) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Aggregations

Address (org.vmmagic.unboxed.Address)281 Offset (org.vmmagic.unboxed.Offset)48 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)30 NoInline (org.vmmagic.pragma.NoInline)30 Test (org.junit.Test)24 Entrypoint (org.vmmagic.pragma.Entrypoint)22 TypeReference (org.jikesrvm.classloader.TypeReference)21 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)17 RVMType (org.jikesrvm.classloader.RVMType)16 Inline (org.vmmagic.pragma.Inline)15 Uninterruptible (org.vmmagic.pragma.Uninterruptible)14 Word (org.vmmagic.unboxed.Word)14 BaseMMTkTest (org.mmtk.harness.tests.BaseMMTkTest)13 Unpreemptible (org.vmmagic.pragma.Unpreemptible)12 ObjectReference (org.vmmagic.unboxed.ObjectReference)12 Interruptible (org.vmmagic.pragma.Interruptible)11 Extent (org.vmmagic.unboxed.Extent)11 RVMClass (org.jikesrvm.classloader.RVMClass)9 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8