At 07:07 PM 11/15/2001 +0000, Simon Cozens wrote:
>On Thu, Nov 15, 2001 at 02:01:53PM -0500, Dan Sugalski wrote:
> > *) Use the cache entry in the PMC header. It'll mean for ints and floats
> > you won't need to bother with a separate structure or dereference
>
>I can't. :(
>
>/* It's more efficient to use our own caching than the PMC's cache
>    Why? Because we also need to store state on what type of thing is
>    in the cache, and this can be one of three things. (four, if you
>    include "nothing") Four things is two bits, which means two flag
>    tests instead of one. Hence, we just use the old-style IOK/NOK/POK */
>
> > *) Swap out vtables as the pmc internals change, rather than vectoring off
> > flags.
>
>That's probably the right way to do it. But what about overlapping types
>that are both integer and string OK?

Well, you've got a pointer to a buffer, and either an int or float. (The 
string pointer should be yanked from the union or the GC won't find it) So 
you're fine for an int/string or float/string, or plain int, or plain 
float. For the rest (bignum/string, or int/float) it'll be a matter of 
choosing which things we cache and which we don't. We can profile things 
and see if it's worth extra cache slots or not later.

Anyway, as to how it's handled, you just need a few sets of vtables--string 
only, int only, float only, int/string, float/string, and bignum. A bit of 
a pain, but I think I'm about to cobble up a vtable table builder doodad to 
make it easier.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to