[svn:parrot] r46193 - in trunk/src: . gc io pmc runcore string/encoding

jimmy at svn.parrot.org jimmy at svn.parrot.org
Fri Apr 30 08:53:16 UTC 2010


Author: jimmy
Date: Fri Apr 30 08:53:15 2010
New Revision: 46193
URL: https://trac.parrot.org/parrot/changeset/46193

Log:
manual optimization for old compilers

Modified:
   trunk/src/debug.c
   trunk/src/frame_builder.c
   trunk/src/gc/gc_ms.c
   trunk/src/gc/malloc.c
   trunk/src/hash.c
   trunk/src/io/socket_unix.c
   trunk/src/io/socket_win32.c
   trunk/src/io/utf8.c
   trunk/src/library.c
   trunk/src/misc.c
   trunk/src/pmc/class.pmc
   trunk/src/pmc/float.pmc
   trunk/src/pmc/orderedhashiterator.pmc
   trunk/src/pmc/resizablepmcarray.pmc
   trunk/src/pmc/resizablestringarray.pmc
   trunk/src/runcore/profiling.c
   trunk/src/spf_render.c
   trunk/src/string/encoding/utf8.c
   trunk/src/thread.c

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/debug.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -1161,7 +1161,7 @@
     #if 0
 
     /* Execute */
-    for (; n && pdb->cur_opcode; n--)
+    for (; n && pdb->cur_opcode; --n)
         DO_OP(pdb->cur_opcode, pdb->debugee);
 
     /* Set the stopped flag */
@@ -2115,7 +2115,7 @@
         /* If we have to skip breakpoints, do so. */
         if (pdb->breakpoint_skip) {
             TRACEDEB_MSG("PDB_break skipping");
-            pdb->breakpoint_skip--;
+            --pdb->breakpoint_skip;
             return 0;
         }
 

Modified: trunk/src/frame_builder.c
==============================================================================
--- trunk/src/frame_builder.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/frame_builder.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -408,7 +408,7 @@
           case 'J':   /* interpreter */
             emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 8);
             emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, args_offset);
-            arg_count--;
+            --arg_count;
             break;
           case 'p':   /* push pmc->data */
             /* FIXME (TT #1325) emitm_call_cfunc(pc, get_nci_p); */

Modified: trunk/src/gc/gc_ms.c
==============================================================================
--- trunk/src/gc/gc_ms.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/gc/gc_ms.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -853,7 +853,7 @@
     pool->free_list = item->next;
 #endif
 
-    pool->num_free_objects--;
+    --pool->num_free_objects;
     return (void *)item;
 }
 
@@ -1720,7 +1720,7 @@
 {
     ASSERT_ARGS(gc_ms_unblock_GC_mark)
     if (interp->mem_pools->gc_mark_block_level) {
-        interp->mem_pools->gc_mark_block_level--;
+        --interp->mem_pools->gc_mark_block_level;
         Parrot_shared_gc_unblock(interp);
     }
 }
@@ -1737,7 +1737,7 @@
 {
     ASSERT_ARGS(gc_ms_unblock_GC_sweep)
     if (interp->mem_pools->gc_sweep_block_level)
-        interp->mem_pools->gc_sweep_block_level--;
+        --interp->mem_pools->gc_sweep_block_level;
 }
 
 static unsigned int

Modified: trunk/src/gc/malloc.c
==============================================================================
--- trunk/src/gc/malloc.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/gc/malloc.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -1768,7 +1768,7 @@
     case 4:           *mzp++ = 0;                                             \
     case 3:           *mzp++ = 0;                                             \
     case 2:           *mzp++ = 0;                                             \
-    case 1:           *mzp++ = 0; if (mcn <= 0) break; mcn--; }                \
+    case 1:           *mzp++ = 0; if (mcn <= 0) break; --mcn; }                \
   }                                                                           \
 } while (0)
 
@@ -1787,7 +1787,7 @@
     case 4:           *mcdst++ = *mcsrc++;                                    \
     case 3:           *mcdst++ = *mcsrc++;                                    \
     case 2:           *mcdst++ = *mcsrc++;                                    \
