Merge master into topic/xs-attr-template
[gitmo/Class-MOP.git] / xs / Package.xs
index 362c407..d6ac749 100644 (file)
@@ -34,7 +34,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
 
         method_slot = *hv_fetch(map, method_name, method_name_len, TRUE);
         if ( SvOK(method_slot) ) {
-            SV *const body = mop_call0(aTHX_ method_slot, KEY_FOR(body)); /* $method_object->body() */
+            SV *const body = mop_call0(aTHX_ method_slot, mop_body); /* $method_object->body() */
             if ( SvROK(body) && ((CV *) SvRV(body)) == cv ) {
                 continue;
             }
@@ -59,9 +59,9 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas
         mPUSHs(newRV_inc((SV *)cv));
         PUSHs(mop_associated_metaclass);
         PUSHs(self);
-        PUSHs(KEY_FOR(package_name));
+        PUSHs(mop_package_name);
         PUSHs(class_name);
-        PUSHs(KEY_FOR(name));
+        PUSHs(mop_name);
         mPUSHs(newSVpv(method_name, method_name_len));
         PUTBACK;
 
@@ -100,7 +100,7 @@ get_all_package_symbols(self, filter=TYPE_FILTER_NONE)
 
         PUTBACK;
 
-        if ( (he = hv_fetch_ent((HV *)SvRV(self), KEY_FOR(package), 0, HASH_FOR(package))) ) {
+        if ( (he = hv_fetch_ent((HV *)SvRV(self), mop_package, 0, 0U)) ) {
             stash = gv_stashsv(HeVAL(he), 0);
         }
 
@@ -117,7 +117,7 @@ get_method_map(self)
     SV *self
     PREINIT:
         HV *const obj        = (HV *)SvRV(self);
-        SV *const class_name = HeVAL( hv_fetch_ent(obj, KEY_FOR(package), 0, HASH_FOR(package)) );
+        SV *const class_name = HeVAL( hv_fetch_ent(obj, mop_package, 0, 0U) );
         HV *const stash      = gv_stashsv(class_name, 0);
         UV current;
         SV *cache_flag;
@@ -129,8 +129,8 @@ get_method_map(self)
         }
 
         current    = mop_check_package_cache_flag(aTHX_ stash);
-        cache_flag = HeVAL( hv_fetch_ent(obj, KEY_FOR(package_cache_flag), TRUE, HASH_FOR(package_cache_flag)));
-        map_ref    = HeVAL( hv_fetch_ent(obj, KEY_FOR(methods), TRUE, HASH_FOR(methods)));
+        cache_flag = HeVAL( hv_fetch_ent(obj, mop_package_cache_flag, TRUE, 0U));
+        map_ref    = HeVAL( hv_fetch_ent(obj, mop_methods, TRUE, 0U));
 
         /* $self->{methods} does not yet exist (or got deleted) */
         if ( !SvROK(map_ref) || SvTYPE(SvRV(map_ref)) != SVt_PVHV ) {
@@ -148,3 +148,6 @@ get_method_map(self)
 
 BOOT:
     INSTALL_SIMPLE_READER_WITH_KEY(Package, name, package);
+    INSTALL_SIMPLE_READER(Package, method_metaclass);
+    INSTALL_SIMPLE_READER(Package, wrapped_method_metaclass);
+    INSTALL_SIMPLE_READER_WITH_KEY(Package, _method_map, methods);