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

Commits on May 27, 2016

  1. Copy the full SHA
    d9623a7 View commit details
  2. Copy the full SHA
    536ff19 View commit details
  3. Copy the full SHA
    84abbd4 View commit details
  4. Copy the full SHA
    dada939 View commit details
  5. Copy the full SHA
    199d3f8 View commit details
  6. Copy the full SHA
    26f673a View commit details
  7. Copy the full SHA
    9192acd View commit details
  8. Copy the full SHA
    c7dfe5c View commit details
18 changes: 18 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/core/hash/HashNodes.java
Original file line number Diff line number Diff line change
@@ -1403,6 +1403,24 @@ public DynamicObject rehashBuckets(DynamicObject hash) {

}

@NonStandard
@CoreMethod(names = "internal_default_value")
public abstract static class InternalDefaultValueNode extends CoreMethodArrayArgumentsNode {

@Child private DefaultValueNode defaultValueNode;

public InternalDefaultValueNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
defaultValueNode = HashNodesFactory.DefaultValueNodeFactory.create(null);
}

@Specialization
public Object internalDefaultValue(DynamicObject hash) {
return defaultValueNode.defaultValue(hash);
}

}

@NonStandard
@NodeChild(type = RubyNode.class, value = "self")
public abstract static class DefaultValueNode extends CoreMethodNode {
37 changes: 36 additions & 1 deletion truffle/src/main/java/org/jruby/truffle/core/time/TimeNodes.java
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
import org.jruby.truffle.builtins.CoreMethod;
import org.jruby.truffle.builtins.CoreMethodArrayArgumentsNode;
import org.jruby.truffle.builtins.CoreMethodNode;
import org.jruby.truffle.builtins.NonStandard;
import org.jruby.truffle.builtins.Primitive;
import org.jruby.truffle.builtins.PrimitiveArrayArgumentsNode;
import org.jruby.truffle.core.string.StringOperations;
@@ -196,6 +197,41 @@ private DateTime inUTC(final DateTime dateTime) {

}

@CoreMethod(names = "gmt?")
public abstract static class GmtNode extends CoreMethodArrayArgumentsNode {

@Child private InternalGMTNode internalGMTNode;

public GmtNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
internalGMTNode = TimeNodesFactory.InternalGMTNodeFactory.create(null);
}

@Specialization
public boolean allocate(DynamicObject time) {
return internalGMTNode.internalGMT(time);
}

}

@NonStandard
@CoreMethod(names = "internal_offset")
public abstract static class InternalOffsetCoreNode extends CoreMethodArrayArgumentsNode {

@Child private InternalOffsetNode internalOffsetNode;

public InternalOffsetCoreNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
internalOffsetNode = TimeNodesFactory.InternalOffsetNodeFactory.create(null);
}

@Specialization
public Object allocate(DynamicObject time) {
return internalOffsetNode.internalOffset(time);
}

}

@CoreMethod(names = "allocate", constructor = true)
public abstract static class AllocateNode extends CoreMethodArrayArgumentsNode {

@@ -213,7 +249,6 @@ public DynamicObject allocate(DynamicObject rubyClass) {

}


@Primitive(name = "time_s_now")
public static abstract class TimeSNowPrimitiveNode extends PrimitiveArrayArgumentsNode {

Original file line number Diff line number Diff line change
@@ -1851,44 +1851,6 @@ public RubyNode visitInstVarNode(org.jruby.ast.InstVarNode node) {
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
}
} else if (path.equals(corePath + "time.rb")) {
if (name.equals("@is_gmt")) {
ret = TimeNodesFactory.InternalGMTNodeFactory.create(self);
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
} else if (name.equals("@offset")) {
ret = TimeNodesFactory.InternalOffsetNodeFactory.create(self);
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
}
} else if (path.equals(corePath + "hash.rb")) {
if (name.equals("@default")) {
ret = HashNodesFactory.DefaultValueNodeFactory.create(self);
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
} else if (name.equals("@default_proc")) {
ret = HashNodesFactory.DefaultProcNodeFactory.create(new RubyNode[]{ self });
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
} else if (name.equals("@size")) {
ret = HashNodesFactory.SizeNodeFactory.create(new RubyNode[]{ self });
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
}
} else if (path.equals(corePath + "range.rb")) {
if (name.equals("@begin")) {
ret = RangeNodesFactory.BeginNodeFactory.create(new RubyNode[]{ self });
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
} else if (name.equals("@end")) {
ret = RangeNodesFactory.EndNodeFactory.create(new RubyNode[]{ self });
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
} else if (name.equals("@excl")) {
ret = RangeNodesFactory.ExcludeEndNodeFactory.create(new RubyNode[]{ self });
setSourceSection(ret, sourceSection);
return addNewlineIfNeeded(node, ret);
}
}

ret = new ReadInstanceVariableNode(context, sourceSection, name, self);
20 changes: 8 additions & 12 deletions truffle/src/main/ruby/core/hash.rb
Original file line number Diff line number Diff line change
@@ -306,17 +306,13 @@ def compare_by_identity?
end

def default(key=undefined)
if @default_proc and !undefined.equal?(key)
@default_proc.call(self, key)
if default_proc and !undefined.equal?(key)
default_proc.call(self, key)
else
@default
internal_default_value
end
end

def default_proc
@default_proc
end

# Sets the default proc to be executed on each key lookup
def default_proc=(prc)
Truffle.check_frozen
@@ -565,9 +561,9 @@ def select!

return nil if empty?

size = @size
previous_size = size
each_item { |e| delete e.key unless yield(e.key, e.value) }
return nil if size == @size
return nil if previous_size == size

self
end
@@ -695,7 +691,7 @@ def each_value

# Returns true if there are no entries.
def empty?
@size == 0
size == 0
end

def index(value)
@@ -784,9 +780,9 @@ def reject!(&block)
Truffle.check_frozen

unless empty?
size = @size
previous_size = size
delete_if(&block)
return self if size != @size
return self if previous_size != size
end

nil
Loading