Version 2 (modified by allison, 6 years ago)


Global changes:

* Convert all calls to 'Parrot_runops_fromc_args*' into calls to 'Parrot_pcc_invoke_sub_from_c_args'.

* Consider adding a :lookahead option to the calling conventions.

* Remove the TODO mark from t/pmc/multidispatch.t test 32 (see RT #59628).

* Merge inter_call.c and inter_run.c, or completely rename and resort the existing functions. Possibly src/calling.c and src/opcode_runloop.c or src/calling/pcc.c and src/calling/opcodes.c?

* There's a huge hodge-podge of functions that do basically the same thing. Trim these down to a logical set that handle the basic cases. (calling from PIR, calling from C, calling from a CallSignature PMC).

* Converge on one calling convention for all invocation. Different entry points for calling from PIR, C, or CallSignature PMC. Different exit points, depending on whether the call is a Sub (Closure, Contintuation, etc) or a CFunction. But same code pattern, and same core routines for all.

* 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.

* Stop marshalling and demarshalling between C calling conventions and Parrot Calling Conventions (especially in hot paths, such as MMD and vtables)


* Change 'signature' in ‘Parrot_pcc_invoke_from_sig_object’ to a Parrot STRING, and change all relevant functions to accept a Parrot STRING instead of a C string.


* Modify Parrot_build_sig_object_from_varargs to check if an invocant is present and if "Pi" doesn't already exist at the beginning of the string. CallSignature PMC:

* Add adverb modifier "i" to signature string for an invocant.

* Add lots of documentation about signature strings

Object PMC:

* Change the default vtable function generator for Object PMC to generate 'Parrot_pcc_invoke_sub_from_c_args' calls instead of 'Parrot_runops_fromc_args*' calls.

Integer PMC:

* Refactor Integer PMC's overflow mechanism to do a VTABLE call rather than directly performing an MMD call (to allow for vtable overrides).