Melvin Smith: # At 03:25 AM 3/29/2002 -0500, Michel J Lambert wrote: # >The attached patch fixes a bunch of bugs. They are: # # I've reviewed this one and I'd like to apply it the GC # portion, but I'm not sure about the PMC patch. # # Are you sure the following is correct? # # RCS file: /cvs/public/parrot/classes/perlnum.pmc,v # retrieving revision 1.19 # diff -u -r1.19 perlnum.pmc # --- parrot/classes/perlnum.pmc 10 Mar 2002 21:18:13 -0000 1.19 # +++ parrot/classes/perlnum.pmc 29 Mar 2002 08:09:26 -0000 # @@ -117,27 +117,27 @@ # # void set_string (PMC * value) { # SELF->vtable = &(Parrot_base_vtables[enum_class_PerlString]); # - SELF->cache.struct_val = value->cache.struct_val; # + SELF->data = value->cache.struct_val; # } # # Shouldn't this be: # # + SELF->data = value->data; # # My other question to anyone who can answer, why does the PMC struct # have a DPOINTER * data and a DPOINTER * struct_val in the union. # # Aren't they redundant?
Let's say my data pointer points to this struct: typedef struct parrot_subroutine_t { opcode_t *bytecode; STRING *name; proto *prototype; (a bunch of other stuff here) } Subroutine; Now, most of the time, I'll just want to access the bytecode. I can remove a level of indirection by stuffing the bytecode pointer into cache.struct_val. The cache.* is intended to just be *shortcuts* to commonly-accessed data, *not* pointers to completely different data. That's why it's referred to as a "cache". --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) #define private public --Spotted in a C++ program just before a #include