No commit activity in last 3 years
No release in over 3 years
A Gem for visualizing JRuby compiler artifacts
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 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

Either

  1. 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
  1. Execute the installed binary
$ jruby_visualizer foo.rb
  1. Use the visualizer as gem in your jruby code
#!/usr/bin/env jruby

require 'jruby_visualizer'

JRubyVisualizer::visualize('def bar; puts "spam HAM"; end; bar')