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

Commits on Mar 1, 2016

  1. Copy the full SHA
    9efa581 View commit details
  2. Copy the full SHA
    9f02ddc View commit details
  3. Copy the full SHA
    bbb8800 View commit details
  4. Copy the full SHA
    bbb954a View commit details
  5. Copy the full SHA
    79d46ac View commit details
  6. Copy the full SHA
    34a5762 View commit details
  7. Copy the full SHA
    0bdcb5f View commit details
  8. Copy the full SHA
    e298db7 View commit details
  9. Copy the full SHA
    4630fea View commit details
  10. [Truffle] add error messages

    pitr-ch committed Mar 1, 2016
    Copy the full SHA
    a264e15 View commit details
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ env:
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
- MALLOC_ARENA_MAX=2
matrix:
- JTRCI='lib/ruby/truffle/jruby+truffle/gem_ci/travis.txt'
- PHASE='-Ptest'
- PHASE='-Prake -Dtask=test:jruby'
- PHASE='-Prake -Dtask=test:jruby:fullint'
@@ -79,7 +80,7 @@ matrix:
- env: JT=check_ambiguous_arguments
jdk: oraclejdk8
- env: JT='test mri'
- env: JTR='ci --batch ../lib/ruby/truffle/jruby+truffle/gem_ci/travis.txt'
- env: JTRCI='lib/ruby/truffle/jruby+truffle/gem_ci/travis.txt'
# NOTE: build seems to never start (waited for any to finish for more than a day) - probably a travis-ci bug
#- env: PHASE='-Pmain'
# sudo: required
Original file line number Diff line number Diff line change
@@ -38,12 +38,6 @@
end
end
# Work around a bug in ActiveSupport whereby it tries to pass an env hash with Symbol keys. This only
# works on JRuby 1.7. The following will allow the Symbol keys to coerce to Strings.
class Symbol
alias :to_str :to_s
end
bundler.rb: "module Bundler; def self.setup; end; end"
# mock method_source gem
method_source.rb: nil
50 changes: 28 additions & 22 deletions lib/ruby/truffle/jruby+truffle/lib/runner.rb
Original file line number Diff line number Diff line change
@@ -68,13 +68,14 @@ def print_cmd(cmd, dir, print)
BRANDING = EXECUTABLE.include?('jruby') ? 'JRuby+Truffle' : 'RubyTruffle'
LOCAL_CONFIG_FILE = '.jruby+truffle.yaml'
ROOT = Pathname(__FILE__).dirname.parent.expand_path
JRUBY_PATH = (ROOT + '../../../..').expand_path
JRUBY_PATH = ROOT.join('../../../..').expand_path

