Version 14 (modified by whiteknight, 5 years ago)

Move the CallSignature refactors section up a little bit because it's higher priority then other stuff

PCC Rewiring Refactors (Current)

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

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

* Refactor to remove code duplication between the various dispatch systems.

* Standardize on PCC-style signature description strings throughout the system, instead of different signature description strings for different calling APIs. Excludes NCI signatures.

* Enable dispatching by CallSignature PMC everywhere.

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

* Add lots of documentation about signature strings, CallSignature, dispatch, etc

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

CallSignature PMC Refactor

* Refactor CallSignature to store arguments as a typed array, instead of as a PMC array. The types we know from the signature, so can store and retrieve the elements in a type-safe way. (Suggestion from IRC discussion was to use a union for the value storage.) This will reduce the number of PMCs created, since integer, number, and string arguments can be stored directly instead of boxed in PMCs.

* Refactor CallSignature to store arguments directly in CallSignature data structure, instead of creating two additional PMCs (array for positionals and hash for named) to hold them. This refactor can be done at the same time as the typed array refactor.

* Refactor CallSignature to no longer store returns at all (after the args/returns unification above). Returns will reuse the arg/param call signature object, or create a new one.

* Refactor CallSignature to merge it with Context, only need one PMC to hold all that information. (Question: what's the implication of this combined with the previous refactor? Do returns get passed out in the same struct members that the arguments came in on?)

API Cleanups

* Add :call_sig parameter flag type. Can be used to get access to the raw CallSignature object.

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

* Delete all old call-related functions that are no longer used.

Invoke Refactor

* Make VTABLE_invoke is consistent between different sub-like PMCs (Sub, NCI, etc). See #1094

* Allow VTABLE_invoke to be properly overridden from PIR. See #103

* Allow Sub, Continuation, etc. to be properly subclassed from PIR

* Add an :invocant flag so that we can name the method invocant something besides "self"

Lookahead Refactor

* Add a :lookahead option for Sub parameters. A lookahead parameter takes a named argument preferably, takes a positional otherwise.

Args/Returns Unification Refactor

* Refactor PASM calling code so that set_returns is called before get_results

* Unify argument passing and returns passing to use a single codepath.

* Optimize PCC dispatch (refactor to slim down the code).

Misc or Old items

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

* 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? (Done in r36595)

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

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