Vasily Chekalkin wrote:
Hello.
context_pmc3 branch in progress of merge back to trunk. Please don't
commit into trunk in next 0.5-1 hour.
Sorry for delay. Branch is merged. Patches for Lua and Rakudo attached.
Partcl and Cardinal should build clearly.
--
Bacek
diff --git a/src/pmc/luauserdata.pmc b/src/pmc/luauserdata.pmc
index 2f6a410..3a8f8b7 100644
--- a/src/pmc/luauserdata.pmc
+++ b/src/pmc/luauserdata.pmc
@@ -29,17 +29,18 @@ _LuaUserdata_get_metatable(PARROT_INTERP, PMC *obj) {
}
static PMC* curr_func(PARROT_INTERP) {
- Parrot_Context *sub_ctx = CONTEXT(interp)->caller_ctx;
+ PMC *sub_ctx = Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp));
while (1) {
PMC *cont;
- if (sub_ctx->current_sub
- && _LuaFunction_get_environment(interp, sub_ctx->current_sub))
- return sub_ctx->current_sub;
- cont = sub_ctx->current_cont;
- if (!cont)
+ PMC *current_sub = Parrot_pcc_get_sub(interp, sub_ctx);
+ if (!PMC_IS_NULL(current_sub)
+ && _LuaFunction_get_environment(interp, current_sub))
+ return current_sub;
+ cont = Parrot_pcc_get_continuation(interp, sub_ctx);
+ if (PMC_IS_NULL(cont))
break;
sub_ctx = PMC_cont(cont)->to_ctx;
- if (!sub_ctx)
+ if (PMC_IS_NULL(sub_ctx))
break;
}
return NULL;
diff --git a/src/ops/perl6.ops b/src/ops/perl6.ops
index 6e333df..1c88ba4 100644
--- a/src/ops/perl6.ops
+++ b/src/ops/perl6.ops
@@ -144,12 +144,12 @@ skips the current sub and starts looking immediately at its outers.
*/
inline op find_lex_skip_current(out PMC, in STR) :base_core {
- Parrot_Context *ctx = CONTEXT(interp);
+ PMC *ctx = CURRENT_CONTEXT(interp);
$1 = PMCNULL;
- while (ctx->outer_ctx) {
- Parrot_Context * const outer = ctx->outer_ctx;
- PMC * const lex_pad = outer->lex_pad;
+ while (Parrot_pcc_get_outer_ctx(interp, ctx)) {
+ PMC * const outer = Parrot_pcc_get_outer_ctx(interp, ctx);
+ PMC * const lex_pad = Parrot_pcc_get_lex_pad(interp, outer);
if (!PMC_IS_NULL(lex_pad) && VTABLE_exists_keyed_str(interp, lex_pad, $2)) {
$1 = VTABLE_get_pmc_keyed_str(interp, lex_pad, $2);
@@ -266,21 +266,21 @@ nextsame need.
*/
inline op get_next_candidate_info(out PMC, out PMC, out PMC) :base_core {
- Parrot_Context *ctx = CONTEXT(interp)->caller_ctx;
- STRING *name = string_from_literal(interp, "__CANDIDATE_LIST__");
- STRING *wrapper = string_from_literal(interp, "$!wrapper_block");
- PMC *last_lexpad = PMCNULL;
- PMC *last_sub = PMCNULL;
+ PMC *ctx = Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp));
+ STRING *name = string_from_literal(interp, "__CANDIDATE_LIST__");
+ STRING *wrapper = string_from_literal(interp, "$!wrapper_block");
+ PMC *last_lexpad = PMCNULL;
+ PMC *last_sub = PMCNULL;
- while (ctx) {
+ while (!PMC_IS_NULL(ctx)) {
/* See if we've found a candidate list. */
- PMC *lexpad = ctx->lex_pad;
+ PMC *lexpad = Parrot_pcc_get_lex_pad(interp, ctx);
PMC *clist = VTABLE_get_pmc_keyed_str(interp, lexpad, name);
if (!PMC_IS_NULL(clist)) {
/* Found. Set results and we're done. */
$1 = clist;
- if (PMC_IS_NULL(VTABLE_getprop(interp, ctx->current_sub, wrapper))) {
- $2 = ctx->current_sub;
+ if (PMC_IS_NULL(VTABLE_getprop(interp, Parrot_pcc_get_sub(interp, ctx), wrapper))) {
+ $2 = Parrot_pcc_get_sub(interp, ctx);
$3 = lexpad;
}
else {
@@ -291,9 +291,9 @@ inline op get_next_candidate_info(out PMC, out PMC, out PMC) :base_core {
}
else {
/* Not found; keep looking. */
- last_sub = ctx->current_sub;
+ last_sub = Parrot_pcc_get_sub(interp, ctx);
last_lexpad = lexpad;
- ctx = ctx->outer_ctx;
+ ctx = Parrot_pcc_get_outer_ctx(interp, ctx);
}
}
if (!ctx)
diff --git a/src/pmc/p6invocation.pmc b/src/pmc/p6invocation.pmc
index 4df78be..11e5921 100644
--- a/src/pmc/p6invocation.pmc
+++ b/src/pmc/p6invocation.pmc
@@ -244,7 +244,7 @@ pmclass P6Invocation need_ext dynpmc group perl6_group {
first_candidate = VTABLE_get_pmc_keyed_str(interp, ns, CONST_STRING(interp, "!deferal_fail"));
}
addr = VTABLE_invoke(interp, first_candidate, next);
- lexpad = CONTEXT(interp)->lex_pad;
+ lexpad = Parrot_pcc_get_lex_pad(INTERP, CURRENT_CONTEXT(interp));
if (!PMC_IS_NULL(lexpad) && VTABLE_exists_keyed_str(interp, lexpad, lexname))
VTABLE_set_pmc_keyed_str(interp, lexpad, lexname, SELF);
return addr;
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev