Ticket #895: TT_895_3.patch

File TT_895_3.patch, 26.4 KB (added by NotFound, 12 years ago)
  • src/gc/api.c

     
    373373    if (PObj_active_destroy_TEST(pmc)) 
    374374        VTABLE_destroy(interp, pmc); 
    375375 
     376    if (PMC_data(pmc) && pmc->vtable->attr_size) { 
     377#if 0 
     378        mem_sys_free(PMC_data(pmc)); 
     379        PMC_data(pmc) = NULL; 
     380#else 
     381        Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size); 
     382#endif 
     383    } 
     384    PARROT_ASSERT(NULL == PMC_data(pmc)); 
     385 
    376386    if (PObj_is_PMC_EXT_TEST(pmc)) 
    377387        Parrot_gc_free_pmc_ext(interp, pmc); 
    378388 
  • src/pmc.c

     
    241241    /* Set the right vtable */ 
    242242    pmc->vtable = new_vtable; 
    243243 
     244    if (PMC_data(pmc) && pmc->vtable->attr_size) { 
     245#if 0 
     246        mem_sys_free(PMC_data(pmc)); 
     247#else 
     248        Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size); 
     249#endif 
     250    } 
     251 
     252    if (new_vtable->attr_size) { 
     253#if 0 
     254        PMC_data(pmc) = mem_sys_allocate_zeroed(new_vtable->attr_size); 
     255#else 
     256        Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size); 
     257#endif 
     258} 
     259    else 
     260        PMC_data(pmc) = NULL; 
     261 
    244262    return pmc; 
    245263} 
    246264 
     
    361379    /* Do we have an extension area? */ 
    362380    INTVAL const has_ext = (PObj_is_PMC_EXT_TEST(pmc) && pmc->pmc_ext); 
    363381 
     382    if (PMC_data(pmc) && pmc->vtable->attr_size) { 
     383#if 0 
     384        mem_sys_free(PMC_data(pmc)); 
     385#else 
     386        Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size); 
     387#endif 
     388    } 
     389 
    364390    /* Do we need one? */ 
    365391    if (flags & VTABLE_PMC_NEEDS_EXT) { 
    366392        /* If we need an ext area, go allocate one */ 
     
    465491    pmc            = Parrot_gc_new_pmc_header(interp, flags); 
    466492    pmc->vtable    = vtable; 
    467493 
     494    if (vtable->attr_size) { 
     495#if 0 
     496        PMC_data(pmc) = mem_sys_allocate_zeroed(vtable->attr_size); 
     497#else 
     498        Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size); 
     499#endif 
     500    } 
     501 
    468502#if GC_VERBOSE 
    469503    if (Interp_flags_TEST(interp, PARROT_TRACE_FLAG)) { 
    470504        /* XXX make a more verbose trace flag */ 
  • src/pmc/class.pmc

     
    443443*/ 
    444444 
    445445pmclass Class 
    446     need_ext { 
     446    need_ext auto_attrs { 
    447447 
    448448    ATTR INTVAL id;             /* The type number of the PMC. [deprecated: See RT #48024] */ 
    449449    ATTR STRING *name;          /* The name of the class. */ 
     
    479479*/ 
    480480 
    481481    VTABLE void init() { 
    482         Parrot_Class_attributes * const _class = mem_allocate_zeroed_typed(Parrot_Class_attributes); 
     482        Parrot_Class_attributes * const _class = 
     483                (Parrot_Class_attributes *) PMC_data(SELF); 
    483484 
    484         /* Set flags for custom GC mark and destroy. */ 
     485        /* Set flag for custom GC mark. */ 
    485486        PObj_custom_mark_SET(SELF); 
    486         PObj_active_destroy_SET(SELF); 
    487487 
    488488        /* Set up the object. */ 
    489         PMC_data(SELF)          = _class; 
    490489        _class->name            = CONST_STRING(interp, ""); 
    491490        _class->_namespace      = PMCNULL; 
    492491        _class->parents         = pmc_new(interp, enum_class_ResizablePMCArray); 
     
    559558 
    560559/* 
    561560 
    562 =item C<void destroy()> 
    563  
    564 Frees the memory associated with the class's underlying struct. 
    565  
    566 =cut 
    567  
    568 */ 
    569  
    570     VTABLE void destroy() { 
    571         mem_sys_free(PMC_data(SELF)); 
    572         PMC_data(SELF) = NULL; 
    573     } 
    574  
    575 /* 
    576  
    577561=item C<STRING *get_string()> 
    578562 
    579563Returns the name of the class (without the HLL namespace). 
  • src/pmc/complex.pmc

     
    217217} 
    218218 
    219219 
    220 pmclass Complex need_ext { 
     220pmclass Complex need_ext auto_attrs { 
    221221 
    222222    ATTR FLOATVAL re; /* real part */ 
    223223    ATTR FLOATVAL im; /* imaginary part */ 
     
    327327Initializes the complex number with the specified initializer. 
    328328The initializer can be a string PMC or a numeric array with (real, imag) 
    329329 
    330 =item C<void destroy()> 
    331  
    332 Cleans up. 
    333  
    334330=item C<PMC *clone()> 
    335331 
    336332Creates an identical copy of the complex number. 
     
    340336*/ 
    341337 
    342338    VTABLE void init() { 
    343         /* XXX should check if mem_sys_allocate failed */ 
    344         PMC_data(SELF) = mem_allocate_typed(Parrot_Complex_attributes); 
    345339        SET_ATTR_re(INTERP, SELF, 0.0); 
    346340        SET_ATTR_im(INTERP, SELF, 0.0); 
    347  
    348         PObj_active_destroy_SET(SELF); 
    349341    } 
    350342 
    351343    VTABLE void init_pmc(PMC *initializer) { 
     
    380372        } 
    381373    } 
    382374 
    383     VTABLE void destroy() { 
    384         mem_sys_free(PMC_data(SELF)); 
    385         PMC_data(SELF) = NULL; 
    386     } 
    387  
    388375    VTABLE PMC *clone() { 
    389376        PMC * const dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF)); 
    390377        FLOATVAL re, im; 
  • src/pmc/cpointer.pmc

     
    4646 
    4747*/ 
    4848 
    49 pmclass CPointer need_ext { 
     49pmclass CPointer need_ext auto_attrs { 
    5050    ATTR void   *pointer; /* The stored pointer. */ 
    5151    ATTR STRING *sig;     /* A string signature for the pointer. */ 
    5252 
     
    6161*/ 
    6262 
    6363    VTABLE void init() { 
    64         Parrot_CPointer_attributes * const pdata_struct = 
    65             mem_allocate_typed(Parrot_CPointer_attributes); 
     64        SET_ATTR_pointer(INTERP, SELF, NULL); 
     65        SET_ATTR_sig(INTERP, SELF, NULL); 
    6666 
    67         PMC_data(SELF)        = pdata_struct; 
    68         pdata_struct->pointer = NULL; 
    69         pdata_struct->sig     = NULL; 
    70  
    7167        PObj_custom_mark_destroy_SETALL(SELF); 
    7268    } 
    7369 
     
    8379*/ 
    8480 
    8581    VTABLE void mark() { 
    86         Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF); 
     82        STRING *sig; 
     83        GET_ATTR_sig(INTERP, SELF, sig); 
     84        if (sig) { 
     85            void *pointer; 
     86            GET_ATTR_pointer(INTERP, SELF, pointer); 
     87            Parrot_gc_mark_PObj_alive(interp, (PObj *)sig); 
    8788 
    88         if (data->sig) { 
    89             Parrot_gc_mark_PObj_alive(interp, (PObj *)data->sig); 
    90  
    91             if (data->pointer) { 
    92                 if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) { 
    93                     PMC ** const pmc_pointer = (PMC **) data->pointer; 
     89            if (pointer) { 
     90                if (Parrot_str_equal(interp, sig, CONST_STRING(interp, "P"))) { 
     91                    PMC ** const pmc_pointer = (PMC **) pointer; 
    9492                    PARROT_ASSERT(*pmc_pointer); 
    9593                    Parrot_gc_mark_PObj_alive(interp, (PObj *) *pmc_pointer); 
    9694                } 
    97                 else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) { 
    98                     STRING ** const str_pointer = (STRING **) data->pointer; 
     95                else if (Parrot_str_equal(interp, sig, CONST_STRING(interp, "S"))) { 
     96                    STRING ** const str_pointer = (STRING **) pointer; 
    9997                    PARROT_ASSERT(*str_pointer); 
    10098                    Parrot_gc_mark_PObj_alive(interp, (PObj *) *str_pointer); 
    10199                } 
     
    114112*/ 
    115113 
    116114    VTABLE void destroy() { 
    117         Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF); 
    118  
    119         if (data) { 
    120             mem_sys_free(data); 
    121             PMC_data(SELF) = NULL; 
    122         } 
    123115    } 
    124116 
    125117/* 
  • src/pmc/fixedfloatarray.pmc

     
    1919 
    2020*/ 
    2121 
    22 pmclass FixedFloatArray need_ext provides array { 
     22pmclass FixedFloatArray need_ext auto_attrs provides array { 
    2323    ATTR INTVAL    size; 
    2424    ATTR FLOATVAL *float_array; 
    2525 
     
    4040*/ 
    4141 
    4242    VTABLE void init() { 
    43         Parrot_FixedFloatArray_attributes* attrs = 
    44             mem_allocate_zeroed_typed(Parrot_FixedFloatArray_attributes); 
    45         PMC_data(SELF) = attrs; 
    4643    } 
    4744 
    4845/* 
     
    6057        GET_ATTR_float_array(INTERP, SELF, float_array); 
    6158        if (float_array) 
    6259            mem_sys_free(float_array); 
    63  
    64         mem_sys_free(PMC_data(SELF)); 
    65         PMC_data(SELF) = NULL; 
    6660    } 
    6761 
    6862/* 
  • src/pmc/retcontinuation.pmc

     
    2323 
    2424#include "parrot/oplib/ops.h" 
    2525 
    26 pmclass RetContinuation extends Continuation need_ext { 
     26pmclass RetContinuation extends Continuation need_ext auto_attrs { 
    2727 
    2828/* 
    2929 
     
    3737 
    3838    VTABLE void init() { 
    3939        Parrot_RetContinuation_attributes * const attrs = 
    40             mem_allocate_typed(Parrot_RetContinuation_attributes); 
    41  
    42         PMC_data(SELF) = attrs; 
     40            (Parrot_RetContinuation_attributes *) PMC_data(SELF); 
    4341        PMC_cont(SELF) = new_ret_continuation(INTERP); 
    4442 
    4543        PObj_custom_mark_destroy_SETALL(SELF); 
     
    5553 
    5654        if (cc) 
    5755            mem_sys_free(cc); 
    58  
    59         mem_sys_free(PMC_data(SELF)); 
    60         PMC_data(SELF) = NULL; 
    6156    } 
    6257/* 
    6358 
  • src/pmc/parrotinterpreter.pmc

     
    240240            Parrot_ParrotInterpreter_attributes *attrs = 
    241241                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes); 
    242242            PMC_data(SELF) = attrs; 
     243        } 
     244        if (!PMC_interp(SELF)) { 
    243245            create_interp(SELF, INTERP); 
    244             PARROT_ASSERT(attrs->interp); 
    245246        } 
    246247        PObj_active_destroy_SET(SELF); 
    247248    } 
     
    261262    VTABLE void init_pmc(PMC *parent) { 
    262263        Parrot_Interp p = PMC_interp(parent); 
    263264 
    264         if (!PMC_interp(SELF)) 
     265        if (!PMC_data(SELF)) { 
     266            Parrot_ParrotInterpreter_attributes *attrs = 
     267                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes); 
     268            PMC_data(SELF) = attrs; 
     269        } 
     270        if (!PMC_interp(SELF)) { 
    265271            create_interp(SELF, p); 
     272        } 
     273        PObj_active_destroy_SET(SELF); 
    266274    } 
    267275 
    268276 
  • src/pmc/resizableintegerarray.pmc

     
    2020 
    2121*/ 
    2222 
    23 pmclass ResizableIntegerArray extends FixedIntegerArray need_ext provides array { 
     23pmclass ResizableIntegerArray extends FixedIntegerArray need_ext auto_attrs provides array { 
    2424    ATTR INTVAL resize_threshold; /* max size before array needs to be resized */ 
    2525 
    2626/* 
     
    3333 
    3434*/ 
    3535    VTABLE void init() { 
    36         Parrot_ResizableIntegerArray_attributes* attrs = 
    37             mem_allocate_zeroed_typed(Parrot_ResizableIntegerArray_attributes); 
    38         PMC_data(SELF) = attrs; 
    39         PObj_active_destroy_SET(SELF); 
     36        SUPER(); 
    4037    } 
    4138 
    4239/* 
  • src/pmc/exception.pmc

     
    5252#include "parrot/exceptions.h" 
    5353#include "pmc_sub.h" 
    5454 
    55 pmclass Exception { 
     55pmclass Exception auto_attrs { 
    5656 
    5757    ATTR INTVAL          id;           /* The task ID in the scheduler. */ 
    5858    ATTR FLOATVAL        birthtime;    /* The creation time stamp of the exception. */ 
     
    8383*/ 
    8484 
    8585    VTABLE void init() { 
    86         Parrot_Exception_attributes * const core_struct = 
    87             mem_allocate_zeroed_typed(Parrot_Exception_attributes); 
    88  
    89         /* Set up the core struct and default values for the exception object. */ 
    90         PMC_data(SELF)            = core_struct; 
    91  
    92         /* Set flags for custom GC mark and destroy. */ 
     86        /* Set flags for custom GC mark. */ 
    9387        PObj_custom_mark_SET(SELF); 
    94         PObj_active_destroy_SET(SELF); 
    9588 
    9689        SET_ATTR_severity(INTERP, SELF, EXCEPT_error); 
    9790        SET_ATTR_handled(INTERP, SELF, 0); 
     
    116109        INTVAL severity_val; 
    117110        STRING *message_val; 
    118111 
    119         Parrot_Exception_attributes * const core_struct = 
    120             mem_allocate_zeroed_typed(Parrot_Exception_attributes); 
    121  
    122112        INTVAL ishash = VTABLE_isa(interp, values, CONST_STRING(interp, 'Hash')); 
    123113 
    124114        if (ishash) { 
     
    132122            message_val  = VTABLE_get_string(interp, values); 
    133123        } 
    134124 
    135         PMC_data(SELF)            = core_struct; 
    136         /* Set flags for custom GC mark and destroy. */ 
     125        /* Set flags for custom GC mark. */ 
    137126        PObj_custom_mark_SET(SELF); 
    138         PObj_active_destroy_SET(SELF); 
    139127 
    140128        /* Set up the core struct and default values for the exception object. */ 
    141129 
     
    175163 
    176164/* 
    177165 
    178 =item C<void destroy()> 
    179  
    180 Destroys the exception. 
    181  
    182 =cut 
    183  
    184 */ 
    185  
    186     VTABLE void destroy() { 
    187         Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF); 
    188         if (core_struct) { 
    189             if (core_struct->thrower) 
    190                 Parrot_free_context(interp, core_struct->thrower, 1); 
    191             mem_sys_free(core_struct); 
    192         } 
    193     } 
    194  
    195 /* 
    196  
    197166=item C<INTVAL get_bool()> 
    198167 
    199168Return true. 
  • src/pmc/multisub.pmc

     
    1919 
    2020*/ 
    2121 
    22 pmclass MultiSub extends ResizablePMCArray need_ext provides array { 
     22pmclass MultiSub extends ResizablePMCArray need_ext auto_attrs provides array { 
    2323 
    2424    VTABLE void push_pmc(PMC *value) { 
    2525        STRING * const _sub = CONST_STRING(interp, "Sub"); 
  • src/pmc/resizablefloatarray.pmc

     
    2020 
    2121*/ 
    2222 
    23 pmclass ResizableFloatArray extends FixedFloatArray need_ext provides array { 
     23pmclass ResizableFloatArray extends FixedFloatArray need_ext auto_attrs provides array { 
    2424    ATTR INTVAL resize_threshold; /* max size before array needs resizing */ 
    2525 
    2626 
     
    3535 
    3636*/ 
    3737    VTABLE void init() { 
    38         Parrot_ResizableFloatArray_attributes* attrs = 
    39             mem_allocate_zeroed_typed(Parrot_ResizableFloatArray_attributes); 
    40         PMC_data(SELF) = attrs; 
     38        SUPER(); 
    4139    } 
    4240 
    4341/* 
  • src/pmc/resizablestringarray.pmc

     
    1818 
    1919*/ 
    2020 
    21 pmclass ResizableStringArray extends FixedStringArray need_ext provides array { 
     21pmclass ResizableStringArray extends FixedStringArray need_ext auto_attrs provides array { 
    2222    ATTR UINTVAL resize_threshold; /*max capacity before resizing */ 
    2323 
    2424/* 
     
    3636*/ 
    3737 
    3838    VTABLE void init() { 
    39         Parrot_ResizableStringArray_attributes *attrs = 
    40             mem_allocate_zeroed_typed(Parrot_ResizableStringArray_attributes); 
    41  
    42         PMC_data(SELF)   = attrs; 
    43  
    44         PObj_custom_mark_destroy_SETALL(SELF); 
     39        SUPER(); 
    4540    } 
    4641 
    4742/* 
  • src/pmc/continuation.pmc

     
    4545 * need the next_for_GC pointer in the pmc_ext area. 
    4646 */ 
    4747 
    48 pmclass Continuation need_ext { 
     48pmclass Continuation need_ext auto_attrs { 
    4949    ATTR struct Parrot_cont *cont; /* the continuation struct */ 
    5050 
    5151/* 
     
    6060 
    6161    VTABLE void init() { 
    6262        Parrot_Continuation_attributes *attrs = 
    63             mem_allocate_zeroed_typed(Parrot_Continuation_attributes); 
    64         PMC_data(SELF) = attrs; 
     63            (Parrot_Continuation_attributes *) PMC_data(SELF); 
    6564 
    6665        PMC_cont(SELF) = new_continuation(INTERP, NULL); 
    6766        PObj_custom_mark_destroy_SETALL(SELF); 
     
    120119 
    121120            mem_sys_free(cc); 
    122121        } 
    123         mem_sys_free(PMC_data(SELF)); 
    124         PMC_data(SELF) = NULL; 
    125122    } 
    126123/* 
    127124 
  • src/pmc/stringiterator.pmc

     
    2222*/ 
    2323 
    2424 
    25 pmclass StringIterator extends Iterator { 
     25pmclass StringIterator auto_attrs extends Iterator { 
    2626    ATTR PMC    *string;    /* String to iterate over */ 
    2727    ATTR INTVAL  pos;       /* Current position of iterator for forward iterator */ 
    2828                            /* Previous position of iterator for reverse iterator */ 
     
    3939 
    4040*/ 
    4141    VTABLE void init_pmc(PMC *string) { 
    42         Parrot_StringIterator_attributes * const attrs = 
    43             mem_allocate_zeroed_typed(Parrot_StringIterator_attributes); 
     42        SET_ATTR_string(INTERP, SELF, string); 
    4443 
    45         attrs->string    = string; 
    46         PMC_data(SELF)   = attrs; 
    47  
    48         PObj_custom_mark_destroy_SETALL(SELF); 
    49  
    5044        /* by default, iterate from start */ 
    5145        SELF.set_integer_native(ITERATE_FROM_START); 
     46        PObj_custom_mark_SET(SELF); 
    5247    } 
    5348 
    5449/* 
    5550 
    56 =item C<void destroy()> 
    57  
    58 destroys this PMC 
    59  
    60 =cut 
    61  
    62 */ 
    63  
    64     VTABLE void destroy() { 
    65         mem_sys_free(PMC_data(SELF)); 
    66         PMC_data(SELF) = NULL; 
    67     } 
    68  
    69 /* 
    70  
    7151=item C<void mark()> 
    7252 
    7353Marks the current idx/key and the aggregate as live. 
  • src/pmc/undef.pmc

     
    5757            VTABLE_destroy(interp, clone); 
    5858 
    5959            PObj_is_object_SET(SELF); 
    60             PObj_active_destroy_SET(SELF); 
    6160 
    6261        } 
    6362    } 
  • src/pmc/fixedintegerarray.pmc

     
    1919 
    2020*/ 
    2121 
    22 pmclass FixedIntegerArray need_ext provides array { 
     22pmclass FixedIntegerArray need_ext auto_attrs provides array { 
    2323    ATTR INTVAL   size;  /* number of INTVALs stored in this array */ 
    2424    ATTR INTVAL * int_array; /* INTVALs are stored here */ 
    2525 
     
    4040*/ 
    4141 
    4242    VTABLE void init() { 
    43         Parrot_FixedIntegerArray_attributes* attrs = 
    44             mem_allocate_zeroed_typed(Parrot_FixedIntegerArray_attributes); 
    45         PMC_data(SELF) = attrs; 
    4643        PObj_active_destroy_SET(SELF); 
    4744    } 
    4845 
     
    154151        GET_ATTR_int_array(INTERP, SELF, int_array); 
    155152        if (int_array) 
    156153            mem_sys_free(int_array); 
    157         mem_sys_free(PMC_data(SELF)); 
    158         PMC_data(SELF) = NULL; 
    159154    } 
    160155 
    161156/* 
  • src/pmc/resizablebooleanarray.pmc

     
    3030/* Convert a size in bits to a size in bytes */ 
    3131#define BITS_TO_BYTES(size) ((size) / BITS_PER_CHAR) 
    3232 
    33 pmclass ResizableBooleanArray extends FixedBooleanArray need_ext provides array { 
     33pmclass ResizableBooleanArray extends FixedBooleanArray need_ext auto_attrs provides array { 
    3434    /* RBA uses the same attributes as FBA, but in RBA they're used as follows: 
    3535       size:             position of the last element (a.k.a tail_pos) 
    3636       resize_threshold: position of the first element (a.k.a. head_pos) */ 
  • src/pmc/parrotlibrary.pmc

     
    3131#define PMC_dlhandle(x) ((Parrot_ParrotLibrary_attributes*)PMC_data(x))->dl_handle 
    3232#define PMC_oplib_init(x) ((Parrot_ParrotLibrary_attributes*)PMC_data(x))->oplib_init 
    3333 
    34 pmclass ParrotLibrary need_ext provides library { 
     34pmclass ParrotLibrary need_ext auto_attrs provides library { 
    3535    ATTR void * dl_handle;  /* DLL handle */ 
    3636    ATTR void * oplib_init; /* oplib init function */ 
    3737 
     
    4646*/ 
    4747 
    4848    VTABLE void init() { 
    49         Parrot_ParrotLibrary_attributes * const attrs = 
    50             mem_allocate_zeroed_typed(Parrot_ParrotLibrary_attributes); 
    51         PMC_data(SELF) = attrs; 
    5249        PObj_active_destroy_SET(SELF); 
    5350    } 
    5451 
     
    6663        void *dl_handle = PMC_dlhandle(SELF); 
    6764        if (dl_handle) 
    6865            Parrot_dlclose(dl_handle); 
    69         mem_sys_free(PMC_data(SELF)); 
    70         PMC_data(SELF) = NULL; 
    7166    } 
    7267 
    7368 
  • src/pmc/exceptionhandler.pmc

     
    2222 
    2323#include "parrot/oplib/ops.h" 
    2424 
    25 pmclass ExceptionHandler extends Continuation need_ext { 
     25pmclass ExceptionHandler extends Continuation need_ext auto_attrs { 
    2626 
    2727    ATTR PMC    *handled_types; 
    2828    ATTR PMC    *handled_types_except; 
     
    4141 
    4242    VTABLE void init() { 
    4343        Parrot_ExceptionHandler_attributes * const core_struct = 
    44             mem_allocate_zeroed_typed(Parrot_ExceptionHandler_attributes); 
     44            (Parrot_ExceptionHandler_attributes *)PMC_data(SELF); 
    4545        Parrot_cont * const cc     = new_continuation(INTERP, NULL); 
    4646 
    4747        cc->invoked                = 0; 
    48         PMC_data(SELF)             = core_struct; 
    4948        PMC_cont(SELF)             = cc; 
    5049        core_struct->min_severity  = 0; 
    5150        core_struct->max_severity  = 0; 
  • src/pmc/pmcproxy.pmc

     
    6464*/ 
    6565 
    6666 
    67 pmclass PMCProxy extends Class need_ext { 
     67pmclass PMCProxy extends Class need_ext auto_attrs { 
    6868 
    6969/* 
    7070 
     
    7777*/ 
    7878 
    7979    VTABLE void init() { 
    80         Parrot_Class_attributes * const _pmc = mem_allocate_zeroed_typed(Parrot_Class_attributes); 
     80        Parrot_Class_attributes * const _pmc = 
     81                (Parrot_Class_attributes *) PMC_data(SELF); 
    8182        PMC          * const new_attribute   = pmc_new(interp, enum_class_Hash); 
    8283        STRING       * const name            = CONST_STRING(interp, "proxy"); 
    83         PMC_data(SELF)                       = _pmc; 
    8484 
    85         /* Set flags for custom GC mark and destroy. */ 
     85        /* Set flag for custom GC mark. */ 
    8686        PObj_custom_mark_SET(SELF); 
    87         PObj_active_destroy_SET(SELF); 
    8887 
    8988        /* Set up the object. */ 
    9089        _pmc->id               = 0; 
  • src/pmc/default.pmc

     
    327327 
    328328/* 
    329329 
     330=item C<void destroy()> 
     331 
     332Does nothing. 
     333 
     334=cut 
     335 
     336*/ 
     337 
     338    VTABLE void destroy() { 
     339    } 
     340 
     341/* 
     342 
    330343=item C<PMC *instantiate(PMC *init)> 
    331344 
    332345Default fallback. Creates a new PMC of the type of the class SELF and 
  • src/pmc/fixedstringarray.pmc

     
    1919 
    2020*/ 
    2121 
    22 pmclass FixedStringArray need_ext provides array { 
     22pmclass FixedStringArray need_ext auto_attrs provides array { 
    2323    ATTR STRING **str_array; /* where the STRINGs are stored */ 
    2424    ATTR UINTVAL  size;      /* element count */ 
    2525 
     
    4040*/ 
    4141 
    4242    VTABLE void init() { 
    43  
    44         Parrot_FixedStringArray_attributes *attrs = 
    45             mem_allocate_zeroed_typed(Parrot_FixedStringArray_attributes); 
    46  
    47         PMC_data(SELF) = attrs; 
    48  
    4943        PObj_custom_mark_destroy_SETALL(SELF); 
    5044    } 
    5145 
     
    6761 
    6862        if (str_array) 
    6963            mem_sys_free(str_array); 
    70  
    71         mem_sys_free(PMC_data(SELF)); 
    72         PMC_data(SELF) = NULL; 
    7364    } 
    7465 
    7566/* 
  • src/pmc/fixedbooleanarray.pmc

     
    2323 
    2424#define BITS_PER_CHAR 8 
    2525 
    26 pmclass FixedBooleanArray need_ext provides array { 
     26pmclass FixedBooleanArray need_ext auto_attrs provides array { 
    2727    ATTR UINTVAL         size;             /* # of bits this fba holds */ 
    2828    ATTR UINTVAL         resize_threshold; /* max capacity before resizing */ 
    2929    ATTR unsigned char * bit_array;        /* where the bits go */ 
     
    4545*/ 
    4646 
    4747    VTABLE void init() { 
    48         Parrot_FixedBooleanArray_attributes* attrs = 
    49             mem_allocate_zeroed_typed(Parrot_FixedBooleanArray_attributes); 
    50  
    51         PMC_data(SELF) = attrs; 
    5248        PObj_active_destroy_SET(SELF); 
    5349    } 
    5450 
     
    6763        GET_ATTR_bit_array(INTERP, SELF, bit_array); 
    6864        if (bit_array) 
    6965            mem_sys_free(bit_array); 
    70         mem_sys_free(PMC_data(SELF)); 
    71         PMC_data(SELF) = NULL; 
    7266    } 
    7367 
    7468/* 
  • lib/Parrot/Vtable.pm

     
    170170    INTVAL  base_type;      /* 'type' value for MMD */ 
    171171    STRING *whoami;         /* Name of class this vtable is for */ 
    172172    UINTVAL flags;          /* Flags. Duh */ 
     173    UINTVAL attr_size;      /* Size of the attributes struct */ 
    173174    STRING *provides_str;   /* space-separated list of interfaces */ 
    174175    Hash   *isa_hash;       /* Hash of class names */ 
    175176    PMC    *pmc_class;      /* for PMCs: a PMC of that type 
  • lib/Parrot/Pmc2c/PMCEmitter.pm

     
    458458        $enum_name, /* base_type */ 
    459459        NULL,       /* whoami */ 
    460460        $vtbl_flag, /* flags */ 
     461        0,          /* attr size */ 
    461462        NULL,       /* provides_str */ 
    462463        NULL,       /* isa_hash */ 
    463464        NULL,       /* class */ 
     
    601602 
    602603EOC 
    603604 
     605    if ( @{$attributes} && $self->{flags}{auto_attrs} ) { 
     606    $cout .= <<"EOC"; 
     607        vt->attr_size = sizeof(Parrot_${classname}_attributes); 
     608EOC 
     609    } 
     610 
    604611    # init vtable slot 
    605612    if ( $self->is_dynamic ) { 
    606613        $cout .= <<"EOC"; 
     
    640647            vt_${k}                 = Parrot_${classname}_${k}_get_vtable(interp); 
    641648            vt_${k}->base_type      = $enum_name; 
    642649            vt_${k}->flags          = $k_flags; 
     650EOC 
     651        if ( @{$attributes}  && $self->{flags}{auto_attrs} ) { 
     652            $cout .= <<"EOC"; 
     653            vt_${k}->attr_size = sizeof(Parrot_${classname}_attributes); 
     654EOC 
     655            } 
     656        $cout .= <<"EOC"; 
     657 
    643658            vt_${k}->attribute_defs = attr_defs; 
    644659 
    645660            vt_${k}->base_type           = entry;