Details
Description
This will obviously affect performance of ruby_parser quite a bit:
~/NetBeansProjects/jruby ➔ jruby -J-Djruby.jit.logging.verbose=true -X+C --server -rubygems -rbenchmark -e "gem :ruby_parser; require 'ruby_parser'; 5.times {puts Benchmark.measure {RubyParser.new.parse(File.read('lib/ruby/1.8/rdoc/parsers/parse_rb.rb'))}}"
could not compile: /Users/headius/NetBeansProjects/jruby/lib/ruby/gems/1.8/gems/ruby_parser-1.0.0/lib/ruby_parser.rb because of: "Invalid method Code length 82165 in class file ruby/Users/headius/NetBeansProjects/jruby/lib/ruby/gems/$1_dot_8/gems/ruby_parser_minus_1_dot_0_dot_0/lib/ruby_parser"
java.lang.ClassFormatError: Invalid method Code length 82165 in class file ruby/Users/headius/NetBeansProjects/jruby/lib/ruby/gems/$1_dot_8/gems/ruby_parser_minus_1_dot_0_dot_0/lib/ruby_parser
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at org.jruby.util.JRubyClassLoader.defineClass(JRubyClassLoader.java:21)
at org.jruby.compiler.impl.StandardASMCompiler.loadClass(StandardASMCompiler.java:159)
at org.jruby.Ruby.tryCompile(Ruby.java:464)
at org.jruby.Ruby.compileAndLoadFile(Ruby.java:2041)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:56)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320)
at org.jruby.runtime.load.LoadService.require(LoadService.java:346)
at org.jruby.RubyKernel.require(RubyKernel.java:769)
Issue Links
- is depended upon by
-
JRUBY-4757
addressable gem doesn't work with --fast
-
I discovered what the problem was with ruby_parser...it's the main script. It initializes a number of seriously gigantic arrays for the Ruby parser productions. I think there are several of these arrays that would fail to compile individually, much less all of them as the body of a method. And because they're gigantic, they can't easily be split into multiple methods.
This should generally affect only +C compilation since it's in the root of the script. But it's something to look out for in the future. I'll leave this open to try to explore any way possible to compile this script. Toughy though.