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: 9dd93a373ccf
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8d328aab1038
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 16, 2015

  1. Copy the full SHA
    53f6c8f View commit details
  2. Copy the full SHA
    8d328aa View commit details
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.nodes.coerce;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -30,11 +31,8 @@
@NodeChild("child")
public abstract class ToProcNode extends RubyNode {

@Child private CallDispatchHeadNode toProc;

public ToProcNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
toProc = DispatchHeadNodeFactory.createMethodCall(context);
}

@Specialization(guards = "isNil(nil)")
@@ -48,7 +46,8 @@ public DynamicObject doRubyProc(DynamicObject proc) {
}

@Specialization(guards = "!isRubyProc(object)")
public DynamicObject doObject(VirtualFrame frame, Object object) {
public DynamicObject doObject(VirtualFrame frame, Object object,
@Cached("createCallNode()") CallDispatchHeadNode toProc) {
final Object coerced;
try {
coerced = toProc.call(frame, object, "to_proc", null);
@@ -69,4 +68,8 @@ public DynamicObject doObject(VirtualFrame frame, Object object) {
}
}

protected CallDispatchHeadNode createCallNode() {
return DispatchHeadNodeFactory.createMethodCall(getContext());
}

}
Original file line number Diff line number Diff line change
@@ -1439,7 +1439,9 @@ public DynamicObject initializeNegative(DynamicObject array, long size, NotProvi
@Specialization(guards = "size >= 0")
public DynamicObject initialize(DynamicObject array, int size, int defaultValue, NotProvided block) {
final int[] store = new int[size];
Arrays.fill(store, defaultValue);
if (defaultValue != 0) {
Arrays.fill(store, defaultValue);
}
Layouts.ARRAY.setStore(array, store);
Layouts.ARRAY.setSize(array, size);
return array;
@@ -1454,7 +1456,9 @@ public DynamicObject initializeNegative(DynamicObject array, int size, int defau
@Specialization(guards = "size >= 0")
public DynamicObject initialize(DynamicObject array, int size, long defaultValue, NotProvided block) {
final long[] store = new long[size];
Arrays.fill(store, defaultValue);
if (defaultValue != 0L) {
Arrays.fill(store, defaultValue);
}
Layouts.ARRAY.setStore(array, store);
Layouts.ARRAY.setSize(array, size);
return array;
@@ -1469,7 +1473,9 @@ public DynamicObject initializeNegative(DynamicObject array, int size, long defa
@Specialization(guards = "size >= 0")
public DynamicObject initialize(DynamicObject array, int size, double defaultValue, NotProvided block) {
final double[] store = new double[size];
Arrays.fill(store, defaultValue);
if (defaultValue != 0.0) {
Arrays.fill(store, defaultValue);
}
Layouts.ARRAY.setStore(array, store);
Layouts.ARRAY.setSize(array, size);
return array;