[svn:parrot] r43314 - branches/pmc_freeze_cleanup/src/pmc

plobsing at svn.parrot.org plobsing at svn.parrot.org
Wed Dec 30 04:16:31 UTC 2009


Author: plobsing
Date: Wed Dec 30 04:16:23 2009
New Revision: 43314
URL: https://trac.parrot.org/parrot/changeset/43314

Log:
remove checking for EXTRA_IS_NULL in PMCs (it will always be so)

Modified:
   branches/pmc_freeze_cleanup/src/pmc/array.pmc
   branches/pmc_freeze_cleanup/src/pmc/class.pmc
   branches/pmc_freeze_cleanup/src/pmc/fixedbooleanarray.pmc
   branches/pmc_freeze_cleanup/src/pmc/fixedintegerarray.pmc
   branches/pmc_freeze_cleanup/src/pmc/fixedpmcarray.pmc
   branches/pmc_freeze_cleanup/src/pmc/fixedstringarray.pmc
   branches/pmc_freeze_cleanup/src/pmc/float.pmc
   branches/pmc_freeze_cleanup/src/pmc/hash.pmc
   branches/pmc_freeze_cleanup/src/pmc/integer.pmc
   branches/pmc_freeze_cleanup/src/pmc/lexinfo.pmc
   branches/pmc_freeze_cleanup/src/pmc/parrotinterpreter.pmc
   branches/pmc_freeze_cleanup/src/pmc/resizableintegerarray.pmc
   branches/pmc_freeze_cleanup/src/pmc/string.pmc
   branches/pmc_freeze_cleanup/src/pmc/sub.pmc

Modified: branches/pmc_freeze_cleanup/src/pmc/array.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/array.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/array.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -1200,10 +1200,8 @@
 
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            SELF.set_integer_native(VTABLE_shift_integer(INTERP, info));
+        SELF.set_integer_native(VTABLE_shift_integer(INTERP, info));
     }
-}
 
 /*
 

Modified: branches/pmc_freeze_cleanup/src/pmc/class.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/class.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/class.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -1496,41 +1496,39 @@
          * anonymous class and later decide whether to link it into the
          * namespace.  */
 
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            /* 1) thaw class id */
-            const INTVAL id = VTABLE_shift_integer(INTERP, info);
-
-            /* 2) thaw class name */
-            STRING * const name = VTABLE_shift_string(INTERP, info);
-
-            /* 3) deserialize namespace name, including HLL */
-            STRING * const serial_namespace = VTABLE_shift_string(INTERP, info);
-            STRING * const semicolon_str = CONST_STRING(INTERP, ";");
-            PMC    * const namespace_array =
-                Parrot_str_split(INTERP, semicolon_str, serial_namespace);
-            PMC *ns = Parrot_get_namespace_keyed(interp,
-                    INTERP->root_namespace, namespace_array);
+        /* 1) thaw class id */
+        const INTVAL id = VTABLE_shift_integer(INTERP, info);
 
-            /* If the namespace doesn't exist, we create it, and initialize
-             * ourselves in it */
-            if (PMC_IS_NULL(ns)) {
-                ns = Parrot_make_namespace_keyed(interp,
-                        INTERP->root_namespace, namespace_array);
-                SELF.init_pmc(ns);
-            }
-            /* If the namespace exists already, we point to it, but otherwise
-             * act as an anonymous class. */
-            else {
-                SELF.init();
-                PARROT_CLASS(SELF)->_namespace = ns;
-            }
+        /* 2) thaw class name */
+        STRING * const name = VTABLE_shift_string(INTERP, info);
 
-            /* Set the class's short name to the frozen name */
-            PARROT_CLASS(SELF)->name = name;
-
-            /* Set the class's id the frozen id */
-            PARROT_CLASS(SELF)->id = id;
+        /* 3) deserialize namespace name, including HLL */
+        STRING * const serial_namespace = VTABLE_shift_string(INTERP, info);
+        STRING * const semicolon_str = CONST_STRING(INTERP, ";");
+        PMC    * const namespace_array =
+            Parrot_str_split(INTERP, semicolon_str, serial_namespace);
+        PMC *ns = Parrot_get_namespace_keyed(interp,
+                INTERP->root_namespace, namespace_array);
+
+        /* If the namespace doesn't exist, we create it, and initialize
+         * ourselves in it */
+        if (PMC_IS_NULL(ns)) {
+            ns = Parrot_make_namespace_keyed(interp,
+                    INTERP->root_namespace, namespace_array);
+            SELF.init_pmc(ns);
         }