-    case 1:           *mcdst++ = *mcsrc++; if (mcn <= 0) break; mcn--; }       \
+    case 1:           *mcdst++ = *mcsrc++; if (mcn <= 0) break; --mcn; }       \
   }                                                                           \
 } while (0)
 
@@ -3857,7 +3857,7 @@
 #if HAVE_MMAP
             int ret;
             INTERNAL_SIZE_T offset = p->prev_size;
-            av->n_mmaps--;
+            --av->n_mmaps;
             av->mmapped_mem -= (size + offset);
             ret = munmap((char*)p - offset, size + offset);
             /* munmap returns non-zero on failure */

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/hash.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -1392,7 +1392,7 @@
             else
                 hash->bi[hashval] = bucket->next;
 
-            hash->entries--;
+            --hash->entries;
             bucket->next    = hash->free_list;
             bucket->key     = NULL;
             hash->free_list = bucket;

Modified: trunk/src/io/socket_unix.c
==============================================================================
--- trunk/src/io/socket_unix.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/io/socket_unix.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -395,7 +395,7 @@
 This is not equivalent to any specific POSIX or BSD socket call, but
 it is a useful, common primitive.
 
-Not at all usefule --leo.
+Not at all useful --leo.
 
 Also, a buffering layer above this may choose to reimplement by checking
 the read buffer.

Modified: trunk/src/io/socket_win32.c
==============================================================================
--- trunk/src/io/socket_win32.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/io/socket_win32.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -343,7 +343,7 @@
 This is not equivalent to any specific POSIX or BSD socket call, but
 it is a useful, common primitive.
 
-Not at all usefule --leo.
+Not at all useful --leo.
 
 Also, a buffering layer above this may choose to reimplement by checking
 the read buffer.

Modified: trunk/src/io/utf8.c
==============================================================================
--- trunk/src/io/utf8.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/io/utf8.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -73,7 +73,7 @@
                     goto ok;
 
                 /* need len - 1 more chars */
-                len2--;
+                --len2;
                 s2 = Parrot_str_new_init(interp, NULL, len2, Parrot_utf8_encoding_ptr,
                                          Parrot_unicode_charset_ptr, 0);
                 s2->bufused  = len2;

Modified: trunk/src/library.c
==============================================================================
--- trunk/src/library.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/library.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -420,8 +420,8 @@
     STRING * const nul = string_chr(interp, '\0');
 
     path = Parrot_str_concat(interp, path, nul);
-    path->bufused--;
-    path->strlen--;
+    --path->bufused;
+    --path->strlen;
 
 #ifdef WIN32
     cnv_to_win32_filesep(path);

Modified: trunk/src/misc.c
==============================================================================
--- trunk/src/misc.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/misc.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -117,7 +117,7 @@
     size_t  str_len;
     if (len == 0)
         return;
