Leopold Toetsch <[EMAIL PROTECTED]> wrote:

[ snip ]

> * const_string_from_cstring - return cached constant string or create one
> * const_key_new_cstring - return cached PMC or create a constant PMC

Some more thoughts WRT this issue:
- PerlHash isn't suitable for storing/lookup these STRINGs/Keys
- so we would need a new hash type with a C<const char*> key
  (a simple implementation like the SymReg* hash inside symreg.c would
   suffice IMHO)
- the keys shouldn't be copied into the hash, so they should be
  declared C<static const s[] = "xxx"> (allocated in rodata).

constant_key_new_cstring() is only needed because the hash interface is
missing optimized a {s,g}et_<type>_keyed_str() interface.

- the constant hash can be in the interpreter->iglobals array
- implementation in a new F<constants.c> source file

Comments welcome,
leo

PS: why we need it IMHO:
$ find . -name '*.c' | xargs egrep '_cstring.*"\w+"'
There are more, which are using string_make or multiple lines.

Reply via email to