@Override protected void onEnter(VirtualFrame frame) { if (CompilerDirectives.inInterpreter()) { counter.interpretedInvocations++; } else { counter.compiledInvocations++; } }
@Override protected void onEnter(VirtualFrame frame) { if (CompilerDirectives.inInterpreter()) { payload.countInterpreted++; } else { payload.countCompiled++; } }
@Override public void profileCounted(long length) { if (CompilerDirectives.inInterpreter()) { long trueCountLocal = trueCount + length; if (trueCountLocal >= 0) { // don't write overflow values trueCount = trueCountLocal; int falseCountLocal = falseCount; if (falseCountLocal < Integer.MAX_VALUE) { falseCount = falseCountLocal + 1; } } } }
/** * Returns a boolean indicating whether or not a given value is seen as constant during the * initial partial evaluation phase. If this method is called in the interpreter this method * will always return <code>true</code>. * * @param value * @return {@code true} when given value is seen as compilation constant, {@code false} if not * compilation constant. * @since 0.8 or earlier */ public static boolean isPartialEvaluationConstant(Object value) { return CompilerDirectives.inInterpreter(); }
@Override public void profileCounted(long length) { if (CompilerDirectives.inInterpreter()) { long trueCountLocal = trueCount + length; if (trueCountLocal >= 0) { // don't write overflow values trueCount = trueCountLocal; int falseCountLocal = falseCount; if (falseCountLocal < Integer.MAX_VALUE) { falseCount = falseCountLocal + 1; } } } }
private void checkSlotIndex(int slotIndex) { if (CompilerDirectives.inInterpreter() && slotIndex >= getTags().length) { if (!resize()) { throw new IllegalArgumentException(String.format("The frame slot '%s' is not known by the frame descriptor.", slotIndex)); } } }
@Override public byte getByte(FrameSlot slot) throws FrameSlotTypeException { Object result = getObject(slot); if (CompilerDirectives.inInterpreter() && !(result instanceof Byte)) { throw new FrameSlotTypeException(); } return (Byte) result; }
@Override public long getLong(FrameSlot slot) throws FrameSlotTypeException { Object result = getObject(slot); if (CompilerDirectives.inInterpreter() && !(result instanceof Long)) { throw new FrameSlotTypeException(); } return (Long) result; }
/** * Directive for the compiler to discontinue compilation at this code position and instead * insert a transfer to the interpreter. */ public static void transferToInterpreter() { if (inInterpreter()) { Truffle.getRuntime().notifyTransferToInterpreter(); } }
/** * Directive for the compiler to discontinue compilation at this code position and instead * insert a transfer to the interpreter. * * @since 0.8 or earlier */ public static void transferToInterpreter() { if (inInterpreter()) { Truffle.getRuntime().notifyTransferToInterpreter(); } }
/** * Directive for the compiler to discontinue compilation at this code position and instead * insert a transfer to the interpreter. * * @since 0.8 or earlier */ public static void transferToInterpreter() { if (inInterpreter()) { Truffle.getRuntime().notifyTransferToInterpreter(); } }
@Override public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException { Object result = getObject(slot); if (CompilerDirectives.inInterpreter() && !(result instanceof Boolean)) { throw new FrameSlotTypeException(); } return (Boolean) result; }
/** * Directive for the compiler to discontinue compilation at this code position and instead * insert a transfer to the interpreter, invalidating the currently executing machine code. * * @since 0.8 or earlier */ public static void transferToInterpreterAndInvalidate() { if (inInterpreter()) { Truffle.getRuntime().notifyTransferToInterpreter(); } }
/** * Directive for the compiler to discontinue compilation at this code position and instead * insert a transfer to the interpreter, invalidating the currently executing machine code. * * @since 0.8 or earlier */ public static void transferToInterpreterAndInvalidate() { if (inInterpreter()) { Truffle.getRuntime().notifyTransferToInterpreter(); } }
@Override public float getFloat(FrameSlot slot) throws FrameSlotTypeException { Object result = getObject(slot); if (CompilerDirectives.inInterpreter() && !(result instanceof Float)) { throw new FrameSlotTypeException(); } return (Float) result; }
protected Object executeImpl(VirtualFrame frame) { VirtualFrame parentFrame = clazz.cast(frame.getArguments()[0]); while (loopNode.getRepeatingNode().executeRepeating(parentFrame)) { if (CompilerDirectives.inInterpreter()) { return Boolean.FALSE; } } return Boolean.TRUE; }
@Override protected void onEnter(VirtualFrame frame) { frame.setLong(timeStartedSlot, System.nanoTime()); super.onEnter(frame); frame.setObject(parentCounterSlot, profiler.activeCounter); profiler.activeCounter = counter; if (CompilerDirectives.inInterpreter()) { counter.compiled = false; } else { counter.compiled = true; } }
@Override public void setObject(FrameSlot slot, Object value) { int index = getFrameSlotIndex(slot); Object[] curLocals = this.getLocals(); if (CompilerDirectives.inInterpreter() && index >= curLocals.length) { curLocals = resizeAndCheck(slot); } curLocals[index] = value; }
@Override public Object getObject(FrameSlot slot) { int index = getFrameSlotIndex(slot); Object[] curLocals = this.getLocals(); if (CompilerDirectives.inInterpreter() && index >= curLocals.length) { curLocals = resizeAndCheck(slot); } return curLocals[index]; }
private void doOnEnter() { StackTraceEntry location = CompilerDirectives.inInterpreter() ? interpretedLocation : (CompilerDirectives.inCompilationRoot() ? compiledLocation : compilationRootLocation); if (seenOtherThreads) { pushSlow(location); } else if (cachedThread == Thread.currentThread()) { cachedStack.push(location); } else { CompilerDirectives.transferToInterpreterAndInvalidate(); seenOtherThreads = true; pushSlow(location); } }