On Tue, Mar 16, 2010 at 8:33 PM, Peter Lobsinger <[email protected]> wrote: > On Tue, Mar 16, 2010 at 3:19 PM, Andrew Whitworth <[email protected]> > wrote: >> Putting arguments into a ResizablePMCArray or Hash and using :flat >> (Signature "Pf") would similarly resolve the problem. > > So we'd have to create a bunch of extra PMCs on every call to pass > ints, floats, and strings? Ewwww! I know that marshaling between > calling conventions is inevitably going to be more expensive, but why > do we make it more expensive when it doesn't have to be? > > Also, what if I want to pass a parameter using :flat? Then I can't use > this trick.
Alternate method is to construct your own CallContext PMC. A CallContext is created by the invocation anyway, so if you create it manually and populate it with the values you need, it doesn't create any extra PMCs. Creating a CallContext is not difficult, and invoking a method with it is very simple. Parrot_pcc_invoke_from_sig_object does the trick magically. After the call, you can get access to the same CallContext object and use it to extract a variable number of returns as well. --Andrew Whitworth _______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
