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

Commits on Aug 11, 2015

  1. Copy the full SHA
    62d513e View commit details
  2. Copy the full SHA
    7b3547e View commit details
  3. Copy the full SHA
    df1a4f2 View commit details
  4. [Truffle] Convert int-fitting long values back to ints when predefine…

    …d int property is being assigned
    
    Only for few ivars in IOBuffer and IO class.
    pitr-ch committed Aug 11, 2015
    Copy the full SHA
    38fd1c9 View commit details
  5. Copy the full SHA
    03ea799 View commit details
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/thread/list_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
fails:Thread.list includes the current and main thread
fails:Thread.list includes threads of non-default thread groups
fails:Thread.list does not include deceased threads
fails:Thread.list includes waiting threads
4 changes: 0 additions & 4 deletions spec/truffle/tags/language/yield_tags.txt

This file was deleted.

2 changes: 1 addition & 1 deletion test/mri_truffle.index
Original file line number Diff line number Diff line change
@@ -725,7 +725,7 @@ rexml/xpath/test_text.rb
# ruby/test_iseq.rb
# ruby/test_keyword.rb
# ruby/test_lazy_enumerator.rb
ruby/test_not.rb
# ruby/test_not.rb
# ruby/test_refinement.rb
# ruby/test_rubyvm.rb
# ruby/test_threadgroup.rb
Original file line number Diff line number Diff line change
@@ -568,4 +568,18 @@ public RubyBasicObject allocate(RubyContext context, RubyBasicObject rubyClass,

}

@CoreMethod(names = "list", onSingleton = true)
public abstract static class ListNode extends CoreMethodArrayArgumentsNode {

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

@Specialization
public RubyBasicObject list() {
final RubyBasicObject[] threads = getContext().getThreadManager().getThreads();
return createArray(threads, threads.length);
}
}

}
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.array.ArrayUtils;
import org.jruby.truffle.runtime.core.RubyBasicObject;
@@ -150,7 +151,7 @@ public static class IntegerArrayBuilderNode extends ArrayBuilderNode {

private final int expectedLength;

@CompilationFinal private boolean hasAppendedIntegerArray = false;
private final ConditionProfile hasAppendedIntegerArray = ConditionProfile.createBinaryProfile();

public IntegerArrayBuilderNode(RubyContext context, int expectedLength) {
super(context);
@@ -199,26 +200,15 @@ public Object appendArray(Object store, int index, RubyBasicObject array) {
return store;
}

if (hasAppendedIntegerArray && otherStore instanceof int[]) {
System.arraycopy(otherStore, 0, store, index, ArrayNodes.getSize(array));
return store;
}

CompilerDirectives.transferToInterpreterAndInvalidate();

if (otherStore instanceof int[]) {
hasAppendedIntegerArray = true;
if (hasAppendedIntegerArray.profile(otherStore instanceof int[])) {
System.arraycopy(otherStore, 0, store, index, ArrayNodes.getSize(array));
return store;
}

CompilerDirectives.transferToInterpreter();

replace(new ObjectArrayBuilderNode(getContext(), expectedLength));
final Object[] newStore = ArrayUtils.box((int[]) store);
System.arraycopy(otherStore, 0, newStore, index, ArrayNodes.getSize(array));

return newStore;
return replace(new ObjectArrayBuilderNode(getContext(), expectedLength)).
appendArray(ArrayUtils.box((int[]) store), index, array);
}

@Override
@@ -258,6 +248,7 @@ public Object finish(Object store, int length) {
public static class LongArrayBuilderNode extends ArrayBuilderNode {

private final int expectedLength;
private final ConditionProfile otherLongStoreProfile = ConditionProfile.createBinaryProfile();

public LongArrayBuilderNode(RubyContext context, int expectedLength) {
super(context);
@@ -290,7 +281,21 @@ public Object ensure(Object store, int length) {

@Override
public Object appendArray(Object store, int index, RubyBasicObject array) {
throw new UnsupportedOperationException();
Object otherStore = ArrayNodes.getStore(array);

if (otherStore == null) {
return store;
}

if (otherLongStoreProfile.profile(otherStore instanceof long[])) {
System.arraycopy(otherStore, 0, store, index, ArrayNodes.getSize(array));
return store;
}

CompilerDirectives.transferToInterpreter();

return replace(new ObjectArrayBuilderNode(getContext(), expectedLength)).
appendArray(ArrayUtils.box((long[]) store), index, array);
}

@Override
@@ -322,6 +327,7 @@ public Object finish(Object store, int length) {
public static class DoubleArrayBuilderNode extends ArrayBuilderNode {

private final int expectedLength;
private final ConditionProfile otherDoubleStoreProfile = ConditionProfile.createBinaryProfile();

public DoubleArrayBuilderNode(RubyContext context, int expectedLength) {
super(context);
@@ -361,8 +367,21 @@ public Object ensure(Object store, int length) {

@Override
public Object appendArray(Object store, int index, RubyBasicObject array) {
Object otherStore = ArrayNodes.getStore(array);

if (otherStore == null) {
return store;
}

if (otherDoubleStoreProfile.profile(otherStore instanceof double[])) {
System.arraycopy(otherStore, 0, store, index, ArrayNodes.getSize(array));
return store;
}

CompilerDirectives.transferToInterpreter();
throw new UnsupportedOperationException();

return replace(new ObjectArrayBuilderNode(getContext(), expectedLength)).
appendArray(ArrayUtils.box((double[]) store), index, array);
}

@Override
Original file line number Diff line number Diff line change
@@ -124,6 +124,10 @@ public void shutdown() {
}
}

public RubyBasicObject[] getThreads() {
return runningRubyThreads.toArray(new RubyBasicObject[runningRubyThreads.size()]);
}

private void killOtherThreads() {
while (true) {
try {
Original file line number Diff line number Diff line change
@@ -1648,6 +1648,18 @@ public RubyNode visitInstAsgnNode(org.jruby.ast.InstAsgnNode node) {
}
}

// TODO (pitr 08-Aug-2015): values of predefined OM properties should be casted to defined types automatically
if (sourceSection.getSource().getPath().equals("core:/core/rubinius/common/io.rb")) {
if (name.equals("@start") || name.equals("@used") || name.equals("@total") || name.equals("@lineno")) {
// Cast int-fitting longs back to int
return addNewlineIfNeeded(
node,
new WriteInstanceVariableNode(context, sourceSection, name, self,
IntegerCastNodeGen.create(context, sourceSection, rhs),
false));
}
}

final RubyNode ret = new WriteInstanceVariableNode(context, sourceSection, name, self, rhs, false);
return addNewlineIfNeeded(node, ret);
}
@@ -2805,9 +2817,9 @@ public RubyNode visitYieldNode(org.jruby.ast.YieldNode node) {

org.jruby.ast.Node argsNode = node.getArgsNode();

final boolean unsplat = argsNode instanceof org.jruby.ast.SplatNode;
final boolean unsplat = argsNode instanceof org.jruby.ast.SplatNode || argsNode instanceof org.jruby.ast.ArgsCatNode;

if (unsplat) {
if (argsNode instanceof org.jruby.ast.SplatNode) {
argsNode = ((org.jruby.ast.SplatNode) argsNode).getValue();
}