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: 58bd0ecd8706
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d023658775ac
Choose a head ref

Commits on Oct 30, 2014

  1. Copy the full SHA
    18bb4db View commit details
  2. Copy the full SHA
    eed2a9e View commit details

Commits on Oct 31, 2014

  1. [Truffle] Remove some abstractions that don't seem to compile well, a…

    …nd fix some other compilation problems.
    chrisseaton committed Oct 31, 2014
    Copy the full SHA
    6793854 View commit details
  2. Copy the full SHA
    bbd3d29 View commit details
  3. Revert "[Truffle] Remove now useless (and incorrect!) AddNode special…

    …ization."
    
    This reverts commit 27712b7.
    eregon committed Oct 31, 2014
    Copy the full SHA
    57f049f View commit details
  4. Copy the full SHA
    abb749d View commit details
  5. Revert "[Truffle] Introduce ImplicitCast from int to long."

    This reverts commit 032326d.
    eregon committed Oct 31, 2014
    Copy the full SHA
    7fcb6a3 View commit details
  6. Copy the full SHA
    62bb382 View commit details
  7. [Truffle] Fix a couple specializations which cannot overflow.

    * Also rename specializations which deal with the overflow just [op]negWithOverflow
      so we have a compile-time check for this potential issue.
    eregon committed Oct 31, 2014
    Copy the full SHA
    ae9a341 View commit details
  8. Copy the full SHA
    e52f6bf View commit details
  9. Copy the full SHA
    7bce91f View commit details
  10. [Truffle] Implement Regexp#source.

    * RubyRegexp.source should obviously be a String.
    eregon committed Oct 31, 2014
    Copy the full SHA
    4256190 View commit details
  11. [Truffle] Implement Fixnum#<<(int) correctly.

    * Mostly, there was no case to return an int.
    eregon committed Oct 31, 2014
    Copy the full SHA
    403f65f View commit details
  12. [Truffle] FixnumLowerNode should throw a TypeError if it fails.

    * Add an helper method for typeErrorCantConvertInto.
    eregon committed Oct 31, 2014
    Copy the full SHA
    b605cb5 View commit details
  13. Copy the full SHA
    4de3991 View commit details
  14. Copy the full SHA
    ff101b8 View commit details
  15. Copy the full SHA
    50f3ae3 View commit details
  16. [Truffle] RUBY_ENGINE should be jrubytruffle!

    * Fix the new failures due to deviates_on.
    eregon committed Oct 31, 2014
    Copy the full SHA
    a7b51d9 View commit details
  17. Copy the full SHA
    0852a31 View commit details
  18. Merge branch 'master' into truffle-head

    Conflicts:
    	core/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java
    	core/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
    chrisseaton committed Oct 31, 2014
    Copy the full SHA
    a284586 View commit details
  19. [Truffle] Remove stale tag.

    eregon committed Oct 31, 2014
    Copy the full SHA
    b1ba52e View commit details
  20. Copy the full SHA
    1896640 View commit details
  21. Copy the full SHA
    9ba6b5a View commit details
  22. Copy the full SHA
    3da3e8b View commit details
  23. [Truffle] Fix BasicObject#!=.

    eregon committed Oct 31, 2014
    Copy the full SHA
    3a7397d View commit details
  24. [Truffle] Fix Kernel#===.

    eregon committed Oct 31, 2014
    Copy the full SHA
    cc5e719 View commit details
  25. Copy the full SHA
    733cf82 View commit details
  26. Copy the full SHA
    b38c8f0 View commit details
  27. [Truffle] Fix equal?

    eregon committed Oct 31, 2014
    Copy the full SHA
    5ea9eb5 View commit details
  28. [Truffle] Fix Array#==.

    eregon committed Oct 31, 2014
    Copy the full SHA
    3f8c1a7 View commit details
  29. [Truffle] Implement Bignum#==.

    eregon committed Oct 31, 2014
    Copy the full SHA
    09821f7 View commit details
  30. Copy the full SHA
    26fb642 View commit details
  31. Copy the full SHA
    46092f4 View commit details
  32. [Truffle] Get rid of superfluous #=== and #eql? definitions.

    * So we match MRI and avoid code duplication.
    * MRI still defines #=== uselessly on a couple classes like Fixnum, Symbol and String.
    * No more reference to the confusing "three equal".
    eregon committed Oct 31, 2014
    Copy the full SHA
    5a8ee14 View commit details
  33. Copy the full SHA
    d023658 View commit details
