public String displayIdentifier(FrameSlot slot) { return slot.getIdentifier().toString(); }
@SuppressWarnings("deprecation") private static int getFrameSlotIndex(FrameSlot slot) { return slot.getIndex(); }
/** @since 0.8 or earlier */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("FrameDescriptor@").append(Integer.toHexString(hashCode())); sb.append("{"); boolean comma = false; for (FrameSlot slot : slots) { if (comma) { sb.append(", "); } else { comma = true; } sb.append(slot.getIndex()).append(":").append(slot.getIdentifier()); } sb.append("}"); return sb.toString(); }
/** * 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 FrameSlot addFrameSlot(Object identifier, Object info, FrameSlotKind kind) { CompilerAsserts.neverPartOfCompilation("interpreter-only. includes hashmap operations."); assert !identifierToSlotMap.containsKey(identifier); FrameSlot slot = new FrameSlot(this, identifier, info, slots.size(), kind); slots.add(slot); identifierToSlotMap.put(identifier, slot); updateVersion(); invalidateNotInFrameAssumption(identifier); return slot; }
private DefineNode convertDefine(ListSyntax syntax, Namespace ns) { MumblerList<? extends Syntax<? extends Object>> list = syntax.getValue(); SymbolSyntax symSyntax = (SymbolSyntax) list.cdr().car(); FrameSlot nameSlot = ns.getIdentifier(symSyntax.getValue().name).b; MumblerNode valueNode = convert(list.cdr().cdr().car(), ns); DefineNode node = DefineNodeGen.create(valueNode, nameSlot); node.setSourceSection(syntax.getSourceSection()); if (valueNode instanceof LambdaNode) { // TODO : not good enough. if there's an error in the lambda, // the name won't be used. Have to pass name LambdaNode lambda = (LambdaNode) valueNode; lambda.setName(nameSlot.toString()); } return node; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("FrameDescriptor@").append(Integer.toHexString(hashCode())); sb.append("{"); boolean comma = false; for (FrameSlot slot : slots) { if (comma) { sb.append(", "); } else { comma = true; } sb.append(slot.getIndex()).append(":").append(slot.getIdentifier()); } sb.append("}"); return sb.toString(); } }
/** * 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; } }
/** * Adds new frame slot to {@link #getSlots()} list. This is a slow operation that switches to * interpreter mode. * * @param identifier key for the slot - must not be {@code null} and needs proper * {@link #equals(java.lang.Object)} and {@link Object#hashCode()} implementations * @param info additional {@linkplain FrameSlot#getInfo() information for the slot}, may be null * @param kind the kind of the new slot * @return the newly created slot * @throws IllegalArgumentException if a frame slot with the same identifier exists * @throws NullPointerException if {@code identifier} or {@code kind} is {@code null} * @since 0.8 or earlier */ public FrameSlot addFrameSlot(Object identifier, Object info, FrameSlotKind kind) { CompilerAsserts.neverPartOfCompilation(NEVER_PART_OF_COMPILATION_MESSAGE); Objects.requireNonNull(identifier, "identifier"); Objects.requireNonNull(kind, "kind"); if (identifierToSlotMap.containsKey(identifier)) { throw new IllegalArgumentException("duplicate frame slot: " + identifier); } FrameSlot slot = new FrameSlot(this, identifier, info, kind, slots.size()); slots.add(slot); identifierToSlotMap.put(identifier, slot); updateVersion(); invalidateNotInFrameAssumption(identifier); return slot; }
@SuppressWarnings("deprecation") private static int getFrameSlotIndex(FrameSlot slot) { return slot.getIndex(); }
private static boolean isInternal(FrameSlot slot) { Object identifier = slot.getIdentifier(); if (identifier == null) { return true; } if (VMAccessor.INSTRUMENT.isInputValueSlotIdentifier(identifier)) { return true; } return false; }
throw new IllegalArgumentException("duplicate frame slot: " + identifier); FrameSlot slot = new FrameSlot(this, identifier, info, kind, size); size++; slots.add(slot);
@SuppressWarnings("deprecation") private static int getFrameSlotIndex(FrameSlot slot) { return slot.getIndex(); }
private static boolean isInternal(FrameSlot slot) { Object identifier = slot.getIdentifier(); if (identifier == null) { return true; } if (VMAccessor.INSTRUMENT.isInputValueSlotIdentifier(identifier)) { return true; } return false; }
@Specialization(contains = {"writeLong", "writeBoolean"}) protected Object write(VirtualFrame virtualFrame, Object value) { FrameSlot slot = this.getSlot(); if (slot.getKind() != FrameSlotKind.Object) { CompilerDirectives.transferToInterpreterAndInvalidate(); slot.setKind(FrameSlotKind.Object); } virtualFrame.setObject(slot, value); return value; }
@SuppressWarnings("deprecation") private static int getFrameSlotIndex(FrameSlot slot) { return slot.getIndex(); }
@Override public String toString() { return "'" + this.getSlot().getIdentifier(); } }
@Override public void setBoolean(FrameSlot slot, boolean value) { verifySet(slot, FrameSlotKind.Boolean); locals[slot.getIndex()] = value; }