Search in sources :

Example 36 with NoInline

use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.

the class StackTrace method recordFramesUninterruptible.

/**
 * Walk the stack recording the stack frames encountered
 * The stack being walked is our stack, so code is Uninterrupible to stop the
 * stack moving.
 *
 * @param stackTraceThread the thread whose stack is walked
 */
@Uninterruptible
@NoInline
private void recordFramesUninterruptible(RVMThread stackTraceThread) {
    int stackFrameCount = 0;
    Address fp;
    Address ip;
    /* Stack trace for the thread */
    if (stackTraceThread == RVMThread.getCurrentThread()) {
        fp = Magic.getFramePointer();
    } else {
        AbstractRegisters contextRegisters = stackTraceThread.getContextRegisters();
        fp = contextRegisters.getInnermostFramePointer();
    }
    ip = Magic.getReturnAddress(fp);
    fp = Magic.getCallerFramePointer(fp);
    while (Magic.getCallerFramePointer(fp).NE(StackFrameLayout.getStackFrameSentinelFP())) {
        // VM.sysWriteln("at stackFrameCount = ",stackFrameCount);
        int compiledMethodId = Magic.getCompiledMethodID(fp);
        compiledMethods[stackFrameCount] = compiledMethodId;
        if (compiledMethodId != StackFrameLayout.getInvisibleMethodID()) {
            CompiledMethod compiledMethod = CompiledMethods.getCompiledMethod(compiledMethodId);
            if (compiledMethod.getCompilerType() != CompiledMethod.TRAP) {
                instructionOffsets[stackFrameCount] = compiledMethod.getInstructionOffset(ip).toInt();
                if (compiledMethod.hasBridgeFromNativeAnnotation()) {
                    // VM.sysWriteln("native!");
                    // skip native frames, stopping at last native frame preceeding the
                    // Java To C transition frame
                    fp = RuntimeEntrypoints.unwindNativeStackFrame(fp);
                }
            } else {
            // VM.sysWriteln("trap!");
            }
        } else {
        // VM.sysWriteln("invisible method!");
        }
        stackFrameCount++;
        ip = Magic.getReturnAddress(fp, stackTraceThread);
        fp = Magic.getCallerFramePointer(fp);
    }
}
Also used : Address(org.vmmagic.unboxed.Address) AbstractRegisters(org.jikesrvm.architecture.AbstractRegisters) BaselineCompiledMethod(org.jikesrvm.compilers.baseline.BaselineCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) Uninterruptible(org.vmmagic.pragma.Uninterruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 37 with NoInline

use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.

the class PostThreadSwitch method postProcess.

/**
 * This method must not be inlined to keep the correctness
 * This method is called at the end of threadSwitch, the caller
 * is threadSwitchFrom<...>
 *
 * @param myThread the currently running thread
 */
@NoInline
public static void postProcess(RVMThread myThread) {
    /* We need to generate thread specific code and install new code.
    * We have to make sure that no GC happens from here and before
    * the new code get executed.
    */
    // add branch instruction from CTR.
    CodeArray bridge = myThread.bridgeInstructions;
    Address bridgeaddr = Magic.objectAsAddress(bridge);
    if (VM.TraceOnStackReplacement) {
        VM.sysWriteln("osr post processing");
    }
    Offset offset = myThread.tsFPOffset.plus(STACKFRAME_RETURN_ADDRESS_OFFSET);
    Magic.objectAsAddress(myThread.getStack()).store(bridgeaddr, offset);
    myThread.tsFPOffset = Offset.zero();
    myThread.isWaitingForOsr = false;
    myThread.bridgeInstructions = null;
// no GC should happen until the glue code gets executed.
}
Also used : CodeArray(org.jikesrvm.compilers.common.CodeArray) Address(org.vmmagic.unboxed.Address) Offset(org.vmmagic.unboxed.Offset) NoInline(org.vmmagic.pragma.NoInline)

Example 38 with NoInline

use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.

the class JNIHelpers method invokeWithDotDotVarArg.

/**
 * Common code shared by the JNI functions Call<type>Method
 * (virtual method invocation)
 * @param obj the object instance
 * @param methodID the method ID
 * @param expectReturnType the return type for checking purpose
 * @param skip4Args  true if the calling JNI Function takes 4 args before the vararg
 *                   false if the calling JNI Function takes 3 args before the vararg
 * @return an object that may be the return object or a wrapper for the primitive return value
 */
@NoInline
public static Object invokeWithDotDotVarArg(Object obj, int methodID, TypeReference expectReturnType, boolean skip4Args) throws Exception {
    MethodReference mr = MemberReference.getMethodRef(methodID);
    if (VM.BuildForPower64ELF_ABI) {
        Address varargAddress = pushVarArgToSpillArea(methodID, skip4Args);
        Object[] argObjectArray = packageParameterFromVarArg(mr, varargAddress);
        return callMethod(obj, mr, argObjectArray, expectReturnType, skip4Args);
    } else {
        if (VM.VerifyAssertions)
            VM._assert(VM.BuildForSVR4ABI);
        Address glueFP = Magic.getCallerFramePointer(Magic.getCallerFramePointer(Magic.getCallerFramePointer(Magic.getFramePointer())));
        Object[] argObjectArray = packageParameterFromDotArgSVR4(mr, glueFP, skip4Args);
        return callMethod(obj, mr, argObjectArray, expectReturnType, skip4Args);
    }
}
Also used : Address(org.vmmagic.unboxed.Address) MethodReference(org.jikesrvm.classloader.MethodReference) NoInline(org.vmmagic.pragma.NoInline)

Example 39 with NoInline

use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.

the class DynamicLinkerHelper method getReceiverObject.

/**
 * Reach up two stack frames into a frame that is compiled
 * with the DynamicBridge register protocol and grab
 * the receiver object of the invoke.
 * <p>
 * NOTE: assumes that caller has disabled GC.
 *
 * @return the receiver object for the method invocation
 */
@NoInline
public static Object getReceiverObject() {
    Address callingFrame = Magic.getCallerFramePointer(Magic.getFramePointer());
    callingFrame = Magic.getCallerFramePointer(callingFrame);
    Address location = Address.zero();
    if (0 < NUM_PARAMETER_GPRS) {
        location = callingFrame.plus(T0_SAVE_OFFSET).loadAddress();
    } else {
        VM.sysFail("DynamicLinerHelper: assumes at least one param passed in registers");
    }
    return Magic.addressAsObject(location);
}
Also used : Address(org.vmmagic.unboxed.Address) NoInline(org.vmmagic.pragma.NoInline)

Example 40 with NoInline

use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.

the class MemoryManager method newNonMovingShortArray.

/**
 * Allocates a non moving short array.
 *
 * @param size The size of the array
 * @return the new non moving short array
 */
@NoInline
@Interruptible
public static short[] newNonMovingShortArray(int size) {
    if (!VM.runningVM) {
        return new short[size];
    }
    RVMArray arrayType = RVMArray.ShortArray;
    int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
    int align = ObjectModel.getAlignment(arrayType);
    int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
    int width = arrayType.getLogElementSize();
    TIB arrayTib = arrayType.getTypeInformationBlock();
    return (short[]) allocateArray(size, width, headerSize, arrayTib, Plan.ALLOC_NON_MOVING, align, offset, Plan.DEFAULT_SITE);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Aggregations

NoInline (org.vmmagic.pragma.NoInline)46 Entrypoint (org.vmmagic.pragma.Entrypoint)23 Address (org.vmmagic.unboxed.Address)22 Unpreemptible (org.vmmagic.pragma.Unpreemptible)10 TIB (org.jikesrvm.objectmodel.TIB)9 Interruptible (org.vmmagic.pragma.Interruptible)9 RVMArray (org.jikesrvm.classloader.RVMArray)8 Word (org.vmmagic.unboxed.Word)6 NoOptCompile (org.vmmagic.pragma.NoOptCompile)5 Offset (org.vmmagic.unboxed.Offset)5 MethodReference (org.jikesrvm.classloader.MethodReference)4 CodeArray (org.jikesrvm.compilers.common.CodeArray)4 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)4 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)3 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)3 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)3 BaselineSaveLSRegisters (org.vmmagic.pragma.BaselineSaveLSRegisters)3 RVMType (org.jikesrvm.classloader.RVMType)2 RVMThread (org.jikesrvm.scheduler.RVMThread)2