begin
assign_new_value = -> (new, old, _) { new }
add_to_array = -> (new, old, _) { old << new }
merge_hash = -> ((k, v), old, _) { old.merge k => v }
apply_pattern = -> (pattern, old, options) do
assign_new_value = -> (new, old, _) { new }
assign_new_negated_value = -> (new, old, _) { !new }
add_to_array = -> (new, old, _) { old << new }
merge_hash = -> ((k, v), old, _) { old.merge k => v }
apply_pattern = -> (pattern, old, options) do
Dir.glob(pattern) do |file|
if options[:exclude_pattern].any? { |p| /#{p}/ =~ file }
puts "skipped: #{file}" if verbose?
@@ -91,7 +92,7 @@ def print_cmd(cmd, dir, print)
# -> (new_value, old_value) { result_of_this_block_is_stored },
# default_value]
# }
OPTION_DEFINITIONS = {
OPTION_DEFINITIONS = {
global: {
verbose: ['-v', '--verbose', 'Run verbosely (prints options)', assign_new_value, false],
help: ['-h', '--help', 'Show this message', assign_new_value, false],
@@ -100,8 +101,8 @@ def print_cmd(cmd, dir, print)
'-J-agentlib:jdwp=transport=dt_socket,server=y,address=%d,suspend=y'],
truffle_bundle_path: ['--truffle-bundle-path NAME', 'Bundle path', assign_new_value, '.jruby+truffle_bundle'],
interpreter_path: ['--interpreter-path PATH', "Path to #{BRANDING} interpreter executable", assign_new_value,
JRUBY_PATH + 'bin' + 'jruby'],
graal_path: ['--graal-path PATH', 'Path to Graal', assign_new_value, '../graalvm-jdk1.8.0/bin/java'],
JRUBY_PATH.join('bin', 'jruby')],
graal_path: ['--graal-path PATH', 'Path to Graal', assign_new_value, (JRUBY_PATH + '../GraalVM-0.10/jre/bin/javao').to_s],
mock_load_path: ['--mock-load-path PATH',
'Path of mocks & monkey-patches (prepended in $:, relative to --truffle_bundle_path)',
assign_new_value, 'mocks'],
@@ -119,7 +120,7 @@ def print_cmd(cmd, dir, print)
},
run: {
help: ['-h', '--help', 'Show this message', assign_new_value, false],
no_truffle: ['-n', '--no-truffle', "Use conventional JRuby instead of #{BRANDING}", assign_new_value, false],
no_truffle: ['-n', '--no-truffle', "Use conventional JRuby instead of #{BRANDING}", assign_new_negated_value, false],
graal: ['-g', '--graal', 'Run on graal', assign_new_value, false],
build: ['-b', '--build', 'Run `jt build` using conventional JRuby', assign_new_value, false],
rebuild: ['--rebuild', 'Run `jt rebuild` using conventional JRuby', assign_new_value, false],
@@ -285,7 +286,7 @@ def load_gem_configuration

if candidates.size == 1
gem_name, _ = candidates.first.split('.')
yaml_path = ROOT + 'gem_configurations'+ "#{gem_name}.yaml"
yaml_path = ROOT.join 'gem_configurations', "#{gem_name}.yaml"
end

apply_yaml_to_configuration(yaml_path)
@@ -334,7 +335,7 @@ def deep_merge(a, b)

if Array === a
if Array === b
return a.replace a + b.map { |v| eval_yaml_strings v }
return a.concat b.map { |v| eval_yaml_strings v }
else
return a
end
@@ -366,9 +367,15 @@ def subcommand_setup(rest)
'--path', bundle_path,
*(['--without', @options[:setup][:without].join(' ')] unless @options[:setup][:without].empty?)])

link_path = "#{bundle_path}/jruby+truffle"
FileUtils.rm link_path if File.exist? link_path
execute_cmd "ln -s #{bundle_path}/#{RUBY_ENGINE} #{link_path}"
jruby_truffle_path = File.join(bundle_path, 'jruby+truffle')
FileUtils.ln_s File.join(bundle_path, RUBY_ENGINE),
jruby_truffle_path,
verbose: verbose? unless File.exists? jruby_truffle_path

jruby_truffle_22_path = File.join(bundle_path, 'jruby+truffle', '2.2.0')
FileUtils.ln_s File.join(bundle_path, 'jruby+truffle', '2.3.0'),
jruby_truffle_22_path,
verbose: verbose? unless File.exists? jruby_truffle_22_path

mock_path = "#{bundle_path}/#{@options[:global][:mock_load_path]}"
FileUtils.mkpath mock_path
@@ -428,12 +435,12 @@ def subcommand_run(rest)
truffle_options = [
('-X+T'),
("-Xtruffle.core.load_path=#{core_load_path}" if @options[:global][:use_fs_core]),
('-Xtruffle.exceptions.print_java=true' if @options[:run][:jexception]),
(format(@options[:global][:debug_option], @options[:global][:debug_port]) if @options[:run][:debug])
('-Xtruffle.exceptions.print_java=true' if @options[:run][:jexception])
]

