PMC flags
[email protected] (Nicholas Clark) Sun, 1 May 2005 23:36:02 +0100
| Newsgroups | perl.ponie.dev |
|---|---|
| Message-ID | <[email protected]> |
Parrot gives each PMC class 8 private flag bits. I was wondering how to use these most efficiently for ponie. My thoughts so far are 1 bit for SVf_IOK 1 bit for SVf_NOK 1 bit for SVf_POK 1 bit for SVf_ROK (so that it's fast to check that a scalar has a valid value) The PMC has a union that can store an integer or a floating point value or a reference (or a string - now sure whether to store a parrot string or a char * for SvPVX) 2 bits to say what we're storing in the union 1 bit to act as SVp_IOK/SVp_NOK/SVp_POK for whatever type we're storing in the union. (so that SvIVX() can check 3 bits to see whether it can read directly from the union) This leaves 1 bit spare currently. The point of all this is to allow sv.h macros to check the PMC flag bits and in the common cases be able to access the PObj structure members directly. In the cases where the macros can't be sure from the flag bits then they take the slow path of calling into the PMC, which can store more metadata/ cached values "behind the scenes" Thoughts? Nicholas Clark