[svn:parrot] r46050 - branches/compact_pool_revamp/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Apr 27 07:43:20 UTC 2010


Author: chromatic
Date: Tue Apr 27 07:43:19 2010
New Revision: 46050
URL: https://trac.parrot.org/parrot/changeset/46050

Log:
[PMC] Made CallContext PMC avoid unnecessary calls to static
ensure_positionals_storage() in PCC hot paths; this improves oofib.pir
performance by 1.539% and speeds up PCC in general.  Rethinking the static
function might be useful.

Modified:
   branches/compact_pool_revamp/src/pmc/callcontext.pmc

Modified: branches/compact_pool_revamp/src/pmc/callcontext.pmc
==============================================================================
--- branches/compact_pool_revamp/src/pmc/callcontext.pmc	Tue Apr 27 07:12:04 2010	(r46049)
+++ branches/compact_pool_revamp/src/pmc/callcontext.pmc	Tue Apr 27 07:43:19 2010	(r46050)
@@ -929,10 +929,13 @@
 
     VTABLE void push_integer(INTVAL value) {
         Pcc_cell *cells;
-        INTVAL    num_pos;
+        INTVAL    num_pos, allocated_positionals;
 
         GET_ATTR_num_positionals(INTERP, SELF, num_pos);
-        ensure_positionals_storage(INTERP, SELF, num_pos + 1);
+        GET_ATTR_allocated_positionals(interp, SELF, allocated_positionals);
+
+        if (num_pos + 1 > allocated_positionals)
+            ensure_positionals_storage(INTERP, SELF, num_pos + 1);
 
         GET_ATTR_positionals(INTERP, SELF, cells);
         cells[num_pos].u.i      = value;
@@ -968,10 +971,13 @@
 
     VTABLE void push_pmc(PMC *value) {
         Pcc_cell *cells;
-        INTVAL    num_pos;
+        INTVAL    num_pos, allocated_positionals;
 
         GET_ATTR_num_positionals(INTERP, SELF, num_pos);
-        ensure_positionals_storage(INTERP, SELF, num_pos + 1);
+        GET_ATTR_allocated_positionals(interp, SELF, allocated_positionals);
+
+        if (num_pos + 1 > allocated_positionals)
+            ensure_positionals_storage(INTERP, SELF, num_pos + 1);
 
         GET_ATTR_positionals(INTERP, SELF, cells);
         cells[num_pos].u.p      = value;


More information about the parrot-commits mailing list