Charlie,
I tested out the patch, but got a CCE and a NPE, which I have listed
below:
Peter
java.lang.ClassNotFoundException: utf8proc_native
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:298)
at org.jruby.runtime.load.LoadService.require(LoadService.java:349)
at org.jruby.RubyKernel.require(RubyKernel.java:770)
at org.jruby.RubyKernelInvoker$require_s_method_1_0.call(Unknown Source)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:259)
at
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:60)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:245)
at org.jruby.ast.FCallNode.interpret(FCallNode.java:153)
<snip>
java.lang.NullPointerException
at org.jruby.ast.CaseNode.interpret(CaseNode.java:158)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:98)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:66)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:82)
at
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:267)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:316)
at org.jruby.ast.FCallNode.interpret(FCallNode.java:135)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:98)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:66)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:82)
at
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:267)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:316)
<snip>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Oliver
Nutter
Sent: Tuesday, May 13, 2008 4:57 AM
To: [email protected]
Subject: [jruby-dev] New interpreter
Man, I don't know why I start into these things in the middle of the night.
I refactored the interpreter to be a pure tree-walker. Each Node now has an
"interpret" method, which means no double-dispatching visitors, no giant
switch...just polymorphic dispatch from one node to the next. This does a
couple things:
- halves the size of interpreted stack traces in the interpreter (since
evalInternal is now gone)
- eliminates the suspected overhead of the big switch
- makes interpreted mode execution faster than Ruby 1.8.6 in every benchmark
I've tried, and as much as 25-50% faster than the previous interpreter.
But it's not complete, and I could use some help completing it.
- Because it walks the tree directly, null nodes are VERY BAD. I've started in
a few nodes to replace them with a default singleton NilNode, but I don't know
how that will affect IDEs using the AST nor whether it's entirely kosher. But I
think it's worth eliminating the terminal nulls finally, since it means we
never have to null check anywhere in the tree-walk.
- I had to disable the RewriterVisitor tests in MainTestSuite since they depend
on certain sequences of nodes terminating in nulls. Obviously these would
probably need to be fixed.
- I had to disable testPositions in test_index because it failed wherever it
expected terminal nulls to produce specific output.
- The provided patch has some extra logging on in LoadService that will need to
be removed later. You'll get some stack traces during the early phases of
testing that can be ignored...they're expected failovers in some bogus file
loading tests.
I'm attaching the patch containing the current work, which I have committed to
a local branch. I think it's worth getting it 100% for 1.1.2, since it means
that even if not compiled, we execute code much faster than Ruby 1.8.6.
- Charlie