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; }
/** * 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; }
throw new IllegalArgumentException("duplicate frame slot: " + identifier); FrameSlot slot = new FrameSlot(this, identifier, info, kind, size); size++; slots.add(slot);