https://github.com/jruby/jruby-visualizer
Visualize JRuby's runtime in action
https://github.com/jruby/jruby-visualizer
Last synced: 2 months ago
JSON representation
Visualize JRuby's runtime in action
- Host: GitHub
- URL: https://github.com/jruby/jruby-visualizer
- Owner: jruby
- License: apache-2.0
- Created: 2013-07-11T19:31:34.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2019-07-15T16:23:01.000Z (almost 6 years ago)
- Last Synced: 2025-03-28T16:51:19.828Z (3 months ago)
- Language: Ruby
- Homepage: http://www.jruby.org/
- Size: 205 KB
- Stars: 5
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jruby-visualizer
The ```jruby_visualizer``` gem takes as input Ruby code and visualizes artifacts of JRuby's compiler/interpreter tool chain.
This includes
* the Abstract Syntax Tree (AST)
* the Intermediate Representation (IR)
* the execution of compiler passes on IR
* a visualization for the Control Flow Graphs (CFGs) on JRuby Scopes# Installation
You can install this visualizer as gem into your jruby environment:1. Clone the repository ```$ git clone https://github.com/jruby/jruby-visualizer.git```
2. Build the gem ```$ rake build```
3. Install the gem ```$ jruby -S gem install --local pkg/jruby_visualizer-0.1.gem```# Usage
Either1. call into the library
```
$ ./lib/jruby_visualizer.rb
RuntimeError: No ruby input for the JRuby Visualizer
Usage:
./lib/jruby_visualizer.rb "def foo; 42; end; foo"
or
./lib/jruby_visualizer.rb foo.rb
(root) at ./lib/jruby_visualizer.rb:15
```
This is also possible with the following command, to visualize ```foo.rb```:```
$ jruby -Ilib ./bin/jruby_visualizer foo.rb
```2. Execute the installed binary
```
$ jruby_visualizer foo.rb
```3. Use the visualizer as gem in your jruby code
```ruby
#!/usr/bin/env jrubyrequire 'jruby_visualizer'
JRubyVisualizer::visualize('def bar; puts "spam HAM"; end; bar')
```