-    len--;
+    --len;
     if (len) {
         const STRING * const ret = Parrot_vsprintf_c(interp, pat, args);
         /* string_transcode(interp, ret, NULL, NULL, &ret); */

Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/pmc/class.pmc	Fri Apr 30 08:53:15 2010	(r46193)
@@ -415,7 +415,7 @@
     STRING * const name  = CONST_STRING(interp, "init");
 
     /* Loop through the parents in reverse MRO order. */
-    for (; parent_index >= 0; parent_index--) {
+    for (; parent_index >= 0; --parent_index) {
         PMC *meth;
         PMC * const parent = VTABLE_get_pmc_keyed_int(interp,
             all_parents, parent_index);
@@ -445,7 +445,7 @@
     STRING * const name  = CONST_STRING(interp, "init_pmc");
 
     /* Loop through the parents in reverse MRO order. */
-    for (; parent_index >= 0; parent_index--) {
+    for (; parent_index >= 0; --parent_index) {
         PMC *meth;
         PMC * const parent = VTABLE_get_pmc_keyed_int(interp,
             all_parents, parent_index);

Modified: trunk/src/pmc/float.pmc
==============================================================================
--- trunk/src/pmc/float.pmc	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/pmc/float.pmc	Fri Apr 30 08:53:15 2010	(r46193)
@@ -317,7 +317,7 @@
     VTABLE void decrement() {
         FLOATVAL fv;
         GET_ATTR_fv(INTERP, SELF, fv);
-        fv--;
+        --fv;
         SET_ATTR_fv(INTERP, SELF, fv);
     }
 /*

Modified: trunk/src/pmc/orderedhashiterator.pmc
==============================================================================
--- trunk/src/pmc/orderedhashiterator.pmc	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/pmc/orderedhashiterator.pmc	Fri Apr 30 08:53:15 2010	(r46193)
@@ -214,8 +214,8 @@
                 ORDERED_HASH_ITEM_KEY);
         attrs->next_entry = VTABLE_get_pmc_keyed_int(INTERP, attrs->next_entry,
                 ORDERED_HASH_ITEM_PREV);
-        attrs->pos--;
-        attrs->elements--;
+        --attrs->pos;
+        --attrs->elements;
 
         return ret;
     }

Modified: trunk/src/pmc/resizablepmcarray.pmc
==============================================================================
--- trunk/src/pmc/resizablepmcarray.pmc	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/pmc/resizablepmcarray.pmc	Fri Apr 30 08:53:15 2010	(r46193)
@@ -292,7 +292,7 @@
         for (i = idx; i < n - 1; ++i)
             data[i] = data[i + 1];
 
-        PMC_size(SELF)--;
+        --PMC_size(SELF);
     }
 
 /*
@@ -715,7 +715,7 @@
 
             /* move the existing values */
             /* start at length-1 so we don't overwrite values we'll need */
-            for (i = length - 1; i >= offset; i--)
+            for (i = length - 1; i >= offset; --i)
                 VTABLE_set_pmc_keyed_int(INTERP, SELF, i + shift,
                     VTABLE_get_pmc_keyed_int(INTERP, SELF, i));
         }

Modified: trunk/src/pmc/resizablestringarray.pmc
==============================================================================
--- trunk/src/pmc/resizablestringarray.pmc	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/pmc/resizablestringarray.pmc	Fri Apr 30 08:53:15 2010	(r46193)
@@ -617,7 +617,7 @@
 
             /* move the existing values */
             /* start at length-1 so we don't overwrite values we'll need */
-            for (i = length - 1; i >= offset; i--)
+            for (i = length - 1; i >= offset; --i)
                 VTABLE_set_pmc_keyed_int(INTERP, SELF, i + shift,
                     VTABLE_get_pmc_keyed_int(INTERP, SELF, i));
         }

Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/runcore/profiling.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -349,7 +349,7 @@
         else
             op_time = runcore->op_finish - runcore->op_start;
 
-        runcore->level--;
+        --runcore->level;
 
         /* if current context changed since the last printing of a CS line... */
         /* Occasionally the ctx stays the same while the sub changes, possible

Modified: trunk/src/spf_render.c
==============================================================================
--- trunk/src/spf_render.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/spf_render.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -855,7 +855,7 @@
                             /* fake the old %P and %S commands */
                             if (info.type == SIZE_PMC
                              || info.type == SIZE_PSTR) {
-                                i--;
+                                --i;
                                 goto CASE_s;
                                 /* case 's' will see the SIZE_PMC or SIZE_PSTR
                                  * and assume it was %Ps (or %Ss).  Genius,

Modified: trunk/src/string/encoding/utf8.c
==============================================================================
--- trunk/src/string/encoding/utf8.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/string/encoding/utf8.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -365,9 +365,9 @@
     const utf8_t *u8ptr = (const utf8_t *)ptr;
 
     while (n-- > 0) {
-        u8ptr--;
+        --u8ptr;
         while (UTF8_IS_CONTINUATION(*u8ptr))
-            u8ptr--;
+            --u8ptr;
     }
 
     return u8ptr;

Modified: trunk/src/thread.c
==============================================================================
--- trunk/src/thread.c	Fri Apr 30 08:27:15 2010	(r46192)
+++ trunk/src/thread.c	Fri Apr 30 08:53:15 2010	(r46193)
@@ -1234,7 +1234,7 @@
             retval = PMCNULL;
         }
         interpreter_array[tid] = NULL;
-        running_threads--;
+        --running_threads;
 
         DEBUG_ONLY(fprintf(stderr, "destroying an interpreter [join]\n"));
         if (Interp_debug_TEST(parent, PARROT_THREAD_DEBUG_FLAG))


More information about the parrot-commits mailing list