Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into truffle-head
Browse files Browse the repository at this point in the history
Conflicts:
	truffle/src/main/java/org/jruby/truffle/runtime/RubyArguments.java
  • Loading branch information
eregon committed Mar 19, 2015
2 parents c00ff32 + fbf9427 commit 8ccb1f1
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 31 deletions.
15 changes: 15 additions & 0 deletions test/mri/excludes/TestM17NComb.rb
@@ -1,4 +1,19 @@
exclude :test_str_assign, "needs investigation"
exclude :test_str_assign_len, "needs investigation"
exclude :test_str_casecmp, "needs investigation"
exclude :test_str_chop, "needs investigation"
exclude :test_str_count, "needs investigation"
exclude :test_str_crypt, "needs investigation"
exclude :test_str_each_line, "needs investigation"
exclude :test_str_include?, "needs investigation"
exclude :test_str_intern, "needs investigation"
exclude :test_str_rindex, "needs investigation"
exclude :test_str_rpartition, "needs investigation"
exclude :test_str_scan, "needs investigation"
exclude :test_str_split, "needs investigation"
exclude :test_str_squeeze, "needs investigation"
exclude :test_str_sub, "needs investigation"
exclude :test_str_sub!, "needs investigation"
exclude :test_str_succ, "appears to run forever"
exclude :test_tr_s, "needs investigation"
exclude :test_tr_sjis, "needs investigation"
60 changes: 38 additions & 22 deletions tool/jt.rb
Expand Up @@ -9,7 +9,7 @@

# A workflow tool for JRuby+Truffle development

# Recommended: function jt { ruby PATH/TO/jruby/tool/jt.rb $@; }
# Recommended: function jt { ruby tool/jt.rb $@; }

require 'fileutils'
require 'digest/sha1'
Expand All @@ -18,21 +18,44 @@

module Utilities

def self.graal_version
File.foreach("#{JRUBY_DIR}/truffle/pom.rb").each do |line|
if /jar 'com.oracle:truffle:(\d+\.\d+(?:-SNAPSHOT)?)'/ =~ line
break $1
end
end
end

def self.find_graal
base_graal_path = if graal_version.include?('SNAPSHOT')
'basic-graal/jdk1.8.0_05/product'
else
'graalvm-jdk1.8.0'
end

graal_locations = [
ENV["GRAAL_BIN_#{mangle_for_env(git_branch)}"],
ENV['GRAAL_BIN'],
"#{base_graal_path}/bin/java",
"../#{base_graal_path}/bin/java",
"../../#{base_graal_path}/bin/java",
].compact.map { |path| File.expand_path(path, JRUBY_DIR) }

not_found = -> {
raise "couldn't find graal - download it from http://lafo.ssw.uni-linz.ac.at/graalvm/ and extract it into the JRuby repository or parent directory"
}
GRAAL_LOCATIONS.find(not_found) do |location|

graal_locations.find(not_found) do |location|
File.executable?(location)
end
end

def self.branch
`git rev-parse --abbrev-ref HEAD`.strip
def self.git_branch
@git_branch ||= `git rev-parse --abbrev-ref HEAD`.strip
end

def self.mangle_for_env(name)
name.upcase.gsub('-', '_')
name.upcase.tr('-', '_')
end

def self.find_graal_mx
Expand Down Expand Up @@ -63,10 +86,17 @@ def self.ensure_igv_running
end

def self.find_bench
bench_locations = [
ENV['BENCH_DIR'],
'bench9000',
'../bench9000'
].compact.map { |path| File.expand_path(path, JRUBY_DIR) }

not_found = -> {
raise "couldn't find bench9000 - clone it from https://github.com/jruby/bench9000.git into the JRuby repository or parent directory"
}
BENCH_LOCATIONS.find(not_found) do |location|

bench_locations.find(not_found) do |location|
Dir.exist?(location)
end
end
Expand All @@ -75,20 +105,6 @@ def self.jruby_version
File.read("#{JRUBY_DIR}/VERSION").strip
end

GRAAL_LOCATIONS = [
ENV["GRAAL_BIN_#{mangle_for_env(branch)}"],
ENV['GRAAL_BIN'],
'graalvm-jdk1.8.0/bin/java',
'../graalvm-jdk1.8.0/bin/java',
'../../graal/graalvm-jdk1.8.0/bin/java'
].compact.map { |path| File.expand_path(path, JRUBY_DIR) }

BENCH_LOCATIONS = [
ENV['BENCH_DIR'],
'bench9000',
'../bench9000'
].compact.map { |path| File.expand_path(path, JRUBY_DIR) }

end

module ShellUtils
Expand Down Expand Up @@ -159,7 +175,7 @@ def help
puts 'recognised environment variables:'
puts
puts ' GRAAL_BIN GraalVM executable (java command) to use'
puts ' GRAAL_BIN_...branch_name... GraalVM executable to use for a given branch'
puts ' GRAAL_BIN_...git_branch_name... GraalVM executable to use for a given branch'
puts ' branch names are mangled - eg truffle-head becomes GRAAL_BIN_TRUFFLE_HEAD'
end

Expand Down Expand Up @@ -209,7 +225,7 @@ def run(*args)
end

if args.delete('--igv')
raise "--igv doesn't work on master - you need a branch that builds against latest graal" if Utilities.branch == 'master'
raise "--igv doesn't work on master - you need a branch that builds against latest graal" if Utilities.git_branch == 'master'
Utilities.ensure_igv_running
jruby_args += %w[-J-G:Dump=TrufflePartialEscape]
end
Expand Down
Expand Up @@ -34,7 +34,7 @@ public Object execute(VirtualFrame frame) {
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return toEnumNode.call(frame, RubyArguments.getSelf(frame.getArguments()), "to_enum", null, unshift(getContext().getSymbolTable().getSymbol(methodName), RubyArguments.extractUserArguments(frame.getArguments())));
return toEnumNode.call(frame, RubyArguments.getSelf(frame.getArguments()), "to_enum", null, RubyArguments.extractUserArgumentsWithUnshift(getContext().getSymbolTable().getSymbol(methodName), frame.getArguments()));

} else {

Expand All @@ -43,12 +43,4 @@ public Object execute(VirtualFrame frame) {
}
}

private static <T> T[] unshift(T first, T[] array) {
final int length = array.length;
final T[] result = Arrays.copyOf(array, length + 1);
System.arraycopy(array, 0, result, 1, length);
result[0] = first;
return result;
}

}
Expand Up @@ -57,6 +57,12 @@ public static Object[] extractUserArguments(Object[] arguments) {
return ArrayUtils.extractRange(arguments, RUNTIME_ARGUMENT_COUNT, arguments.length);
}

public static Object[] extractUserArgumentsWithUnshift(Object first, Object[] arguments) {
final Object[] range = ArrayUtils.extractRange(arguments, BLOCK_INDEX, arguments.length);
range[0] = first;
return range;
}

public static int getUserArgumentsCount(Object[] internalArguments) {
return internalArguments.length - RUNTIME_ARGUMENT_COUNT;
}
Expand Down

0 comments on commit 8ccb1f1

Please sign in to comment.