Java Code Examples for com.oracle.truffle.api.CompilerDirectives#transferToInterpreterAndInvalidate()
The following examples show how to use
com.oracle.truffle.api.CompilerDirectives#transferToInterpreterAndInvalidate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MiscPrimitivePlugin.java From trufflesqueak with MIT License | 6 votes |
private void ensureAsciiOrder(final NativeObject orderValue) { if (orderValue != asciiOrder) { CompilerDirectives.transferToInterpreterAndInvalidate(); if (asciiOrder == null) { /* Haven't seen asciiOrder yet. */ if (!orderValue.isByteType()) { throw new NotAsciiOrderException(); } final byte[] bytes = orderValue.getByteStorage(); if (bytes.length != 256) { throw new NotAsciiOrderException(); } /* AsciiOrder is the identity function. */ for (int i = 0; i < bytes.length; i++) { if ((bytes[i] & 0xff) != i) { throw new NotAsciiOrderException(); } } asciiOrder = orderValue; } else { throw new NotAsciiOrderException(); } } }
Example 2
Source File: CompiledCodeObject.java From trufflesqueak with MIT License | 6 votes |
protected void ensureCorrectNumberOfStackSlots() { final int requiredNumberOfStackSlots = getNumStackSlots(); if (stackSlots == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); stackSlots = new FrameSlot[requiredNumberOfStackSlots]; return; } final int currentNumberOfStackSlots = stackSlots.length; if (currentNumberOfStackSlots < requiredNumberOfStackSlots) { // Grow number of stack slots. CompilerDirectives.transferToInterpreterAndInvalidate(); stackSlots = Arrays.copyOf(stackSlots, requiredNumberOfStackSlots); } else if (currentNumberOfStackSlots > requiredNumberOfStackSlots) { // Shrink number of stack slots. CompilerDirectives.transferToInterpreterAndInvalidate(); for (int i = requiredNumberOfStackSlots; i < currentNumberOfStackSlots; i++) { frameDescriptor.removeFrameSlot(i); } stackSlots = Arrays.copyOf(stackSlots, requiredNumberOfStackSlots); } }
Example 3
Source File: GetContextNode.java From trufflesqueak with MIT License | 5 votes |
public ContextObject execute(final VirtualFrame frame) { if (contextSlot == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); contextSlot = FrameAccess.getContextSlot(frame); } return FrameAccess.getContext(frame, contextSlot); }
Example 4
Source File: SqueakProfiles.java From trufflesqueak with MIT License | 5 votes |
@Override @SuppressWarnings("unchecked") public <T> T profile(final T newValue) { // Field needs to be cached in local variable for thread safety and startup speed. final Object cached = cachedValue; if (cached == newValue) { return (T) cached; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); cachedValue = newValue; return newValue; } }
Example 5
Source File: SqueakImageContext.java From trufflesqueak with MIT License | 5 votes |
public boolean patch(final SqueakLanguage.Env newEnv) { CompilerDirectives.transferToInterpreterAndInvalidate(); env = newEnv; output = new PrintWriter(env.out(), true); error = new PrintWriter(env.err(), true); return true; }
Example 6
Source File: SqueakImageContext.java From trufflesqueak with MIT License | 5 votes |
public boolean setForeignObjectClass(final ClassObject classObject) { if (foreignObjectClass == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); foreignObjectClass = classObject; return true; } else { return false; } }
Example 7
Source File: BlockClosureObject.java From trufflesqueak with MIT License | 5 votes |
public long getStartPC() { if (startPC == -1) { CompilerDirectives.transferToInterpreterAndInvalidate(); startPC = block.getInitialPC(); } return startPC; }
Example 8
Source File: ControlPrimitives.java From trufflesqueak with MIT License | 5 votes |
private LinkProcessToListNode getLinkProcessToListNode() { if (linkProcessToListNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); linkProcessToListNode = insert(LinkProcessToListNode.create()); wakeHighestPriorityNode = insert(WakeHighestPriorityNode.create()); } return linkProcessToListNode; }
Example 9
Source File: MakeArgumentArrayNode.java From nodeprof.js with Apache License 2.0 | 5 votes |
@Specialization public Object executeOther(Object[] input) { CompilerDirectives.transferToInterpreterAndInvalidate(); this.arguments = new Object[input.length - offset - tillEnd]; copy(input); return toJSArray(); }
Example 10
Source File: SourceMapping.java From nodeprof.js with Apache License 2.0 | 5 votes |
@TruffleBoundary private static void init() { CompilerDirectives.transferToInterpreterAndInvalidate(); iidToLocationCache = new HashMap<>(); sourceSet = new HashMap<>(); idToSource = new HashMap<>(); syntheticLocations = new HashMap<>(); }
Example 11
Source File: Zip.java From trufflesqueak with MIT License | 5 votes |
public boolean readStreamHasCorrectSize(final PointersObject receiver) { if (readStreamInstSize == 0) { if (!determineSizeOfReadStream(receiver)) { return false; } if (receiver.size() < readStreamInstSize + 8) { CompilerDirectives.transferToInterpreterAndInvalidate(); readStreamInstSize = 0; return false; } } return receiver.size() >= readStreamInstSize + 8; }
Example 12
Source File: ContextObject.java From trufflesqueak with MIT License | 5 votes |
private void setFields(final MaterializedFrame otherTruffleFrame, final int otherSize, final boolean otherHasModifiedSender, final boolean otherEscaped) { CompilerDirectives.transferToInterpreterAndInvalidate(); truffleFrame = otherTruffleFrame; size = otherSize; hasModifiedSender = otherHasModifiedSender; escaped = otherEscaped; }
Example 13
Source File: SqueakImageContext.java From trufflesqueak with MIT License | 5 votes |
public PointersObject getScheduler() { if (scheduler == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); scheduler = (PointersObject) schedulerAssociation.instVarAt0Slow(ASSOCIATION.VALUE); } return scheduler; }
Example 14
Source File: PushBytecodes.java From trufflesqueak with MIT License | 5 votes |
private CompiledBlockObject getBlock(final VirtualFrame frame) { if (cachedBlock == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); cachedBlock = code.findBlock(FrameAccess.getMethod(frame), numArgs, numCopied, getSuccessorIndex(), blockSize); cachedStartPC = cachedBlock.getInitialPC(); } return cachedBlock; }
Example 15
Source File: SqueakImageContext.java From trufflesqueak with MIT License | 5 votes |
public String getImagePath() { if (imagePath == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); setImagePath(options.imagePath.isEmpty() ? SqueakImageLocator.findImage() : options.imagePath); } return imagePath; }
Example 16
Source File: GlobalObjectCache.java From nodeprof.js with Apache License 2.0 | 4 votes |
public static void reset() { CompilerDirectives.transferToInterpreterAndInvalidate(); cache = new GlobalObjectCache(); }
Example 17
Source File: SqueakDisplay.java From trufflesqueak with MIT License | 4 votes |
@Override public void setInputSemaphoreIndex(final int interruptSemaphoreIndex) { CompilerDirectives.transferToInterpreterAndInvalidate(); inputSemaphoreIndex = interruptSemaphoreIndex; }
Example 18
Source File: BlockClosureObject.java From trufflesqueak with MIT License | 4 votes |
public void setCopied(final Object[] copied) { CompilerDirectives.transferToInterpreterAndInvalidate(); this.copied = copied; }
Example 19
Source File: BitBlt.java From trufflesqueak with MIT License | 4 votes |
private void initBBOpTable() { CompilerDirectives.transferToInterpreterAndInvalidate(); opTable[0 + 1] = BitBlt::clearWordwith; opTable[1 + 1] = BitBlt::bitAndwith; opTable[2 + 1] = BitBlt::bitAndInvertwith; opTable[3 + 1] = BitBlt::sourceWordwith; opTable[4 + 1] = BitBlt::bitInvertAndwith; opTable[5 + 1] = BitBlt::destinationWordwith; opTable[6 + 1] = BitBlt::bitXorwith; opTable[7 + 1] = BitBlt::bitOrwith; opTable[8 + 1] = BitBlt::bitInvertAndInvertwith; opTable[9 + 1] = BitBlt::bitInvertXorwith; opTable[10 + 1] = BitBlt::bitInvertDestinationwith; opTable[11 + 1] = BitBlt::bitOrInvertwith; opTable[12 + 1] = BitBlt::bitInvertSourcewith; opTable[13 + 1] = BitBlt::bitInvertOrwith; opTable[14 + 1] = BitBlt::bitInvertOrInvertwith; opTable[15 + 1] = BitBlt::destinationWordwith; opTable[16 + 1] = BitBlt::destinationWordwith; opTable[17 + 1] = BitBlt::destinationWordwith; opTable[18 + 1] = BitBlt::addWordwith; opTable[19 + 1] = BitBlt::subWordwith; opTable[20 + 1] = this::rgbAddwith; opTable[21 + 1] = this::rgbSubwith; opTable[22 + 1] = this::oLDrgbDiffwith; opTable[23 + 1] = this::oLDtallyIntoMapwith; opTable[24 + 1] = this::alphaBlendwith; opTable[25 + 1] = this::pixPaintwith; opTable[26 + 1] = this::pixMaskwith; opTable[27 + 1] = this::rgbMaxwith; opTable[28 + 1] = this::rgbMinwith; opTable[29 + 1] = this::rgbMinInvertwith; opTable[30 + 1] = this::alphaBlendConstwith; opTable[31 + 1] = this::alphaPaintConstwith; opTable[32 + 1] = this::rgbDiffwith; opTable[33 + 1] = this::tallyIntoMapwith; opTable[34 + 1] = this::alphaBlendScaledwith; opTable[35 + 1] = this::alphaBlendScaledwith; opTable[36 + 1] = this::alphaBlendScaledwith; opTable[37 + 1] = this::rgbMulwith; opTable[38 + 1] = this::pixSwapwith; opTable[39 + 1] = this::pixClearwith; opTable[40 + 1] = this::fixAlphawith; opTable[41 + 1] = this::rgbComponentAlphawith; }
Example 20
Source File: ProfilerExecutionEventNode.java From nodeprof.js with Apache License 2.0 | 4 votes |
private void updateChild(BaseEventHandlerNode newChild) { CompilerDirectives.transferToInterpreterAndInvalidate(); this.child = insert(newChild); }