+        /* If the namespace exists already, we point to it, but otherwise
+         * act as an anonymous class. */
+        else {
+            SELF.init();
+            PARROT_CLASS(SELF)->_namespace = ns;
+        }
+
+        /* Set the class's short name to the frozen name */
+        PARROT_CLASS(SELF)->name = name;
+
+        /* Set the class's id the frozen id */
+        PARROT_CLASS(SELF)->id = id;
     }
 
 /*

Modified: branches/pmc_freeze_cleanup/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/fixedbooleanarray.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/fixedbooleanarray.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -540,7 +540,7 @@
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
 
-        if (info->extra_flags == EXTRA_IS_NULL) {
+        {
             unsigned char * bit_array;
             UINTVAL         threshold;
             const INTVAL    size      = VTABLE_shift_integer(INTERP, info);

Modified: branches/pmc_freeze_cleanup/src/pmc/fixedintegerarray.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/fixedintegerarray.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/fixedintegerarray.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -574,27 +574,23 @@
     }
 
     VTABLE void thaw(visit_info *info) {
-        PObj_custom_destroy_SET(SELF);
+        INTVAL n;
 
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            const INTVAL n = VTABLE_shift_integer(INTERP, info);
+        SUPER(info);
 
-            SET_ATTR_size(INTERP, SELF, 0);
-            SET_ATTR_int_array(INTERP, SELF, NULL);
+        SET_ATTR_size(INTERP, SELF, 0);
+        SET_ATTR_int_array(INTERP, SELF, NULL);
 
-            if (n) {
-                INTVAL  i;
-                INTVAL *int_array;
+        if ((n = VTABLE_shift_integer(INTERP, info))) {
+            INTVAL  i;
+            INTVAL *int_array;
 
-                SELF.set_integer_native(n);
-                GET_ATTR_int_array(INTERP, SELF, int_array);
+            SELF.set_integer_native(n);
+            GET_ATTR_int_array(INTERP, SELF, int_array);
 
-                for (i = 0; i < n; ++i)
-                    int_array[i] = VTABLE_shift_integer(INTERP, info);
-            }
+            for (i = 0; i < n; ++i)
+                int_array[i] = VTABLE_shift_integer(INTERP, info);
         }
-        else
-            SUPER(info);
     }
 }
 

Modified: branches/pmc_freeze_cleanup/src/pmc/fixedpmcarray.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/fixedpmcarray.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/fixedpmcarray.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -727,8 +727,7 @@
 
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
-        if (info->extra_flags == EXTRA_IS_NULL)
-            SELF.set_integer_native(VTABLE_shift_integer(INTERP, info));
+        SELF.set_integer_native(VTABLE_shift_integer(INTERP, info));
     }
 
 /*

Modified: branches/pmc_freeze_cleanup/src/pmc/fixedstringarray.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/fixedstringarray.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/fixedstringarray.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -588,21 +588,18 @@
 
 */
     VTABLE void thaw(visit_info *info) {
+        UINTVAL  i, size;
+        STRING **str_array;
+
+        SELF.init();
         SUPER(info);
 
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            UINTVAL  i, size;
-            STRING **str_array;
-
-            SELF.init();
-
-            size   = VTABLE_shift_integer(INTERP, info);
-            SELF.set_integer_native((INTVAL)size);
-            GET_ATTR_str_array(INTERP, SELF, str_array);
-
-            for (i = 0; i < size; ++i)
-                str_array[i] = VTABLE_shift_string(INTERP, info);
-        }
+        size   = VTABLE_shift_integer(INTERP, info);
+        SELF.set_integer_native((INTVAL)size);
+        GET_ATTR_str_array(INTERP, SELF, str_array);
+
+        for (i = 0; i < size; ++i)
+            str_array[i] = VTABLE_shift_string(INTERP, info);
     }
 }
 

