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

Commits on Feb 26, 2016

  1. Copy the full SHA
    8f64a78 View commit details
  2. Copy the full SHA
    48b557d View commit details
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
import com.oracle.truffle.api.frame.FrameSlot;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.Encoding;
@@ -62,10 +63,11 @@
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.language.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.language.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.AllocateObjectNodeGen;
import org.jruby.util.ByteList;
import org.jruby.util.RegexpOptions;
import org.jruby.util.RegexpSupport;

import java.nio.charset.StandardCharsets;
import java.util.Iterator;

@@ -605,13 +607,16 @@ public static boolean anyNames(DynamicObject regexp) {
@CoreMethod(names = "allocate", constructor = true)
public abstract static class AllocateNode extends CoreMethodArrayArgumentsNode {

@Child private AllocateObjectNode allocateNode;

public AllocateNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
allocateNode = AllocateObjectNodeGen.create(context, sourceSection, null, null);
}

@Specialization
public DynamicObject allocate(DynamicObject rubyClass) {
return Layouts.REGEXP.createRegexp(Layouts.CLASS.getInstanceFactory(rubyClass), null, null, RegexpOptions.NULL_OPTIONS, null);
return allocateNode.allocate(rubyClass, null, null, RegexpOptions.NULL_OPTIONS, null);
}

}
Original file line number Diff line number Diff line change
@@ -47,21 +47,25 @@
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.control.RaiseException;

import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.AllocateObjectNodeGen;
import java.io.File;

public abstract class DirPrimitiveNodes {

@RubiniusPrimitive(name = "dir_allocate")
public static abstract class DirAllocatePrimitiveNode extends RubiniusPrimitiveArrayArgumentsNode {

@Child private AllocateObjectNode allocateNode;

public DirAllocatePrimitiveNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
allocateNode = AllocateObjectNodeGen.create(context, sourceSection, null, null);
}

@Specialization
public DynamicObject allocate(DynamicObject dirClass) {
return Layouts.DIR.createDir(Layouts.CLASS.getInstanceFactory(dirClass), null, 0);
return allocateNode.allocate(dirClass, null, 0);
}

}