[Ironruby-core] Code Review: LightBinding5

Jim Deville jdeville at microsoft.com
Wed Jan 13 13:54:43 EST 2010

Tests look good.


From: Dino Viehland
Sent: Wednesday, January 13, 2010 10:46 AM
To: Tomas Matousek; IronRuby External Code Reviewers; Rowan Code Reviewers
Cc: ironruby-core at rubyforge.org
Subject: RE: Code Review: LightBinding5

One nitpick: The usings in the namespace in DynamicUtils.cs are misformatted.

Otherwise looks great!

From: Tomas Matousek
Sent: Tuesday, January 12, 2010 8:12 PM
To: IronRuby External Code Reviewers; Rowan Code Reviewers
Cc: ironruby-core at rubyforge.org
Subject: Code Review: LightBinding5

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/da180d24/attachment-0001.html>

More information about the Ironruby-core mailing list