pnkfelix / larceny-test

test import of trac db
Other
2 stars 0 forks source link

investigate DynamicMethod class for CommonLarceny CompileOnEval #481

Open larceny-trac-import opened 11 years ago

larceny-trac-import commented 11 years ago

_Reported by: pnkfelix on Tue Oct 23 12:11:20 2007 _ From an email exchange in early May:

On May 2, 2007, at 4:34 PM, William D Clinger wrote: http://blogs.msdn.com/hugunin/

Describes "Dynamic Languages on .NET - IronPython and Beyond".

Of particular interest to me is a much older entry, from November 2005. http://blogs.msdn.com/hugunin/archive/2005/11/18/494519.aspx

It mentions System.Reflection.Emit.DynamicMethod. I've never heard of this class. At the time I was developing il-corememory.sch (summer 2005), I was (probably) trying to support CLR 1.1, which did not have this class. I wish I had paid more attention to what was available in CLR 2.0.

Why is this class important?

  1. Jim Hugunin claims that it allows for "cheap generation of code on the fly"
  2. Another claim: "most importantly the code it generates doesn't need to live for the full life of the application but can be reclaimed when there are no more references."

Assuming item 2 is true, that means that we could adopt CompileOnEval for the CLR, rather than CompileOnLoad. Plus loading the same file over and over would become safe-for-space.

Jesse: I think this should be your first area of attack for making things faster on .NET. You should investigate what the API of System.Reflection.Emit.DynamicMethod is, and see how hard it would be to adapt src/Asm/IL/il-corememory.sch to use it (or replace il-corememory.sch with something simpler that uses it, if you like).

larceny-trac-import commented 11 years ago

Author: pnkfelix See LightweightCodeGen

See also [source:trunk/larceny_src/src/Asm/IL-LCG Asm/IL-LCG], which started with changeset:5495 (last known development was in changeset:5526).