[svn:parrot] r41104 - trunk/src/gc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Mon Sep 7 08:39:09 UTC 2009


Author: chromatic
Date: Mon Sep  7 08:39:09 2009
New Revision: 41104
URL: https://trac.parrot.org/parrot/changeset/41104

Log:
[Contexts] Avoided repeated calls to Parrot_pcc_get_context_struct() when
allocating a new context (unintentional irony, yes) by clearing register
contents directly.  A judicious use of memset() would likely be faster, but a
1.7% performance improvement in the fib.pir benchmark is reasonable.  Bigger
register sets will have better performance here too.

Modified:
   trunk/src/gc/alloc_register.c

Modified: trunk/src/gc/alloc_register.c
==============================================================================
--- trunk/src/gc/alloc_register.c	Mon Sep  7 08:39:05 2009	(r41103)
+++ trunk/src/gc/alloc_register.c	Mon Sep  7 08:39:09 2009	(r41104)
@@ -165,20 +165,21 @@
      */
 
     for (i = 0; i < ctx->n_regs_used[REGNO_PMC]; i++) {
-        CTX_REG_PMC(pmcctx, i) = PMCNULL;
+        ctx->bp_ps.regs_p[-1L - i] = PMCNULL;
     }
 
     for (i = 0; i < ctx->n_regs_used[REGNO_STR]; i++) {
-        CTX_REG_STR(pmcctx, i) = NULL;
+        ctx->bp_ps.regs_s[i] = NULL;
     }
 
     if (Interp_debug_TEST(interp, PARROT_REG_DEBUG_FLAG)) {
-        /* depending on -D40 we set int and num to be identifiable garbage values */
+        /* depending on -D40, set int and num to identifiable garbage values */
         for (i = 0; i < ctx->n_regs_used[REGNO_INT]; i++) {
-            CTX_REG_INT(pmcctx, i) = -999;
+            ctx->bp.regs_i[i] = -999;
         }
+
         for (i = 0; i < ctx->n_regs_used[REGNO_NUM]; i++) {
-            CTX_REG_NUM(pmcctx, i) = -99.9;
+            ctx->bp.regs_n[-1L - i] = -99.9;
         }
     }
 }
@@ -195,8 +196,7 @@
 */
 
 static void
-init_context(PARROT_INTERP, ARGMOD(PMC *pmcctx),
-        ARGIN_NULLOK(PMC *pmcold))
+init_context(PARROT_INTERP, ARGMOD(PMC *pmcctx), ARGIN_NULLOK(PMC *pmcold))
 {
     ASSERT_ARGS(init_context)
     Parrot_Context *ctx = Parrot_pcc_get_context_struct(interp, pmcctx);


More information about the parrot-commits mailing list