@Specialization(guards = "strategy.matches(array)", limit = "ARRAY_STRATEGIES") public boolean ensureCapacity( DynamicObject array, int requiredCapacity, @Cached("of(array)") ArrayStrategy strategy, @Cached("createCountingProfile()") ConditionProfile extendProfile) { final ArrayMirror mirror = strategy.newMirror(array); if (extendProfile.profile(mirror.getLength() < requiredCapacity)) { final int capacity = ArrayUtils.capacity(getContext(), mirror.getLength(), requiredCapacity); Layouts.ARRAY.setStore(array, mirror.copyArrayAndMirror(capacity).getArray()); return true; } else { return false; } }