Modified: branches/pmc_freeze_cleanup/src/pmc/float.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/float.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/float.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -367,8 +367,7 @@
 */
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
-        if (info->extra_flags == EXTRA_IS_NULL)
-            SET_ATTR_fv(INTERP, SELF, VTABLE_shift_float(INTERP, info));
+        SET_ATTR_fv(INTERP, SELF, VTABLE_shift_float(INTERP, info));
     }
 /*
 

Modified: branches/pmc_freeze_cleanup/src/pmc/hash.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/hash.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/hash.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -1122,7 +1122,8 @@
 
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
-        if (info->extra_flags == EXTRA_IS_NULL) {
+
+        {
             const INTVAL elems  = VTABLE_shift_integer(INTERP, info);
             const INTVAL k_type = VTABLE_shift_integer(INTERP, info);
             const INTVAL v_type = VTABLE_shift_integer(INTERP, info);

Modified: branches/pmc_freeze_cleanup/src/pmc/integer.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/integer.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/integer.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -1328,8 +1328,7 @@
 */
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
-        if (info->extra_flags == EXTRA_IS_NULL)
-            SELF.set_integer_native(VTABLE_shift_integer(INTERP, info));
+        SELF.set_integer_native(VTABLE_shift_integer(INTERP, info));
     }
 }
 

Modified: branches/pmc_freeze_cleanup/src/pmc/lexinfo.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/lexinfo.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/lexinfo.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -140,27 +140,22 @@
 
 
     VTABLE void thaw(visit_info *info) {
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            const INTVAL elems  = VTABLE_shift_integer(INTERP, info);
-            const INTVAL k_type = VTABLE_shift_integer(INTERP, info);
-            const INTVAL v_type = VTABLE_shift_integer(INTERP, info);
-            Hash        *hash;
-
-            UNUSED(k_type);
-            UNUSED(v_type);
-
-            PARROT_ASSERT(v_type == enum_hash_int);
-            /* TODO make a better interface for hash creation
-             * TODO create hash with needed types in the first place
-             */
-
-            SELF.init_pmc(NULL);
-            hash          = (Hash *)SELF.get_pointer();
-            hash->entries = elems;
-        }
-        else {
-            SUPER(info);
-        }
+        const INTVAL elems  = VTABLE_shift_integer(INTERP, info);
+        const INTVAL k_type = VTABLE_shift_integer(INTERP, info);
+        const INTVAL v_type = VTABLE_shift_integer(INTERP, info);
+        Hash        *hash;
+
+        UNUSED(k_type);
+        UNUSED(v_type);
+
+        PARROT_ASSERT(v_type == enum_hash_int);
+        /* TODO make a better interface for hash creation
+         * TODO create hash with needed types in the first place
+         */
+
+        SELF.init_pmc(NULL);
+        hash          = (Hash *)SELF.get_pointer();
+        hash->entries = elems;
     }
 }
 

