On 12/04/2010 10:58 AM, Charles Oliver Nutter wrote:
On Fri, Dec 3, 2010 at 12:21 PM, John Rose<[email protected]> wrote:
If you are able to prove (in the JRuby compiler and runtime) that 'p' does
not escape the 'each' call, you can pass a static code pointer for 'p' and
handle the data link ('i' or a frame containing 'i') via another means. The
simplest means is defining another entry point to 'each', invisible to the
user, which takes the closure "on the stack" broken into components.
Breaking the static code pointer and data link is the same as manual
scalarization of any other immutable structure. Compare:
Another clarification...
I think what you're suggestion in your original "scalarization"
suggestion is that we pass along a separate structure that holds the
closure state but does not insert it into a globally-visible object
structure, yes? Currently JRuby does push closure scope onto a
globally-visible stack (that's only ever used from a single thread),
so it immediately escapes. To further complicate matters, "each" will
never inline any closure since that closure invocation is almost
certainly going to be polymorphic. That would need to be addressed as
well, wouldn't it?
My current plan for the latter case is to have the compile emit a
specialized "each" that we dispatch to rather than the canonical,
global "each". The code would be identical, but since it would be
specialized to this call site and this call site alone, it and the
block passed to it should inline correctly. Once we eliminate the push
to a global stack, EA then becomes possible.
Am I understanding your suggestion?
- Charlie
This is equivalent to implement your own EA + inlining
in your runtime instead of relying on the EA done by hotspot.
Rémi
--
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en.