Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Insert static values into a context's registers, thus putting values …
…from the static lex pad in place per invocation.
  • Loading branch information
jnthn committed Mar 6, 2011
1 parent 94fc85c commit 5c2b972
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/pmc/nqplexpad.pmc
Expand Up @@ -56,6 +56,25 @@ Return the LexInfo PMC, if any or a Null PMC.
}

VTABLE void set_pointer(void *ctx) {
/* Check if we need to put any static values in place. */
PMC *info, *static_slots_cache;
GET_ATTR_lexinfo(INTERP, SELF, info);
GETATTR_NQPLexInfo_static_slots_cache(INTERP, info, static_slots_cache);
if (!PMC_IS_NULL(static_slots_cache)) {
/* Yes, we have some. Grab values too, then iterate. */
PMC *static_values_cache;
INTVAL num_statics = VTABLE_elements(interp, static_slots_cache);
INTVAL i;
GETATTR_NQPLexInfo_static_values_cache(INTERP, info, static_values_cache);
for (i = 0; i < num_statics; i++) {
INTVAL slot = VTABLE_get_integer_keyed_int(interp, static_slots_cache, i);
PMC *value = VTABLE_get_pmc_keyed_int(interp, static_values_cache, i);
CTX_REG_PMC((PMC *)ctx, slot) = value;
}
PARROT_GC_WRITE_BARRIER(INTERP, (PMC *)ctx);
}

/* Stash the context pointer. */
SET_ATTR_ctx(INTERP, SELF, (PMC *)ctx);
}

Expand Down

0 comments on commit 5c2b972

Please sign in to comment.