Search in sources :

Example 21 with NoInline

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

the class BumpPointer method allocSlow.

/**
 * Internal allocation slow path.  This is called whenever the bump
 * pointer reaches the internal limit.  The code is forced out of
 * line.  If required we perform an external slow path take, which
 * we inline into this method since this is already out of line.
 *
 * @param start The start address for the pending allocation
 * @param end The end address for the pending allocation
 * @param align The requested alignment
 * @param offset The offset from the alignment
 * @return The address of the first byte of the allocated region
 */
@NoInline
private Address allocSlow(Address start, Address end, int align, int offset) {
    Address rtn = null;
    Address card = null;
    if (SUPPORT_CARD_SCANNING)
        // round up
        card = getCard(start.plus(CARD_MASK));
    if (end.GT(limit)) {
        /* external slow path */
        rtn = allocSlowInline(end.diff(start).toInt(), align, offset);
        if (SUPPORT_CARD_SCANNING && card.NE(getCard(rtn.plus(CARD_MASK))))
            // round down
            card = getCard(rtn);
    } else {
        /* internal slow path */
        while (internalLimit.LE(end)) internalLimit = internalLimit.plus(STEP_SIZE);
        if (internalLimit.GT(limit))
            internalLimit = limit;
        fillAlignmentGap(cursor, start);
        cursor = end;
        rtn = start;
    }
    if (SUPPORT_CARD_SCANNING && !rtn.isZero())
        createCardAnchor(card, rtn, end.diff(start).toInt());
    return rtn;
}
Also used : Address(org.vmmagic.unboxed.Address) NoInline(org.vmmagic.pragma.NoInline)

Example 22 with NoInline

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

the class OnStackReplacementTrigger method trigger.

@NoInline
@Unpreemptible
public static void trigger(int ypTakenInCMID, Offset tsFromFPoff, Offset ypTakenFPoff, int whereFrom) {
    RVMThread thread = RVMThread.getCurrentThread();
    CompiledMethod ypTakenInCM = CompiledMethods.getCompiledMethod(ypTakenInCMID);
    RVMMethod ypTakenInMethod = ypTakenInCM.getMethod();
    boolean isInBootImage = ypTakenInMethod.getDeclaringClass().isInBootImage();
    if (isInBootImage)
        return;
    OnStackReplacementEvent event = (OnStackReplacementEvent) thread.onStackReplacementEvent;
    event.suspendedThread = thread;
    event.whereFrom = whereFrom;
    event.CMID = ypTakenInCMID;
    event.tsFromFPoff = tsFromFPoff;
    event.ypTakenFPoff = ypTakenFPoff;
    thread.monitor().lockNoHandshake();
    thread.requesting_osr = true;
    thread.monitor().unlock();
    Controller.osrOrganizer.activate();
    // PNT: Assumes that OSR doesn't need access to our context regs
    thread.monitor().lockNoHandshake();
    while (!thread.osr_done) {
        thread.monitor().waitWithHandshake();
    }
    thread.osr_done = false;
    thread.monitor().unlock();
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) RVMThread(org.jikesrvm.scheduler.RVMThread) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Unpreemptible(org.vmmagic.pragma.Unpreemptible) NoInline(org.vmmagic.pragma.NoInline)

Example 23 with NoInline

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

the class DefUse method computeDU.

/**
 * Compute the register list and def-use lists for a method.
 *
 * @param ir the IR in question
 */
@NoInline
public static void computeDU(IR ir) {
    // Clear old register list (if any)
    clearDU(ir);
    // Create register defList and useList
    for (Instruction instr = ir.firstInstructionInCodeOrder(); instr != null; instr = instr.nextInstructionInCodeOrder()) {
        Enumeration<Operand> defs = instr.getPureDefs();
        Enumeration<Operand> uses = instr.getUses();
        while (defs.hasMoreElements()) {
            Operand op = defs.nextElement();
            if (op instanceof RegisterOperand) {
                RegisterOperand rop = (RegisterOperand) op;
                recordDef(rop);
            }
        }
        while (uses.hasMoreElements()) {
            Operand op = uses.nextElement();
            if (op instanceof RegisterOperand) {
                RegisterOperand rop = (RegisterOperand) op;
                recordUse(rop);
            }
        }
    // for ( uses = ... )
    }
    // for ( instr = ... )
    // Remove any symbloic registers with no uses/defs from
    // the register pool.  We'll waste analysis time keeping them around.
    Register next;
    for (Register reg = ir.regpool.getFirstSymbolicRegister(); reg != null; reg = next) {
        next = reg.getNext();
        if (reg.defList == null && reg.useList == null) {
            if (DEBUG) {
                VM.sysWriteln("Removing " + reg + " from the register pool");
            }
            ir.regpool.removeRegister(reg);
        }
    }
}
Also used : RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Register(org.jikesrvm.compilers.opt.ir.Register) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) NoInline(org.vmmagic.pragma.NoInline)

Example 24 with NoInline

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

the class TraceInterface method skipOwnFramesAndDump.

