[svn:parrot] r45004 - branches/pcc_megrecells/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Thu Mar 18 09:49:47 UTC 2010
Author: bacek
Date: Thu Mar 18 09:49:47 2010
New Revision: 45004
URL: https://trac.parrot.org/parrot/changeset/45004
Log:
Reimplement CallContext.unshift_pmc
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 09:49:19 2010 (r45003)
+++ branches/pcc_megrecells/src/pmc/callcontext.pmc Thu Mar 18 09:49:47 2010 (r45004)
@@ -831,6 +831,25 @@
SET_ATTR_num_positionals(INTERP, SELF, pos + 1);
}
+ /*
+ TODO It's very naive implementation. But we do unshift _once_ only.
+ So, for speed sake, allocate _one_ Cell upfront. Or store it independent.
+ */
+
+ VTABLE void unshift_pmc(PMC *value) {
+ INTVAL size = STATICSELF.elements();
+ Pcc_cell *cells;
+ INTVAL i;
+
+ ensure_positionals_storage(INTERP, SELF, size + 1);
+ GET_ATTR_positionals(INTERP, SELF, cells);
+
+ for (i = size; i; --i)
+ cells[i] = cells[i - 1];
+
+ cells[0].u.p = value;
+ }
+
VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
More information about the parrot-commits
mailing list