Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -146,7 +146,6 @@ public static class IntegerArrayBuilderNode extends ArrayBuilderNode {
private final int expectedLength;

@CompilerDirectives.CompilationFinal private boolean hasAppendedIntegerArray = false;
@CompilerDirectives.CompilationFinal private boolean hasAppendedObjectArray = false;

public IntegerArrayBuilderNode(RubyContext context, int expectedLength) {
super(context);
@@ -200,11 +199,6 @@ public Object append(Object store, int index, RubyArray array) {
return store;
}

if (hasAppendedObjectArray && otherStore instanceof Object[]) {
System.arraycopy(otherStore, 0, store, index, array.getSize());
return store;
}

CompilerDirectives.transferToInterpreterAndInvalidate();

if (otherStore instanceof int[]) {
@@ -213,13 +207,13 @@ public Object append(Object store, int index, RubyArray array) {
return store;
}

if (otherStore instanceof Object[]) {
hasAppendedObjectArray = true;
System.arraycopy(otherStore, 0, store, index, array.getSize());
return store;
}
CompilerDirectives.transferToInterpreter();

throw new UnsupportedOperationException(array.getStore().getClass().getName());
replace(new ObjectArrayBuilderNode(getContext(), expectedLength));
final Object[] newStore = ArrayUtils.box((int[]) store);
System.arraycopy(otherStore, 0, newStore, index, array.getSize());

return newStore;
}

@Override

0 comments on commit 9e423f9

Please sign in to comment.