On Sep 10, 2008, at 1:32 PM, Charles Oliver Nutter wrote:

> I would picture the flyby more like...
>
> public static void myConvertArgs(Object[] args) {
>    for each arg do conversion and reinsert into array
> }
>
> And in bootstrap:
>
> MethodHandle incomingHandle = (handle based on call site);
> MethodHandle flyby = MethodHandle.findStatic(This.class,
> "myConvertArgs", ...);
> MethodHandle adapter = MethodHandlers.adaptArguments 
> (incomingHandle, flyby);
>
> Where the adapter would simply invoke the flyby on the arguments  
> before
> passing them along. Because method handles are not methods but  
> pointers
> to methods (potentially curried) there should be no frames introduced;
> each handle added to the adapter has a specific job to do, with the
> eventual result being that the arguments are ready for the target  
> call.

Yes, that's it.  One tweak is that the reified argument list is more  
opaque, something like a combo of List<Object>, List<long> (sic), and  
List<int>, with direct pointer-safe r/w access to the stacked  
arguments.  Requires a new stack frame type in the JVM to hold the  
original arglist steady under GC, while it's reified, as described by  
a MethodType.  Not difficult, just fiddly in a lot of places.

(Someone will ask about dangling pointers into the stack.  Answer:   
The ArgumentList object points indirectly to the stack, and try/ 
finally zeroes the link, so that out-of-scope uses get a safe NPE.   
Cf. the treatment of out-of-scope continuations in Common Lisp or  
Smalltalk.)

-- John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to