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

Commits on Apr 20, 2015

  1. Copy the full SHA
    8006860 View commit details
  2. Copy the full SHA
    5a97149 View commit details
  3. Copy the full SHA
    191d340 View commit details
  4. Copy the full SHA
    9c8580b View commit details
  5. Copy the full SHA
    65337b3 View commit details
  6. Copy the full SHA
    15d0be6 View commit details
  7. Copy the full SHA
    69f0d7b View commit details
  8. Copy the full SHA
    88a16d8 View commit details
  9. Copy the full SHA
    e793352 View commit details
  10. Copy the full SHA
    49a6dea View commit details
  11. [Truffle] Basic Hash#each is fine for compilation as long as we move …

    …part of it into a boundary.
    chrisseaton committed Apr 20, 2015
    Copy the full SHA
    9cb5925 View commit details
  12. Copy the full SHA
    ff888bb View commit details
  13. Copy the full SHA
    2c34739 View commit details
  14. Copy the full SHA
    2d277a1 View commit details
  15. Copy the full SHA
    37bc06c View commit details
  16. Copy the full SHA
    b5ec83a View commit details
27 changes: 20 additions & 7 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -131,8 +131,13 @@ def mvn(*args)
sh 'mvn', *args
end

def mspec(command, *args)
sh 'ruby', 'spec/mspec/bin/mspec', command, '--config', 'spec/truffle/truffle.mspec', *args
def mspec(env, command, *args)
env_vars = {}
mspec_env env_vars, command, *args
end

def mspec_env(env, command, *args)
sh env, 'ruby', 'spec/mspec/bin/mspec', command, '--config', 'spec/truffle/truffle.mspec', *args
end
end

@@ -152,7 +157,7 @@ def help
puts 'jt test mri run mri tests'
puts 'jt test run all specs'
puts 'jt test fast run all specs except sub-processes, GC, sleep, ...'
puts 'jt test spec/ruby/language run specs in this directory'
puts 'jt test [--graal] spec/ruby/language run specs in this directory'
puts 'jt test spec/ruby/language/while_spec.rb run specs in this file'
puts 'jt test pe run partial evaluation tests'
puts 'jt tag spec/ruby/language tag failing specs in this directory'
@@ -229,7 +234,7 @@ def run(*args)
jruby_args += %w[-J-G:Dump=TrufflePartialEscape]
end

raw_sh(env_vars, "#{JRUBY_DIR}/bin/jruby", *jruby_args, *args)
raw_sh env_vars, "#{JRUBY_DIR}/bin/jruby", *jruby_args, *args
end
alias ruby run

@@ -248,15 +253,23 @@ def test_mri(*args)

def test(*args)
return test_pe(*args.drop(1)) if args.first == 'pe'

return test_mri(*args.drop(1)) if args.first == 'mri'

env_vars = {}
options = %w[--excl-tag fails]

if args.first == 'fast'
args.shift
options += %w[--excl-tag slow]
end
mspec 'run', *options, *args

if args.first == '--graal'
args.shift
env_vars["JAVACMD"] = Utilities.find_graal
options << '-T-J-server'
end

mspec_env env_vars, 'run', *options, *args
end

def test_pe(*args)
@@ -271,7 +284,7 @@ def tag(path, *args)

