src/pmc/packfileconstanttable.pmc - PackfileConstantTable PMC


This class implements a PackfileConstantTable object, a segment of the .pbc data file used for storing constants of various types. (int, string, PMC)

See packfile.pmc for the toplevel Packfile interface, see packfilesegment.pmc for the list of common methods every packfile segment pmc must implement; see PDD13 for the design spec.


Create empty PackfileConstantTable.
void mark()
Marks the object as live.
Set pointer to underlying PackFile_ConstTable
void *get_pointer()
INTVAL num_count()
INTVAL str_count()
INTVAL pmc_count()
Get the number of constants.
FLOATVAL get_number_keyed_int(INTVAL index)
Fetch a numeric constant.
STRING *get_string_keyed_int(INTVAL index)
Fetch a string constant.
PMC *get_pmc_keyed_int(INTVAL index)
Fetch a PMC constant.
void set_number_keyed_int(INTVAL index, FLOATVAL value)
Set the constant to the given number.
void set_string_keyed_int(INTVAL index, STRING *value)
Set the constant to the given string.
void set_pmc_keyed_int(INTVAL index, PMC *value)
Set the constant to the given PMC (or key).
void set_main(INTVAL index)
Set the :main flag in a Sub in the constant table.Experimental. Use with care. There is no way to set the private flags from PIR, so we need something like this.If something goes wrong, blame NotFound.
INTVAL get_or_create_constant()
Get or create constant for passed value.
METHOD type()
Set segment type.
METHOD add_tag_mapping(INTVAL pmc_idx, INTVAL str_idx)
Add a string->pmc tag mapping*/
    METHOD add_tag_mapping(INTVAL pmc_idx, INTVAL str_idx) {
        Parrot_PackfileConstantTable_attributes * const attrs =
        INTVAL idx = VTABLE_elements(INTERP, attrs->tag_map);
        VTABLE_set_integer_keyed_int(INTERP, attrs->tag_map, idx, pmc_idx);
        VTABLE_set_integer_keyed_int(INTERP, attrs->tag_map, idx, str_idx);
} /*