Sanify STRING->PMC Conversions
completed by: Matt Rajca
mentors: whiteknight
Task description: Parrot has 4 primary data types: PMC, STRING, INTVAL, and FLOATVAL. Parrot allows automatic conversions between these 4 types as necessary. Converting low-level type (STRING, INTVAL, and FLOATVAL) to a PMC is called "boxing". Boxing happens in many places.
Several places box a STRING, and this creates lots of duplicate code. Implement a new function, Parrot_pmc_box_string in src/pmc.c to perform this logic. The function should take the interp and a STRING*, and return a PMC*. It should follow HLL mapping rules (See examples for details).
Steps for Completion:
- Create a fork of parrot/parrot on Github
- Create a new function, Parrot_pmc_box_string in src/pmc.c. Do not mark it PARROT_EXPORT. Do mark it PARROT_HOT and PARROT_INLINE.
- Update src/pmc/callcontext.pmc:autobox_pmc() to use the new function for STRINGs
- Delete the function make_string_pmc from src/dynext.c. Replace all calls to it with your new function.
- Update the definition for the box opcode in src/ops/pmc.ops to use the new function (ask for help if you don't understand ops)
- Update the function Parrot_api_pmc_box_string in src/embed/api.c to use your new function
- Build parrot and run all tests to verify
- Open a pull request on github to have your changes merged in.