[Ironruby-core] Code Review: LightBinding5

Tomas Matousek Tomas.Matousek at microsoft.com
Tue Jan 12 23:12:05 EST 2010

tfpt review "/shelveset:LightBinding5;REDMOND\tomat"

The changeset focuses on reducing time spent in JIT to compile generic instantiations of various helper methods. These are mostly related to generic instructions that implement dynamic sites and method calls. It reduces the number of methods jitted during startup time of irb from 481 to 80 (with -X:CompilationThreshold 10000000), which translates to 34% time reduction:

rbr -X:CompilationThreshold 10000000 i.rb < exit.txt

s = Time.now
require 'irb'
t = Time.now
p t - s

Before: 0.961096 seconds
After: 0.631063 seconds


Adds LightDynamicExpression - these reducible nodes reduce to strongly typed DynamicExpressions yet when interpreted use untyped dynamic sites (sites typed to CallSite<Func<CallSite, object*>>). Using light sites avoids jitting generic instantiations of various instructions, stubs and helpers that are strongly typed to the call-site signature. Also, strongly typed delegate types are created only when compiling the sites.

Adds helpers to CallInstruction that add MethodInfo to CallInstruction mapping into the internal cache. These helpers can be used by reflection caches that look up CLR helper methods. For example, Ruby's ReflectionCache holds on MethodInfos for all RubyOps. Whenever a helper MethodInfo is needed a delegate is created for it and cached into CallInstruction's cache along with the instruction that dispatches to it. Since all static helpers are known upfront the delegates and the corresponding instructions can all be ngen'd.

Moves helpers for rule interpretation from Ruby to DynamicUtils.

Replaces LazyDynamicExpressions with subclasses of LightDynamicExpressions.

Simplifies rules interpretation, moves related helpers to DLR.
Uses LightDynamicExpression for all dynamic sites.
Uses CallInstruction caching for RubyOps.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100113/e771146c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LightBinding5.diff
Type: application/octet-stream
Size: 287931 bytes
Desc: LightBinding5.diff
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100113/e771146c/attachment-0001.obj>

More information about the Ironruby-core mailing list