@Override
@NoInline
// This can't be uninterruptible --- it is an IO routine
@Interruptible
public Address skipOwnFramesAndDump(ObjectReference typeRef) {
    TIB tib = Magic.addressAsTIB(typeRef.toAddress());
    RVMMethod m = null;
    int bci = -1;
    int compiledMethodID = 0;
    Offset ipOffset = Offset.zero();
    Address fp = Magic.getFramePointer();
    Address ip = Magic.getReturnAddressUnchecked(fp);
    fp = Magic.getCallerFramePointer(fp);
    // This code borrows heavily from RVMThread.dumpStack
    final Address STACKFRAME_SENTINEL_FP = StackFrameLayout.getStackFrameSentinelFP();
    final int INVISIBLE_METHOD_ID = StackFrameLayout.getInvisibleMethodID();
    while (Magic.getCallerFramePointer(fp).NE(STACKFRAME_SENTINEL_FP)) {
        compiledMethodID = Magic.getCompiledMethodID(fp);
        if (compiledMethodID != INVISIBLE_METHOD_ID) {
            // normal java frame(s)
            CompiledMethod compiledMethod = CompiledMethods.getCompiledMethod(compiledMethodID);
            if (compiledMethod.getCompilerType() != CompiledMethod.TRAP) {
                ipOffset = compiledMethod.getInstructionOffset(ip);
                m = compiledMethod.getMethod();
                if (VM.BuildForOptCompiler && compiledMethod.getCompilerType() == CompiledMethod.OPT) {
                    OptCompiledMethod optInfo = (OptCompiledMethod) compiledMethod;
                    /* Opt stack frames may contain multiple inlined methods. */
                    OptMachineCodeMap map = optInfo.getMCMap();
                    int iei = map.getInlineEncodingForMCOffset(ipOffset);
                    if (iei >= 0) {
                        int[] inlineEncoding = map.inlineEncoding;
                        boolean allocCall = true;
                        bci = map.getBytecodeIndexForMCOffset(ipOffset);
                        for (int j = iei; j >= 0 && allocCall; j = OptEncodedCallSiteTree.getParent(j, inlineEncoding)) {
                            int mid = OptEncodedCallSiteTree.getMethodID(j, inlineEncoding);
                            m = MemberReference.getMethodRef(mid).getResolvedMember();
                            if (!isAllocCall(m.getName().getBytes()))
                                allocCall = false;
                            if (j > 0)
                                bci = OptEncodedCallSiteTree.getByteCodeOffset(j, inlineEncoding);
                        }
                        if (!allocCall)
                            break;
                    }
                } else {
                    if (!isAllocCall(m.getName().getBytes())) {
                        BaselineCompiledMethod baseInfo = (BaselineCompiledMethod) compiledMethod;
                        final int INSTRUCTION_WIDTH = ArchConstants.getInstructionWidth();
                        bci = baseInfo.findBytecodeIndexForInstruction(ipOffset.toWord().lsh(INSTRUCTION_WIDTH).toOffset());
                        break;
                    }
                }
            }
        }
        ip = Magic.getReturnAddressUnchecked(fp);
        fp = Magic.getCallerFramePointer(fp);
    }
    if (m != null) {
        int allocid = (((compiledMethodID & 0x0000ffff) << 15) ^ ((compiledMethodID & 0xffff0000) >> 16) ^ ipOffset.toInt()) & ~0x80000000;
        /* Now print the location string. */
        VM.sysWrite('\n');
        VM.writeHex(allocid);
        VM.sysWrite('-');
        VM.sysWrite('>');
        VM.sysWrite('[');
        VM.writeHex(compiledMethodID);
        VM.sysWrite(']');
        m.getDeclaringClass().getDescriptor().sysWrite();
        VM.sysWrite(':');
        m.getName().sysWrite();
        m.getDescriptor().sysWrite();
        VM.sysWrite(':');
        VM.writeHex(bci);
        VM.sysWrite('\t');
        RVMType type = tib.getType();
        type.getDescriptor().sysWrite();
        VM.sysWrite('\n');
    }
    return fp;
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) OptMachineCodeMap(org.jikesrvm.compilers.opt.runtimesupport.OptMachineCodeMap) Address(org.vmmagic.unboxed.Address) RVMType(org.jikesrvm.classloader.RVMType) BaselineCompiledMethod(org.jikesrvm.compilers.baseline.BaselineCompiledMethod) TIB(org.jikesrvm.objectmodel.TIB) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) BaselineCompiledMethod(org.jikesrvm.compilers.baseline.BaselineCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Offset(org.vmmagic.unboxed.Offset) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 25 with NoInline

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

the class VM method writeField.

/**
 * Low level print of the {@link Atom} <code>s</code> to the console.
 * Left-fill with enough spaces to print at least <code>fieldWidth</code>
 * characters
 * @param fieldWidth  Minimum width to print.
 * @param s       The {@link Atom} to print.
 */
@NoInline
public static /* don't waste code space inlining these --dave */
void writeField(int fieldWidth, Atom s) {
    int len = s.length();
    while (fieldWidth > len++) write(" ");
    write(s);
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) 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