On 04/02/2009 10:44 PM, Jon Harrop wrote:
> When Java calls back into Kawa, where does Kawa get the current CallContext
> from when it has not been passed in as the first argument?
The CallContext is a per-thread structure, stored in a ThreadLocal.
Passing the CallContext from caller to callee in a synthetic parameter
can be thought of as an optimization compared to always using
a ThreadLocal.
One might think of the CallContext structure as a set of "virtual
hardware registers". Obviously, there is some flexibility in
designing a calling convention when you can pick the "register
set" that gives best performance. I don't pretend to have done
a particularly good job in that design - but it works, and the
overhead is tolerable.
I think most people who use Kawa are more interested in the
Java interoperability and/or performance, and so my guess is
the CallContext-based calling convention isn't used as much.
But I don't know. Qexo, the Kawa implementation of the
XQuery language does use the CallContext-based calling convention
by default. One reason is that XQuery is all about returning
sequences of values, which can be implemented efficiently
using a SAX-like "push target" - which is also an implicit
parameter, stored in the CallContext.
--
--Per Bothner
[email protected] http://per.bothner.com/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---