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

Commits on Aug 5, 2016

  1. Copy the full SHA
    7ba8959 View commit details
  2. Copy the full SHA
    e5cf5a8 View commit details
  3. Copy the full SHA
    bb8f30b View commit details
  4. Copy the full SHA
    780274f View commit details
  5. Copy the full SHA
    1563b71 View commit details
  6. Copy the full SHA
    248d553 View commit details
  7. [Truffle] Mx: have the same switch as GraalVM to show the command.

    * Avoids not overloading -d.
    eregon committed Aug 5, 2016
    Copy the full SHA
    b200f02 View commit details
Showing with 40 additions and 22 deletions.
  1. +13 −5 mx.jruby/mx_jruby.py
  2. +18 −7 tool/jruby_mx
  3. +9 −10 tool/jt.rb
18 changes: 13 additions & 5 deletions mx.jruby/mx_jruby.py
Original file line number Diff line number Diff line change
@@ -193,14 +193,18 @@ def clean(self, forBuild=False):
def extractArguments(args):
vmArgs = []
rubyArgs = []
for i in range(len(args)):
arg = args[i]
if arg.startswith('-J-'):
while args:
arg = args.pop(0)
if arg == '-J-cp' or arg == '-J-classpath':
vmArgs.append(arg[2:])
vmArgs.append(args.pop(0))
elif arg.startswith('-J-'):
vmArgs.append(arg[2:])
elif arg.startswith('-X'):
vmArgs.append('-Djruby.' + arg[2:])
else:
rubyArgs.extend(args[i:])
rubyArgs.append(arg)
rubyArgs.extend(args)
break
return vmArgs, rubyArgs

@@ -229,7 +233,11 @@ def setup_jruby_home():
def ruby_command(args):
"""runs Ruby"""
vmArgs, rubyArgs = extractArguments(args)
vmArgs += ['-cp', mx.classpath(['TRUFFLE_API', 'RUBY'])]
classpath = mx.classpath(['TRUFFLE_API', 'RUBY']).split(':')
truffle_api, classpath = classpath[0], classpath[1:]
assert os.path.basename(truffle_api) == "truffle-api.jar"
vmArgs += ['-Xbootclasspath/p:' + truffle_api]
vmArgs += ['-cp', ':'.join(classpath)]
vmArgs += ['org.jruby.Main', '-X+T']
env = setup_jruby_home()
mx.run_java(vmArgs + rubyArgs, env=env)
25 changes: 18 additions & 7 deletions tool/jruby_mx
Original file line number Diff line number Diff line change
@@ -7,32 +7,43 @@ GRAAL_OPTIONS_PREFIX = "graal."
java = ENV["JAVACMD"] || "java"

java_flags = []
rest = []
ruby_flags = []

# Translate shortcuts like -J-G: and -Xtruffle.
print_command = false

# Separate java and ruby flags from JRUBY_OPTS and ARGV.
# Also translate shortcuts like -J-G:, -J and -Xtruffle.
parse_options = lambda do |args|
until args.empty?
case arg = args.shift
when "-X+T"
# Just drop it
when "-X-T"
abort "Can only run JRuby+Truffle with mx"
when "-J-cmd"
print_command = true
when /^-J-G:\+/
java_flags << "-J-D#{GRAAL_OPTIONS_PREFIX}#{$'}=true"
when /^-J-G:-/
java_flags << "-J-D#{GRAAL_OPTIONS_PREFIX}#{$'}=false"
when /^-J-G:/
java_flags << "-J-D#{GRAAL_OPTIONS_PREFIX}#{$'}"
when /^-J-(cp|classpath)$/
java_flags << arg << args.shift
when /^-J/
java_flags << arg
when /^-Xtruffle\./
java_flags << "-J-Djruby.#{arg[2..-1]}"
else
rest << arg
else # Not a VM argument, leave untouched
ruby_flags << arg
break
end
end
ruby_flags += args
end

parse_options.call(ARGV)
parse_options.call(ENV["JRUBY_OPTS"].to_s.split(' '))
parse_options.call(ARGV)

args = ["mx"]
unless java == "java"
@@ -42,9 +53,9 @@ end
args << "ruby"
args << "-J-Xss2048k"
args += java_flags
args += rest
args += ruby_flags

if args.include?('-d')
if print_command
args.insert(1, '-v')
puts "$ " + args.join(' ')
end
19 changes: 9 additions & 10 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -160,6 +160,11 @@ def self.find_jruby
end

def self.find_jruby_bin_dir
# Make sure bin/ruby points to the right launcher
ruby_symlink = "#{JRUBY_DIR}/bin/ruby"
FileUtils.rm_f ruby_symlink
File.symlink Utilities.find_jruby, ruby_symlink

if jruby_eclipse? or mx?
JRUBY_DIR + "/bin"
else
@@ -1026,11 +1031,8 @@ def metrics_alloc(*args)
samples = []
METRICS_REPS.times do
Utilities.log '.', "sampling\n"
r, w = IO.pipe
run '-Xtruffle.metrics.memory_used_on_exit=true', '-J-verbose:gc', *args, {err: w, out: w, no_print_cmd: true}
w.close
samples.push memory_allocated(r.read)
r.close
out, _ = run '-Xtruffle.metrics.memory_used_on_exit=true', '-J-verbose:gc', *args, {capture: true, no_print_cmd: true}
samples.push memory_allocated(out)
end
Utilities.log "\n", nil
range = samples.max - samples.min
@@ -1111,13 +1113,10 @@ def metrics_time(*args)
samples = []
METRICS_REPS.times do
Utilities.log '.', "sampling\n"
r, w = IO.pipe
start = Time.now
run '-Xtruffle.metrics.time=true', *args, {err: w, out: w, no_print_cmd: true}
out, _ = run '-Xtruffle.metrics.time=true', *args, {capture: true, no_print_cmd: true}
finish = Time.now
w.close
samples.push get_times(r.read, finish - start)
r.close
samples.push get_times(out, finish - start)
end
Utilities.log "\n", nil
results = {}