Showing with 613 additions and 432 deletions.
  1. +101 −0 bench/truffle/regression.rb
  2. +5 −1 core/src/main/java/org/jruby/ir/passes/OptimizeDynScopesPass.java
  3. +4 −0 core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  4. +1 −6 core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
  5. +3 −3 core/src/main/java/org/jruby/truffle/nodes/control/WhenSplatNode.java
  6. +54 −0 core/src/main/java/org/jruby/truffle/nodes/conversion/ToJavaStringNode.java
  7. +51 −0 core/src/main/java/org/jruby/truffle/nodes/conversion/ToSymbolNode.java
  8. +18 −18 core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
  9. +24 −63 core/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  10. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java
  11. +2 −0 core/src/main/java/org/jruby/truffle/nodes/core/CoreMethod.java
  12. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/CoreMethodNodeManager.java
  13. +2 −1 core/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
  14. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/FalseClassNodes.java
  15. +3 −2 core/src/main/java/org/jruby/truffle/nodes/core/FixnumLowerNode.java
  16. +71 −30 core/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java
  17. +7 −14 core/src/main/java/org/jruby/truffle/nodes/core/GCNodes.java
  18. +74 −121 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  19. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/MainNodes.java
  20. +0 −20 core/src/main/java/org/jruby/truffle/nodes/core/NilClassNodes.java
  21. +21 −3 core/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  22. +2 −4 core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  23. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/SymbolNodes.java
  24. +7 −8 core/src/main/java/org/jruby/truffle/nodes/core/ThreadNodes.java
  25. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/TrueClassNodes.java
  26. +10 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/CachedBooleanDispatchNode.java
  27. +15 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/CachedBoxedDispatchNode.java
  28. +2 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/CachedBoxedMethodMissingDispatchNode.java
  29. +5 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/CachedBoxedSymbolDispatchNode.java
  30. +9 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/CachedDispatchNode.java
  31. +1 −2 core/src/main/java/org/jruby/truffle/nodes/dispatch/DispatchNode.java
  32. +25 −36 core/src/main/java/org/jruby/truffle/nodes/dispatch/UncachedDispatchNode.java
  33. +19 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/UnresolvedDispatchNode.java
  34. +10 −0 core/src/main/java/org/jruby/truffle/nodes/literal/RangeLiteralNode.java
  35. +1 −12 core/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  36. +5 −1 core/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  37. +6 −1 core/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  38. +2 −0 core/src/main/java/org/jruby/truffle/runtime/core/RubySymbol.java
  39. +11 −15 core/src/main/java/org/jruby/truffle/runtime/core/RubyThread.java
  40. +12 −2 core/src/main/java/org/jruby/truffle/runtime/methods/SharedMethodInfo.java
  41. +14 −12 core/src/main/java/org/jruby/truffle/runtime/subsystems/SafepointManager.java
  42. +3 −22 core/src/main/java/org/jruby/truffle/runtime/subsystems/ThreadManager.java
  43. +1 −2 spec/jruby.2.1.mspec
  44. +0 −1 spec/tags/ruby/core/encoding/converter/primitive_errinfo_tags.txt
  45. +1 −1 spec/truffle/tags/core/bignum/size_tags.txt
  46. +2 −1 spec/truffle/tags/core/file/split_tags.txt
  47. +0 −1 spec/truffle/tags/core/fixnum/bit_and_tags.txt
  48. +0 −1 spec/truffle/tags/core/fixnum/bit_or_tags.txt
  49. +0 −2 spec/truffle/tags/core/fixnum/bit_xor_tags.txt
  50. +0 −2 spec/truffle/tags/core/fixnum/exponent_tags.txt
  51. +0 −5 spec/truffle/tags/core/fixnum/left_shift_tags.txt
  52. +0 −1 spec/truffle/tags/core/fixnum/minus_tags.txt
  53. +0 −1 spec/truffle/tags/core/fixnum/multiply_tags.txt
  54. +0 −1 spec/truffle/tags/core/fixnum/plus_tags.txt
  55. +1 −0 spec/truffle/tags/core/float/constants_tags.txt
  56. +0 −10 spec/truffle/tags/core/kernel/case_compare_tags.txt
  57. +1 −0 spec/truffle/tags/core/kernel/eval_tags.txt
  58. +1 −0 spec/truffle/tags/core/module/prepend_tags.txt
