Leopold Toetsch <[EMAIL PROTECTED]> writes: > Dan Sugalski wrote: > > > At 5:46 PM +0200 10/21/02, Leopold Toetsch wrote: > > > >> With an approach like this, we could cut down the VTABLE to roughly > >> 1/3 of it's current size. The _keyed entrys would only consist of > >> the set_.._keyed{,_int} variants plus exists_keyed and > >> defined_keyed. And, we would never have the opcode explosion to 64 > >> times of current size. > > > > The big disadvantage here is speed. It means that specialized > > aggregates will have to create temporary PMCs for things that don't > > already have them, which is potentially slow and wasteful, something > > I'd rather avoid. > > No, take the "new px, .PerlUndef" out of the opcode, it must only be > done once. This temporary Px can be reused by _all_ _keyed ops.
Im not sure about this. This really depends on the fact if the op does something depending on the type of LHS. If it doesn't need any information about this type then even the "new px, .PerlUndef" is not really needed (This is just an artefact of the fact that the vtable-functions are called with value of the register instead of the register). But if the context-information is needed then the right context must be provided. If this context evalutation is done in the vtable function then its up to the PMC-implementation to decide if its needed. OTOH the compiler has no chance to decide if this context is necessary or not. > If the LHS doesn't exist, like in my example, a new PMC has to be > created anyway. If the LHS exists, the set_value methods assigns a new > value. If we would change the signature of the vtable function to add (PMC *, PMC *, PMC **lhs) and the call in the op to $2->vtable->add($2,$3,&$1), then the new is not need. The signature of the add op could also be changed to add (out PMC, in PMC, in PMC) > The only difference of my solution is +4 opcode dispatches worst case > minus some checks, we now have, that a key exists. These checks in > each _keyed method could be tossed then. [...] b. -- Juergen Boemmels [EMAIL PROTECTED] Fachbereich Physik Tel: ++49-(0)631-205-2817 Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906 PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47