Modified: branches/pmc_freeze_cleanup/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/parrotinterpreter.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/parrotinterpreter.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -720,17 +720,14 @@
     }
 
     VTABLE void thaw(visit_info *info) {
-        if (info->extra_flags == EXTRA_IS_NULL) {
-
-            if (!PMC_data(SELF)) {
-                Parrot_ParrotInterpreter_attributes *attrs =
-                    mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
-                PMC_data(SELF) = attrs;
-                PObj_custom_destroy_SET(SELF);
-            }
-
-            PMC_interp(SELF) = INTERP;
+        if (!PMC_data(SELF)) {
+            Parrot_ParrotInterpreter_attributes *attrs =
+                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
+            PMC_data(SELF) = attrs;
+            PObj_custom_destroy_SET(SELF);
         }
+
+        PMC_interp(SELF) = INTERP;
     }
 
     VTABLE void thawfinish(visit_info *info) {

Modified: branches/pmc_freeze_cleanup/src/pmc/resizableintegerarray.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/resizableintegerarray.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/resizableintegerarray.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -309,27 +309,23 @@
     }
 
     VTABLE void thaw(visit_info *info) {
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            const INTVAL n = VTABLE_shift_integer(INTERP, info);
-            const INTVAL rt = VTABLE_shift_integer(INTERP, info);
-
-            SET_ATTR_size(INTERP, SELF, 0);
-            SET_ATTR_resize_threshold(INTERP, SELF, rt);
-            SET_ATTR_int_array(INTERP, SELF, NULL);
-
-            if (n) {
-                INTVAL  i;
-                INTVAL *int_array;
-
-                SELF.set_integer_native(n);
-                GET_ATTR_int_array(INTERP, SELF, int_array);
-
-                for (i = 0; i < n; ++i)
-                    int_array[i] = VTABLE_shift_integer(INTERP, info);
-            }
+        const INTVAL n = VTABLE_shift_integer(INTERP, info);
+        const INTVAL rt = VTABLE_shift_integer(INTERP, info);
+
+        SET_ATTR_size(INTERP, SELF, 0);
+        SET_ATTR_resize_threshold(INTERP, SELF, rt);
+        SET_ATTR_int_array(INTERP, SELF, NULL);
+
+        if (n) {
+            INTVAL  i;
+            INTVAL *int_array;
+
+            SELF.set_integer_native(n);
+            GET_ATTR_int_array(INTERP, SELF, int_array);
+
+            for (i = 0; i < n; ++i)
+                int_array[i] = VTABLE_shift_integer(INTERP, info);
         }
-        else
-            SUPER(info);
     }
 
 

Modified: branches/pmc_freeze_cleanup/src/pmc/string.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/string.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/string.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -797,8 +797,7 @@
 */
     VTABLE void thaw(visit_info *info) {
         SUPER(info);
-        if (info->extra_flags == EXTRA_IS_NULL)
-            SET_ATTR_str_val(INTERP, SELF, VTABLE_shift_string(INTERP, info));
+        SET_ATTR_str_val(INTERP, SELF, VTABLE_shift_string(INTERP, info));
     }
 /*
 

Modified: branches/pmc_freeze_cleanup/src/pmc/sub.pmc
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc/sub.pmc	Wed Dec 30 03:59:16 2009	(r43313)
+++ branches/pmc_freeze_cleanup/src/pmc/sub.pmc	Wed Dec 30 04:16:23 2009	(r43314)
@@ -712,35 +712,33 @@
 */
 
     VTABLE void thaw(visit_info *info) {
+        Parrot_Sub_attributes *sub;
+        INTVAL flags;
+        int    i;
+
         SUPER(info);
 
-        if (info->extra_flags == EXTRA_IS_NULL) {
-            Parrot_Sub_attributes *sub;
-            INTVAL flags;
-            int    i;
-
-            PMC_get_sub(INTERP, SELF, sub);
-
-            /* we get relative offsets */
-            sub->start_offs   = (size_t) VTABLE_shift_integer(INTERP, info);
-            sub->end_offs     = (size_t) VTABLE_shift_integer(INTERP, info);
-            flags             = VTABLE_shift_integer(INTERP, info);
-
-            PObj_get_FLAGS(SELF) |= flags & SUB_FLAG_PF_MASK;
-
-            sub->name           = VTABLE_shift_string(INTERP, info);
-            sub->method_name    = VTABLE_shift_string(INTERP, info);
-            sub->ns_entry_name  = VTABLE_shift_string(INTERP, info);
-            sub->HLL_id         = Parrot_get_HLL_id(INTERP,
-                VTABLE_shift_string(INTERP, info));
-            sub->comp_flags     = VTABLE_shift_integer(INTERP, info);
-            sub->vtable_index   = VTABLE_shift_integer(INTERP, info);
+        PMC_get_sub(INTERP, SELF, sub);
 
-            for (i = 0; i < 4; ++i)
-                sub->n_regs_used[i] = VTABLE_shift_integer(INTERP, info);
+        /* we get relative offsets */
+        sub->start_offs   = (size_t) VTABLE_shift_integer(INTERP, info);
+        sub->end_offs     = (size_t) VTABLE_shift_integer(INTERP, info);
+        flags             = VTABLE_shift_integer(INTERP, info);
+
+        PObj_get_FLAGS(SELF) |= flags & SUB_FLAG_PF_MASK;
+
+        sub->name           = VTABLE_shift_string(INTERP, info);
+        sub->method_name    = VTABLE_shift_string(INTERP, info);
+        sub->ns_entry_name  = VTABLE_shift_string(INTERP, info);
+        sub->HLL_id         = Parrot_get_HLL_id(INTERP,
+            VTABLE_shift_string(INTERP, info));
+        sub->comp_flags     = VTABLE_shift_integer(INTERP, info);
+        sub->vtable_index   = VTABLE_shift_integer(INTERP, info);
 
-            sub->subid        = VTABLE_shift_string(INTERP, info);
-        }
+        for (i = 0; i < 4; ++i)
+            sub->n_regs_used[i] = VTABLE_shift_integer(INTERP, info);
+
+        sub->subid        = VTABLE_shift_string(INTERP, info);
     }
 
 /*


More information about the parrot-commits mailing list