101 changes: 101 additions & 0 deletions bench/truffle/regression.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Copyright © 2004-2013 Brent Fulgham
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of "The Computer Language Benchmarks Game" nor the name
# of "The Computer Language Shootout Benchmarks" nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# The Computer Language Benchmarks Game

# http://benchmarksgame.alioth.debian.org/

# Contributed by Wesley Moxam

# Modified by Sokolov Yura aka funny_falcon

# http://benchmarksgame.alioth.debian.org/u64q/program.php?test=fannkuchredux&lang=yarv&id=1

def fannkuch(n)
p = (0..n).to_a
s = p.dup
q = p.dup
sign = 1
sum = maxflips = 0
while(true)
# flip.

if (q1 = p[1]) != 1
q[0..-1] = p
flips = 1
until (qq = q[q1]) == 1
q[q1] = q1
if q1 >= 4
i, j = 2, q1 - 1
while i < j
q[i], q[j] = q[j], q[i]
i += 1
j -= 1
end
end
q1 = qq
flips += 1
end
sum += sign * flips
maxflips = flips if flips > maxflips # New maximum?

end
# Permute.

if sign == 1
# Rotate 1<-2.

p[1], p[2] = p[2], p[1]
sign = -1
else
# Rotate 1<-2 and 1<-2<-3.

p[2], p[3] = p[3], p[2]
sign = 1
i = 3
while i <= n && s[i] == 1
#return [sum, maxflips] if i == n # Out of permutations.
return sum if i == n

s[i] = i
# Rotate 1<-...<-i+1.

t = p.delete_at(1)
i += 1
p.insert(i, t)
end
s[i] -= 1 if i <= n
end
end
end

while true
fannkuch(9)
end
Original file line number Diff line number Diff line change
@@ -11,11 +11,15 @@
import org.jruby.ir.operands.Variable;
import org.jruby.ir.representations.BasicBlock;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

