Changes between Version 17 and Version 18 of CallingConventionsTasklist

Show
Ignore:
Timestamp:
02/02/10 20:19:09 (12 years ago)
Author:
allison
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CallingConventionsTasklist

    v17 v18  
    1 == PCC Rewiring Refactors (Current) == 
     1See CallingConventionsOverview for an explanation of changes that have already gone in. 
    22 
    3 * ~~Convert all calls to 'Parrot_runops_fromc_args*' into calls to 'Parrot_pcc_invoke_sub_from_c_args'.~~ 
     3== Args/Returns Unification Refactor == 
    44 
    5 * 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). 
     5(These refactors are interdependent and will need to be done together.) 
    66 
    7 * 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. 
     7* Refactor PASM calling code so that set_returns is called before get_results 
    88 
    9 * Refactor to remove code duplication between the various dispatch systems. 
     9* Unify argument passing and returns passing to use a single codepath. 
     10 - Collapse 'Parrot_pcc_build_sig_object_returns_from_op' into 'Parrot_pcc_build_sig_object_from_op' (and call it from 'set_returns' instead of 'get_results') 
     11 - Collapse 'assign_default_result_value' into 'assign_default_param_value'. 
     12 - Collapse 'Parrot_pcc_fill_returns_from_op' into 'Parrot_pcc_fill_params_from_op' 
     13 - Collapse 'Parrot_pcc_fill_returns_from_c_args' into 'Parrot_pcc_fill_params_from_c_args' 
     14 - Collapse 'fill_results' into 'fill_params' 
    1015 
    11 * Standardize on PCC-style signature description strings throughout the system, instead of different signature description strings for different calling APIs. Excludes NCI signatures. 
     16* Rename 'Parrot_pcc_fill_returns_from_continuation' to 'Parrot_pcc_fill_params_from_continuation' (or see if there's some way to merge it with another existing parameter filling function) 
    1217 
    13 * Enable dispatching by CallSignature PMC everywhere. 
     18* Remove deprecated (temporary) function 'Parrot_pcc_append_result' 
    1419 
    15 * ~~Add adverb modifier "i" to signature string for an invocant.~~ 
     20* Modify 'Parrot_pcc_build_sig_object_from_op' ('Parrot_pcc_build_sig_object_returns_from_op'), 'extract_named_arg_from_op', and 'Parrot_pcc_build_sig_object_from_varargs' to use the same function pointers as 'fill_params', where possible. 
    1621 
    17 * Add lots of documentation about signature strings, CallSignature, dispatch, etc 
    18  
    19 * ~~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.~~ 
    20  
    21 == CallSignature PMC Refactor == 
    22  
    23 * 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. 
    24  
    25 * 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. 
    26  
    27 * 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. 
    28  
    29 * 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?) 
     22* Remove sections of CallContext PMC that were used for storing and manipulating returns inside the parameters signature. (Returns will reuse the arg/param call context object, or create a new one.) 
     23 - 'results_signature', 'current_results', 'returns_values', 'returns_size', and 'returns_resize_threshold' ATTRs 
     24 - 'results' and 'return_flags' accessors in set_attr_str and get_attr_str 
    3025 
    3126 
    32 == API Cleanups == 
     27 
     28== General tasks == 
     29 
     30* Remove 'Parrot_call_*' functions (deprecated in TT # 1145) 
     31 
     32* Remove 'Parrot_PCCINVOKE', it has been replaced by 'Parrot_pcc_invoke_method_from_c_args' (the bodies of the two functions are exact copies). (falls under blanket deprecation in TT #443, may deserve its own deprecation ticket) 
     33 
     34* Move static 'csr_*' functions (src/call/args.c) that define an interface to manipulating the CallContext PMC into src/call/context.c. 
     35 
     36* Review the current functions in src/call/context.c and src/call/context_accessors.c, to see what's still useful after the move to the CallContext PMC. 
     37 
     38* Optimize PCC dispatch, refactor to slim down the code (much of that will happen in the args/returns refactor, but worth another look after that's done). 
     39 
     40* Enable dispatching by CallContext PMC everywhere (check if there are places it isn't enabled where it should be possible). 
     41 
     42* Add lots of documentation about signature strings, CallContext, dispatch, etc 
     43 
     44- Make sure the API and documentation consistently uses "args" and "returns" to mean "the things passed into the call or return" and "params" and "results" to mean "the things extracted from the call or return". 
    3345 
    3446* Add :call_sig parameter flag type. Can be used to get access to the raw CallSignature object. 
     
    3648* Add :call_sig argument flag type. Can be used to pass in a CallSignature object instead of building one. 
    3749 
    38 * 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. 
    3950 
    40 * ~~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.~~ 
     51* Add a :lookahead option for Sub parameters. A lookahead parameter takes a named argument preferably, takes a positional otherwise. 
    4152 
    42 * ~~Delete all old call-related functions that are no longer used.~~ 
     53 
     54* Reduce marshalling and demarshalling between C calling conventions and Parrot Calling Conventions (especially in hot paths, such as MMD and vtables) 
     55 
     56* Standardize on PCC-style signature description strings throughout the system, instead of different signature description strings for different calling APIs. Excludes NCI signatures. 
    4357 
    4458== Invoke Refactor == 
    4559 
    46 * Make VTABLE_invoke is consistent between different sub-like PMCs (Sub, NCI, etc). See #1094 
     60* Make VTABLE_invoke consistent between different sub-like PMCs (Sub, NCI, etc). See #1094 
    4761 
    4862* Allow VTABLE_invoke to be properly overridden from PIR. See #103 
     
    5266* Add an :invocant flag so that we can name the method invocant something besides "self" 
    5367 
    54 == Lookahead Refactor == 
    55  
    56 * Add a :lookahead option for Sub parameters. A lookahead parameter takes a named argument preferably, takes a positional otherwise. 
    57  
    58 == Args/Returns Unification Refactor == 
    59  
    60 * Refactor PASM calling code so that set_returns is called before get_results 
    61  
    62 * Unify argument passing and returns passing to use a single codepath. 
    63  
    64 * Optimize PCC dispatch (refactor to slim down the code). 
    65  
    66 == Misc or Old items == 
     68== Completed items == 
    6769 
    6870* ~~Remove the TODO mark from t/pmc/multidispatch.t test 32 (see RT #59628)~~ (r41812). 
     
    7072* ~~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) 
    7173 
    72 * Stop marshalling and demarshalling between C calling conventions and Parrot Calling Conventions (especially in hot paths, such as MMD and vtables) 
    7374 
    7475* ~~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 
     76 
     77* ~~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.~~ 
     78 
     79* ~~Delete all old call-related functions that are no longer used.~~ 
     80 
     81* ~~Convert all calls to 'Parrot_runops_fromc_args*' into calls to 'Parrot_pcc_invoke_sub_from_c_args'.~~ 
     82 
     83- ~~The Parrot_call_sub_* and Parrot_call_method_* variants in src/extend.c don't all have the necessary changes to allow them to work with the new calling conventions (these are temporary implementations for backward compatibility before they're removed at the next deprecation point). Parrot_call_sub does have the right changes, and the others can be largely copied from it.~~ 
     84 
     85- ~~NCI hasn't been fully updated on caller and receiver side to use the new argument passing style.~~ 
     86 
     87* ~~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).~~ 
     88 
     89* ~~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.~~ 
     90 
     91* ~~Refactor to remove code duplication between the various dispatch systems.~~ 
     92 
     93* ~~Add adverb modifier "i" to signature string for an invocant.~~ 
     94 
     95* ~~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.~~ 
     96 
     97* ~~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.~~ 
     98 
     99* ~~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.~~ 
     100 
     101* ~~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?)~~ 
     102 
     103 
     104- ~~Return argument processing (Parrot_pcc_fill_returns_from_op and Parrot_pcc_fill_returns_from_c_args) doesn't currently support :named, :slurpy, :flatten, :optional, :opt_flag etc. (t/compilers/imcc/syn/tail.t, t/pmc/coroutine.t)~~ 
     105 
     106- ~~Parrot_pcc_fill_params_from_op and Parrot_pcc_fill_params_from_c_args are monolithic functions (basically finite state machines iterating over the arguments), that contain a great deal of nearly repeated code (one or two things different each time). Parrot_pcc_fill_returns_from_op and Parrot_pcc_fill_returns_from_c_args will be just as bad once they support all the options. Not a requirement before the merge, but these should be refactored into smaller subroutines. Needs to be thought through carefully though, it was a similar plan that lead to the current mess.~~ 
     107 
     108- ~~Flattening an argument doesn't alter the signature string stored, so multiple dispatch can't handle the resulting string. Need to modify the signature string while building the CallSignature object. (t/pmc/multisub.t and t/pmc/multidispatch.t)~~ 
     109 
     110- ~~Edge cases on auto boxing/unboxing argument types, e.g. "Unable to set PMC value, the pointer is not a PMC" (t/oo/methods.t, t/oo/subclass.t, t/pmc/hashiteratorkey.t, t/pmc/object-meths.t, t/pmc/resizablestringarray.t, t/pmc/string.t)~~ 
     111 
     112- ~~GC attempting to mark a bad variable (t/op/box.t) (Actually IMCC creates bad PackFile_Constants segment for box.t)~~ 
     113 
     114- ~~Insufficient checking on positional arguments passed inside named arguments (t/op/calling.t)~~ 
     115 
     116- ~~Insufficient checking on missing named arguments (t/op/cc_state.t)~~ 
     117 
     118- ~~Insufficient checking on too many arguments passed (t/pmc/exporter.t)~~ 
     119 
     120- ~~Some tests need to be updated to match the current error messages (t/op/calling.t, t/op/cc_params.t)~~ 
     121 
     122- ~~Segfault in set_returns, possibly a null call object? (t/op/gc.t, t/pmc/exceptionhandler.t)~~ 
     123 
     124- ~~Probably a problem with argument handling (t/op/lexicals.t, t/pmc/class.t, t/pmc/codestring.t, t/pmc/object-meths.t, t/pmc/sub.t)~~ 
     125 
     126- ~~Two NCI edge cases (t/pmc/nci.t)~~ 
     127 
     128- ~~Likely cases of code still calling into the old functions for invoking from C, instead of the new functions (t/pmc/sub.t, t/pmc/threads.t)~~ 
     129 
     130- ~~Likely bug in Parrot_call_sub reimplementation (t/src/embed.t)~~ 
     131 
     132- ~~miniparrot fails to compile if an installed parrot is not already present, because it has -lparrot in the compile options~~ 
     133 
     134- ~~Currently, test_more.pir cannot be used on pcc_reapply. Attempting to use test_more.pir results in~~  
     135{{{ 
     136FixedIntegerArray: index out of bounds! 
     137current instr.: 'parrot;Test;Builder;Test;_initialize' pc 44 (runtime/parrot/library/Test/Builder/Test.pir:46) 
     138called from Sub 'parrot;Test;Builder;_initialize' pc 0 (runtime/parrot/library/Test/Builder.pir:51) 
     139... call repeated 1 times 
     140}}}