# New Ticket Created by Allison Randal
# Please include the string: [perl #58414]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=58414 >
Briefly discussed in a phone call with Patrick, Jerry, and chromatic:
Our calling conventions have grown in an organic fashion over the past
few years, and they're showing some signs of cruft. The current design
and implementation could use a consistency review. Among the topics for
review:
- VTABLE_invoke is inconsistent between different sub-like PMCs. For
most subs it simply sets up the environment for invocation, and selects
the first opcode instruction of the sub as the next 'opcode_t *' for
'runops'. For NCI subs it actually invokes the function pointer. The
disjoint means that NCI subs can't be invoked from C argument lists the
same way as all the other subs (because the regular C argument list
passing can only happen *after* VTABLE_invoke has been called to set up
the environment, but NCI requires the arguments to be passed *before*
the call to VTABLE_invoke).
- Also, VTABLE_invoke can't really be overridden from PIR, because it
requires direct access to low-level interpreter data structures.
- Standardize on PCC-style signature description strings throughout the
system (instead of different signature description strings for NCI, PCC,
and regular subs).
- Refactor to remove code duplication between the various dispatch systems.
- Optimize PCC dispatch (refactor to slim down the code).
- Enable dispatching by CallSignature PMC everywhere.
Some of these elements may be post-1.0 features. Consider this ticket a
collection point for calling convention issues, and link in related tickets.
Allison