[svn:parrot] r45020 - branches/pcc_megrecells/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Mar 18 19:46:05 UTC 2010


Author: bacek
Date: Thu Mar 18 19:46:04 2010
New Revision: 45020
URL: https://trac.parrot.org/parrot/changeset/45020

Log:
More CallContext push_foo and get_foo_keyed_int optimizations.

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

Modified: branches/pcc_megrecells/src/pmc/callcontext.pmc
==============================================================================
--- branches/pcc_megrecells/src/pmc/callcontext.pmc	Thu Mar 18 19:45:36 2010	(r45019)
+++ branches/pcc_megrecells/src/pmc/callcontext.pmc	Thu Mar 18 19:46:04 2010	(r45020)
@@ -808,15 +808,25 @@
     }
 
     VTABLE void push_integer(INTVAL value) {
-        INTVAL    pos  = STATICSELF.elements();
-        Pcc_cell *cell = get_cell_at(INTERP, SELF, pos);
-        cell->u.i      = value;
-        cell->type     = INTCELL;
-        SET_ATTR_num_positionals(INTERP, SELF, pos + 1);
+        INTVAL    num_pos;
+        Pcc_cell *cells;
+
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
+        ensure_positionals_storage(INTERP, SELF, num_pos + 1);
+
+        GET_ATTR_positionals(INTERP, SELF, cells);
+        cells[num_pos].u.i      = value;
+        cells[num_pos].type     = INTCELL;
+        SET_ATTR_num_positionals(INTERP, SELF, num_pos + 1);
     }
 
     VTABLE void push_float(FLOATVAL value) {
-        INTVAL    pos  = STATICSELF.elements();
+        INTVAL    num_pos;
+        Pcc_cell *cells;
+
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
+        ensure_positionals_storage(INTERP, SELF, num_pos + 1);
+
         Pcc_cell *cell = get_cell_at(INTERP, SELF, pos);
         cell->u.n      = value;
         cell->type     = FLOATCELL;
@@ -824,16 +834,26 @@
     }
 
     VTABLE void push_string(STRING *value) {
-        INTVAL    pos  = STATICSELF.elements();
-        Pcc_cell *cell = get_cell_at(INTERP, SELF, pos);
+        INTVAL    num_pos;
+        Pcc_cell *cells;
+
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
+        ensure_positionals_storage(INTERP, SELF, num_pos + 1);
+
+        GET_ATTR_positionals(INTERP, SELF, cells);
         cell->u.s      = value;
         cell->type     = STRINGCELL;
         SET_ATTR_num_positionals(INTERP, SELF, pos + 1);
     }
 
     VTABLE void push_pmc(PMC *value) {
-        INTVAL    pos  = STATICSELF.elements();
-        Pcc_cell *cell = get_cell_at(INTERP, SELF, pos);
+        INTVAL    num_pos;
+        Pcc_cell *cells;
+
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
+        ensure_positionals_storage(INTERP, SELF, num_pos + 1);
+
+        GET_ATTR_positionals(INTERP, SELF, cells);
         cell->u.p      = value;
         cell->type     = PMCCELL;
         SET_ATTR_num_positionals(INTERP, SELF, pos + 1);
@@ -862,9 +882,10 @@
 
 
     VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
-        INTVAL    num_pos = STATICSELF.elements();
+        INTVAL    num_pos;
         Pcc_cell *cells;
 
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
         if (key>=num_pos || key < 0)
             return 0;
 
@@ -873,9 +894,10 @@
     }
 
     VTABLE FLOATVAL get_number_keyed_int(INTVAL key) {
-        INTVAL    num_pos = STATICSELF.elements();
+        INTVAL    num_pos;
         Pcc_cell *cells;
 
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
         if (key>=num_pos || key < 0)
             return 0.0;
 
@@ -884,9 +906,10 @@
     }
 
     VTABLE STRING * get_string_keyed_int(INTVAL key) {
-        INTVAL    num_pos = STATICSELF.elements();
+        INTVAL    num_pos;
         Pcc_cell *cells;
 
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
         if (key>=num_pos || key < 0)
             return NULL;
 
@@ -895,9 +918,10 @@
     }
 
     VTABLE PMC * get_pmc_keyed_int(INTVAL key) {
-        INTVAL    num_pos = STATICSELF.elements();
+        INTVAL    num_pos;
         Pcc_cell *cells;
 
+        GET_ATTR_num_positionals(INTERP, SELF, num_pos);
         if (key>=num_pos || key < 0)
             return PMCNULL;
 


More information about the parrot-commits mailing list