Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6c9db70f4b2d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 00afa3f1c739
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Feb 9, 2015

  1. Copy the full SHA
    593f187 View commit details
  2. Copy the full SHA
    00afa3f View commit details
16 changes: 10 additions & 6 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -36,9 +36,6 @@
import org.jruby.truffle.nodes.methods.locals.ReadLevelVariableNodeFactory;
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.control.BreakException;
import org.jruby.truffle.runtime.control.NextException;
import org.jruby.truffle.runtime.control.RaiseException;
@@ -949,9 +946,16 @@ public RubyArray concatDouble(RubyArray array, RubyArray other) {
public RubyArray concatObject(RubyArray array, RubyArray other) {
notDesignedForCompilation();

// TODO(CS): is there already space in array?
System.arraycopy(other.getStore(), 0, array.getStore(), array.getSize(), other.getSize());
array.setStore(Arrays.copyOf((Object[]) array.getStore(), array.getSize() + other.getSize()), array.getSize() + other.getSize());
int size = array.getSize();
int newSize = size + other.getSize();
Object[] store = (Object[]) array.getStore();

if (newSize > store.length) {
store = Arrays.copyOf(store, ArrayUtils.capacity(store.length, newSize));
}

System.arraycopy(other.getStore(), 0, store, size, other.getSize());
array.setStore(store, newSize);
return array;
}

Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails
}
}

assert assertNoAmbiguousDefaultArguments(methodDetails);
verifyNoAmbiguousDefaultArguments(methodDetails);

final CheckArityNode checkArity = new CheckArityNode(context, sourceSection, arity);
final RubyNode block = SequenceNode.sequence(context, sourceSection, checkArity, methodNode);
@@ -202,7 +202,9 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails
return new RubyRootNode(context, sourceSection, null, sharedMethodInfo, exceptionTranslatingNode);
}

private static boolean assertNoAmbiguousDefaultArguments(MethodDetails methodDetails) {
private static boolean verifyNoAmbiguousDefaultArguments(MethodDetails methodDetails) {
boolean success = true;

if (methodDetails.getMethodAnnotation().optional() > 0) {
int opt = methodDetails.getMethodAnnotation().optional();
int argc = methodDetails.getNodeFactory().getExecutionSignature().size();
@@ -231,12 +233,17 @@ private static boolean assertNoAmbiguousDefaultArguments(MethodDetails methodDet
}

if (undefined && object) {
throw new RuntimeException("Ambiguous default argument " + (argc - i) + " in " + node.getCanonicalName());
success = false;
System.err.println("Ambiguous default argument " + (argc - i) + " in " + node.getCanonicalName());
}
}
}

return true;
if (!success) {
throw new RuntimeException("Found ambiguous arguments");
}

return success;
}

public static class MethodDetails {