# Add tags to all given examples without running them. Useful to avoid file exclusions.
def tag_all(*args)
mspec('tag', *%w[--unguarded --all --dry-run --add fails], *args)
mspec 'tag', *%w[--unguarded --all --dry-run --add fails], *args
end
private :tag_all

Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DirectCallNode;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.BranchProfile;
@@ -1587,8 +1588,6 @@ public boolean includeIntegerFixnum(VirtualFrame frame, RubyArray array, Object
for (int n = 0; n < array.getSize(); n++) {
final Object stored = store[n];

notDesignedForCompilation();

if (equalNode.executeSameOrEqual(frame, stored, value)) {
return true;
}
@@ -1604,8 +1603,6 @@ public boolean includeLongFixnum(VirtualFrame frame, RubyArray array, Object val
for (int n = 0; n < array.getSize(); n++) {
final Object stored = store[n];

notDesignedForCompilation();

if (equalNode.executeSameOrEqual(frame, stored, value)) {
return true;
}
@@ -1621,8 +1618,6 @@ public boolean includeFloat(VirtualFrame frame, RubyArray array, Object value) {
for (int n = 0; n < array.getSize(); n++) {
final Object stored = store[n];

notDesignedForCompilation();

if (equalNode.executeSameOrEqual(frame, stored, value)) {
return true;
}
@@ -2655,11 +2650,12 @@ public RubyString packCached(
public RubyString packUncached(
VirtualFrame frame,
RubyArray array,
RubyString format) {
RubyString format,
@Cached("create()") IndirectCallNode callPackNode) {
final PackResult result;

try {
result = (PackResult) compileFormat(format).call(array.getStore(), array.getSize());
result = (PackResult) callPackNode.call(frame, compileFormat(format), new Object[]{array.getStore(), array.getSize()});
} catch (PackException e) {
CompilerDirectives.transferToInterpreter();
throw handleException(e);
@@ -3210,7 +3206,6 @@ public RubyArray pushNullEmptyObjects(RubyArray array, Object... values) {

@Specialization(guards = {"!isNull(array)", "isEmpty(array)"})
public RubyArray pushEmptySingleIntegerFixnum(RubyArray array, Object... values) {
notDesignedForCompilation();
// TODO CS 20-Apr-15 in reality might be better reusing any current storage, but won't worry about that for now
array.setStore(values, values.length);
return array;
Original file line number Diff line number Diff line change
@@ -190,8 +190,6 @@ public Object instanceEval(VirtualFrame frame, Object receiver, RubyString strin

@Specialization
public Object instanceEval(VirtualFrame frame, Object receiver, UndefinedPlaceholder string, RubyProc block) {
notDesignedForCompilation();

return yield.dispatchWithModifiedSelf(frame, block, receiver, receiver);
}

Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

@CoreClass(name = "Hash")
@@ -568,15 +569,18 @@ public RubyHash eachPackedArray(VirtualFrame frame, RubyHash hash, RubyProc bloc

@Specialization(guards = "isBuckets(hash)")
public RubyHash eachBuckets(VirtualFrame frame, RubyHash hash, RubyProc block) {
notDesignedForCompilation();

for (KeyValue keyValue : HashOperations.verySlowToKeyValues(hash)) {
yield(frame, block, RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), keyValue.getKey(), keyValue.getValue()));
for (KeyValue keyValue : verySlowToKeyValues(hash)) {
yield(frame, block, new RubyArray(getContext().getCoreLibrary().getArrayClass(), new Object[]{keyValue.getKey(), keyValue.getValue()}, 2));
}

return hash;
}

@CompilerDirectives.TruffleBoundary
private Collection<KeyValue> verySlowToKeyValues(RubyHash hash) {
return HashOperations.verySlowToKeyValues(hash);
}

@Specialization
public Object each(VirtualFrame frame, RubyHash hash, UndefinedPlaceholder block) {
notDesignedForCompilation();
Original file line number Diff line number Diff line change
@@ -856,19 +856,19 @@ public InstanceVariableGetNode(RubyContext context, SourceSection sourceSection)
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public Object instanceVariableGet(RubyBasicObject object, RubyString name) {
return instanceVariableGet(object, name.toString());
}

@TruffleBoundary
@Specialization
public Object instanceVariableGet(RubyBasicObject object, RubySymbol name) {
return instanceVariableGet(object, name.toString());
}

private Object instanceVariableGet(RubyBasicObject object, String name) {
notDesignedForCompilation();

return object.getInstanceVariable(RubyContext.checkInstanceVariableName(getContext(), name, this));
}

@@ -960,8 +960,6 @@ public LambdaNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyProc proc(RubyProc block) {
notDesignedForCompilation();

return new RubyProc(getContext().getCoreLibrary().getProcClass(), RubyProc.Type.LAMBDA,
block.getSharedMethodInfo(), block.getCallTargetForMethods(), block.getCallTargetForMethods(),
block.getCallTargetForMethods(), block.getDeclarationFrame(), block.getMethod(),
Original file line number Diff line number Diff line change
@@ -604,8 +604,6 @@ public RubyNode wrap(RubyNode node) {

@Specialization
public Object classEval(VirtualFrame frame, RubyModule self, UndefinedPlaceholder code, UndefinedPlaceholder file, UndefinedPlaceholder line, RubyProc block) {
notDesignedForCompilation();

return yield.dispatchWithModifiedSelf(frame, block, self);
}

@@ -914,30 +912,28 @@ public RubyNode coerceToString(RubyNode name) {
return SymbolOrToStrNodeFactory.create(getContext(), getSourceSection(), name);
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubySymbol defineMethod(RubyModule module, String name, UndefinedPlaceholder proc, UndefinedPlaceholder block) {
notDesignedForCompilation();
throw new RaiseException(getContext().getCoreLibrary().argumentError("needs either proc or block", this));
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubySymbol defineMethod(RubyModule module, String name, UndefinedPlaceholder proc, RubyProc block) {
notDesignedForCompilation();

return defineMethod(module, name, block, UndefinedPlaceholder.INSTANCE);
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubySymbol defineMethod(RubyModule module, String name, RubyProc proc, UndefinedPlaceholder block) {
return defineMethod(module, name, proc);
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubySymbol defineMethod(RubyModule module, String name, RubyMethod method, UndefinedPlaceholder block) {
notDesignedForCompilation();

module.addMethod(this, method.getMethod().withNewName(name));

return getContext().getSymbolTable().getSymbol(name);
}

@@ -1665,10 +1661,9 @@ public RemoveMethodNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubyModule removeMethod(RubyModule module, Object[] args) {
notDesignedForCompilation();

for (Object arg : args) {
final String name;

Original file line number Diff line number Diff line change
@@ -945,11 +945,10 @@ public DowncaseNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public RubyString downcase(RubyString string) {
notDesignedForCompilation();
final ByteList newByteList = StringNodesHelper.downcase(getContext().getRuntime(), string.getByteList());

return string.getContext().makeString(string.getLogicalClass(), newByteList);
}
}
@@ -961,10 +960,9 @@ public DowncaseBangNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public RubyBasicObject downcase(RubyString string) {
notDesignedForCompilation();

final ByteList newByteList = StringNodesHelper.downcase(getContext().getRuntime(), string.getByteList());

if (newByteList.equal(string.getBytes())) {
@@ -1097,10 +1095,9 @@ public EncodingNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public RubyEncoding encoding(RubyString string) {
notDesignedForCompilation();

return RubyEncoding.getEncoding(string.getBytes().getEncoding());
}
}
@@ -2236,11 +2233,10 @@ public UpcaseNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public RubyString upcase(RubyString string) {
notDesignedForCompilation();
final ByteList byteListString = StringNodesHelper.upcase(getContext().getRuntime(), string.getByteList());

return string.getContext().makeString(string.getLogicalClass(), byteListString);
}

@@ -2253,10 +2249,9 @@ public UpcaseBangNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public RubyBasicObject upcaseBang(RubyString string) {
notDesignedForCompilation();

final ByteList byteListString = StringNodesHelper.upcase(getContext().getRuntime(), string.getByteList());

if (byteListString.equal(string.getByteList())) {
Original file line number Diff line number Diff line change
@@ -52,8 +52,6 @@ public CurrentNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyThread current() {
notDesignedForCompilation();

return getContext().getThreadManager().getCurrentThread();
}

Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@
import org.jruby.truffle.nodes.conversion.ToJavaStringNodeFactory;
import org.jruby.truffle.nodes.conversion.ToSymbolNode;
import org.jruby.truffle.nodes.conversion.ToSymbolNodeFactory;
import org.jruby.truffle.nodes.objects.MetaClassNode;
import org.jruby.truffle.nodes.objects.MetaClassNodeFactory;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyConstant;
import org.jruby.truffle.runtime.RubyContext;
@@ -37,6 +39,7 @@ public class UncachedDispatchNode extends DispatchNode {
@Child private IndirectCallNode callNode;
@Child private ToSymbolNode toSymbolNode;
@Child private ToJavaStringNode toJavaStringNode;
@Child private MetaClassNode metaClassNode;

private final BranchProfile constantMissingProfile = BranchProfile.create();
private final BranchProfile methodMissingProfile = BranchProfile.create();
@@ -48,6 +51,7 @@ public UncachedDispatchNode(RubyContext context, boolean ignoreVisibility, Dispa
callNode = Truffle.getRuntime().createIndirectCallNode();
toSymbolNode = ToSymbolNodeFactory.create(context, null, null);
toJavaStringNode = ToJavaStringNodeFactory.create(context, null, null);
metaClassNode = MetaClassNodeFactory.create(context, null, null);
}

@Override
@@ -74,7 +78,7 @@ public Object executeDispatch(

constantMissingProfile.enter();

final RubyClass callerClass = ignoreVisibility ? null : getContext().getCoreLibrary().getMetaClass(RubyArguments.getSelf(frame.getArguments()));
final RubyClass callerClass = ignoreVisibility ? null : metaClassNode.executeMetaClass(frame, RubyArguments.getSelf(frame.getArguments()));

final InternalMethod missingMethod = lookup(callerClass, receiverObject, "const_missing", ignoreVisibility);

@@ -94,7 +98,7 @@ public Object executeDispatch(
null,
new Object[]{toSymbolNode.executeRubySymbol(frame, name)}));
} else {
final RubyClass callerClass = ignoreVisibility ? null : getContext().getCoreLibrary().getMetaClass(RubyArguments.getSelf(frame.getArguments()));
final RubyClass callerClass = ignoreVisibility ? null : metaClassNode.executeMetaClass(frame, RubyArguments.getSelf(frame.getArguments()));

final InternalMethod method = lookup(callerClass, receiverObject, toJavaStringNode.executeJavaString(frame, name),
ignoreVisibility);
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.BranchProfile;
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jcodings.Encoding;
import org.jcodings.exception.EncodingException;
@@ -264,9 +265,11 @@ public Object stringByteSubstring(RubyString string, int index, long length) {
@Specialization
public Object stringByteSubstring(RubyString string, long index, long length) {
if (index > Integer.MAX_VALUE || index < Integer.MIN_VALUE) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("index out of int range", this));
}
if (length > Integer.MAX_VALUE || length < Integer.MIN_VALUE) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("length out of int range", this));
}
return stringByteSubstring(string, (int) index, (int) length);
Loading