@Specialization public RubyString javaClassOf(RubyArray array) { notDesignedForCompilation(); return getContext() .makeString( "RubyArray(" + (array.getStore() == null ? "null" : array.getStore().getClass()) + "*" + array.getSize() + ")"); }
@ExplodeLoop @Override public RubyArray executeArray(VirtualFrame frame) { CompilerDirectives.transferToInterpreter(); final Object[] executedValues = new Object[values.length]; for (int n = 0; n < values.length; n++) { executedValues[n] = values[n].execute(frame); } final RubyArray array = RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), executedValues); final Object store = array.getStore(); if (store == null) { replace(new EmptyArrayLiteralNode(getContext(), getSourceSection(), values)); } if (store instanceof int[]) { replace(new IntegerFixnumArrayLiteralNode(getContext(), getSourceSection(), values)); } else if (store instanceof long[]) { replace(new LongFixnumArrayLiteralNode(getContext(), getSourceSection(), values)); } else if (store instanceof double[]) { replace(new FloatArrayLiteralNode(getContext(), getSourceSection(), values)); } else { replace(new ObjectArrayLiteralNode(getContext(), getSourceSection(), values)); } return array; }