JRuby Power on the JVM
Ola Bini JRuby Core Developer ThoughtWorks
JRuby Power on the JVM Ola Bini JRuby Core Developer ThoughtWorks - - PowerPoint PPT Presentation
JRuby Power on the JVM Ola Bini JRuby Core Developer ThoughtWorks Vanity slide Ola Bini From Stockholm, Sweden Programming language nerd (Lisp, Ruby, Java, Smalltalk, Io, Erlang, ML, C/C++, etc) JRuby Core Developer (2
JRuby Power on the JVM
Ola Bini JRuby Core Developer ThoughtWorks
Vanity slide
Erlang, ML, C/C++, etc)
Agenda
What is JRuby
Community
Ruby Issues - Threading
Ruby Issues - Unicode
Ruby Issues - Performance
Ruby Issues - Memory
Ruby Issues - C
Ruby Issues - Politics
C libraries
Getting started
Calling Ruby from Java
ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("jruby"); // Evaluate JRuby code from string. try { engine.eval("puts('Hello')"); } catch (ScriptException exception) { exception.printStackTrace(); }
DEMO Java Integration
Implementation: Lexing, parsing
YACC/Bison-based parser
Implementation: Core classes
Implementation: Interpreter
Implementation: Compilation
DEMO Precompilation
Compiler problems
Compiler optimizations
Core class implementations
Threading
POSIX
Java Integration
Performance
DEMO Benchmarks
JRuby Internals
JRuby::ast_for { 1+1 } #-> Java AST JRuby::compile(“1+1”) #-> CompiledScript CompiledScript.inspect_bytecode JRuby::runtime JRuby::reference(“str”)
... evil stuff
a.freeze JRuby::reference(a).setFrozen(false)
something = Object.new JRuby::reference(something).setMetaClass(Foobar)
JRuby::reference(Foobar).getMethods()
JRuby on Rails - end to end
JtestR
Rubiq
example)
ActiveHibernate
Ruvlets
Bare bones Ruvlet
def service(context, request, response) response.content_type = "text/html" response.writer << <<-EOF <html> <head><title>Hello World!</title></head> <body>Hello World!</body> </html> EOF end end HelloWorld.new
YARV & Rubinius machine
JSR292, JLR & DaVinci
JRuby’s future
Resources