public Namespace(String name, Namespace parent) { this.functionName = name; this.parent = parent; this.frameDescriptor = new FrameDescriptor(); }
protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor) { super(sourceSection); if (frameDescriptor == null) { this.frameDescriptor = new FrameDescriptor(); } else { this.frameDescriptor = frameDescriptor; } }
public static FrameDescriptor create(Object defaultValue) { return new FrameDescriptor(defaultValue); }
public Translator(LuaContext context) { frameDescriptor = new FrameDescriptor(); this.context = context; }
public static FrameDescriptor create() { return new FrameDescriptor(); }
/** * @param rootFrameDescriptor may be {@code null}. */ protected OSRRootNode createRootNode(FrameDescriptor rootFrameDescriptor, Class<? extends VirtualFrame> clazz) { /* * Use a new frame descriptor, because the frame that this new root node creates is not * used. */ return new OSRRootNode(this, new FrameDescriptor(), clazz); }
public FrameDescriptor shallowCopy() { FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue); clonedFrameDescriptor.slots.addAll(slots); clonedFrameDescriptor.identifierToSlotMap.putAll(identifierToSlotMap); return clonedFrameDescriptor; }
@Override public MaterializedFrame createMaterializedFrame(Object[] arguments) { return createMaterializedFrame(arguments, new FrameDescriptor()); }
/** * Shallow copy of the descriptor. Re-uses the existing slots in new descriptor. As a result, if * you {@link FrameSlot#setKind(FrameSlotKind) change kind} of one of the slots it is changed in * the original as well as in the shallow copy. * * @return new instance of a descriptor with copies of values from this one * @since 0.8 or earlier */ public FrameDescriptor shallowCopy() { FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue); clonedFrameDescriptor.slots.addAll(slots); clonedFrameDescriptor.identifierToSlotMap.putAll(identifierToSlotMap); return clonedFrameDescriptor; }
@Override public MaterializedFrame createMaterializedFrame(Object[] arguments) { return createMaterializedFrame(arguments, new FrameDescriptor()); }
@Override public MaterializedFrame createMaterializedFrame(Object[] arguments) { return createMaterializedFrame(arguments, new FrameDescriptor()); }
@Override public MaterializedFrame createMaterializedFrame(Object[] arguments) { return createMaterializedFrame(arguments, new FrameDescriptor()); }
public MumblerContext() { this.globalFrameDescriptor = new FrameDescriptor(); this.globalNamespace = new Namespace(this.globalFrameDescriptor); this.globalFrame = this.initGlobalFrame(); }
/** * Deeper copy of the descriptor. Copies all slots in the descriptor, but only their * {@linkplain FrameSlot#getIdentifier() identifier} and {@linkplain FrameSlot#getInfo() info} * but not their {@linkplain FrameSlot#getKind() kind}! * * @return new instance of a descriptor with copies of values from this one * @since 0.8 or earlier */ public FrameDescriptor copy() { FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue); for (int i = 0; i < slots.size(); i++) { FrameSlot slot = slots.get(i); clonedFrameDescriptor.addFrameSlot(slot.getIdentifier(), slot.getInfo(), FrameSlotKind.Illegal); } return clonedFrameDescriptor; }
public FrameDescriptor copy() { FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue); for (int i = 0; i < this.getSlots().size(); i++) { Object identifier = this.getSlots().get(i).getIdentifier(); clonedFrameDescriptor.addFrameSlot(identifier); } return clonedFrameDescriptor; }
public static MumblerFunction createBuiltinFunction( NodeFactory<? extends BuiltinNode> factory, VirtualFrame outerFrame) { int argumentCount = factory.getExecutionSignature().size(); MumblerNode[] argumentNodes = new MumblerNode[argumentCount]; for (int i=0; i<argumentCount; i++) { argumentNodes[i] = new ReadArgumentNode(i); } BuiltinNode node = factory.createNode((Object) argumentNodes); return new MumblerFunction(Truffle.getRuntime().createCallTarget( new MumblerRootNode(new MumblerNode[] {node}, new FrameDescriptor()))); } }
/** * Deeper copy of the descriptor. Copies all slots in the descriptor, but only their * {@linkplain FrameSlot#getIdentifier() identifier} and {@linkplain FrameSlot#getInfo() info} * but not their {@linkplain FrameDescriptor#getFrameSlotKind(FrameSlot) kind}! * * @return new instance of a descriptor with copies of values from this one * @since 0.8 or earlier */ public FrameDescriptor copy() { CompilerAsserts.neverPartOfCompilation(NEVER_PART_OF_COMPILATION_MESSAGE); synchronized (lock) { FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue); for (int i = 0; i < slots.size(); i++) { FrameSlot slot = slots.get(i); clonedFrameDescriptor.addFrameSlot(slot.getIdentifier(), slot.getInfo(), FrameSlotKind.Illegal); } return clonedFrameDescriptor; } }
@Override protected OSRRootNode createRootNode(FrameDescriptor rootFrameDescriptor, Class<? extends VirtualFrame> clazz) { if (readFrameSlots == null || writtenFrameSlots == null) { return super.createRootNode(rootFrameDescriptor, clazz); } else { FrameDescriptor frameDescriptor = rootFrameDescriptor == null ? new FrameDescriptor() : rootFrameDescriptor; if (previousRoot == null) { previousRoot = new VirtualizingOSRRootNode(this, frameDescriptor, clazz, readFrameSlots, writtenFrameSlots); } else { // we want to reuse speculations from a previous compilation so no rewrite loops // occur. previousRoot = new VirtualizingOSRRootNode(previousRoot, this, frameDescriptor, clazz); } return previousRoot; } }
/** * Forces OSR compilation for this loop. */ public final void forceOSR() { baseLoopCount = getThreshold(); RootNode rootNode = getRootNode(); VirtualFrame dummyFrame = Truffle.getRuntime().createVirtualFrame(new Object[0], rootNode != null ? rootNode.getFrameDescriptor() : new FrameDescriptor()); compileLoop(dummyFrame); }
/** * Creates new root node given an language environment and frame descriptor. The language * instance is obtainable while {@link TruffleLanguage#createContext(Env)} or * {@link TruffleLanguage#parse(ParsingRequest)} is executed. If no language environment is * available, then <code>null</code> can be passed. Please note that root nodes with * <code>null</code> language are considered not instrumentable and have no access to the * {@link #getLanguage(Class) language} or its public {@link #getLanguageInfo() information}. * * @param language the language this root node is associated with * @since 0.25 */ protected RootNode(TruffleLanguage<?> language, FrameDescriptor frameDescriptor) { super(language); CompilerAsserts.neverPartOfCompilation(); if (this.language != null) { this.sourceVM = Node.ACCESSOR.engineSupport().getVMFromLanguageObject(Node.ACCESSOR.languageSupport().getLanguageInfo(this.language).getEngineObject()); } else { this.sourceVM = getCurrentVM(); } this.frameDescriptor = frameDescriptor == null ? new FrameDescriptor() : frameDescriptor; }