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: 787bdf0cb882
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 77a5ca9a811c
Choose a head ref
  • 4 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 19, 2015

  1. Copy the full SHA
    794fa12 View commit details
  2. Copy the full SHA
    bd31401 View commit details
  3. Copy the full SHA
    c31f20b View commit details
  4. 5
    Copy the full SHA
    77a5ca9 View commit details
Original file line number Diff line number Diff line change
@@ -56,12 +56,12 @@ public RubyBasicObject allocate(RubyClass rubyClass) {
@CoreMethod(names = "new", needsBlock = true, argumentsAsArray = true)
public abstract static class NewNode extends CoreMethodNode {

@Child private AllocateNode allocateNode;
@Child private CallDispatchHeadNode allocateNode;
@Child private CallDispatchHeadNode initialize;

public NewNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
allocateNode = ClassNodesFactory.AllocateNodeFactory.create(context, sourceSection, new RubyNode[]{null});
allocateNode = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
initialize = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
}

@@ -74,17 +74,17 @@ public NewNode(NewNode prev) {
public abstract RubyBasicObject executeNew(VirtualFrame frame, RubyClass rubyClass, Object[] args, Object block);

@Specialization
public RubyBasicObject newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, UndefinedPlaceholder block) {
public Object newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, UndefinedPlaceholder block) {
return doNewInstance(frame, rubyClass, args, null);
}

@Specialization
public RubyBasicObject newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, RubyProc block) {
public Object newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, RubyProc block) {
return doNewInstance(frame, rubyClass, args, block);
}

private RubyBasicObject doNewInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, RubyProc block) {
final RubyBasicObject instance = allocateNode.executeAllocate(frame, rubyClass);
private Object doNewInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, RubyProc block) {
final Object instance = allocateNode.call(frame, rubyClass, "allocate", null);
initialize.call(frame, instance, "initialize", block, args);
return instance;
}
Original file line number Diff line number Diff line change
@@ -30,6 +30,24 @@ public abstract class DirPrimitiveNodes {
private static final HiddenKey contentsKey = new HiddenKey("contents");
private static final HiddenKey positionKey = new HiddenKey("position");

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

public DirAllocatePrimitiveNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public DirAllocatePrimitiveNode(DirAllocatePrimitiveNode prev) {
super(prev);
}

@Specialization
public RubyBasicObject allocate(RubyClass dirClass) {
return new RubyBasicObject(dirClass);
}

}

@RubiniusPrimitive(name = "dir_open")
public static abstract class DirOpenPrimitiveNode extends RubiniusPrimitiveNode {

Original file line number Diff line number Diff line change
@@ -25,14 +25,7 @@
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyArray;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyEncoding;
import org.jruby.truffle.runtime.core.RubyEncodingConverter;
import org.jruby.truffle.runtime.core.RubyException;
import org.jruby.truffle.runtime.core.RubyHash;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
import org.jruby.truffle.runtime.core.*;
import org.jruby.util.ByteList;
import org.jruby.util.io.EncodingUtils;

@@ -53,8 +46,8 @@ public EncodingConverterAllocateNode(EncodingConverterAllocateNode prev) {
}

@Specialization
public Object encodingConverterAllocate(RubyEncoding fromEncoding, RubyEncoding toEncoding, RubyHash options) {
return new RubyEncodingConverter(getContext().getCoreLibrary().getEncodingConverterClass(), null);
public Object encodingConverterAllocate(RubyClass encodingConverterClass, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2) {
return new RubyEncodingConverter(encodingConverterClass, null);
}

}