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

Commits on Mar 19, 2015

  1. 1
    Copy the full SHA
    7881f7c View commit details
  2. 2
    Copy the full SHA
    2bc8f5c View commit details
Showing with 63 additions and 14 deletions.
  1. +63 −14 tool/jt.rb
77 changes: 63 additions & 14 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -18,19 +18,6 @@

module Utilities

GRAAL_LOCATIONS = [
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) }

def self.find_graal
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"
@@ -40,6 +27,41 @@ def self.find_graal
end
end

def self.branch
`git rev-parse --abbrev-ref HEAD`.strip
end

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

def self.find_graal_mx
mx = File.expand_path('../../../../mx.sh', '../../graal/basic-graal/jdk1.8.0_31/product/bin/java')
raise "couldn't find mx.sh - set GRAAL_BIN, and are need to use a checkout of Graal, not a build" unless File.executable?(mx)
mx
end

def self.igv_running?
`ps`.lines.any? { |p| p.include? 'mxtool/mx.py igv' }
end

def self.ensure_igv_running
unless igv_running?
spawn "#{find_graal_mx} igv"
sleep 5
puts
puts
puts "-------------"
puts "Waiting for IGV start"
puts "The first time you run IGV it may take several minutes to download dependencies and compile"
puts "Press enter when you see the IGV window"
puts "-------------"
puts
puts
$stdin.gets
end
end

def self.find_bench
not_found = -> {
raise "couldn't find bench9000 - clone it from https://github.com/jruby/bench9000.git into the JRuby repository or parent directory"
@@ -53,6 +75,20 @@ 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
@@ -98,6 +134,7 @@ def help
puts ' --graal use Graal (set GRAAL_BIN or it will try to automagically find it)'
puts ' --asm show assembly (implies --graal)'
puts ' --server run an instrumentation server on port 8080'
puts ' --igv make sure IGV is running and dump Graal graphs after partial escape (implies --graal)'
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'
@@ -118,6 +155,12 @@ def help
puts 'jt install ..../graal/mx/suite.py install a JRuby distribution into an mx suite'
puts
puts 'you can also put build or rebuild in front of any command'
puts
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 ' branch names are mangled - eg truffle-head becomes GRAAL_BIN_TRUFFLE_HEAD'
end

def build(project = nil)
@@ -144,7 +187,7 @@ def run(*args)
env_vars = {}
jruby_args = %w[-X+T]

{ '--asm' => '--graal' }.each_pair do |arg, dep|
{ '--asm' => '--graal', '--igv' => '--graal' }.each_pair do |arg, dep|
args.unshift dep if args.include?(arg)
end

@@ -165,6 +208,12 @@ def run(*args)
jruby_args += %w[-Xtruffle.instrumentation_server_port=8080 -Xtruffle.passalot=1]
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'
Utilities.ensure_igv_running
jruby_args += %w[-J-G:Dump=TrufflePartialEscape]
end

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