public class OptimizeDynScopesPass extends CompilerPass {
public static List<Class<? extends CompilerPass>> DEPENDENCIES = Arrays.<Class<? extends CompilerPass>>asList(CFGBuilder.class);

@Override
public String getLabel() {
return "Optimize Dynamic Scopes";
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -59,6 +59,10 @@ public Object isDefined(VirtualFrame frame) {
return getContext().makeString("expression");
}

public String executeJavaString(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectString(execute(frame));
}

public RubyArray executeArray(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectRubyArray(execute(frame));
}
7 changes: 1 addition & 6 deletions core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
int.class, //
long.class, //
double.class, //
String.class, // for SymbolCastNode
BigInteger.class, //
RubyRange.IntegerFixnumRange.class, //
RubyRange.LongFixnumRange.class, //
@@ -73,12 +74,6 @@

public class RubyTypes {

@ImplicitCast
public long int2long(int value) {
return value;
}


@ImplicitCast
public boolean unboxBoolean(RubyTrueClass value) {
return true;
Original file line number Diff line number Diff line change
@@ -21,13 +21,13 @@ public class WhenSplatNode extends RubyNode {

@Child protected RubyNode readCaseExpression;
@Child protected RubyNode splat;
@Child protected DispatchHeadNode dispatchThreeEqual;
@Child protected DispatchHeadNode dispatchCaseEqual;

public WhenSplatNode(RubyContext context, SourceSection sourceSection, RubyNode readCaseExpression, RubyNode splat) {
super(context, sourceSection);
this.readCaseExpression = readCaseExpression;
this.splat = splat;
dispatchThreeEqual = new DispatchHeadNode(context);
dispatchCaseEqual = new DispatchHeadNode(context);
}

@Override
@@ -47,7 +47,7 @@ public boolean executeBoolean(VirtualFrame frame) {
for (Object value : array.slowToArray()) {
// TODO(CS): how to cast this to a boolean?

if ((boolean) dispatchThreeEqual.call(frame, caseExpression, "===", null, value)) {
if ((boolean) dispatchCaseEqual.call(frame, caseExpression, "===", null, value)) {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.nodes.conversion;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;

@NodeChild(value="child", type=RubyNode.class)
public abstract class ToJavaStringNode extends RubyNode {

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

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

public abstract String executeJavaString(VirtualFrame frame, Object object);

// TODO(CS): cache the conversion to a Java String? Or should the user do that themselves?

@CompilerDirectives.TruffleBoundary
@Specialization
protected String toJavaString(RubySymbol symbol) {
return symbol.toString();
}

@CompilerDirectives.TruffleBoundary
@Specialization
protected String toJavaString(RubyString string) {
return string.toString();
}

@Specialization
protected String toJavaString(String string) {
return string;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.nodes.conversion;

import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;

@NodeChild(value="child", type=RubyNode.class)
public abstract class ToSymbolNode extends RubyNode {

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

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

public abstract RubySymbol executeRubySymbol(VirtualFrame frame, Object object);

// TODO(CS): cache the conversion to a symbol? Or should the user do that themselves?

@Specialization
protected RubySymbol toSymbol(RubySymbol symbol) {
return symbol;
}

@Specialization
protected RubySymbol toSymbol(RubyString string) {
return getContext().newSymbol(string.getBytes());
}

@Specialization
protected RubySymbol toSymbol(String string) {
return getContext().newSymbol(string);
}

}
36 changes: 18 additions & 18 deletions core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -507,11 +507,15 @@ public boolean equal(VirtualFrame frame, RubyArray a, RubyArray b) {
return true;
}

// TODO(CS): what to do about all the other cases?

@Specialization
public boolean equal(VirtualFrame frame, RubyArray a, RubySymbol b) {
return false;
public boolean equal(VirtualFrame frame, RubyArray a, Object b) {
notDesignedForCompilation();

if (!(b instanceof RubyArray)) {
return false;
} else {
return equal(frame, a, (RubyArray) b);
}
}

}
@@ -1162,16 +1166,16 @@ public RubyArray concat(RubyArray array, RubyArray other) {
@CoreMethod(names = "delete", required = 1)
public abstract static class DeleteNode extends ArrayCoreMethodNode {

@Child protected DispatchHeadNode threeEqual;
@Child protected KernelNodes.SameOrEqualNode equalNode;

public DeleteNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
threeEqual = new DispatchHeadNode(context);
equalNode = KernelNodesFactory.SameOrEqualNodeFactory.create(context, sourceSection, new RubyNode[]{null,null});
}

public DeleteNode(DeleteNode prev) {
super(prev);
threeEqual = prev.threeEqual;
equalNode = prev.equalNode;
}

@Specialization(guards = "isIntegerFixnum")
@@ -1185,9 +1189,7 @@ public Object deleteIntegerFixnum(VirtualFrame frame, RubyArray array, Object va
for (int n = 0; n < array.getSize(); n++) {
final Object stored = store[n];

// TODO(CS): need a cast node around the dispatch

if (stored == value || (boolean) threeEqual.call(frame, store[n], "===", null, value)) {
if (equalNode.executeSameOrEqual(frame, stored, value)) {
found = store[n];
continue;
}
@@ -1214,9 +1216,7 @@ public Object deleteObject(VirtualFrame frame, RubyArray array, Object value) {
for (int n = 0; n < array.getSize(); n++) {
final Object stored = store[n];

// TODO(CS): need a cast node around the dispatch

if (stored == value || (boolean) threeEqual.call(frame, store[n], "===", null, value)) {
if (equalNode.executeSameOrEqual(frame, stored, value)) {
found = store[n];
continue;
}
@@ -1737,16 +1737,16 @@ public RubyArray flatten(RubyArray array) {
@CoreMethod(names = "include?", required = 1)
public abstract static class IncludeNode extends ArrayCoreMethodNode {

@Child protected DispatchHeadNode threeEqual;
@Child protected KernelNodes.SameOrEqualNode equalNode;

public IncludeNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
threeEqual = new DispatchHeadNode(context);
equalNode = KernelNodesFactory.SameOrEqualNodeFactory.create(context, sourceSection, new RubyNode[]{null,null});
}

public IncludeNode(IncludeNode prev) {
super(prev);
threeEqual = prev.threeEqual;
equalNode = prev.equalNode;
}

@Specialization(guards = "isNull")
@@ -1764,7 +1764,7 @@ public boolean includeFixnum(VirtualFrame frame, RubyArray array, Object value)
// TODO(CS): cast node around the dispatch
notDesignedForCompilation();

if (stored == value || (boolean) threeEqual.call(frame, store[n], "===", null, value)) {
if (equalNode.executeSameOrEqual(frame, stored, value)) {
return true;
}
}
@@ -1782,7 +1782,7 @@ public boolean includeObject(VirtualFrame frame, RubyArray array, Object value)
// TODO(CS): cast node around the dispatch
notDesignedForCompilation();

if (stored == value || (boolean) threeEqual.call(frame, store[n], "===", null, value)) {
if (equalNode.executeSameOrEqual(frame, stored, value)) {
return true;
}
}
Loading