Ticket #1375: class_tt1375.pmc.patch

File class_tt1375.pmc.patch, 75.4 KB (added by jimmy, 5 years ago)
  • src/pmc/class.pmc

     
    9999    PMC *cache, int cur_index) 
    100100{ 
    101101    /* The attribute metadata hash. */ 
    102     Parrot_Class_attributes * const class_info = PARROT_CLASS(cur_class); 
    103     PMC          * const attribs     = class_info->attrib_metadata; 
    104     PMC          * const iter        = VTABLE_get_iter(interp, attribs); 
     102    PMC *attrib_metadata, *iter; 
     103     
    105104 
    106105    /* Build a string representing the fully qualified class name. */ 
    107106    /* Retrieve the fully qualified class name for the class. */ 
    108     STRING       * const fq_class    = VTABLE_get_string(interp, cur_class); 
    109     PMC          * const class_cache = pmc_new(interp, enum_class_Hash); 
     107    PMC    * const class_cache = pmc_new(interp, enum_class_Hash); 
     108    STRING * const fq_class    = VTABLE_get_string(interp, cur_class); 
     109 
    110110    VTABLE_set_pmc_keyed_str(interp, cache, fq_class, class_cache); 
    111111 
     112    GETATTR_Class_attrib_metadata(interp, cur_class, attrib_metadata); 
     113 
     114    iter = VTABLE_get_iter(interp, attrib_metadata); 
     115 
    112116    /* Iterate over the attributes. */ 
    113117    while (VTABLE_get_bool(interp, iter)) { 
    114118        /* Get attribute. */ 
    115119        PMC    * const cur_attrib  = VTABLE_get_pmc_keyed_str(interp, 
    116                 attribs, VTABLE_shift_string(interp, iter)); 
     120                attrib_metadata, VTABLE_shift_string(interp, iter)); 
    117121 
    118122        /* Get attribute name and append it to the key. */ 
    119123        STRING * const name_str    = CONST_STRING(interp, "name"); 
     
    134138/* This function builds the attribute index (table to map class name and 
    135139 * attribute name to an index) for the current class. */ 
    136140static void 
    137 build_attrib_index(PARROT_INTERP, PMC *self) 
     141build_attrib_index(PARROT_INTERP, PMC *SELF) 
    138142{ 
    139     Parrot_Class_attributes * const _class      = PARROT_CLASS(self); 
    140     int                  cur_index    = 0; 
    141     PMC * const          attrib_index = pmc_new(interp, enum_class_Hash); 
    142     PMC * const          cache        = pmc_new(interp, enum_class_Hash); 
    143     const int            num_classes  = VTABLE_elements(interp, _class->all_parents); 
    144     int                  i; 
     143    int          i, num_classes, cur_index = 0; 
     144    PMC         *all_parents; 
     145    PMC * const  attrib_index = pmc_new(interp, enum_class_Hash); 
     146    PMC * const  cache        = pmc_new(interp, enum_class_Hash); 
     147     
     148    GETATTR_Class_all_parents(interp, SELF, all_parents); 
    145149 
     150    num_classes =VTABLE_elements(interp, all_parents); 
     151 
    146152    /* Go over the list of all parents to construct the attribute index. */ 
    147153    for (i = 0; i < num_classes; i++) { 
    148154       /* Get the class and check that it respects the standard class interface 
    149155        * (if not we don't know how it stores its attributes, so we'll have to 
    150156        * delegate the lookup). */ 
    151157        PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp, 
    152                                     _class->all_parents, i); 
     158                                    all_parents, i); 
    153159 
    154160        if (PObj_is_class_TEST(cur_class)) 
    155161            cur_index = cache_class_attribs(interp, cur_class, 
     
    157163    } 
    158164 
    159165    /* Store built attribute index and invalidate cache. */ 
    160     _class->attrib_index = attrib_index; 
    161     _class->attrib_cache = cache; 
     166    SETATTR_Class_attrib_index(interp, SELF, attrib_index); 
     167    SETATTR_Class_attrib_cache(interp, SELF, cache); 
    162168} 
     169 
    163170/* Takes a hash and initializes the class based on it. */ 
    164171static void 
    165 init_class_from_hash(PARROT_INTERP, PMC *self, PMC *info) 
     172init_class_from_hash(PARROT_INTERP, PMC *SELF, PMC *info) 
    166173{ 
    167     Parrot_Class_attributes * const _class      = PARROT_CLASS(self); 
    168174    STRING       * const name_str    = CONST_STRING(interp, "name"); 
    169175    STRING       * const parents_str = CONST_STRING(interp, "parents"); 
    170176    STRING       * const methods_str = CONST_STRING(interp, "methods"); 
    171177    STRING       * const roles_str   = CONST_STRING(interp, "roles"); 
    172178    STRING       * const attrs_str   = CONST_STRING(interp, "attributes"); 
    173     PMC          *old_ns; 
    174     STRING       *resolve_method_str; 
     179    STRING              *resolve_method_str; 
     180    PMC                 *old_namespace, *new_namespace; 
    175181 
    176182    /* Ensure we actually have some initialization info. */ 
    177183    if (PMC_IS_NULL(info)) 
    178184        return; 
    179185 
    180186    /* Take a copy of the current namespace the class is attached to. */ 
    181     old_ns = _class->_namespace; 
     187    GETATTR_Class__namespace(interp, SELF, old_namespace); 
    182188 
    183189    /* Check if we have a name/namespace. */ 
    184190    if (VTABLE_exists_keyed_str(interp, info, name_str)) { 
     191        INTVAL  type_num; 
    185192        STRING *new_name; 
    186         PMC    *new_namespace; 
     193        VTABLE *new_vtable; 
     194        PMC    *all_parents; 
    187195        PMC    *name_arg = VTABLE_get_pmc_keyed_str(interp, info, name_str); 
    188         VTABLE *new_vtable; 
    189         INTVAL type_num; 
    190196 
    191197        /* If we were passed a namespace PMC, set the namespace attribute 
    192198         * directly. Otherwise, lookup or create the appropriate namespace. */ 
     
    213219              Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
    214220                "Failed to set name for class."); 
    215221 
    216         _class->_namespace = new_namespace; 
    217         _class->name       = new_name; 
     222        /* Set new name/namespace to SELF */ 
     223        SETATTR_Class_name(interp, SELF, new_name); 
     224        SETATTR_Class__namespace(interp, SELF, new_namespace); 
    218225 
    219226        /* At this point we know the class isn't anonymous */ 
    220         CLASS_is_anon_CLEAR(self); 
     227        CLASS_is_anon_CLEAR(SELF); 
    221228 
    222229        /* Register a type number for the class. */ 
    223230        type_num   = Parrot_oo_register_type(interp, name_arg, new_namespace); 
    224231 
     232        SETATTR_Class_id(interp, SELF, type_num); 
     233 
     234        GETATTR_Class_all_parents(interp, SELF, all_parents); 
     235 
    225236        /* Link the type number with the class's vtable. */ 
    226         new_vtable = Parrot_clone_vtable(interp, self->vtable); 
     237        new_vtable = Parrot_clone_vtable(interp, SELF->vtable); 
    227238 
     239        new_vtable->pmc_class         = SELF; 
    228240        new_vtable->base_type         = type_num; 
    229         new_vtable->pmc_class         = self; 
    230         new_vtable->whoami            = VTABLE_get_string(interp, self); 
    231         new_vtable->mro               = _class->all_parents; 
     241        new_vtable->mro               = all_parents; 
     242        new_vtable->whoami            = VTABLE_get_string(interp, SELF); 
    232243        new_vtable->ro_variant_vtable = 
    233                 Parrot_clone_vtable(interp, self->vtable->ro_variant_vtable); 
     244                Parrot_clone_vtable(interp, SELF->vtable->ro_variant_vtable); 
    234245 
    235246        /* Store the class's vtable in the global table */ 
    236247        interp->vtables[type_num]     = new_vtable; 
    237  
    238         _class->id                    = type_num; 
     248    } else { 
     249        /* no new namespace, so use the old one */ 
     250        new_namespace = old_namespace; 
    239251    } 
    240252 
    241253    /* If we were attached to a namespace and are now attached to a new one, 
    242254     * need to unset ourselves in the old namespace. */ 
    243     if (!PMC_IS_NULL(old_ns) && _class->_namespace != old_ns) 
    244         Parrot_pcc_invoke_method_from_c_args(interp, old_ns, CONST_STRING(interp, "set_class"), "P->", PMCNULL); 
     255    if (!PMC_IS_NULL(old_namespace) && new_namespace != old_namespace) { 
     256        STRING * const set_class_str = CONST_STRING(interp, "set_class"); 
     257        Parrot_pcc_invoke_method_from_c_args(interp, 
     258                old_namespace, set_class_str, "P->", PMCNULL); 
     259    } 
    245260 
    246261    /* Link namespace to this class, if there is one. */ 
    247     if (!PMC_IS_NULL(_class->_namespace)) { 
     262    if (!PMC_IS_NULL(new_namespace)) { 
    248263        STRING * const set_class_str = CONST_STRING(interp, "set_class"); 
    249         Parrot_pcc_invoke_method_from_c_args(interp, _class->_namespace, set_class_str, "P->", 
    250                                              self); 
     264        Parrot_pcc_invoke_method_from_c_args(interp, 
     265                new_namespace, set_class_str, "P->", SELF); 
    251266    } 
    252267 
    253268    /* Initialize resolve_method. */ 
    254269    resolve_method_str = CONST_STRING(interp, "resolve_method"); 
    255270    if (VTABLE_exists_keyed_str(interp, info, resolve_method_str)) { 
    256271        /* Set it. */ 
    257         _class->resolve_method = 
    258             VTABLE_get_pmc_keyed_str(interp, info, resolve_method_str); 
     272        SETATTR_Class_resolve_method(interp, SELF,  
     273                VTABLE_get_pmc_keyed_str(interp, info, resolve_method_str)); 
    259274    } 
    260275 
    261276    /* Initialize parents, if we have any. */ 
    262277    if (VTABLE_exists_keyed_str(interp, info, parents_str)) { 
    263278        /* Loop over parents array and add them. */ 
    264279        PMC * const parent_list = VTABLE_get_pmc_keyed_str(interp, info, 
    265             parents_str); 
     280                                          parents_str); 
    266281        const int  parent_count = VTABLE_elements(interp, parent_list); 
    267282        int i; 
    268283 
    269284        for (i = 0; i < parent_count; i++) 
    270             VTABLE_add_parent(interp, self, 
     285            VTABLE_add_parent(interp, SELF, 
    271286                VTABLE_get_pmc_keyed_int(interp, parent_list, i)); 
    272287    } 
    273288 
     
    280295        int i; 
    281296 
    282297        for (i = 0; i < role_count; i++) 
    283             VTABLE_add_role(interp, self, 
     298            VTABLE_add_role(interp, SELF, 
    284299                VTABLE_get_pmc_keyed_int(interp, role_list, i)); 
    285300    } 
    286301 
     
    288303    if (VTABLE_exists_keyed_str(interp, info, attrs_str)) { 
    289304        /* Loop over attributes array and add them. */ 
    290305        PMC * const attrs_name_list = VTABLE_get_pmc_keyed_str(interp, info, 
    291                                             attrs_str); 
     306                                             attrs_str); 
    292307        const int   attrib_count    = VTABLE_elements(interp, attrs_name_list); 
    293308        int i; 
    294309 
    295310        for (i = 0; i < attrib_count; i++) { 
    296311            STRING * const attr_name = VTABLE_get_string_keyed_int(interp, 
    297312                attrs_name_list, i); 
    298             VTABLE_add_attribute(interp, self, attr_name, PMCNULL); 
     313            VTABLE_add_attribute(interp, SELF, attr_name, PMCNULL); 
    299314        } 
    300315    } 
    301316 
     
    303318    if (VTABLE_exists_keyed_str(interp, info, methods_str)) { 
    304319        /* Get the methods hash. */ 
    305320        PMC * const methods = VTABLE_get_pmc_keyed_str(interp, info, 
    306             methods_str); 
     321                                     methods_str); 
    307322 
    308323        /* Iterate over the list of methods. */ 
    309324        PMC * const iter    = VTABLE_get_iter(interp, methods); 
     
    312327            /* Add the method. */ 
    313328            STRING * const method_name = VTABLE_shift_string(interp, iter); 
    314329            PMC    * const method_pmc  = VTABLE_get_pmc_keyed_str(interp, 
    315                 methods, method_name); 
    316             VTABLE_add_method(interp, self, method_name, method_pmc); 
     330                                                methods, method_name); 
     331            VTABLE_add_method(interp, SELF, method_name, method_pmc); 
    317332        } 
    318333    } 
    319334 
    320335    /* Extract any methods from the namespace */ 
    321     Parrot_oo_extract_methods_from_namespace(interp, self, _class->_namespace); 
     336    Parrot_oo_extract_methods_from_namespace(interp, SELF, new_namespace); 
    322337} 
    323338 
    324339static void 
     
    331346    for (; parent_index >= 0; parent_index--) { 
    332347        PMC *meth; 
    333348        PMC * const parent = VTABLE_get_pmc_keyed_int(interp, 
    334             all_parents, parent_index); 
     349                                    all_parents, parent_index); 
    335350 
    336351        /* PMCProxy parents store an instance to delegate to */ 
    337352        if (parent->vtable->base_type == enum_class_PMCProxy) { 
    338             PMC    *proxy     = VTABLE_instantiate(interp, parent, PMCNULL); 
    339             STRING *proxy_str = CONST_STRING(interp, "proxy"); 
     353            PMC    * const proxy     = VTABLE_instantiate(interp, parent, PMCNULL); 
     354            STRING * const proxy_str = CONST_STRING(interp, "proxy"); 
    340355            VTABLE_set_attr_keyed(interp, object, parent, proxy_str, proxy); 
    341356        } 
    342357 
     
    391406static STRING * 
    392407make_class_name(PARROT_INTERP, PMC *SELF) 
    393408{ 
    394     Parrot_Class_attributes * const  _class    = PARROT_CLASS(SELF); 
    395     PMC          * const _namespace = _class->_namespace; 
     409    PMC    *_namespace; 
     410    STRING *name; 
    396411 
     412    GETATTR_Class__namespace(interp, SELF, _namespace); 
     413 
    397414    if (!PMC_IS_NULL(_namespace)) { 
    398         if (_class->fullname) 
    399             return _class->fullname; 
     415        STRING *fullname; 
     416 
     417        GETATTR_Class_fullname(interp, SELF, fullname); 
     418 
     419        if (fullname) 
     420            return fullname; 
    400421        else { 
    401  
    402422            /* Call the 'get_name' method on the class's associated 
    403423             * namespace to retrieve a fully qualified list of names, then 
    404424             * join the list with a semicolon.  */ 
     
    407427            if (!PMC_IS_NULL(names)) 
    408428                /* remove the HLL namespace name */ 
    409429                VTABLE_shift_string(interp, names); 
    410                 _class->fullname = Parrot_str_join(interp, CONST_STRING(interp, ";"), names); 
    411                 return _class->fullname; 
     430 
     431                fullname = Parrot_str_join(interp, CONST_STRING(interp, ";"), names); 
     432 
     433                SETATTR_Class_fullname(interp, SELF, fullname); 
     434                 
     435                return fullname; 
    412436        } 
    413437    } 
     438    /* Otherwise, copy the stored string name of the class. */ 
     439    GETATTR_Class_name(interp, SELF, name); 
    414440 
    415     /* Otherwise, copy the stored string name of the class. */ 
    416     return _class->name; 
     441    return name; 
    417442} 
    418443 
    419444/* calculates the C3 method resolution order for this class. C3 is the 
     
    424449static void 
    425450calculate_mro(PARROT_INTERP, PMC *SELF, INTVAL num_parents) 
    426451{ 
    427     Parrot_Class_attributes  * const _class = PARROT_CLASS(SELF); 
     452    PMC *mro; 
    428453 
    429454    /* SELF is already on the all_parents */ 
    430455    if (num_parents == 0) 
    431456        return; 
    432457 
    433458    if (num_parents == 1) { 
    434         STRING * const ap         = CONST_STRING(interp, "all_parents"); 
    435         PMC    * const parent     = VTABLE_get_pmc_keyed_int(interp, 
    436                 _class->parents, 0); 
    437         PMC    * const parent_mro = VTABLE_inspect_str(interp, parent, ap); 
    438         PMC    * const mro        = VTABLE_clone(interp, parent_mro); 
     459        PMC    *parent, *parents; 
     460        STRING * const ap = CONST_STRING(interp, "all_parents"); 
     461 
     462        GETATTR_Class_parents(interp, SELF, parents); 
     463 
     464        parent = VTABLE_get_pmc_keyed_int(interp, parents, 0); 
     465        mro    = VTABLE_clone(interp, 
     466                        VTABLE_inspect_str(interp, parent, ap)); 
    439467        VTABLE_unshift_pmc(interp, mro, SELF); 
    440         _class->all_parents = mro; 
     468        SETATTR_Class_all_parents(interp, SELF, mro);; 
    441469    } 
    442     else 
    443         _class->all_parents = Parrot_ComputeMRO_C3(interp, SELF); 
     470    else { 
     471         mro = Parrot_ComputeMRO_C3(interp, SELF); 
     472         SETATTR_Class_all_parents(interp, SELF, mro); 
     473    } 
    444474 
    445475    if (!CLASS_is_anon_TEST(SELF)) 
    446         interp->vtables[VTABLE_type(interp, SELF)]->mro = _class->all_parents; 
     476        interp->vtables[VTABLE_type(interp, SELF)]->mro = mro; 
    447477} 
    448478 
    449479/* 
     
    459489*/ 
    460490 
    461491pmclass Class auto_attrs { 
     492    ATTR INTVAL  id;               /* The type number of the PMC. */ 
     493    ATTR INTVAL  instantiated;     /* Any instantiations since last modification? */ 
     494    ATTR STRING *name;             /* The name of the class. */ 
     495    ATTR STRING *fullname;         /* The name of the class. */ 
     496    ATTR PMC    *_namespace;       /* The namespace it's linked to, if any. */ 
     497    ATTR PMC    *parents;          /* Immediate parent classes. */ 
     498    ATTR PMC    *all_parents;      /* Cached list of ourself and all parents, in MRO order. */ 
     499    ATTR PMC    *roles;            /* An array of roles. */ 
     500    ATTR PMC    *methods;          /* Hash of method names to methods in this class. */ 
     501    ATTR PMC    *vtable_overrides; /* Hash of Parrot v-table methods we override. */ 
     502    ATTR PMC    *attrib_metadata;  /* Hash of attributes in this class to hashes of metadata. */ 
     503    ATTR PMC    *attrib_index;     /* Lookup table for attributes in this and parents. */ 
     504    ATTR PMC    *attrib_cache;     /* Cache of visible attrib names to indexes. */ 
     505    ATTR PMC    *resolve_method;   /* List of method names the class provides to resolve 
     506                                    * conflicts with methods from roles. */ 
     507    ATTR PMC    *parent_overrides; 
     508    ATTR PMC    *meth_cache; 
    462509 
    463     ATTR INTVAL id;             /* The type number of the PMC. */ 
    464     ATTR STRING *name;          /* The name of the class. */ 
    465     ATTR STRING *fullname;      /* The name of the class. */ 
    466     ATTR PMC *_namespace;       /* The namespace it's linked to, if any. */ 
    467     ATTR INTVAL instantiated;   /* Any instantiations since last modification? */ 
    468     ATTR PMC *parents;          /* Immediate parent classes. */ 
    469     ATTR PMC *all_parents;      /* Cached list of ourself and all parents, in MRO order. */ 
    470     ATTR PMC *roles;            /* An array of roles. */ 
    471     ATTR PMC *methods;          /* Hash of method names to methods in this class. */ 
    472     ATTR PMC *vtable_overrides; /* Hash of Parrot v-table methods we override. */ 
    473     ATTR PMC *attrib_metadata;  /* Hash of attributes in this class to hashes of metadata. */ 
    474     ATTR PMC *attrib_index;     /* Lookup table for attributes in this and parents. */ 
    475     ATTR PMC *attrib_cache;     /* Cache of visible attrib names to indexes. */ 
    476     ATTR PMC *resolve_method;   /* List of method names the class provides to resolve 
    477                                  * conflicts with methods from roles. */ 
    478     ATTR PMC *parent_overrides; 
    479     ATTR PMC *meth_cache; 
    480  
    481510/* 
    482511 
    483512=item C<void init()> 
     
    495524*/ 
    496525 
    497526    VTABLE void init() { 
    498         Parrot_Class_attributes * const _class = 
    499                 (Parrot_Class_attributes *) PMC_data(SELF); 
     527        PMC * const all_parents = pmc_new(INTERP, enum_class_ResizablePMCArray); 
    500528 
    501529        /* Set flag for custom GC mark. */ 
    502530        PObj_custom_mark_SET(SELF); 
    503531 
    504532        /* Set up the object. */ 
    505         _class->name            = CONST_STRING(interp, ""); 
    506         _class->_namespace      = PMCNULL; 
    507         _class->parents         = pmc_new(interp, enum_class_ResizablePMCArray); 
    508         _class->all_parents     = pmc_new(interp, enum_class_ResizablePMCArray); 
    509         _class->roles           = pmc_new(interp, enum_class_ResizablePMCArray); 
    510         _class->methods         = pmc_new(interp, enum_class_Hash); 
    511         _class->attrib_metadata = pmc_new(interp, enum_class_Hash); 
    512         _class->attrib_index    = PMCNULL; 
    513         _class->attrib_cache    = PMCNULL; 
    514         _class->meth_cache      = PMCNULL; 
    515         _class->resolve_method  = pmc_new(interp, enum_class_ResizablePMCArray); 
     533        SET_ATTR_name(INTERP, SELF, CONST_STRING(INTERP, "")); 
     534        SET_ATTR__namespace(INTERP, SELF, PMCNULL); 
    516535 
    517         _class->vtable_overrides = pmc_new(interp, enum_class_Hash); 
    518         _class->parent_overrides = pmc_new(interp, enum_class_Hash); 
     536        SET_ATTR_parents(INTERP, SELF, pmc_new(INTERP, enum_class_ResizablePMCArray)); 
     537        SET_ATTR_all_parents(INTERP, SELF, all_parents); 
    519538 
     539        SET_ATTR_roles(INTERP, SELF, pmc_new(INTERP, enum_class_ResizablePMCArray)); 
     540        SET_ATTR_methods(INTERP, SELF, pmc_new(INTERP, enum_class_Hash)); 
     541 
     542        SET_ATTR_attrib_metadata(INTERP, SELF, pmc_new(INTERP, enum_class_Hash)); 
     543        SET_ATTR_attrib_index(INTERP, SELF, PMCNULL); 
     544        SET_ATTR_attrib_cache(INTERP, SELF, PMCNULL); 
     545 
     546        SET_ATTR_meth_cache(INTERP, SELF, PMCNULL); 
     547        SET_ATTR_resolve_method(INTERP, SELF, pmc_new(INTERP, enum_class_ResizablePMCArray)); 
     548 
     549        SET_ATTR_vtable_overrides(INTERP, SELF, pmc_new(INTERP, enum_class_Hash)); 
     550        SET_ATTR_parent_overrides(INTERP, SELF, pmc_new(INTERP, enum_class_Hash)); 
     551 
    520552        /* We put ourself on the all parents list. */ 
    521         VTABLE_push_pmc(interp, _class->all_parents, SELF); 
     553        VTABLE_push_pmc(INTERP, all_parents, SELF); 
    522554 
    523555        /* We are a class. */ 
    524556        PObj_is_class_SET(SELF); 
     
    529561 
    530562    VTABLE void init_pmc(PMC *init_data) { 
    531563        PMC           *arg; 
    532         const INTVAL   arg_type = VTABLE_type(interp, init_data); 
    533         STRING * const name_str = CONST_STRING(interp, "name"); 
     564        const INTVAL   arg_type = VTABLE_type(INTERP, init_data); 
     565        STRING * const name_str = CONST_STRING(INTERP, "name"); 
    534566 
    535567        /* Set up the object. */ 
    536         SELF.init(); 
     568        STATICSELF.init(); 
    537569 
    538570        /* fast attempt to determine init_data type */ 
    539571        switch (arg_type) { 
     
    542574          case enum_class_ResizableStringArray: 
    543575          case enum_class_NameSpace: 
    544576            /* set only the name property */ 
    545             arg = pmc_new(interp, enum_class_Hash); 
    546             VTABLE_set_pmc_keyed_str(interp, arg, name_str, init_data); 
     577            arg = pmc_new(INTERP, enum_class_Hash); 
     578            VTABLE_set_pmc_keyed_str(INTERP, arg, name_str, init_data); 
    547579            break; 
    548580 
    549581          case enum_class_Hash: 
     
    552584 
    553585            /* slow attempt to determine init_data type */ 
    554586          default: 
    555             if (VTABLE_isa(interp, init_data, CONST_STRING(interp, "String")) 
    556              || VTABLE_isa(interp, init_data, CONST_STRING(interp, "Key")) 
    557              || VTABLE_isa(interp, init_data, CONST_STRING(interp, "ResizableStringArray"))) { 
     587            if (VTABLE_isa(INTERP, init_data, CONST_STRING(INTERP, "String")) 
     588             || VTABLE_isa(INTERP, init_data, CONST_STRING(INTERP, "Key")) 
     589             || VTABLE_isa(INTERP, init_data, CONST_STRING(INTERP, "ResizableStringArray"))) { 
    558590                /* set only the name property */ 
    559                 arg = pmc_new(interp, enum_class_Hash); 
    560                 VTABLE_set_pmc_keyed_str(interp, arg, name_str, init_data); 
     591                arg = pmc_new(INTERP, enum_class_Hash); 
     592                VTABLE_set_pmc_keyed_str(INTERP, arg, name_str, init_data); 
    561593            } 
    562594 
    563             if (VTABLE_isa(interp, init_data, CONST_STRING(interp, "Hash"))) 
     595            if (VTABLE_isa(INTERP, init_data, CONST_STRING(INTERP, "Hash"))) 
    564596                arg = init_data; 
    565597            else 
    566598                Parrot_ex_throw_from_c_args(INTERP, NULL, 
     
    570602        } 
    571603 
    572604        /* Initialize the class with the supplied data. */ 
    573         init_class_from_hash(interp, SELF, arg); 
     605        init_class_from_hash(INTERP, SELF, arg); 
    574606    } 
    575607 
    576608/* 
     
    584616*/ 
    585617 
    586618    VTABLE STRING *get_string() { 
    587         return Parrot_str_copy(interp, make_class_name(interp, SELF)); 
     619        return Parrot_str_copy(INTERP, make_class_name(INTERP, SELF)); 
    588620    } 
    589621 
    590622/* 
     
    598630*/ 
    599631 
    600632    VTABLE void mark() { 
    601         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    602         Parrot_gc_mark_STRING_alive(interp, _class->name); 
    603         Parrot_gc_mark_STRING_alive(interp, _class->fullname); 
    604         Parrot_gc_mark_PMC_alive(interp, _class->_namespace); 
    605         Parrot_gc_mark_PMC_alive(interp, _class->parents); 
    606         Parrot_gc_mark_PMC_alive(interp, _class->all_parents); 
    607         Parrot_gc_mark_PMC_alive(interp, _class->roles); 
    608         Parrot_gc_mark_PMC_alive(interp, _class->methods); 
    609         Parrot_gc_mark_PMC_alive(interp, _class->vtable_overrides); 
    610         Parrot_gc_mark_PMC_alive(interp, _class->parent_overrides); 
    611         Parrot_gc_mark_PMC_alive(interp, _class->attrib_metadata); 
    612         Parrot_gc_mark_PMC_alive(interp, _class->attrib_index); 
    613         Parrot_gc_mark_PMC_alive(interp, _class->attrib_cache); 
    614         Parrot_gc_mark_PMC_alive(interp, _class->resolve_method); 
    615         Parrot_gc_mark_PMC_alive(interp, _class->meth_cache); 
     633        STRING *tmp_name; 
     634        PMC    *tmp; 
     635 
     636        if (!PMC_data(SELF)) 
     637            return; 
     638 
     639        GET_ATTR_name(INTERP, SELF, tmp_name); 
     640        Parrot_gc_mark_STRING_alive(INTERP, tmp_name); 
     641 
     642        GET_ATTR_fullname(INTERP, SELF, tmp_name); 
     643        Parrot_gc_mark_STRING_alive(INTERP, tmp_name); 
     644 
     645        GET_ATTR__namespace(INTERP, SELF, tmp); 
     646        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     647 
     648        GET_ATTR_parents(INTERP, SELF, tmp); 
     649        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     650 
     651        GET_ATTR_all_parents(INTERP, SELF, tmp); 
     652        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     653 
     654        GET_ATTR_roles(INTERP, SELF, tmp); 
     655        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     656 
     657        GET_ATTR_methods(INTERP, SELF, tmp); 
     658        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     659 
     660        GET_ATTR_vtable_overrides(INTERP, SELF, tmp); 
     661        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     662 
     663        GET_ATTR_parent_overrides(INTERP, SELF, tmp); 
     664        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     665 
     666        GET_ATTR_attrib_metadata(INTERP, SELF, tmp); 
     667        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     668 
     669        GET_ATTR_attrib_index(INTERP, SELF, tmp); 
     670        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     671 
     672        GET_ATTR_attrib_cache(INTERP, SELF, tmp); 
     673        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     674 
     675        GET_ATTR_resolve_method(INTERP, SELF, tmp); 
     676        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
     677 
     678        GET_ATTR_meth_cache(INTERP, SELF, tmp); 
     679        Parrot_gc_mark_PMC_alive(INTERP, tmp); 
    616680    } 
    617681 
    618682 
     
    630694*/ 
    631695 
    632696    VTABLE void add_attribute(STRING *name, PMC *type) { 
    633         Parrot_Class_attributes * const _class        = PARROT_CLASS(SELF); 
    634         PMC          * const new_attribute = pmc_new(interp, enum_class_Hash); 
     697        INTVAL      instantiated; 
     698        PMC        *attrib_metadata; 
     699        PMC * const new_attribute = pmc_new(INTERP, enum_class_Hash); 
    635700 
     701        GET_ATTR_instantiated(INTERP, SELF, instantiated); 
     702 
    636703        /* If we've been instantiated already, not allowed. */ 
    637         if (_class->instantiated) 
    638             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     704        if (instantiated) 
     705            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    639706                "Modifications to classes are not allowed after instantiation."); 
    640707 
     708        GET_ATTR_attrib_metadata(INTERP, SELF, attrib_metadata); 
     709 
    641710        /* If we already have an attribute of this name, it's an error. */ 
    642         if (VTABLE_exists_keyed_str(interp, _class->attrib_metadata, name)) 
    643             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     711        if (VTABLE_exists_keyed_str(INTERP, attrib_metadata, name)) 
     712            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    644713                "Attribute '%Ss' already exists in '%Ss'.", name, 
    645714                VTABLE_get_string(INTERP, SELF)); 
    646715 
    647716        /* Set name and type. */ 
    648         VTABLE_set_string_keyed_str(interp, new_attribute, CONST_STRING(interp, "name"), name); 
     717        VTABLE_set_string_keyed_str(INTERP, new_attribute, CONST_STRING(INTERP, "name"), name); 
    649718 
    650719        if (!PMC_IS_NULL(type)) 
    651             VTABLE_set_pmc_keyed_str(interp, new_attribute, CONST_STRING(interp, "type"), type); 
     720            VTABLE_set_pmc_keyed_str(INTERP, new_attribute, CONST_STRING(INTERP, "type"), type); 
    652721 
    653722        /* Enter the attribute in the attrib_metadata table. */ 
    654         VTABLE_set_pmc_keyed_str(interp, _class->attrib_metadata, name, 
    655             new_attribute); 
     723        VTABLE_set_pmc_keyed_str(INTERP, attrib_metadata, name, new_attribute); 
    656724    } 
    657725 
    658726/* 
     
    668736*/ 
    669737 
    670738    VTABLE void remove_attribute(STRING *name) { 
    671         Parrot_Class_attributes * const _class        = PARROT_CLASS(SELF); 
     739        INTVAL instantiated; 
     740        PMC   *attrib_metadata; 
    672741 
     742        GET_ATTR_instantiated(INTERP, SELF, instantiated); 
     743 
    673744        /* If we've been instantiated already, not allowed. */ 
    674         if (_class->instantiated) 
    675             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     745        if (instantiated) 
     746            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    676747                "Modifications to classes are not allowed after instantiation."); 
    677748 
     749        GET_ATTR_attrib_metadata(INTERP, SELF, attrib_metadata); 
     750 
    678751        /* If we don't have an attribute of this name, it's an error. */ 
    679         if (!VTABLE_exists_keyed_str(interp, _class->attrib_metadata, name)) 
    680             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     752        if (!VTABLE_exists_keyed_str(INTERP, attrib_metadata, name)) 
     753            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    681754                "Attribute '%Ss' cannot be removed, does not exist in '%Ss'.", name, 
    682755                VTABLE_get_string(INTERP, SELF)); 
    683756 
    684757        /* Remove the attribute from the attrib_metadata table. */ 
    685         VTABLE_delete_keyed_str(interp, _class->attrib_metadata, name); 
     758        VTABLE_delete_keyed_str(INTERP, attrib_metadata, name); 
    686759 
    687         build_attrib_index(interp, SELF); 
     760        build_attrib_index(INTERP, SELF); 
    688761    } 
    689762 
    690763/* 
     
    697770 
    698771*/ 
    699772    VTABLE void add_method(STRING *name, PMC *sub) { 
    700         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    701         PMC                     * const method = 
    702                  VTABLE_get_pmc_keyed_str(interp, _class->methods, name); 
     773        PMC *methods, *method; 
    703774 
     775        GET_ATTR_methods(INTERP, SELF, methods); 
     776 
     777        method = VTABLE_get_pmc_keyed_str(INTERP, methods, name); 
     778 
    704779        /* If we have already added a method with this name... */ 
    705780        if (!PMC_IS_NULL(method)) { 
    706781            if (method == sub) 
    707782                return; 
    708783 
    709             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     784            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    710785                "A method named '%S' already exists in class '%S'. " 
    711786                "It may have been supplied by a role.", 
    712                 name, VTABLE_get_string(interp, SELF)); 
     787                name, VTABLE_get_string(INTERP, SELF)); 
    713788        } 
    714789 
    715790        /* Enter it into the table. */ 
    716         VTABLE_set_pmc_keyed_str(interp, _class->methods, name, sub); 
     791        VTABLE_set_pmc_keyed_str(INTERP, methods, name, sub); 
    717792    } 
    718793 
    719794/* 
     
    726801 
    727802*/ 
    728803    VTABLE void remove_method(STRING *name) { 
    729         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    730         if (VTABLE_exists_keyed_str(interp, _class->methods, name)) 
    731             VTABLE_delete_keyed_str(interp, _class->methods, name); 
     804        PMC *methods; 
     805 
     806        GET_ATTR_methods(INTERP, SELF, methods); 
     807 
     808        if (VTABLE_exists_keyed_str(INTERP, methods, name)) 
     809            VTABLE_delete_keyed_str(INTERP, methods, name); 
    732810        else 
    733             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     811            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    734812                "No method named '%S' to remove in class '%S'.", 
    735                 name, VTABLE_get_string(interp, SELF)); 
     813                name, VTABLE_get_string(INTERP, SELF)); 
    736814    } 
    737815 
    738816/* 
     
    745823 
    746824*/ 
    747825    VTABLE void add_vtable_override(STRING *name, PMC *sub) { 
    748         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    749         PMC                     * const vtable = 
    750             VTABLE_get_pmc_keyed_str(interp, _class->vtable_overrides, name); 
     826        PMC *vtable_overrides, *vtable; 
    751827 
     828        GET_ATTR_vtable_overrides(INTERP, SELF, vtable_overrides); 
     829 
     830        vtable = VTABLE_get_pmc_keyed_str(INTERP, vtable_overrides, name); 
     831 
    752832        /* If we have already added a vtable override with this name... */ 
    753833        if (!PMC_IS_NULL(vtable)) { 
    754834            if (vtable == sub) 
    755835                return; 
    756836 
    757             Parrot_ex_throw_from_c_args(interp, NULL, 
     837            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    758838                EXCEPTION_INVALID_OPERATION, 
    759839                "A vtable override named '%S' already exists in class '%S'. " 
    760840                "It may have been supplied by a role.", 
    761                 name, VTABLE_get_string(interp, SELF)); 
     841                name, VTABLE_get_string(INTERP, SELF)); 
    762842        } 
    763843 
    764844        /* Check that the name is actually valid as a vtable override */ 
    765         if (Parrot_get_vtable_index(interp, name) == -1) 
    766             Parrot_ex_throw_from_c_args(interp, NULL, 
     845        if (Parrot_get_vtable_index(INTERP, name) == -1) 
     846            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    767847                EXCEPTION_METHOD_NOT_FOUND, 
    768848                "'%S' is not a valid vtable function name.", name); 
    769849 
    770850        /* Add it to vtable methods list. */ 
    771         VTABLE_set_pmc_keyed_str(interp, _class->vtable_overrides, name, sub); 
     851        VTABLE_set_pmc_keyed_str(INTERP, vtable_overrides, name, sub); 
    772852    } 
    773853 
    774854/* 
     
    781861 
    782862*/ 
    783863    VTABLE void add_parent(PMC *parent) { 
    784         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    785         int parent_count, index; 
     864        int    parent_count, index; 
     865        INTVAL instantiated; 
     866        PMC   *parents, *all_parents; 
    786867 
     868        GET_ATTR_instantiated(INTERP, SELF, instantiated); 
     869 
    787870        /* If we've been instantiated already, not allowed. */ 
    788         if (_class->instantiated) 
    789             Parrot_ex_throw_from_c_args(interp, NULL, 
     871        if (instantiated) 
     872            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    790873                EXCEPTION_INVALID_OPERATION, 
    791874                "Modifications to classes are not allowed after instantiation."); 
    792875 
    793876        /* Ensure it really is a class. */ 
    794877        if (!PObj_is_class_TEST(parent)) 
    795             Parrot_ex_throw_from_c_args(interp, NULL, 
     878            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    796879                EXCEPTION_INVALID_OPERATION, "Parent isn't a Class."); 
    797880 
    798881        /* Check is not self */ 
    799882        if (parent == SELF) 
    800             Parrot_ex_throw_from_c_args(interp, NULL, 
     883            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    801884                    EXCEPTION_INVALID_OPERATION, "Can't be own parent"); 
    802885 
     886        GET_ATTR_parents(INTERP, SELF, parents); 
     887 
    803888        /* get number of direct parents */ 
    804         parent_count = VTABLE_elements(interp, _class->parents); 
     889        parent_count = VTABLE_elements(INTERP, parents); 
    805890 
    806891        /* iterate over all direct parents, check whether this class already has 
    807892         * the parent being added. */ 
    808893        for (index = 0; index < parent_count; index++) { 
    809894            /* get the next parent */ 
    810             PMC * const current_parent = VTABLE_get_pmc_keyed_int(interp, 
    811                                       _class->parents, index); 
     895            PMC * const current_parent = VTABLE_get_pmc_keyed_int(INTERP, 
     896                                      parents, index); 
    812897 
    813898            /* throw an exception if we already have this parent */ 
    814899            if (current_parent == parent) 
    815                 Parrot_ex_throw_from_c_args(interp, NULL, 
     900                Parrot_ex_throw_from_c_args(INTERP, NULL, 
    816901                    EXCEPTION_INVALID_OPERATION, 
    817902                    "The class '%S' already has a parent class '%S'. " 
    818903                    "It may have been supplied by a role.", 
    819                     VTABLE_get_string(interp, SELF), 
    820                     VTABLE_get_string(interp, parent)); 
     904                    VTABLE_get_string(INTERP, SELF), 
     905                    VTABLE_get_string(INTERP, parent)); 
    821906        } 
    822907 
     908        GET_ATTR_all_parents(INTERP, parent, all_parents); 
     909 
    823910        /* Check that none of the parents is self */ 
    824         parent_count = VTABLE_elements(interp, PARROT_CLASS(parent)->all_parents); 
     911        parent_count = VTABLE_elements(INTERP, all_parents); 
    825912 
    826913        for (index = 0; index < parent_count; index++) { 
    827914            /* get the next parent */ 
    828             PMC * const current_parent = VTABLE_get_pmc_keyed_int(interp, 
    829                 PARROT_CLASS(parent)->all_parents, index); 
     915            PMC * const current_parent = VTABLE_get_pmc_keyed_int(INTERP, 
     916                    all_parents, index); 
    830917 
    831918            if (current_parent == SELF) 
    832                 Parrot_ex_throw_from_c_args(interp, NULL, 
     919                Parrot_ex_throw_from_c_args(INTERP, NULL, 
    833920                    EXCEPTION_INVALID_OPERATION, 
    834921                    "Loop in class hierarchy: '%S' is an ancestor of '%S'.", 
    835                     VTABLE_get_string(interp, SELF), 
    836                     VTABLE_get_string(interp, parent)); 
     922                    VTABLE_get_string(INTERP, SELF), 
     923                    VTABLE_get_string(INTERP, parent)); 
    837924        } 
    838925 
    839926        /* Add to the lists of our immediate parents and all parents. */ 
    840         VTABLE_push_pmc(interp, _class->parents, parent); 
    841         calculate_mro(interp, SELF, parent_count + 1); 
     927        VTABLE_push_pmc(INTERP, parents, parent); 
     928        calculate_mro(INTERP, SELF, parent_count + 1); 
    842929    } 
    843930 
    844931/* 
     
    853940 
    854941*/ 
    855942    VTABLE void remove_parent(PMC *parent) { 
    856         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    857         int parent_count, index; 
     943        int    parent_count, index; 
     944        INTVAL instantiated; 
     945        PMC   *parents, *all_parents; 
    858946 
     947        GET_ATTR_instantiated(INTERP, SELF, instantiated); 
     948 
    859949        /* If we've been instantiated already, not allowed. */ 
    860         if (_class->instantiated) 
    861             Parrot_ex_throw_from_c_args(interp, NULL, 
     950        if (instantiated) 
     951            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    862952                EXCEPTION_INVALID_OPERATION, 
    863953                "Modifications to classes are not allowed after instantiation."); 
    864954 
    865955        /* Ensure it really is a class. */ 
    866956        if (!PObj_is_class_TEST(parent)) 
    867             Parrot_ex_throw_from_c_args(interp, NULL, 
     957            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    868958                EXCEPTION_INVALID_OPERATION, "Parent isn't a Class."); 
    869959 
     960        GET_ATTR_parents(INTERP, SELF, parents); 
     961 
    870962        /* get number of direct parents */ 
    871         parent_count = VTABLE_elements(interp, _class->parents); 
     963        parent_count = VTABLE_elements(INTERP, parents); 
    872964 
    873965        /* iterate over all direct parents, looking for the parent to remove */ 
    874966        for (index = 0; index < parent_count; index++) { 
    875967            /* get the next parent */ 
    876             PMC * const current_parent = VTABLE_get_pmc_keyed_int(interp, 
    877                                       _class->parents, index); 
     968            PMC * const current_parent = VTABLE_get_pmc_keyed_int(INTERP, 
     969                                      parents, index); 
    878970            if (current_parent == parent) 
    879971                break; 
    880972        } 
    881973 
    882974        if (index >= parent_count) 
    883             Parrot_ex_throw_from_c_args(interp, NULL, 
     975            Parrot_ex_throw_from_c_args(INTERP, NULL, 
    884976                EXCEPTION_INVALID_OPERATION, 
    885977                "Can't remove_parent: is not a parent."); 
    886978 
    887         VTABLE_delete_keyed_int(interp, _class->parents, index); 
    888         calculate_mro(interp, SELF, parent_count - 1); 
     979        VTABLE_delete_keyed_int(INTERP, parents, index); 
     980        calculate_mro(INTERP, SELF, parent_count - 1); 
    889981    } 
    890982 
    891983/* 
     
    899991 
    900992*/ 
    901993    VTABLE void add_role(PMC *role) { 
    902         const Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
     994        PMC *resolve_method, *methods, *roles; 
    903995 
     996        GET_ATTR_resolve_method(INTERP, SELF, resolve_method); 
     997        GET_ATTR_methods(INTERP, SELF, methods); 
     998        GET_ATTR_roles(INTERP, SELF, roles); 
     999 
    9041000        /* Do the composition. */ 
    905         Parrot_ComposeRole(interp, role, 
    906             _class->resolve_method, !PMC_IS_NULL(_class->resolve_method), 
    907            PMCNULL, 0, _class->methods, _class->roles); 
     1001        Parrot_ComposeRole(INTERP, role, 
     1002            resolve_method, !PMC_IS_NULL(resolve_method), 
     1003           PMCNULL, 0, methods, roles); 
    9081004    } 
    9091005 
    9101006/* 
     
    9481044 
    9491045*/ 
    9501046    VTABLE PMC *inspect_str(STRING *what) { 
    951         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    952  
    9531047        /* What should we return? */ 
    9541048        PMC *found; 
    9551049 
    956         if (Parrot_str_equal(interp, what, CONST_STRING(interp, "attributes"))) { 
    957             found = _class->attrib_metadata; 
     1050        if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) { 
     1051            GET_ATTR_attrib_metadata(INTERP, SELF, found); 
    9581052        } 
    959         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "parents"))) { 
    960             found = _class->parents; 
     1053        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) { 
     1054            GET_ATTR_parents(INTERP, SELF, found); 
    9611055        } 
    962         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "name"))) { 
    963             found = pmc_new(interp, enum_class_String); 
    964             VTABLE_set_string_native(interp, found, _class->name); 
     1056        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) { 
     1057            STRING *name; 
     1058 
     1059            GET_ATTR_name(INTERP, SELF, name); 
     1060 
     1061            found = pmc_new(INTERP, enum_class_String); 
     1062            VTABLE_set_string_native(INTERP, found, name); 
    9651063        } 
    966         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "id"))) { 
    967             found = pmc_new(interp, enum_class_Integer); 
    968             VTABLE_set_integer_native(interp, found, _class->id); 
     1064        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "id"))) { 
     1065            INTVAL id; 
     1066            GET_ATTR_id(INTERP, SELF, id); 
     1067 
     1068            found = pmc_new(INTERP, enum_class_Integer); 
     1069            VTABLE_set_integer_native(INTERP, found, id); 
    9691070        } 
    970         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "namespace"))) { 
     1071        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) { 
     1072            GET_ATTR__namespace(INTERP, SELF, found); 
     1073 
    9711074            /* Should not clone this. */ 
    972             return _class->_namespace; 
     1075            return found; 
    9731076        } 
    974         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "attrib_index"))) { 
    975             found = _class->attrib_index; 
     1077        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) { 
     1078            GET_ATTR_attrib_index(INTERP, SELF, found); 
    9761079        } 
    977         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "methods"))) { 
    978             found = _class->methods; 
     1080        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) { 
     1081            GET_ATTR_methods(INTERP, SELF, found); 
    9791082        } 
    980         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "vtable_overrides"))) { 
    981             found = _class->vtable_overrides; 
     1083        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) { 
     1084            GET_ATTR_vtable_overrides(INTERP, SELF, found); 
    9821085        } 
    983         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "all_parents"))) { 
    984             found = _class->all_parents; 
     1086        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) { 
     1087            GET_ATTR_all_parents(INTERP, SELF, found); 
    9851088        } 
    986         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "roles"))) { 
    987             found = _class->roles; 
     1089        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) { 
     1090            GET_ATTR_roles(INTERP, SELF, found); 
    9881091        } 
    989         else if (Parrot_str_equal(interp, what, CONST_STRING(interp, "flags"))) { 
    990             found = pmc_new(interp, enum_class_Integer); 
    991             VTABLE_set_integer_native(interp, found, 
     1092        else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) { 
     1093            found = pmc_new(INTERP, enum_class_Integer); 
     1094            VTABLE_set_integer_native(INTERP, found, 
    9921095                (INTVAL)PObj_get_FLAGS(SELF)); 
    9931096        } 
    9941097        else 
    995             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
     1098            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
    9961099                "Unknown introspection value '%S'", what); 
    9971100 
    9981101        /* return found value */ 
     
    10021105        if (found->vtable->base_type == enum_class_Hash) { 
    10031106            /* for Hash return values, create and return a shallow 
    10041107             * clone because the VTABLE_clone does a deep clone */ 
    1005             PMC * const hash  = pmc_new(interp, enum_class_Hash); 
    1006             PMC * const iter  = VTABLE_get_iter(interp, found); 
    1007             while (VTABLE_get_bool(interp, iter)) { 
    1008                 STRING * const key   = VTABLE_shift_string(interp, iter); 
    1009                 PMC    * const value = VTABLE_get_pmc_keyed_str(interp, found, key); 
    1010                 VTABLE_set_pmc_keyed_str(interp, hash, key, value); 
     1108            PMC * const hash  = pmc_new(INTERP, enum_class_Hash); 
     1109            PMC * const iter  = VTABLE_get_iter(INTERP, found); 
     1110            while (VTABLE_get_bool(INTERP, iter)) { 
     1111                STRING * const key   = VTABLE_shift_string(INTERP, iter); 
     1112                PMC    * const value = VTABLE_get_pmc_keyed_str(INTERP, found, key); 
     1113                VTABLE_set_pmc_keyed_str(INTERP, hash, key, value); 
    10111114            } 
    10121115 
    10131116            return hash; 
    10141117        } 
    10151118 
    1016         return VTABLE_clone(interp, found); 
     1119        return VTABLE_clone(INTERP, found); 
    10171120    } 
    10181121 
    10191122/* 
     
    10291132    VTABLE PMC *inspect() { 
    10301133        /* Create a hash, then use inspect_str to get all of the data to 
    10311134         * fill it up with. */ 
    1032         PMC    * const metadata    = pmc_new(interp, enum_class_Hash); 
    1033         STRING * const name_str    = CONST_STRING(interp, "name"); 
    1034         STRING * const ns_str      = CONST_STRING(interp, "namespace"); 
    1035         STRING * const attrs_str   = CONST_STRING(interp, "attributes"); 
    1036         STRING * const meths_str   = CONST_STRING(interp, "methods"); 
    1037         STRING * const parents_str = CONST_STRING(interp, "parents"); 
    1038         STRING * const roles_str   = CONST_STRING(interp, "roles"); 
    1039         STRING * const flags_str   = CONST_STRING(interp, "flags"); 
     1135        PMC    * const metadata    = pmc_new(INTERP, enum_class_Hash); 
     1136        STRING * const name_str    = CONST_STRING(INTERP, "name"); 
     1137        STRING * const ns_str      = CONST_STRING(INTERP, "namespace"); 
     1138        STRING * const attrs_str   = CONST_STRING(INTERP, "attributes"); 
     1139        STRING * const meths_str   = CONST_STRING(INTERP, "methods"); 
     1140        STRING * const parents_str = CONST_STRING(INTERP, "parents"); 
     1141        STRING * const roles_str   = CONST_STRING(INTERP, "roles"); 
     1142        STRING * const flags_str   = CONST_STRING(INTERP, "flags"); 
    10401143 
    1041         VTABLE_set_pmc_keyed_str(interp, metadata, name_str, 
    1042             VTABLE_inspect_str(interp, SELF, name_str)); 
     1144        VTABLE_set_pmc_keyed_str(INTERP, metadata, name_str, 
     1145            VTABLE_inspect_str(INTERP, SELF, name_str)); 
    10431146 
    1044         VTABLE_set_pmc_keyed_str(interp, metadata, ns_str, 
    1045             VTABLE_inspect_str(interp, SELF, ns_str)); 
     1147        VTABLE_set_pmc_keyed_str(INTERP, metadata, ns_str, 
     1148            VTABLE_inspect_str(INTERP, SELF, ns_str)); 
    10461149 
    1047         VTABLE_set_pmc_keyed_str(interp, metadata, attrs_str, 
    1048             VTABLE_inspect_str(interp, SELF, attrs_str)); 
     1150        VTABLE_set_pmc_keyed_str(INTERP, metadata, attrs_str, 
     1151            VTABLE_inspect_str(INTERP, SELF, attrs_str)); 
    10491152 
    1050         VTABLE_set_pmc_keyed_str(interp, metadata, meths_str, 
    1051             VTABLE_inspect_str(interp, SELF, meths_str)); 
     1153        VTABLE_set_pmc_keyed_str(INTERP, metadata, meths_str, 
     1154            VTABLE_inspect_str(INTERP, SELF, meths_str)); 
    10521155 
    1053         VTABLE_set_pmc_keyed_str(interp, metadata, parents_str, 
    1054             VTABLE_inspect_str(interp, SELF, parents_str)); 
     1156        VTABLE_set_pmc_keyed_str(INTERP, metadata, parents_str, 
     1157            VTABLE_inspect_str(INTERP, SELF, parents_str)); 
    10551158 
    1056         VTABLE_set_pmc_keyed_str(interp, metadata, roles_str, 
    1057             VTABLE_inspect_str(interp, SELF, roles_str)); 
     1159        VTABLE_set_pmc_keyed_str(INTERP, metadata, roles_str, 
     1160            VTABLE_inspect_str(INTERP, SELF, roles_str)); 
    10581161 
    1059         VTABLE_set_pmc_keyed_str(interp, metadata, flags_str, 
    1060             VTABLE_inspect_str(interp, SELF, flags_str)); 
     1162        VTABLE_set_pmc_keyed_str(INTERP, metadata, flags_str, 
     1163            VTABLE_inspect_str(INTERP, SELF, flags_str)); 
    10611164 
    10621165        return metadata; 
    10631166    } 
     
    10741177*/ 
    10751178 
    10761179    VTABLE PMC *clone() { 
    1077         Parrot_Class_attributes * const _class    = PARROT_CLASS(SELF); 
     1180        PMC *parents, *roles, *methods, *vtable_overrides; 
     1181        PMC *parent_overrides, *attrib_metadata, *resolve_method; 
    10781182 
    10791183        /* Create the new class PMC, of the same type of this one (we may 
    10801184         * have been subclassed). */ 
    1081         PMC          * const copy      = SUPER(); 
     1185        PMC * const copy = SUPER(); 
    10821186 
     1187        GET_ATTR_parents(INTERP, SELF, parents); 
     1188        GET_ATTR_roles(INTERP, SELF, roles); 
     1189        GET_ATTR_methods(INTERP, SELF, methods); 
     1190        GET_ATTR_vtable_overrides(INTERP, SELF, vtable_overrides); 
     1191        GET_ATTR_parent_overrides(INTERP, SELF, parent_overrides); 
     1192        GET_ATTR_attrib_metadata(INTERP, SELF, attrib_metadata); 
     1193        GET_ATTR_resolve_method(INTERP, SELF, resolve_method); 
     1194 
    10831195        /* Clone parents, roles, methods, attributes and resolve data. We do 
    10841196         * not copy name/namespace related stuff (need anonymous clone) or 
    10851197         * stuff that gets computed on the first instantiation. */ 
     1198        SET_ATTR_name(INTERP, copy, CONST_STRING(INTERP, "")); 
     1199        SET_ATTR__namespace(INTERP, copy, PMCNULL); 
     1200        SET_ATTR_parents(INTERP, copy, VTABLE_clone(INTERP, parents)); 
     1201        SET_ATTR_roles(INTERP, copy, VTABLE_clone(INTERP, roles)); 
     1202        SET_ATTR_methods(INTERP, copy, VTABLE_clone(INTERP, methods)); 
     1203        SET_ATTR_vtable_overrides(INTERP, copy, VTABLE_clone(INTERP, vtable_overrides)); 
     1204        SET_ATTR_parent_overrides(INTERP, copy, VTABLE_clone(INTERP, parent_overrides)); 
     1205        SET_ATTR_attrib_metadata(INTERP, copy, VTABLE_clone(INTERP, attrib_metadata)); 
     1206        SET_ATTR_resolve_method(INTERP, copy, VTABLE_clone(INTERP, resolve_method)); 
    10861207 
    1087         Parrot_Class_attributes * const new_class = PARROT_CLASS(copy); 
    1088  
    1089         new_class->name                = CONST_STRING(interp, ""); 
    1090         new_class->_namespace          = PMCNULL; 
    1091         new_class->parents             = VTABLE_clone(interp, _class->parents); 
    1092         new_class->roles               = VTABLE_clone(interp, _class->roles); 
    1093         new_class->methods             = VTABLE_clone(interp, _class->methods); 
    1094         new_class->vtable_overrides    = VTABLE_clone(interp, 
    1095                                             _class->vtable_overrides); 
    1096         new_class->parent_overrides    = VTABLE_clone(interp, 
    1097                                             _class->parent_overrides); 
    1098         new_class->attrib_metadata     = VTABLE_clone(interp, 
    1099                                             _class->attrib_metadata); 
    1100         new_class->resolve_method      = VTABLE_clone(interp, 
    1101                                             _class->resolve_method); 
    1102  
    11031208        /* Return cloned class. */ 
    11041209        return copy; 
    11051210    } 
     
    11191224 
    11201225    VTABLE PMC *clone_pmc(PMC *args) { 
    11211226        /* Do the standard clone. */ 
    1122         PMC * const copy = SELF.clone(); 
     1227        PMC * const copy = STATICSELF.clone(); 
    11231228 
    1124         init_class_from_hash(interp, copy, args); 
     1229        init_class_from_hash(INTERP, copy, args); 
    11251230 
    11261231        return copy; 
    11271232    } 
     
    11371242*/ 
    11381243 
    11391244    VTABLE PMC *instantiate(PMC *init) { 
    1140         Parrot_Class_attributes  * const _class = PARROT_CLASS(SELF); 
    1141         PMC                      *object; 
     1245        INTVAL instantiated; 
     1246        PMC   *object, *all_parents; 
    11421247 
     1248        GET_ATTR_instantiated(INTERP, SELF, instantiated); 
     1249        GET_ATTR_all_parents(INTERP, SELF, all_parents); 
     1250 
    11431251        /* If we've not been instantiated before... */ 
    1144         if (!_class->instantiated) { 
     1252        if (!instantiated) { 
     1253            int          i, resolve_count; 
     1254            INTVAL       num_parents, mro_length; 
     1255            PMC         *resolve_method, *parents, *methods, *attrib_index; 
     1256            const INTVAL cur_hll = Parrot_pcc_get_HLL(INTERP, CURRENT_CONTEXT(interp)); 
     1257 
     1258            GET_ATTR_parents(INTERP, SELF, parents); 
     1259            GET_ATTR_methods(INTERP, SELF, methods); 
     1260            GET_ATTR_resolve_method(INTERP, SELF, resolve_method); 
     1261 
    11451262            /* Check that we have all methods listed in resolve list. */ 
    1146             const int resolve_count  = VTABLE_elements(interp, 
    1147                                                        _class->resolve_method); 
    1148             const INTVAL cur_hll     = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)); 
    1149             const INTVAL num_parents = VTABLE_elements(interp, _class->parents); 
    1150             INTVAL       mro_length; 
    1151             int          i; 
     1263            resolve_count  = VTABLE_elements(INTERP, resolve_method); 
    11521264 
     1265            num_parents = VTABLE_elements(INTERP, parents); 
     1266 
    11531267            /* don't use HLL mappings for internal-only data */ 
    1154             Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), 0); 
     1268            Parrot_pcc_set_HLL(INTERP, CURRENT_CONTEXT(interp), 0); 
    11551269 
    11561270            for (i = 0; i < resolve_count; i++) { 
    11571271                STRING * const check_meth = 
    1158                     VTABLE_get_string_keyed_int(interp, _class->resolve_method, i); 
    1159                 if (!VTABLE_exists_keyed_str(interp, _class->methods, check_meth)) 
    1160                     Parrot_ex_throw_from_c_args(interp, NULL, 
     1272                    VTABLE_get_string_keyed_int(INTERP, resolve_method, i); 
     1273                if (!VTABLE_exists_keyed_str(INTERP, methods, check_meth)) 
     1274                    Parrot_ex_throw_from_c_args(INTERP, NULL, 
    11611275                        EXCEPTION_METHOD_NOT_FOUND, "The method '%S' was named " 
    11621276                        "in the resolve list, but not supplied", check_meth); 
    11631277            } 
    11641278 
    11651279            /* Build full parents list. 
    11661280             * TT #1256:  Need pluggable MRO, for now always do C3. */ 
    1167             calculate_mro(interp, SELF, num_parents); 
    1168             build_attrib_index(interp, SELF); 
     1281            calculate_mro(INTERP, SELF, num_parents); 
     1282            build_attrib_index(INTERP, SELF); 
    11691283 
    1170             if (PMC_IS_NULL(_class->attrib_index)) 
     1284            GET_ATTR_attrib_index(INTERP, SELF, attrib_index); 
     1285 
     1286            if (PMC_IS_NULL(attrib_index)) 
    11711287                return PMCNULL; 
    11721288 
    11731289            /* See if we have any parents from other universes and if so set a 
    11741290             * flag stating so. */ 
    1175             mro_length = VTABLE_elements(interp, _class->all_parents); 
     1291            mro_length = VTABLE_elements(INTERP, all_parents); 
    11761292 
    11771293            for (i = 0; i < mro_length; i++) { 
    1178                 PMC * const class_check = VTABLE_get_pmc_keyed_int(interp, 
    1179                     _class->all_parents, i); 
     1294                PMC * const class_check = VTABLE_get_pmc_keyed_int(INTERP, 
     1295                                                 all_parents, i); 
    11801296                if (class_check->vtable->base_type != enum_class_Class) { 
    11811297                    /* Found one; that's enough. */ 
    11821298                    CLASS_has_alien_parents_SET(SELF); 
     
    11841300                } 
    11851301            } 
    11861302 
    1187             Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), cur_hll); 
     1303            Parrot_pcc_set_HLL(INTERP, CURRENT_CONTEXT(interp), cur_hll); 
    11881304        } 
    11891305 
    11901306        /* Set instantiated flag. */ 
    1191         _class->instantiated = 1; 
     1307        SET_ATTR_instantiated(INTERP, SELF, 1); 
    11921308 
    11931309        /* Create object. */ 
    1194         object = pmc_new_noinit(interp, enum_class_Object); 
     1310        object = pmc_new_noinit(INTERP, enum_class_Object); 
    11951311 
    11961312        /* Set custom GC mark and destroy on the object. */ 
    11971313        PObj_custom_mark_destroy_SETALL(object); 
     
    12041320        /* TODO: this has been changed in order to use auto_attrs in the 
    12051321         * Object PMC. Needs to be redone in a cleaner way. */ 
    12061322        { 
    1207             Parrot_Object_attributes * const objattr = 
    1208                 PMC_data_typed(object, Parrot_Object_attributes *); 
     1323            Parrot_Object_attributes * const objattr = PARROT_OBJECT(object); 
    12091324            objattr->_class       = SELF; 
    1210             objattr->attrib_store = pmc_new(interp, enum_class_ResizablePMCArray); 
     1325            objattr->attrib_store = pmc_new(INTERP, enum_class_ResizablePMCArray); 
    12111326        } 
    12121327 
    12131328        if (!PMC_IS_NULL(init)) { 
    12141329            /* Initialize attributes with the supplied values. */ 
    1215             PMC * const iter = VTABLE_get_iter(interp, init); 
     1330            PMC * const iter = VTABLE_get_iter(INTERP, init); 
    12161331 
    1217             while (VTABLE_get_bool(interp, iter)) { 
    1218                 STRING * const name  = VTABLE_shift_string(interp, iter); 
    1219                 PMC    * const value = VTABLE_get_pmc_keyed_str(interp, init, 
     1332            while (VTABLE_get_bool(INTERP, iter)) { 
     1333                STRING * const name  = VTABLE_shift_string(INTERP, iter); 
     1334                PMC    * const value = VTABLE_get_pmc_keyed_str(INTERP, init, 
    12201335                                            name); 
    12211336 
    12221337                /* Set the attribute. */ 
    1223                 VTABLE_set_attr_str(interp, object, name, value); 
     1338                VTABLE_set_attr_str(INTERP, object, name, value); 
    12241339            } 
    12251340 
    12261341            /* Check for overrides on the init_pmc vtable function */ 
    1227             initialize_parents_pmc(interp, object, _class->all_parents, init); 
     1342            initialize_parents_pmc(INTERP, object, all_parents, init); 
    12281343        } 
    12291344        else 
    12301345            /* Check for overrides on the init vtable function */ 
    1231             initialize_parents(interp, object, _class->all_parents); 
     1346            initialize_parents(INTERP, object, all_parents); 
    12321347 
    12331348        return object; 
    12341349    } 
     
    12451360*/ 
    12461361 
    12471362    VTABLE INTVAL isa_pmc(PMC *lookup) { 
    1248         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    1249         PMC          *classobj; 
    1250         INTVAL        i, num_classes; 
     1363        INTVAL  i, num_classes; 
     1364        PMC    *classobj, *parents; 
    12511365 
    12521366        if (PMC_IS_NULL(lookup)) 
    12531367            return 0; 
     
    12551369        if (PObj_is_class_TEST(lookup) && lookup == SELF) 
    12561370            return 1; 
    12571371 
    1258         classobj = Parrot_oo_get_class(interp, lookup); 
     1372        classobj = Parrot_oo_get_class(INTERP, lookup); 
    12591373 
    12601374        if (PMC_IS_NULL(classobj)) 
    12611375            return 0; 
    12621376 
    12631377        /* Check if the class object is the same as self's class object */ 
    1264         if (VTABLE_is_same(interp, SELF, classobj)) 
     1378        if (VTABLE_is_same(INTERP, SELF, classobj)) 
    12651379            return 1; 
    12661380 
    12671381        /* this is effectively what the default PMC's isa_pmc does 
     
    12691383         * only in these two, very specific and common cases */ 
    12701384        if (classobj->vtable->base_type == enum_class_Class 
    12711385        ||  classobj->vtable->base_type == enum_class_PMCProxy) { 
    1272             STRING *classname = make_class_name(interp, classobj); 
     1386            STRING * const classname = make_class_name(INTERP, classobj); 
    12731387 
    1274             if (Parrot_str_equal(interp, SELF->vtable->whoami, classname)) 
     1388            if (Parrot_str_equal(INTERP, SELF->vtable->whoami, classname)) 
    12751389                return 1; 
    12761390 
    12771391            if (SELF->vtable->isa_hash 
    1278             &&  parrot_hash_exists(interp, SELF->vtable->isa_hash, 
     1392            &&  parrot_hash_exists(INTERP, SELF->vtable->isa_hash, 
    12791393                                    (void *)classname)) 
    12801394                return 1; 
    12811395        } 
    12821396 
     1397        GET_ATTR_parents(INTERP, SELF, parents); 
     1398 
    12831399        /* Iterate over all the parents and check if they respond true 
    12841400         * for 'isa' on the original comparison. */ 
    1285         num_classes = VTABLE_elements(interp, _class->parents); 
     1401        num_classes = VTABLE_elements(INTERP, parents); 
    12861402 
    12871403        for (i = 0; i < num_classes; i++) { 
    1288             PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp, 
    1289                     _class->parents, i); 
     1404            PMC * const cur_class = VTABLE_get_pmc_keyed_int(INTERP, 
     1405                                           parents, i); 
    12901406 
    1291             if (VTABLE_isa_pmc(interp, cur_class, lookup)) 
     1407            if (VTABLE_isa_pmc(INTERP, cur_class, lookup)) 
    12921408                return 1; 
    12931409        } 
    12941410 
     
    13091425        PMC *want_class; 
    13101426 
    13111427        /* hard-code this one exception right away */ 
    1312         if (Parrot_str_equal(interp, classname, CONST_STRING(interp, "Class"))) 
     1428        if (Parrot_str_equal(INTERP, classname, CONST_STRING(INTERP, "Class"))) 
    13131429            return 1; 
    13141430 
    1315         want_class = Parrot_oo_get_class_str(interp, classname); 
     1431        want_class = Parrot_oo_get_class_str(INTERP, classname); 
    13161432 
    13171433        if (PMC_IS_NULL(want_class)) 
    13181434            return 0; 
     
    13201436        if (SELF == want_class) 
    13211437            return 1; 
    13221438 
    1323         return VTABLE_isa_pmc(interp, SELF, want_class); 
     1439        return VTABLE_isa_pmc(INTERP, SELF, want_class); 
    13241440    } 
    13251441 
    13261442/* 
     
    13331449 
    13341450*/ 
    13351451    VTABLE INTVAL does(STRING *role_name) { 
    1336         Parrot_Class_attributes * const _class    = PARROT_CLASS(SELF); 
    1337         PMC          * const role_list = _class->roles; 
    13381452        INTVAL i, count; 
     1453        PMC   *roles, *parents; 
    13391454 
    1340         if (!role_list) 
     1455        GET_ATTR_roles(INTERP, SELF, roles); 
     1456 
     1457        if (!roles) 
    13411458            return 0; 
    13421459 
    1343         count = VTABLE_elements(interp, role_list); 
     1460        count = VTABLE_elements(INTERP, roles); 
    13441461 
    13451462        for (i = 0; i < count; i++) { 
    1346             PMC * const role = VTABLE_get_pmc_keyed_int(interp, role_list, i); 
     1463            PMC * const role = VTABLE_get_pmc_keyed_int(INTERP, roles, i); 
    13471464 
    1348             if (VTABLE_does(interp, role, role_name)) 
     1465            if (VTABLE_does(INTERP, role, role_name)) 
    13491466                return 1; 
    13501467        } 
    13511468 
     1469        GET_ATTR_parents(INTERP, SELF, parents); 
     1470 
    13521471        /* Iterate over all the parents and check if they respond true 
    13531472         * for 'does' on the original comparison. */ 
    1354         count = VTABLE_elements(interp, _class->parents); 
     1473        count = VTABLE_elements(INTERP, parents); 
    13551474 
    13561475        for (i = 0; i < count; i++) { 
    1357             PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp, 
    1358                     _class->parents, i); 
     1476            PMC * const cur_class = VTABLE_get_pmc_keyed_int(INTERP, 
     1477                    parents, i); 
    13591478 
    1360             if (VTABLE_does(interp, cur_class, role_name)) 
     1479            if (VTABLE_does(INTERP, cur_class, role_name)) 
    13611480                return 1; 
    13621481        } 
    13631482 
    1364         return VTABLE_isa(interp, SELF, role_name); 
     1483        return VTABLE_isa(INTERP, SELF, role_name); 
    13651484    } 
    13661485 
    13671486/* 
     
    13741493 
    13751494*/ 
    13761495    VTABLE INTVAL does_pmc(PMC *role) { 
    1377         Parrot_Class_attributes * const _class    = PARROT_CLASS(SELF); 
    1378         PMC * const role_list          = _class->roles; 
    13791496        INTVAL i, role_count, count; 
     1497        PMC   *roles, *parents; 
    13801498 
    1381         if (!role_list) 
     1499        GET_ATTR_roles(INTERP, SELF, roles); 
     1500 
     1501        if (!roles) 
    13821502            return 0; 
    13831503 
    1384         role_count = VTABLE_elements(interp, role_list); 
     1504        role_count = VTABLE_elements(INTERP, role); 
    13851505 
    13861506        for (i = 0; i < role_count; i++) { 
    1387             PMC    * const test_role = VTABLE_get_pmc_keyed_int(interp, role_list, i); 
    1388             if (VTABLE_does_pmc(interp, test_role, role)) 
     1507            PMC    * const test_role = VTABLE_get_pmc_keyed_int(INTERP, roles, i); 
     1508            if (VTABLE_does_pmc(INTERP, test_role, role)) 
    13891509                return 1; 
    13901510        } 
    13911511 
     1512        GET_ATTR_parents(INTERP, SELF, parents); 
     1513 
    13921514        /* Iterate over all the parents and check if they respond true 
    13931515         * for 'does' on the original comparison. */ 
    1394         count = VTABLE_elements(interp, _class->parents); 
     1516        count = VTABLE_elements(INTERP, parents); 
    13951517 
    13961518        for (i = 0; i < count; i++) { 
    1397             PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp, 
    1398                     _class->parents, i); 
     1519            PMC * const cur_class = VTABLE_get_pmc_keyed_int(INTERP, 
     1520                   parents, i); 
    13991521 
    1400             if (VTABLE_does_pmc(interp, cur_class, role)) 
     1522            if (VTABLE_does_pmc(INTERP, cur_class, role)) 
    14011523                return 1; 
    14021524        } 
    14031525 
    1404         return VTABLE_isa_pmc(interp, SELF, role); 
     1526        return VTABLE_isa_pmc(INTERP, SELF, role); 
    14051527    } 
    14061528 
    14071529/* 
     
    14151537*/ 
    14161538 
    14171539    VTABLE INTVAL type() { 
    1418         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    1419         return _class->id; 
     1540        INTVAL id; 
     1541 
     1542        GET_ATTR_id(INTERP, SELF, id); 
     1543 
     1544        return id; 
    14201545    } 
    14211546 
    14221547/* 
     
    14771602*/ 
    14781603 
    14791604    VTABLE void freeze(visit_info *info) { 
    1480         IMAGE_IO     * const io         = info->image_io; 
    1481         Parrot_Class_attributes * const class_data = PARROT_CLASS(SELF); 
    1482         STRING       *serial_namespace = CONST_STRING(interp, ""); 
     1605        INTVAL           id; 
     1606        PMC             *_namespace; 
     1607        STRING          *name; 
     1608        STRING          *serial_namespace = CONST_STRING(INTERP, ""); 
     1609        IMAGE_IO * const io               = info->image_io; 
    14831610 
     1611        GET_ATTR_id(INTERP, SELF, id); 
     1612        GET_ATTR_name(INTERP, SELF, name); 
     1613        GET_ATTR__namespace(INTERP, SELF, _namespace); 
     1614 
    14841615        /* 1) freeze class id */ 
    1485         VTABLE_push_integer(INTERP, io, class_data->id); 
     1616        VTABLE_push_integer(INTERP, io, id); 
    14861617 
    14871618        /* 2) freeze class name */ 
    1488         VTABLE_push_string(INTERP, io, class_data->name); 
     1619        VTABLE_push_string(INTERP, io, name); 
    14891620 
    14901621        /* 3) serialize namespace name, including HLL */ 
    1491         if (!PMC_IS_NULL(class_data->_namespace)) { 
    1492             PMC * const names = Parrot_ns_get_name(interp, 
    1493                     class_data->_namespace); 
     1622        if (!PMC_IS_NULL(_namespace)) { 
     1623            PMC * const names = Parrot_ns_get_name(INTERP, 
     1624                    _namespace); 
    14941625            if (!PMC_IS_NULL(names)) 
    1495                 serial_namespace = Parrot_str_join(interp, CONST_STRING(interp, ";"), names); 
     1626                serial_namespace = Parrot_str_join(INTERP, CONST_STRING(INTERP, ";"), names); 
    14961627        } 
    14971628        VTABLE_push_string(INTERP, io, serial_namespace); 
    14981629    } 
     
    15261657 
    15271658            /* 3) deserialize namespace name, including HLL */ 
    15281659            STRING * const serial_namespace = VTABLE_shift_string(INTERP, io); 
    1529             STRING * const semicolon_str = CONST_STRING(INTERP, ";"); 
    1530             PMC    * const namespace_array = 
    1531                 Parrot_str_split(INTERP, semicolon_str, serial_namespace); 
    1532             PMC *ns = Parrot_get_namespace_keyed(interp, 
     1660            STRING * const semicolon_str    = CONST_STRING(INTERP, ";"); 
     1661            PMC    * const namespace_array  = 
     1662                    Parrot_str_split(INTERP, semicolon_str, serial_namespace); 
     1663            PMC           *ns               = Parrot_get_namespace_keyed(INTERP, 
    15331664                    INTERP->root_namespace, namespace_array); 
    15341665 
    15351666            /* If the namespace doesn't exist, we create it, and initialize 
    15361667             * ourselves in it */ 
    15371668            if (PMC_IS_NULL(ns)) { 
    1538                 ns = Parrot_make_namespace_keyed(interp, 
     1669                ns = Parrot_make_namespace_keyed(INTERP, 
    15391670                        INTERP->root_namespace, namespace_array); 
    1540                 SELF.init_pmc(ns); 
     1671                STATICSELF.init_pmc(ns); 
    15411672            } 
    15421673            /* If the namespace exists already, we point to it, but otherwise 
    15431674             * act as an anonymous class. */ 
    15441675            else { 
    1545                 SELF.init(); 
    1546                 PARROT_CLASS(SELF)->_namespace = ns; 
     1676                STATICSELF.init(); 
     1677                SET_ATTR__namespace(INTERP, SELF, ns); 
    15471678            } 
    15481679 
     1680            /* Set the class's id the frozen id */ 
     1681            SET_ATTR_id(INTERP, SELF, id); 
     1682 
    15491683            /* Set the class's short name to the frozen name */ 
    1550             PARROT_CLASS(SELF)->name = name; 
    1551  
    1552             /* Set the class's id the frozen id */ 
    1553             PARROT_CLASS(SELF)->id = id; 
     1684            SET_ATTR_name(INTERP, SELF, name); 
    15541685        } 
    15551686    } 
    15561687 
     
    15671698*/ 
    15681699 
    15691700    VTABLE INTVAL get_integer() { 
    1570         return PARROT_CLASS(SELF)->id; 
     1701        INTVAL id; 
     1702 
     1703        GET_ATTR_id(INTERP, SELF, id); 
     1704 
     1705        return id; 
    15711706    } 
    15721707 
    15731708/* 
     
    15811716*/ 
    15821717 
    15831718    VTABLE void thawfinish(visit_info *info) { 
    1584         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    15851719        UNUSED(info) 
    15861720 
    15871721        /* Recalculate full MRO from thawed parents */ 
    1588         _class->all_parents         = Parrot_ComputeMRO_C3(interp, SELF); 
    1589         _class->parent_overrides    = pmc_new(interp, enum_class_Hash); 
     1722        SET_ATTR_all_parents(INTERP, SELF, Parrot_ComputeMRO_C3(INTERP, SELF)); 
     1723        SET_ATTR_parent_overrides(INTERP, SELF, pmc_new(INTERP, enum_class_Hash)); 
    15901724 
    15911725        /* Rebuild attribute index from thawed attribute metadata */ 
    1592         build_attrib_index(interp, SELF); 
     1726        build_attrib_index(INTERP, SELF); 
    15931727    } 
    15941728 
    15951729    /* ********************************************************************** 
     
    16081742 
    16091743*/ 
    16101744    METHOD name(STRING *name :optional, int has_name :opt_flag) { 
    1611         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
    16121745        STRING *ret_name; 
    16131746 
    16141747        if (has_name) { 
    16151748            /* We'll build a hash just containing the name, then give this to 
    16161749             * init_class_from_hash - saves some code duplication. */ 
    1617             PMC    * const naming_hash = pmc_new(interp, enum_class_Hash); 
    1618             STRING * const name_str    = CONST_STRING(interp, "name"); 
     1750            PMC    * const naming_hash = pmc_new(INTERP, enum_class_Hash); 
     1751            STRING * const name_str    = CONST_STRING(INTERP, "name"); 
    16191752 
    1620             VTABLE_set_string_keyed_str(interp, naming_hash, name_str, name); 
    1621             init_class_from_hash(interp, SELF, naming_hash); 
     1753            VTABLE_set_string_keyed_str(INTERP, naming_hash, name_str, name); 
     1754            init_class_from_hash(INTERP, SELF, naming_hash); 
    16221755        } 
    16231756 
    1624         ret_name = _class->name; 
     1757        GET_ATTR_name(INTERP, SELF, ret_name); 
     1758 
    16251759        RETURN(STRING *ret_name); 
    16261760    } 
    16271761 
     
    16351769 
    16361770*/ 
    16371771    METHOD get_namespace(PMC *_namespace :optional, int has_name :opt_flag) { 
    1638         Parrot_Class_attributes * const _class        = PARROT_CLASS(SELF); 
    1639         PMC          * const ret_namespace = _class->_namespace; 
     1772        PMC * ret_namespace; 
     1773 
    16401774        UNUSED(_namespace); 
    16411775        UNUSED(has_name); 
     1776 
     1777        GET_ATTR__namespace(INTERP, SELF, ret_namespace); 
     1778 
    16421779        RETURN(PMC *ret_namespace); 
    16431780    } 
    16441781 
     
    16531790 
    16541791*/ 
    16551792    METHOD resolve_method(PMC *resolve_list :optional, int has_list :opt_flag) { 
    1656         Parrot_Class_attributes * const _class   = PARROT_CLASS(SELF); 
    16571793        PMC *ret_list; 
    16581794 
    16591795        /* Store list. */ 
    16601796        if (has_list) 
    1661             _class->resolve_method = resolve_list; 
     1797            SET_ATTR_resolve_method(INTERP, SELF, resolve_list); 
    16621798 
    1663         ret_list = _class->resolve_method; 
     1799        GET_ATTR_resolve_method(INTERP, SELF, ret_list); 
     1800 
    16641801        RETURN(PMC *ret_list); 
    16651802    } 
    16661803 
     
    16781815        /* Check if any arguments are in the slurpy hash, don't pass an empty 
    16791816         * hash to instantiate */ 
    16801817        PMC * const obj = 
    1681             VTABLE_elements(interp, args) > 0 
    1682                 ? VTABLE_instantiate(interp, SELF, args) 
    1683                 : VTABLE_instantiate(interp, SELF, PMCNULL); 
     1818            VTABLE_elements(INTERP, args) > 0 
     1819                ? VTABLE_instantiate(INTERP, SELF, args) 
     1820                : VTABLE_instantiate(INTERP, SELF, PMCNULL); 
    16841821 
    16851822        RETURN(PMC *obj); 
    16861823     } 
     
    16961833 
    16971834*/ 
    16981835    METHOD attributes() { 
    1699         STRING * const attr_str            = CONST_STRING(interp, "attributes"); 
     1836        STRING * const attr_str            = CONST_STRING(INTERP, "attributes"); 
    17001837        PMC    * const ret_attrib_metadata = SELF.inspect_str(attr_str); 
    17011838 
    17021839        RETURN(PMC *ret_attrib_metadata); 
     
    17271864 
    17281865*/ 
    17291866    METHOD methods() { 
    1730         PMC * const ret_methods = SELF.inspect_str(CONST_STRING(interp, "methods")); 
     1867        PMC * const ret_methods = SELF.inspect_str(CONST_STRING(INTERP, "methods")); 
    17311868 
    17321869        RETURN(PMC *ret_methods); 
    17331870    } 
     
    17571894 
    17581895*/ 
    17591896    METHOD add_vtable_override(STRING *name, PMC *sub) { 
    1760         VTABLE_add_vtable_override(interp, SELF, name, sub); 
     1897        SELF.add_vtable_override(name, sub); 
    17611898    } 
    17621899 
    17631900/* 
     
    17701907 
    17711908*/ 
    17721909    METHOD remove_method(STRING *name) { 
    1773         VTABLE_remove_method(interp, SELF, name); 
     1910        SELF.remove_method(name); 
    17741911    } 
    17751912 
    17761913/* 
     
    17841921*/ 
    17851922 
    17861923    METHOD find_method(STRING *name) { 
    1787         Parrot_Class_attributes * const  _class    = PARROT_CLASS(SELF); 
    1788         int i; 
     1924        int  i, num_classes; 
     1925        PMC *all_parents; 
    17891926 
     1927        GET_ATTR_all_parents(INTERP, SELF , all_parents); 
     1928 
    17901929        /* Walk and search. One day, we'll use the cache first. */ 
    1791         const int num_classes = VTABLE_elements(interp, _class->all_parents); 
     1930        num_classes = VTABLE_elements(INTERP, all_parents); 
    17921931 
    17931932        for (i = 0; i < num_classes; i++) { 
     1933            PMC        *methods; 
     1934 
    17941935            /* Get the class and see if it has the method. */ 
    17951936            PMC * const cur_class = 
    1796                 VTABLE_get_pmc_keyed_int(interp, _class->all_parents, i); 
    1797             const Parrot_Class_attributes * const class_info = PARROT_CLASS(cur_class); 
     1937                VTABLE_get_pmc_keyed_int(INTERP, all_parents, i); 
    17981938 
     1939            GET_ATTR_methods(INTERP, cur_class, methods); 
     1940 
    17991941            /* Found it! */ 
    1800             if (VTABLE_exists_keyed_str(interp, class_info->methods, name)) { 
    1801                 PMC * const ret = VTABLE_get_pmc_keyed_str(interp, class_info->methods, name); 
     1942            if (VTABLE_exists_keyed_str(INTERP, methods, name)) { 
     1943                PMC * const ret = VTABLE_get_pmc_keyed_str(INTERP, methods, name); 
    18021944                RETURN(PMC *ret); 
    18031945            } 
    18041946        } 
     
    18161958 
    18171959*/ 
    18181960    METHOD parents() { 
    1819         PMC * const ret_parents = SELF.inspect_str(CONST_STRING(interp, "parents")); 
     1961        PMC * const ret_parents = SELF.inspect_str(CONST_STRING(INTERP, "parents")); 
    18201962 
    18211963        RETURN(PMC *ret_parents); 
    18221964    } 
     
    18441986 
    18451987*/ 
    18461988    METHOD roles() { 
    1847         PMC * const ret_roles = SELF.inspect_str(CONST_STRING(interp, "roles")); 
     1989        PMC * const ret_roles = SELF.inspect_str(CONST_STRING(INTERP, "roles")); 
    18481990 
    18491991        RETURN(PMC *ret_roles); 
    18501992    } 
     
    18602002 
    18612003*/ 
    18622004    METHOD add_role(PMC *role, 
    1863             PMC *exclude_method     :optional :named("exclude_method"), 
    1864             int has_exclude_method  :opt_flag, 
    1865             PMC *alias_method       :optional :named("alias_method"), 
    1866             int has_alias_method    :opt_flag) { 
     2005            PMC *exclude_method      :optional :named("exclude_method"), 
     2006            int  has_exclude_method  :opt_flag, 
     2007            PMC *alias_method        :optional :named("alias_method"), 
     2008            int  has_alias_method    :opt_flag) { 
     2009        PMC *resolve_method, *methods, *roles; 
    18672010 
    1868         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); 
     2011        GET_ATTR_resolve_method(INTERP, SELF, resolve_method); 
     2012        GET_ATTR_methods(INTERP, SELF, methods); 
     2013        GET_ATTR_roles(INTERP, SELF, roles); 
    18692014 
    18702015        /* Add everything on the resolve list to the exclude list; if we have 
    18712016         * no exclude list, pass along the resolve list in its place if it has 
    18722017         * any methods listed in it. */ 
    18732018        if (!has_exclude_method) { 
    1874             if (VTABLE_elements(interp, _class->resolve_method) != 0) { 
    1875                 exclude_method     = _class->resolve_method; 
     2019            if (VTABLE_elements(INTERP, resolve_method) != 0) { 
     2020                exclude_method     = resolve_method; 
    18762021                has_exclude_method = 1; 
    18772022            } 
    18782023        } 
    18792024        else { 
    1880             const int resolve_count = VTABLE_elements(interp, _class->resolve_method); 
     2025            const int resolve_count = VTABLE_elements(INTERP, resolve_method); 
    18812026            int i; 
    18822027 
    18832028            for (i = 0; i < resolve_count; i++) { 
    1884                 STRING * const meth_name = VTABLE_get_string_keyed_int(interp, 
    1885                     _class->resolve_method, i); 
    1886                 VTABLE_push_string(interp, exclude_method, meth_name); 
     2029                STRING * const meth_name = VTABLE_get_string_keyed_int(INTERP, 
     2030                        resolve_method, i); 
     2031                VTABLE_push_string(INTERP, exclude_method, meth_name); 
    18872032            } 
    18882033        } 
    18892034 
    18902035        /* Do the composition. */ 
    1891         Parrot_ComposeRole(interp, role, exclude_method, has_exclude_method, 
    1892                            alias_method, has_alias_method, 
    1893                            _class->methods, _class->roles); 
     2036        Parrot_ComposeRole(INTERP, role, exclude_method, has_exclude_method, 
     2037               alias_method, has_alias_method, methods, roles); 
    18942038    } 
    18952039 
    18962040/* 
     
    19422086 
    19432087*/ 
    19442088    METHOD does(STRING *role_name) { 
    1945         const INTVAL does = VTABLE_does(interp, SELF, role_name); 
     2089        const INTVAL does = VTABLE_does(INTERP, SELF, role_name); 
    19462090        RETURN(INTVAL does); 
    19472091    } 
    19482092