We currently have constant Key and Sub PMCs both created from the packfile at load time. They live in the constant_table pointing to a constant PMC pool. But we need more.

We have allover the core code like this:

  string_from_cstring(interpreter, "pIt", 0)
  key = key_new_cstring(interpreter, "_message");

to create some STRINGs or entries in hashes. The keys should be constant PMCs and they should be shared as well as the STRINGs.
We need this in objects.c ("\0\0anonymous"), for setting standard property names internally and for the current hash based implementation of Exceptions.


This leads to my proposal:
* const_string_from_cstring - return cached constant string or create one
* const_key_new_cstring - return cached PMC or create a constant PMC
* constant_pmc_new* - ditto (called from above)

Further we would need for some classes a Const$Class variant, where the set-like vtables throw an exception. These classes should be autogenerated from *.pmc for all classes that have a "const_too" or such in their classes $flags.

This leads to changes in parsing the vtable.tbl - which we need anyway to do the proposed var/value split of vtables.

e.g.
[FETCH]
get_integer
...
[STORE]
set_integer
...
[PUSH]
push_integer
...
and so on.
The section names conform (where applicable) to methods described in Tie::*(3pm).


Comments welcome
leo



Reply via email to