develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34493 - in trunk/src: . pmc

From:
jkeenan
Date:
December 28, 2008 07:16
Subject:
[svn:parrot] r34493 - in trunk/src: . pmc
Message ID:
20081228151647.213A5CB9F9@x12.develooper.com
Author: jkeenan
Date: Sun Dec 28 07:16:46 2008
New Revision: 34493

Modified:
   trunk/src/jit.c
   trunk/src/list.c
   trunk/src/pmc/role.pmc

Log:
Applying cage-cleaning patch submitted in Trac #95.  jimmy++.

Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c	(original)
+++ trunk/src/jit.c	Sun Dec 28 07:16:46 2008
@@ -366,10 +366,8 @@
                     else if (flags & KEY_string_FLAG)
                         typ = 2;
 
-                    if (n < NUM_REGISTERS) {
-                        if (!ru[typ].reg_count[n]++)
-                            ru[typ].reg_dir[n] |= PARROT_ARGDIR_IN;
-                    }
+                    if (n < NUM_REGISTERS & !ru[typ].reg_count[n]++)
+                        ru[typ].reg_dir[n] |= PARROT_ARGDIR_IN;
                 }
                 key = key_next(interp, key);
             }

Modified: trunk/src/list.c
==============================================================================
--- trunk/src/list.c	(original)
+++ trunk/src/list.c	Sun Dec 28 07:16:46 2008
@@ -652,30 +652,33 @@
     int do_sparse = (INTVAL)idx - (INTVAL)list->cap >= 10 * MAX_ITEMS;
 
     if (list->item_type == enum_type_sized) {
-        items = list->items_per_chunk;
-        size = items * list->item_size;
+        do_sparse = 0;
+        items     = list->items_per_chunk;
+        size      = items * list->item_size;
+
         list->grow_policy = items == MAX_ITEMS ?
             enum_grow_fixed : enum_grow_mixed;
-        do_sparse = 0;
     }
     else if (do_sparse) {
         PARROT_ASSERT(where);
         /* don't add sparse chunk at start of list */
         if (!list->n_chunks) {
-            list->grow_policy = enum_grow_fixed;
-            /* if wee need more, the next allocation will allocate the rest */
-            items = MAX_ITEMS;
-            size = items * list->item_size;
             do_sparse = 0;
+            items     = MAX_ITEMS;
+
+            /* if we need more, the next allocation will allocate the rest */
+            size = items * list->item_size;
+            list->grow_policy = enum_grow_fixed;
         }
         else {
+            /* allocate a dummy chunk holding many items virtually */
+            size  = list->item_size;
             items = idx - list->cap - 1;
+
             /* round down this function will then be called again, to add the
              * final real chunk, with the rest of the needed size */
             items &= ~(MAX_ITEMS - 1);
             list->grow_policy = enum_grow_mixed;
-            /* allocate a dummy chunk holding many items virtually */
-            size = list->item_size;
         }
     }
     /* initial size for empty lists grow_policy is not yet known or was
@@ -752,9 +755,10 @@
     if (where) {                /* at end */
         if (chunk)
             chunk->next = new_chunk;
-        list->last = new_chunk;
         if (!list->first)
             list->first = new_chunk;
+
+        list->last = new_chunk;
     }
     else {
         new_chunk->next = chunk;

Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc	(original)
+++ trunk/src/pmc/role.pmc	Sun Dec 28 07:16:46 2008
@@ -296,8 +296,8 @@
 */
 
     VTABLE void add_attribute(STRING *name, PMC *type) {
-        Parrot_Role_attributes * const role          = PARROT_ROLE(SELF);
-        PMC         * const new_attribute = pmc_new(interp, enum_class_Hash);
+        Parrot_Role_attributes * const role  = PARROT_ROLE(SELF);
+        PMC           * const new_attribute  = pmc_new(interp, enum_class_Hash);
 
         /* Set name and type. */
         VTABLE_set_string_keyed_str(interp, new_attribute, CONST_STRING(interp, "name"), name);
@@ -486,7 +486,7 @@
 
     VTABLE STRING *get_string() {
         Parrot_Role_attributes * const role  = PARROT_ROLE(SELF);
-        PMC         * const _namespace = role->_namespace;
+        PMC               * const _namespace = role->_namespace;
 
         if (!PMC_IS_NULL(_namespace)) {
             /* Call the 'get_name' method on the role's associated namespace
@@ -586,7 +586,7 @@
 
     METHOD name(STRING *name :optional, int got_name :opt_flag) {
         Parrot_Role_attributes *role     = PARROT_ROLE(SELF);
-        STRING      *ret_name = NULL;
+        STRING                 *ret_name = NULL;
 
         if (got_name) {
             /* We'll build a hash just containing the name, then give this to
@@ -613,8 +613,8 @@
 */
 
     METHOD get_namespace() {
-        Parrot_Role_attributes *role          = PARROT_ROLE(SELF);
-        PMC         *ret_namespace = role->_namespace;
+        Parrot_Role_attributes *role = PARROT_ROLE(SELF);
+        PMC           *ret_namespace = role->_namespace;
         RETURN(PMC *ret_namespace);
     }
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About