I started working on implementing an explicit call protocol last week. It required me to clean up a few other bits which I did over several commits since y'day.
I now committed a first cut at AddExplicitCallProtocolInstructions compiler pass. I tested this with the interpreter and it seeks to run fine. There may be bugs in corner cases ... but I haven't run into it running rubyspecs, gem list, and irb. To take full advantage of this, you need to run the following 2 passes: AddLocalVarLoadStoreInstructions, AddExplicitCallProtocolInstructions, and implement compiler code for PushBinding, PopBinding, LoadLocalVar and StoreLocalVar instructions. Ex: jruby -X-CIR -Xir.passes=OptimizeTempVarsPass,LocalOptimizationPass,DeadCodeElimination,AddLocalVarLoadStoreInstructions,AddCallProtocolInstructions,LinearizeCFG bench/bench_fib_recursive.rb Subbu. PS: There is one private patch for operands/TemporaryVariable that I have not yet committed -- this has got to do with handling use-before-defs in Ruby. This is normally not required for tmps but with explicit load/store of local-vars, this becomes necessary since all local vars are now pushed into temp vars (and java local vars in the compiler). This patch is required for gem list and for getting "green" on rubyspecs, for ex. This only affects the interpreter, not the compiler since I presume you have this logic there anyway. The patch is trivial (enclosed below) @Override public Object retrieve(ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) { - return temp[offset]; + Object o = temp[offset]; + return o == null ? context.nil : o; } I have not committed this because I was hoping that we could find a way to eliminate this (both here and in DynamicScope.java:getValueOrNil ) by canonicalizing the instr stream to eliminate use-before-defs in ruby code -- I dont yet have a cheap fix for it, so haven't implemented yet, but maybe I should just commit this patch and forget about it for now.