cmd_options = [
*(truffle_options unless @options[:run][:no_truffle]),
(format(@options[:global][:debug_option], @options[:global][:debug_port]) if @options[:run][:debug]),
*ruby_options,
'-r', "./#{@options[:global][:truffle_bundle_path]}/bundler/setup.rb",
*@options[:run][:load_path].flat_map { |v| ['-I', v] },
@@ -459,7 +466,7 @@ def subcommand_clean(rest)
end

def subcommand_readme(rest)
puts File.read(ROOT + 'README.md')
puts File.read(ROOT.join('README.md'))
end

def subcommand_ci(rest)
@@ -520,8 +527,7 @@ def initialize(options, working_dir, gem_name)
@options = options
@gem_name = gem_name

ci_file = Dir.glob(ROOT + 'gem_ci' + "#{@gem_name}.rb").first ||
Dir.glob(ROOT + 'gem_ci' + 'default.rb').first
ci_file = Dir.glob(ROOT.join('gem_ci', "{#{@gem_name},default}.rb")).first

puts "Running #{ci_file}"

@@ -534,19 +540,19 @@ def initialize(options, working_dir, gem_name)
end

def repository_dir
working_dir + repository_name
working_dir.join repository_name
end

def testing_dir
repository_dir + subdir
repository_dir.join subdir
end

def jruby_path
JRUBY_PATH
end

def jruby_truffle_path
jruby_path + 'bin' + 'jruby+truffle'
jruby_path.join 'bin', 'jruby+truffle'
end

def option(key)
4 changes: 2 additions & 2 deletions tool/travis_runner.sh
Original file line number Diff line number Diff line change
@@ -22,10 +22,10 @@ then
ruby tool/jt.rb $JT
fi

if [[ -v JTR ]]
if [[ -v JTRCI ]]
then
gem install bundler
mkdir gem-testing
cd gem-testing
jruby+truffle $JTR
jruby+truffle ci --batch ../$JTRCI
fi
Original file line number Diff line number Diff line change
@@ -38,7 +38,9 @@ public abstract class ClassNodes {

private final static com.oracle.truffle.api.object.Layout LAYOUT = com.oracle.truffle.api.object.Layout.createLayout();

/** Special constructor for class Class */
/**
* Special constructor for class Class
*/
@TruffleBoundary
public static DynamicObject createClassClass(RubyContext context) {
final ModuleFields model = new ModuleFields(context, null, "Class");
@@ -199,7 +201,6 @@ public static DynamicObject createOneSingletonClass(RubyContext context, Dynamic
return Layouts.BASIC_OBJECT.getMetaClass(rubyClass);
}


public static DynamicObject getSuperClass(DynamicObject rubyClass) {
CompilerAsserts.neverPartOfCompilation();

@@ -262,7 +263,7 @@ void triggerInheritedHook(VirtualFrame frame, DynamicObject subClass, DynamicObj
void moduleInitialize(VirtualFrame frame, DynamicObject rubyClass, DynamicObject block) {
if (moduleInitializeNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
moduleInitializeNode = insert(ModuleNodesFactory.InitializeNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{null,null}));
moduleInitializeNode = insert(ModuleNodesFactory.InitializeNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{ null, null }));
}
moduleInitializeNode.executeInitialize(frame, rubyClass, block);
}
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@

import com.oracle.truffle.api.Assumption;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.DynamicObject;
@@ -65,8 +66,7 @@ public static void debugModuleChain(DynamicObject module) {
private final RubyContext context;

public final ModuleChain start;
@CompilerDirectives.CompilationFinal
public ModuleChain parentModule;
@CompilationFinal public ModuleChain parentModule;

public final DynamicObject lexicalParent;
public final String givenBaseName;
@@ -134,7 +134,7 @@ public void updateAnonymousChildrenModules(RubyContext context) {
}
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void initCopy(DynamicObject from) {
assert RubyGuards.isRubyModule(from);

@@ -177,7 +177,7 @@ public void insertAfter(DynamicObject module) {
parentModule = new IncludedModule(module, parentModule);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void include(RubyContext context, Node currentNode, DynamicObject module) {
assert RubyGuards.isRubyModule(module);

@@ -237,7 +237,7 @@ public boolean isIncludedModuleBeforeSuperClass(DynamicObject module) {
return false;
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void prepend(RubyContext context, Node currentNode, DynamicObject module) {
assert RubyGuards.isRubyModule(module);

@@ -267,7 +267,7 @@ public void prepend(RubyContext context, Node currentNode, DynamicObject module)
/**
* Set the value of a constant, possibly redefining it.
*/
@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void setConstant(RubyContext context, Node currentNode, String name, Object value) {
if (context.getCoreLibrary().isLoadingRubyCore()) {
final RubyConstant currentConstant = constants.get(name);
@@ -284,7 +284,7 @@ public void setConstant(RubyContext context, Node currentNode, String name, Obje
}
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void setAutoloadConstant(RubyContext context, Node currentNode, String name, DynamicObject filename) {
assert RubyGuards.isRubyString(filename);
setConstantInternal(context, currentNode, name, filename, true);
@@ -303,22 +303,22 @@ public void setConstantInternal(RubyContext context, Node currentNode, String na
newLexicalVersion();
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public RubyConstant removeConstant(RubyContext context, Node currentNode, String name) {
checkFrozen(context, currentNode);
RubyConstant oldConstant = constants.remove(name);
newLexicalVersion();
return oldConstant;
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void setClassVariable(RubyContext context, Node currentNode, String variableName, Object value) {
checkFrozen(context, currentNode);

classVariables.put(variableName, value);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public Object removeClassVariable(RubyContext context, Node currentNode, String name) {
checkFrozen(context, currentNode);

@@ -330,7 +330,7 @@ public Object removeClassVariable(RubyContext context, Node currentNode, String
return found;
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void addMethod(RubyContext context, Node currentNode, InternalMethod method) {
assert ModuleOperations.canBindMethodTo(method.getDeclaringModule(), rubyModuleObject) ||
ModuleOperations.assignableTo(context.getCoreLibrary().getObjectClass(), method.getDeclaringModule());
@@ -352,13 +352,13 @@ public void addMethod(RubyContext context, Node currentNode, InternalMethod meth
}
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void removeMethod(String methodName) {
methods.remove(methodName);
newVersion();
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void undefMethod(RubyContext context, Node currentNode, String methodName) {
final InternalMethod method = ModuleOperations.lookupMethod(rubyModuleObject, methodName);
if (method == null) {
@@ -372,7 +372,7 @@ public void undefMethod(RubyContext context, Node currentNode, String methodName
* Also searches on Object for modules.
* Used for alias_method, visibility changes, etc.
*/
@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public InternalMethod deepMethodSearch(RubyContext context, String name) {
InternalMethod method = ModuleOperations.lookupMethod(rubyModuleObject, name);
if (method != null && !method.isUndefined()) {
@@ -391,7 +391,7 @@ public InternalMethod deepMethodSearch(RubyContext context, String name) {
return null;
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void alias(RubyContext context, Node currentNode, String newName, String oldName) {
InternalMethod method = deepMethodSearch(context, oldName);

@@ -409,7 +409,7 @@ public void alias(RubyContext context, Node currentNode, String newName, String
addMethod(context, currentNode, aliasMethod);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public void changeConstantVisibility(RubyContext context, Node currentNode, String name, boolean isPrivate) {
checkFrozen(context, currentNode);
RubyConstant rubyConstant = constants.get(name);
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ public static InternalMethod lookupSuperMethod(DynamicObject declaringModule, St
}
}
}
assert foundDeclaringModule : "Did not find the declaring module in "+ Layouts.MODULE.getFields(objectMetaClass).getName() +" ancestors";
assert foundDeclaringModule : "Did not find the declaring module in " + Layouts.MODULE.getFields(objectMetaClass).getName() + " ancestors";

return null;
}
32 changes: 16 additions & 16 deletions truffle/src/main/java/org/jruby/truffle/stdlib/BigDecimalNodes.java
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ public static RoundingMode toRoundingMode(int constValue) {
case 7:
return RoundingMode.HALF_EVEN;
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unknown value: " + constValue);
}
}

@@ -728,7 +728,7 @@ public Object negSpecial(VirtualFrame frame, DynamicObject value) {
case NAN:
return value;
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + value);
}
}

@@ -796,7 +796,7 @@ protected Object multSpecialNormal(VirtualFrame frame, DynamicObject a, DynamicO
return createBigDecimal(frame, Type.POSITIVE_INFINITY);
}
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch");
}
}

@@ -823,7 +823,7 @@ protected Object multSpecial(VirtualFrame frame, DynamicObject a, DynamicObject
return bType == Type.POSITIVE_INFINITY ? a : createBigDecimal(frame, (Type.POSITIVE_INFINITY));
}

throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch");
}
}

@@ -920,7 +920,7 @@ private Object divBigDecimalWithProfile(DynamicObject a, DynamicObject b, MathCo
case -1:
return Type.NEGATIVE_INFINITY;
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + aBigDecimal.signum());
}
} else {
return divBigDecimal(aBigDecimal, bBigDecimal, mathContext);
@@ -966,7 +966,7 @@ protected Object divNormalSpecial(VirtualFrame frame, DynamicObject a, DynamicOb
return createBigDecimal(frame, BigDecimal.ZERO);
}
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(b));
}
}

@@ -1000,7 +1000,7 @@ protected Object divSpecialNormal(VirtualFrame frame, DynamicObject a, DynamicOb
return createBigDecimal(frame, Type.POSITIVE_INFINITY);
}
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(a));
}
}

@@ -1294,7 +1294,7 @@ public Object divmodSpecial(VirtualFrame frame, DynamicObject a, DynamicObject b
return Layouts.ARRAY.createArray(coreLibrary().getArrayFactory(), store, store.length);
}

throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch");
}
}

@@ -1404,7 +1404,7 @@ public Object moduloSpecial(VirtualFrame frame, DynamicObject a, DynamicObject b
return createBigDecimal(frame, a);
}

throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch");
}
}

@@ -1482,7 +1482,7 @@ public Object power(VirtualFrame frame, DynamicObject a, int exponent, Object un
case NEGATIVE_ZERO:
return createBigDecimal(frame, Integer.signum(exponent) == 1 ? BigDecimal.ZERO : Type.NAN);
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(a));
}
}
}
@@ -1543,7 +1543,7 @@ public Object sqrtSpecial(VirtualFrame frame, DynamicObject a, int precision) {
case NEGATIVE_ZERO:
return createBigDecimal(frame, sqrt(BigDecimal.ZERO, new MathContext(precision, getRoundMode(frame))));
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(a));
}
}
}
@@ -1748,7 +1748,7 @@ public int signSpecial(VirtualFrame frame, DynamicObject value) {
case NAN:
return sign.executeGetIntegerConstant(frame, getBigDecimalClass(), "SIGN_NaN");
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(value));
}
}

@@ -1832,7 +1832,7 @@ public Object absSpecial(VirtualFrame frame, DynamicObject value) {
case NAN:
return createBigDecimal(frame, type);
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + type);
}
}

@@ -1905,7 +1905,7 @@ public Object roundSpecial(VirtualFrame frame, DynamicObject value, NotProvided
throw new RaiseException(coreLibrary().
floatDomainError("Computation results to 'NaN'(Not a Number)", this));
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(value));

}
}
@@ -2016,7 +2016,7 @@ public double toFSpecial(DynamicObject value) {
case NAN:
return Double.NaN;
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(value));
}
}

@@ -2080,7 +2080,7 @@ public int toISpecial(DynamicObject value) {
case NEGATIVE_ZERO:
return 0;
default:
throw new UnsupportedOperationException();
throw new UnsupportedOperationException("unreachable code branch for value: " + Layouts.BIG_DECIMAL.getType(value));
}
}
}