[svn:parrot] r47877 - trunk/src/call

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat Jun 26 20:54:12 UTC 2010


Author: chromatic
Date: Sat Jun 26 20:54:12 2010
New Revision: 47877
URL: https://trac.parrot.org/parrot/changeset/47877

Log:
[PCC] Improved cache friendliness of clear_regs().

Modified:
   trunk/src/call/context.c

Modified: trunk/src/call/context.c
==============================================================================
--- trunk/src/call/context.c	Sat Jun 26 20:54:09 2010	(r47876)
+++ trunk/src/call/context.c	Sat Jun 26 20:54:12 2010	(r47877)
@@ -219,30 +219,24 @@
 clear_regs(PARROT_INTERP, ARGMOD(Parrot_Context *ctx))
 {
     ASSERT_ARGS(clear_regs)
-    UINTVAL i;
+    UINTVAL       i;
+    const UINTVAL s_regs = ctx->n_regs_used[REGNO_STR];
+    const UINTVAL p_regs = ctx->n_regs_used[REGNO_PMC];
 
-    /* NULL out registers - P/S have to be NULL for GC
-     *
-     * if the architecture has 0x := NULL and 0.0 we could memset too
-     */
+    /* NULL out registers - P/S have to be NULL for GC */
+    for (i = 0; i < s_regs; ++i)
+        ctx->bp_ps.regs_s[i] = STRINGNULL;
 
-    for (i = 0; i < ctx->n_regs_used[REGNO_PMC]; ++i) {
+    for (i = 0; i < p_regs; ++i)
         ctx->bp_ps.regs_p[-1L - i] = PMCNULL;
-    }
-
-    for (i = 0; i < ctx->n_regs_used[REGNO_STR]; ++i) {
-        ctx->bp_ps.regs_s[i] = STRINGNULL;
-    }
 
     if (Interp_debug_TEST(interp, PARROT_REG_DEBUG_FLAG)) {
         /* depending on -D40, set int and num to identifiable garbage values */
-        for (i = 0; i < ctx->n_regs_used[REGNO_INT]; ++i) {
+        for (i = 0; i < ctx->n_regs_used[REGNO_INT]; ++i)
             ctx->bp.regs_i[i] = -999;
-        }
 
-        for (i = 0; i < ctx->n_regs_used[REGNO_NUM]; ++i) {
+        for (i = 0; i < ctx->n_regs_used[REGNO_NUM]; ++i)
             ctx->bp.regs_n[-1L - i] = -99.9;
-        }
     }
 }
 


More information about the parrot-commits mailing list