petdance/scratch — Issue #236: Slim down selection of mathematics vtables
Author: petdance
Created: 2011-11-01 05:30:22+00:00
State: open
Labels: core, Pri-normal, rfc, Sev-medium

We have far too many mathematics vtables for too many combinations of input arguments. I would like to make the following suggestions:

- Convert all "3-argument" VTABLEs to "2-argument" ones. These are of the form "PMC * foo(PMC *value, PMC *dest)". VTABLEs of this form are extremely inconsistent throughout the codebase for the handling of the third "dest" argument. In many implementations the third argument is completely unused. I suggest they should all be changed to "PMC *foo(PMC *value)", and always return a new PMC that contains the resultant value.
- Remove all "i_*" vtables. These are less frequently used and tend to be implemented internally in terms of the 3-argument vtables.

These changes will signficantly reduce bloat of the VTABLE structure and decrease Parrot's memory footprint and startup times. We'll also be able to have more consistent implementations of the math ops across all core types, and will have a much lower maintenance burden if we need to make changes to these operations.
Trac ID #1434