Skip to content

Commit

Permalink
[Truffle] Update jt --igv - seemed to have become bit-rotted to some …
Browse files Browse the repository at this point in the history
…extent.
chrisseaton committed Apr 17, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 44ffdab commit 97562a5
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -104,40 +104,50 @@ def self.git_branch
def self.mangle_for_env(name)
name.upcase.tr('-', '_')
end

def self.find_jvmci
jvmci_locations = [
ENV['JVMCI_DIR'],
ENV["JVMCI_DIR#{mangle_for_env(git_branch)}"]
].compact.map { |path| File.expand_path(path, JRUBY_DIR) }

def self.find_graal_parent
graal = File.expand_path('../../../../../graal-compiler', find_graal)
raise "couldn't find graal - set GRAAL_BIN, and you need to use a checkout of Graal, not a build" unless Dir.exist?(graal)
graal
end
not_found = -> {
raise "couldn't find JVMCI"
}

def self.find_graal_mx
mx = File.expand_path('../../../../../../mx/mx', find_graal)
raise "couldn't find mx - set GRAAL_BIN, and you need to use a checkout of Graal, not a build" unless File.executable?(mx)
mx
jvmci_locations.find(not_found) do |location|
Dir.exist?(location)
end
end

def self.igv_running?
`ps ax`.include? 'IdealGraphVisualizer'
`ps ax`.include?('IdealGraphVisualizer')
end

def self.ensure_igv_running
unless igv_running?
Dir.chdir(find_graal_parent + "/../jvmci") do
spawn "#{find_graal_mx} --vm server igv", pgroup: true
Dir.chdir(find_jvmci) do
spawn 'mx --vm server igv', pgroup: true
end

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

sleep 3

until igv_running?
puts 'still waiting for IGV to appear in ps ax...'
sleep 3
end

puts 'just a few more seconds...'
sleep 6
end
end

@@ -305,6 +315,8 @@ def help
puts ' GRAAL_BIN GraalVM executable (java command) to use'
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'
puts ' JVMCI_DIR JMVCI repository checkout to use when running IGV (mx must already be on the $PATH)'
puts ' JVMCI_DIR_...git_branch_name... JMVCI repository to use for a given branch'
puts ' GRAAL_JS_JAR The location of trufflejs.jar'
end

4 comments on commit 97562a5

@chrisseaton
Copy link
Contributor Author

@chrisseaton chrisseaton commented on 97562a5 Apr 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jruby/truffle was anyone else using --igv? It seemed to have become broken. This makes it more robust I think.

@nirvdrum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it all the time. But I've just taken to starting IGV manually from the graal checkout. I think a lot of this checking can be done more simply. Does anyone run mx from somewhere not on the PATH for instance?

Sorry, something went wrong.

@chrisseaton
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that's part of what I've simplified - mx must already be on the $PATH. All we need to find is jvmci, and it needs to be a separate environment variable as I usually use a binary of GraalVM for master, but I want the source build when I want IGV.

Sorry, something went wrong.

@nirvdrum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I should've read the diff rather than just answered the question :-) It looks good to me.

Please sign in to comment.