[svn:parrot] r40715 - in branches/context_pmc3: compilers/imcc include/parrot lib/Parrot/OpTrans lib/Parrot/Ops2c lib/Parrot/Pmc2c src src/call src/gc src/interp src/jit/i386 src/ops src/pmc src/runcore
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Aug 22 09:29:47 UTC 2009
Author: bacek
Date: Sat Aug 22 09:29:44 2009
New Revision: 40715
URL: https://trac.parrot.org/parrot/changeset/40715
Log:
[cage] Add interp to CONTEXT macros.
Modified:
branches/context_pmc3/compilers/imcc/imcc.y
branches/context_pmc3/compilers/imcc/imcparser.c
branches/context_pmc3/compilers/imcc/parser_util.c
branches/context_pmc3/compilers/imcc/pbc.c
branches/context_pmc3/include/parrot/interpreter.h
branches/context_pmc3/include/parrot/register.h
branches/context_pmc3/include/parrot/warnings.h
branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm
branches/context_pmc3/lib/Parrot/OpTrans/CPrederef.pm
branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm
branches/context_pmc3/lib/Parrot/Ops2c/Utils.pm
branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm
branches/context_pmc3/src/call/ops.c
branches/context_pmc3/src/call/pcc.c
branches/context_pmc3/src/debug.c
branches/context_pmc3/src/embed.c
branches/context_pmc3/src/exceptions.c
branches/context_pmc3/src/extend.c
branches/context_pmc3/src/gc/alloc_register.c
branches/context_pmc3/src/gc/mark_sweep.c
branches/context_pmc3/src/global.c
branches/context_pmc3/src/global_setup.c
branches/context_pmc3/src/hll.c
branches/context_pmc3/src/interp/inter_create.c
branches/context_pmc3/src/interp/inter_misc.c
branches/context_pmc3/src/jit.c
branches/context_pmc3/src/jit/i386/core.jit
branches/context_pmc3/src/jit/i386/jit_defs.c
branches/context_pmc3/src/jit_defs.c
branches/context_pmc3/src/multidispatch.c
branches/context_pmc3/src/oo.c
branches/context_pmc3/src/ops/core.ops
branches/context_pmc3/src/ops/debug.ops
branches/context_pmc3/src/ops/object.ops
branches/context_pmc3/src/ops/pic.ops
branches/context_pmc3/src/ops/var.ops
branches/context_pmc3/src/packfile.c
branches/context_pmc3/src/pic.c
branches/context_pmc3/src/pmc.c
branches/context_pmc3/src/pmc/class.pmc
branches/context_pmc3/src/pmc/continuation.pmc
branches/context_pmc3/src/pmc/coroutine.pmc
branches/context_pmc3/src/pmc/exception.pmc
branches/context_pmc3/src/pmc/exporter.pmc
branches/context_pmc3/src/pmc/nci.pmc
branches/context_pmc3/src/pmc/object.pmc
branches/context_pmc3/src/pmc/parrotinterpreter.pmc
branches/context_pmc3/src/pmc/role.pmc
branches/context_pmc3/src/pmc/sub.pmc
branches/context_pmc3/src/runcore/cores.c
branches/context_pmc3/src/runcore/main.c
branches/context_pmc3/src/scheduler.c
branches/context_pmc3/src/sub.c
branches/context_pmc3/src/warnings.c
Modified: branches/context_pmc3/compilers/imcc/imcc.y
==============================================================================
--- branches/context_pmc3/compilers/imcc/imcc.y Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/compilers/imcc/imcc.y Sat Aug 22 09:29:44 2009 (r40715)
@@ -1210,7 +1210,7 @@
HLL STRINGC
{
STRING * const hll_name = Parrot_str_unescape(interp, $2 + 1, '"', NULL);
- CURRENT_CONTEXT_FIELD(current_HLL) =
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) =
Parrot_register_HLL(interp, hll_name);
IMCC_INFO(interp)->cur_namespace = NULL;
Modified: branches/context_pmc3/compilers/imcc/imcparser.c
==============================================================================
--- branches/context_pmc3/compilers/imcc/imcparser.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/compilers/imcc/imcparser.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -3318,7 +3318,7 @@
#line 1211 "compilers/imcc/imcc.y"
{
STRING * const hll_name = Parrot_str_unescape(interp, (yyvsp[(2) - (2)].s) + 1, '"', NULL);
- CURRENT_CONTEXT_FIELD(current_HLL) =
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) =
Parrot_register_HLL(interp, hll_name);
IMCC_INFO(interp)->cur_namespace = NULL;
Modified: branches/context_pmc3/compilers/imcc/parser_util.c
==============================================================================
--- branches/context_pmc3/compilers/imcc/parser_util.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/compilers/imcc/parser_util.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -869,10 +869,10 @@
* Continuations (this happens when something is the target of a :outer)
* trying to return values using them when invoked. (See TT#500 for the
* report of the bug this fixes). */
- opcode_t *save_results = CURRENT_CONTEXT_FIELD(current_results);
- CURRENT_CONTEXT_FIELD(current_results) = NULL;
+ opcode_t *save_results = CURRENT_CONTEXT_FIELD(interp, current_results);
+ CURRENT_CONTEXT_FIELD(interp, current_results) = NULL;
sub = imcc_compile(interp, s, 0, &error_message);
- CURRENT_CONTEXT_FIELD(current_results) = save_results;
+ CURRENT_CONTEXT_FIELD(interp, current_results) = save_results;
if (sub)
return sub;
Modified: branches/context_pmc3/compilers/imcc/pbc.c
==============================================================================
--- branches/context_pmc3/compilers/imcc/pbc.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/compilers/imcc/pbc.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -1280,7 +1280,7 @@
}
/* could be eval too; check if :outer is the current sub */
- current = CURRENT_CONTEXT_FIELD(current_sub);
+ current = CURRENT_CONTEXT_FIELD(interp, current_sub);
if (!current)
IMCC_fatal(interp, 1, "Undefined :outer sub '%s'.\n",
@@ -1434,7 +1434,7 @@
sub->namespace_name = ns_pmc;
sub->start_offs = offs;
sub->end_offs = end;
- sub->HLL_id = CURRENT_CONTEXT_FIELD(current_HLL);
+ sub->HLL_id = CURRENT_CONTEXT_FIELD(interp, current_HLL);
for (i = 0; i < 4; ++i)
sub->n_regs_used[i] = unit->n_regs_used[i];
Modified: branches/context_pmc3/include/parrot/interpreter.h
==============================================================================
--- branches/context_pmc3/include/parrot/interpreter.h Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/include/parrot/interpreter.h Sat Aug 22 09:29:44 2009 (r40715)
@@ -124,9 +124,9 @@
#define Interp_debug_CLEAR(interp, flag) ((interp)->debug_flags &= ~(flag))
#define Interp_debug_TEST(interp, flag) ((interp)->debug_flags & (flag))
-#define Interp_trace_SET(interp, flag) (CURRENT_CONTEXT_FIELD(trace_flags) |= (flag))
-#define Interp_trace_CLEAR(interp, flag) (CURRENT_CONTEXT_FIELD(trace_flags) &= ~(flag))
-#define Interp_trace_TEST(interp, flag) (CURRENT_CONTEXT_FIELD(trace_flags) & (flag))
+#define Interp_trace_SET(interp, flag) (CURRENT_CONTEXT_FIELD(interp, trace_flags) |= (flag))
+#define Interp_trace_CLEAR(interp, flag) (CURRENT_CONTEXT_FIELD(interp, trace_flags) &= ~(flag))
+#define Interp_trace_TEST(interp, flag) (CURRENT_CONTEXT_FIELD(interp, trace_flags) & (flag))
#define Interp_core_SET(interp, core) ((interp)->run_core = (core))
#define Interp_core_TEST(interp, core) ((interp)->run_core == (core))
@@ -200,9 +200,9 @@
/*
* Helper macros to fetch fields from context.
*/
-#define CURRENT_CONTEXT (interp->ctx)
-#define CONTEXT_FIELD(ctx, name) ((Parrot_ctx_get_context(interp, ctx))->name)
-#define CURRENT_CONTEXT_FIELD(name) CONTEXT_FIELD(interp->ctx, name)
+#define CURRENT_CONTEXT(interp) (interp->ctx)
+#define CONTEXT_FIELD(interp, ctx, name) ((Parrot_ctx_get_context(interp, ctx))->name)
+#define CURRENT_CONTEXT_FIELD(interp, name) CONTEXT_FIELD(interp, interp->ctx, name)
#define CHUNKED_CTX_MEM 0 /* no longer works, but will be reinstated
Modified: branches/context_pmc3/include/parrot/register.h
==============================================================================
--- branches/context_pmc3/include/parrot/register.h Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/include/parrot/register.h Sat Aug 22 09:29:44 2009 (r40715)
@@ -20,10 +20,10 @@
* Macros to make accessing registers more convenient/readable.
*/
-#define CTX_REG_NUM(p, x) CONTEXT_FIELD(p, bp.regs_n[-1L-(x)])
-#define CTX_REG_INT(p, x) CONTEXT_FIELD(p, bp.regs_i[x])
-#define CTX_REG_PMC(p, x) CONTEXT_FIELD(p, bp_ps.regs_p[-1L-(x)])
-#define CTX_REG_STR(p, x) CONTEXT_FIELD(p, bp_ps.regs_s[x])
+#define CTX_REG_NUM(p, x) CONTEXT_FIELD(interp, p, bp.regs_n[-1L-(x)])
+#define CTX_REG_INT(p, x) CONTEXT_FIELD(interp, p, bp.regs_i[x])
+#define CTX_REG_PMC(p, x) CONTEXT_FIELD(interp, p, bp_ps.regs_p[-1L-(x)])
+#define CTX_REG_STR(p, x) CONTEXT_FIELD(interp, p, bp_ps.regs_s[x])
#define REG_NUM(interp, x) CTX_REG_NUM((interp)->ctx, (x))
#define REG_INT(interp, x) CTX_REG_INT((interp)->ctx, (x))
Modified: branches/context_pmc3/include/parrot/warnings.h
==============================================================================
--- branches/context_pmc3/include/parrot/warnings.h Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/include/parrot/warnings.h Sat Aug 22 09:29:44 2009 (r40715)
@@ -36,18 +36,18 @@
/* &end_gen */
#define PARROT_WARNINGS_on(interp, flag) do { \
- CURRENT_CONTEXT_FIELD(warns) |= (flag); } while (0)
+ CURRENT_CONTEXT_FIELD(interp, warns) |= (flag); } while (0)
#define PARROT_WARNINGS_off(interp, flag) do { \
- CURRENT_CONTEXT_FIELD(warns) &= ~(flag); } while (0)
+ CURRENT_CONTEXT_FIELD(interp, warns) &= ~(flag); } while (0)
#define PARROT_WARNINGS_test(interp, flag) \
- (CURRENT_CONTEXT_FIELD(warns) & (flag))
+ (CURRENT_CONTEXT_FIELD(interp, warns) & (flag))
#define PARROT_ERRORS_on(interp, flag) do { \
- CURRENT_CONTEXT_FIELD(errors) |= (flag); } while (0)
+ CURRENT_CONTEXT_FIELD(interp, errors) |= (flag); } while (0)
#define PARROT_ERRORS_off(interp, flag) do { \
- CURRENT_CONTEXT_FIELD(errors) &= ~(flag); } while (0)
+ CURRENT_CONTEXT_FIELD(interp, errors) &= ~(flag); } while (0)
#define PARROT_ERRORS_test(interp, flag) \
- (CURRENT_CONTEXT_FIELD(errors) & (flag))
+ (CURRENT_CONTEXT_FIELD(interp, errors) & (flag))
#if defined(PARROT_IN_CORE)
Modified: branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm Sat Aug 22 09:29:44 2009 (r40715)
@@ -68,7 +68,7 @@
return $pred_def . <<END;
/* defines - $0 -> $type */
# define opcode_to_prederef(i, op) \\
- (opcode_t *) (op - CONTEXT_FIELD(i->ctx, pred_offset))
+ (opcode_t *) (op - CONTEXT_FIELD(interp, i->ctx, pred_offset))
END
}
@@ -91,7 +91,7 @@
return "if ($addr == 0)
return 0;
Parrot_cx_handle_tasks(interp, interp->scheduler);
- _reg_base = (char*)CURRENT_CONTEXT_FIELD(bp.regs_i);
+ _reg_base = (char*)CURRENT_CONTEXT_FIELD(interp, bp.regs_i);
goto **(void **)(cur_opcode = opcode_to_prederef(interp, $addr))";
}
}
@@ -107,7 +107,7 @@
my ( $self, $offset ) = @_;
# this must be a single expression, in case it's in a single-statement if
- return "do {\nCURRENT_CONTEXT_FIELD(current_pc) = CUR_OPCODE + $offset;\n"
+ return "do {\nCURRENT_CONTEXT_FIELD(interp, current_pc) = CUR_OPCODE + $offset;\n"
. "goto **(void **)(cur_opcode += $offset);\n} while (1)";
}
Modified: branches/context_pmc3/lib/Parrot/OpTrans/CPrederef.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/CPrederef.pm Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/lib/Parrot/OpTrans/CPrederef.pm Sat Aug 22 09:29:44 2009 (r40715)
@@ -38,7 +38,7 @@
/* defines - $0 -> $type */
#define REL_PC ((size_t)(cur_opcode - (opcode_t*)interp->code->prederef.code))
#define CUR_OPCODE \\
- ((opcode_t*)cur_opcode + CURRENT_CONTEXT_FIELD(pred_offset))
+ ((opcode_t*)cur_opcode + CURRENT_CONTEXT_FIELD(interp, pred_offset))
#define OP_AS_OFFS(o) (_reg_base + ((opcode_t*)cur_opcode)[o])
END
Modified: branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm Sat Aug 22 09:29:44 2009 (r40715)
@@ -76,7 +76,7 @@
return $pred_def . <<END;
/* defines - $0 -> $type */
# define opcode_to_prederef(i, op) (op ? \\
- (opcode_t*) (op - CONTEXT_FIELD(i->ctx, pred_offset)) : (opcode_t*)NULL)
+ (opcode_t*) (op - CONTEXT_FIELD(interp, i->ctx, pred_offset)) : (opcode_t*)NULL)
END
}
@@ -154,7 +154,7 @@
#endif
SWITCH_RELOAD:
- _reg_base = (char*)CURRENT_CONTEXT_FIELD(bp.regs_i);
+ _reg_base = (char*)CURRENT_CONTEXT_FIELD(interp, bp.regs_i);
do {
SWITCH_AGAIN:
Parrot_cx_handle_tasks(interp, interp->scheduler);
Modified: branches/context_pmc3/lib/Parrot/Ops2c/Utils.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/Ops2c/Utils.pm Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/lib/Parrot/Ops2c/Utils.pm Sat Aug 22 09:29:44 2009 (r40715)
@@ -685,7 +685,7 @@
__asm__ ("jmp *4(%ebp)"); /* jump to ret addr, used by JIT */
# endif
#endif
- _reg_base = (char*)CURRENT_CONTEXT_FIELD(bp.regs_i);
+ _reg_base = (char*)CURRENT_CONTEXT_FIELD(interp, bp.regs_i);
goto **(void **)cur_opcode;
END_C
Modified: branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm Sat Aug 22 09:29:44 2009 (r40715)
@@ -403,7 +403,7 @@
UNUSED(_return_indexes);
if (_caller_ctx) {
- _ccont = CONTEXT_FIELD(_caller_ctx, current_cont);
+ _ccont = CONTEXT_FIELD(interp, _caller_ctx, current_cont);
}
else {
/* there is no point calling Parrot_ex_throw_from_c_args here, because
@@ -411,7 +411,7 @@
exit_fatal(1, "No caller_ctx for continuation \%p.", _ccont);
}
- CONTEXT_FIELD(_ctx, current_cont) = _ret_cont;
+ CONTEXT_FIELD(interp, _ctx, current_cont) = _ret_cont;
PMC_cont(_ret_cont)->from_ctx = _ctx;
_current_args = interp->current_args;
@@ -429,8 +429,8 @@
if (PObj_get_FLAGS(_ccont) & SUB_FLAG_TAILCALL) {
PObj_get_FLAGS(_ccont) &= ~SUB_FLAG_TAILCALL;
- --CONTEXT_FIELD(_ctx, recursion_depth);
- CONTEXT_FIELD(_ctx, caller_ctx) = CONTEXT_FIELD(_caller_ctx, caller_ctx);
+ --CONTEXT_FIELD(interp, _ctx, recursion_depth);
+ CONTEXT_FIELD(interp, _ctx, caller_ctx) = CONTEXT_FIELD(interp, _caller_ctx, caller_ctx);
interp->current_args = NULL;
}
/* BEGIN PARMS SCOPE */
@@ -465,7 +465,7 @@
interp->returns_signature = _return_sig;
parrot_pass_args(interp, _ctx, _caller_ctx, _return_indexes,
- CONTEXT_FIELD(_caller_ctx, current_results), PARROT_PASS_RESULTS);
+ CONTEXT_FIELD(interp, _caller_ctx, current_results), PARROT_PASS_RESULTS);
END
}
$e_post->emit( <<"END", __FILE__, __LINE__ + 1 );
Modified: branches/context_pmc3/src/call/ops.c
==============================================================================
--- branches/context_pmc3/src/call/ops.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/call/ops.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -169,7 +169,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"Subroutine returned a NULL address");
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
offset = dest - interp->code->base.data;
runops(interp, offset);
return ctx;
@@ -212,7 +212,7 @@
char new_sig[10];
const char *sig_p;
- PMC * const old_ctx = CURRENT_CONTEXT;
+ PMC * const old_ctx = CURRENT_CONTEXT(interp);
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
interp->current_object = obj;
@@ -264,7 +264,7 @@
"no get_params in sub");
*/
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
offset = dest - interp->code->base.data;
runops(interp, offset);
return ctx;
@@ -304,7 +304,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"Subroutine returned a NULL address");
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
offset = dest - interp->code->base.data;
runops(interp, offset);
return set_retval(interp, 0, ctx);
Modified: branches/context_pmc3/src/call/pcc.c
==============================================================================
--- branches/context_pmc3/src/call/pcc.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/call/pcc.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -341,14 +341,14 @@
#define PARROT_MAX(a, b) (((a)) > (b) ? (a) : (b))
#define SAVE_OFF_REGS(orig, next, save) \
- CONTEXT_FIELD((save), bp) = CONTEXT_FIELD((orig), bp);\
- CONTEXT_FIELD((save), bp_ps) = CONTEXT_FIELD((orig), bp_ps);\
- CONTEXT_FIELD((orig), bp) = CONTEXT_FIELD((next), bp);\
- CONTEXT_FIELD((orig), bp_ps) = CONTEXT_FIELD((next), bp_ps);
+ CONTEXT_FIELD(interp, (save), bp) = CONTEXT_FIELD(interp, (orig), bp);\
+ CONTEXT_FIELD(interp, (save), bp_ps) = CONTEXT_FIELD(interp, (orig), bp_ps);\
+ CONTEXT_FIELD(interp, (orig), bp) = CONTEXT_FIELD(interp, (next), bp);\
+ CONTEXT_FIELD(interp, (orig), bp_ps) = CONTEXT_FIELD(interp, (next), bp_ps);
#define RESTORE_REGS(orig, save) \
- CONTEXT_FIELD((orig), bp) = CONTEXT_FIELD((save), bp);\
- CONTEXT_FIELD((orig), bp_ps) = CONTEXT_FIELD((save), bp_ps);
+ CONTEXT_FIELD(interp, (orig), bp) = CONTEXT_FIELD(interp, (save), bp);\
+ CONTEXT_FIELD(interp, (orig), bp_ps) = CONTEXT_FIELD(interp, (save), bp_ps);
/*
@@ -489,13 +489,13 @@
init_call_stats(st);
if (PMC_IS_NULL(interp->args_signature))
- Parrot_init_arg_op(interp, CURRENT_CONTEXT, interp->current_args,
+ Parrot_init_arg_op(interp, CURRENT_CONTEXT(interp), interp->current_args,
&st->src);
else
- Parrot_init_arg_indexes_and_sig_pmc(interp, CURRENT_CONTEXT,
+ Parrot_init_arg_indexes_and_sig_pmc(interp, CURRENT_CONTEXT(interp),
interp->current_args, interp->args_signature, &st->src);
- Parrot_init_arg_sig(interp, CURRENT_CONTEXT, sig, NULL, &st->dest);
+ Parrot_init_arg_sig(interp, CURRENT_CONTEXT(interp), sig, NULL, &st->dest);
}
@@ -516,8 +516,8 @@
Parrot_init_ret_nci(PARROT_INTERP, ARGOUT(call_state *st), ARGIN(const char *sig))
{
ASSERT_ARGS(Parrot_init_ret_nci)
- PMC *ctx = CURRENT_CONTEXT;
- PMC * const current_cont = CONTEXT_FIELD(ctx, current_cont);
+ PMC *ctx = CURRENT_CONTEXT(interp);
+ PMC * const current_cont = CONTEXT_FIELD(interp, ctx, current_cont);
/* if this NCI call was a taicall, return results to caller's get_results
* this also means that we pass the caller's register base pointer */
@@ -525,16 +525,16 @@
ctx = PMC_cont(current_cont)->to_ctx;
/* TODO simplify all */
- Parrot_init_arg_sig(interp, CURRENT_CONTEXT, sig, NULL, &st->src);
+ Parrot_init_arg_sig(interp, CURRENT_CONTEXT(interp), sig, NULL, &st->src);
/* Non-constant signatures are stored in ctx->results_signature instead of
* in the constants table. */
- if (CONTEXT_FIELD(ctx, results_signature))
+ if (CONTEXT_FIELD(interp, ctx, results_signature))
Parrot_init_arg_indexes_and_sig_pmc(interp, ctx,
- CONTEXT_FIELD(ctx, current_results),
- CONTEXT_FIELD(ctx, results_signature), &st->dest);
+ CONTEXT_FIELD(interp, ctx, current_results),
+ CONTEXT_FIELD(interp, ctx, results_signature), &st->dest);
else
- Parrot_init_arg_op(interp, ctx, CONTEXT_FIELD(ctx, current_results), &st->dest);
+ Parrot_init_arg_op(interp, ctx, CONTEXT_FIELD(interp, ctx, current_results), &st->dest);
}
@@ -565,7 +565,7 @@
ASSERT_ARGS(Parrot_init_arg_indexes_and_sig_pmc)
if (!sig_pmc && indexes) {
++indexes;
- sig_pmc = CONTEXT_FIELD(ctx, constants[*indexes])->u.key;
+ sig_pmc = CONTEXT_FIELD(interp, ctx, constants[*indexes])->u.key;
ASSERT_SIG_PMC(sig_pmc);
++indexes;
}
@@ -615,7 +615,7 @@
if (pc) {
++pc;
- sig_pmc = CONTEXT_FIELD(ctx, constants[*pc])->u.key;
+ sig_pmc = CONTEXT_FIELD(interp, ctx, constants[*pc])->u.key;
ASSERT_SIG_PMC(sig_pmc);
++pc;
}
@@ -781,7 +781,7 @@
break;
case PARROT_ARG_PMC:
if (st->src.u.sig.sig[st->src.i] == 'O')
- UVal_pmc(st->val) = CURRENT_CONTEXT_FIELD(current_object);
+ UVal_pmc(st->val) = CURRENT_CONTEXT_FIELD(interp, current_object);
else {
UVal_pmc(st->val) = va_arg(*ap, PMC *);
}
@@ -844,7 +844,7 @@
break;
}
case PARROT_ARG_FLOATVAL:
- UVal_num(st->val) = constant ? CONTEXT_FIELD(st->src.ctx, constants[idx])->u.number
+ UVal_num(st->val) = constant ? CONTEXT_FIELD(interp, st->src.ctx, constants[idx])->u.number
: CTX_REG_NUM(st->src.ctx, idx);
break;
case PARROT_ARG_PMC:
@@ -1209,15 +1209,15 @@
Regs_ps bp_ps;
/* clone sets key values according to refered register items */
- bp = CURRENT_CONTEXT_FIELD(bp);
- bp_ps = CURRENT_CONTEXT_FIELD(bp_ps);
- CURRENT_CONTEXT_FIELD(bp) = CONTEXT_FIELD(st->src.ctx, bp);
- CURRENT_CONTEXT_FIELD(bp_ps) = CONTEXT_FIELD(st->src.ctx, bp_ps);
+ bp = CURRENT_CONTEXT_FIELD(interp, bp);
+ bp_ps = CURRENT_CONTEXT_FIELD(interp, bp_ps);
+ CURRENT_CONTEXT_FIELD(interp, bp) = CONTEXT_FIELD(interp, st->src.ctx, bp);
+ CURRENT_CONTEXT_FIELD(interp, bp_ps) = CONTEXT_FIELD(interp, st->src.ctx, bp_ps);
UVal_pmc(st->val) = VTABLE_clone(interp, key);
- CURRENT_CONTEXT_FIELD(bp) = bp;
- CURRENT_CONTEXT_FIELD(bp_ps) = bp_ps;
+ CURRENT_CONTEXT_FIELD(interp, bp) = bp;
+ CURRENT_CONTEXT_FIELD(interp, bp_ps) = bp_ps;
return;
}
@@ -1894,9 +1894,9 @@
}
else /* (param_or_result == PARROT_PASS_RESULTS) */ {
src_signature = interp->returns_signature;
- dest_signature = CONTEXT_FIELD(dest_ctx, results_signature);
+ dest_signature = CONTEXT_FIELD(interp, dest_ctx, results_signature);
interp->returns_signature = NULL;
- CONTEXT_FIELD(dest_ctx, results_signature) = NULL;
+ CONTEXT_FIELD(interp, dest_ctx, results_signature) = NULL;
}
Parrot_init_arg_indexes_and_sig_pmc(interp, src_ctx, src_indexes,
@@ -1933,7 +1933,7 @@
ASSERT_ARGS(parrot_pass_args_fromc)
call_state st;
- Parrot_init_arg_op(interp, CURRENT_CONTEXT, dest, &st.dest);
+ Parrot_init_arg_op(interp, CURRENT_CONTEXT(interp), dest, &st.dest);
Parrot_init_arg_sig(interp, old_ctxp, sig, PARROT_VA_TO_VAPTR(ap), &st.src);
Parrot_process_args(interp, &st, PARROT_PASS_PARAMS);
return dest + st.dest.n + 2;
@@ -1963,7 +1963,7 @@
interp->current_returns = NULL;
if (todo) {
- todo = Parrot_init_arg_sig(interp, CURRENT_CONTEXT, sig, NULL,
+ todo = Parrot_init_arg_sig(interp, CURRENT_CONTEXT(interp), sig, NULL,
&st->dest);
if (todo) {
@@ -2632,8 +2632,8 @@
interp->current_args = indexes[0];
interp->args_signature = sigs[0];
- CONTEXT_FIELD(ctx, current_results) = indexes[1];
- CONTEXT_FIELD(ctx, results_signature) = sigs[1];
+ CONTEXT_FIELD(interp, ctx, current_results) = indexes[1];
+ CONTEXT_FIELD(interp, ctx, results_signature) = sigs[1];
return ret_x;
}
@@ -2867,14 +2867,14 @@
interp->current_args = arg_indexes;
interp->args_signature = args_sig;
- CONTEXT_FIELD(ctx, current_results) = result_indexes;
- CONTEXT_FIELD(ctx, results_signature) = results_sig;
+ CONTEXT_FIELD(interp, ctx, current_results) = result_indexes;
+ CONTEXT_FIELD(interp, ctx, results_signature) = results_sig;
/* arg_accessors assigned in loop above */
interp->current_object = pmc;
interp->current_cont = NEED_CONTINUATION;
- CONTEXT_FIELD(ctx, current_cont) = ret_cont;
+ CONTEXT_FIELD(interp, ctx, current_cont) = ret_cont;
PMC_cont(ret_cont)->from_ctx = ctx;
pccinvoke_meth = VTABLE_find_method(interp, pmc, method_name);
@@ -3017,7 +3017,7 @@
interp->current_object = PMCNULL;
}
interp->current_cont = NEED_CONTINUATION;
- CONTEXT_FIELD(ctx, current_cont) = ret_cont;
+ CONTEXT_FIELD(interp, ctx, current_cont) = ret_cont;
PMC_cont(ret_cont)->from_ctx = ctx;
/* Invoke the function */
Modified: branches/context_pmc3/src/debug.c
==============================================================================
--- branches/context_pmc3/src/debug.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/debug.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -2211,7 +2211,7 @@
PDB_check_condition(PARROT_INTERP, ARGIN(const PDB_condition_t *condition))
{
ASSERT_ARGS(PDB_check_condition)
- PMC *ctx = CURRENT_CONTEXT;
+ PMC *ctx = CURRENT_CONTEXT(interp);
TRACEDEB_MSG("PDB_check_condition");
@@ -2219,7 +2219,7 @@
if (condition->type & PDB_cond_int) {
INTVAL i, j;
- if (condition->reg >= CONTEXT_FIELD(ctx, n_regs_used[REGNO_INT]))
+ if (condition->reg >= CONTEXT_FIELD(interp, ctx, n_regs_used[REGNO_INT]))
return 0;
i = CTX_REG_INT(ctx, condition->reg);
@@ -2241,7 +2241,7 @@
else if (condition->type & PDB_cond_num) {
FLOATVAL k, l;
- if (condition->reg >= CONTEXT_FIELD(ctx, n_regs_used[REGNO_NUM]))
+ if (condition->reg >= CONTEXT_FIELD(interp, ctx, n_regs_used[REGNO_NUM]))
return 0;
k = CTX_REG_NUM(ctx, condition->reg);
@@ -2263,7 +2263,7 @@
else if (condition->type & PDB_cond_str) {
STRING *m, *n;
- if (condition->reg >= CONTEXT_FIELD(ctx, n_regs_used[REGNO_STR]))
+ if (condition->reg >= CONTEXT_FIELD(interp, ctx, n_regs_used[REGNO_STR]))
return 0;
m = CTX_REG_STR(ctx, condition->reg);
@@ -2294,7 +2294,7 @@
else if (condition->type & PDB_cond_pmc) {
PMC *m;
- if (condition->reg >= CONTEXT_FIELD(ctx, n_regs_used[REGNO_PMC]))
+ if (condition->reg >= CONTEXT_FIELD(interp, ctx, n_regs_used[REGNO_PMC]))
return 0;
m = CTX_REG_PMC(ctx, condition->reg);
@@ -3512,7 +3512,7 @@
/* information about the current sub */
PMC *sub = interpinfo_p(interp, CURRENT_SUB);
- PMC *ctx = CURRENT_CONTEXT;
+ PMC *ctx = CURRENT_CONTEXT(interp);
if (!PMC_IS_NULL(sub)) {
str = Parrot_Context_infostr(interp, ctx);
@@ -3520,7 +3520,7 @@
Parrot_io_eprintf(interp, "%Ss", str);
if (interp->code->annotations) {
PMC *annot = PackFile_Annotations_lookup(interp, interp->code->annotations,
- CONTEXT_FIELD(ctx, current_pc) - interp->code->base.data + 1, NULL);
+ CONTEXT_FIELD(interp, ctx, current_pc) - interp->code->base.data + 1, NULL);
if (!PMC_IS_NULL(annot)) {
PMC *pfile = VTABLE_get_pmc_keyed_str(interp, annot,
Parrot_str_new_constant(interp, "file"));
@@ -3540,7 +3540,7 @@
/* backtrace: follow the continuation chain */
while (1) {
Parrot_cont *sub_cont;
- sub = CONTEXT_FIELD(ctx, current_cont);
+ sub = CONTEXT_FIELD(interp, ctx, current_cont);
if (!sub)
break;
@@ -3557,10 +3557,10 @@
/* recursion detection */
if (!PMC_IS_NULL(old) && PMC_cont(old) &&
- CONTEXT_FIELD(PMC_cont(old)->to_ctx, current_pc) ==
- CONTEXT_FIELD(PMC_cont(sub)->to_ctx, current_pc) &&
- CONTEXT_FIELD(PMC_cont(old)->to_ctx, current_sub) ==
- CONTEXT_FIELD(PMC_cont(sub)->to_ctx, current_sub)) {
+ CONTEXT_FIELD(interp, PMC_cont(old)->to_ctx, current_pc) ==
+ CONTEXT_FIELD(interp, PMC_cont(sub)->to_ctx, current_pc) &&
+ CONTEXT_FIELD(interp, PMC_cont(old)->to_ctx, current_sub) ==
+ CONTEXT_FIELD(interp, PMC_cont(sub)->to_ctx, current_sub)) {
++rec_level;
}
else if (rec_level != 0) {
@@ -3573,7 +3573,7 @@
Parrot_io_eprintf(interp, "%Ss", str);
if (interp->code->annotations) {
PMC *annot = PackFile_Annotations_lookup(interp, interp->code->annotations,
- CONTEXT_FIELD(sub_cont->to_ctx, current_pc) - interp->code->base.data + 1,
+ CONTEXT_FIELD(interp, sub_cont->to_ctx, current_pc) - interp->code->base.data + 1,
NULL);
if (!PMC_IS_NULL(annot)) {
@@ -3634,7 +3634,7 @@
ASSERT_ARGS(GDB_print_reg)
char * string;
- if (n >= 0 && n < CURRENT_CONTEXT_FIELD(n_regs_used[t])) {
+ if (n >= 0 && n < CURRENT_CONTEXT_FIELD(interp, n_regs_used[t])) {
switch (t) {
case REGNO_INT:
return Parrot_str_from_int(interp, IREG(n))->strstart;
@@ -3699,7 +3699,7 @@
}
if (! s[1]) {
/* Print all registers of this type. */
- const int max_reg = CURRENT_CONTEXT_FIELD(n_regs_used[t]);
+ const int max_reg = CURRENT_CONTEXT_FIELD(interp, n_regs_used[t]);
int n;
for (n = 0; n < max_reg; n++) {
Modified: branches/context_pmc3/src/embed.c
==============================================================================
--- branches/context_pmc3/src/embed.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/embed.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -234,7 +234,7 @@
void
Parrot_set_trace(PARROT_INTERP, UINTVAL flag)
{
- CURRENT_CONTEXT_FIELD(trace_flags) |= flag;
+ CURRENT_CONTEXT_FIELD(interp, trace_flags) |= flag;
Interp_core_SET(interp, PARROT_SLOW_CORE);
}
@@ -289,7 +289,7 @@
void
Parrot_clear_trace(PARROT_INTERP, UINTVAL flag)
{
- CURRENT_CONTEXT_FIELD(trace_flags) &= ~flag;
+ CURRENT_CONTEXT_FIELD(interp, trace_flags) &= ~flag;
}
@@ -343,7 +343,7 @@
UINTVAL
Parrot_test_trace(PARROT_INTERP, UINTVAL flag)
{
- return CURRENT_CONTEXT_FIELD(trace_flags) & flag;
+ return CURRENT_CONTEXT_FIELD(interp, trace_flags) & flag;
}
@@ -910,8 +910,8 @@
const size_t offs = sub->start_offs;
if (offs == interp->resume_offset) {
- CURRENT_CONTEXT_FIELD(current_sub) = sub_pmc;
- CURRENT_CONTEXT_FIELD(current_HLL) = sub->HLL_id;
+ CURRENT_CONTEXT_FIELD(interp, current_sub) = sub_pmc;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = sub->HLL_id;
return sub_pmc;
}
@@ -925,7 +925,7 @@
sub_pmc = pmc_new(interp, enum_class_Sub);
PMC_get_sub(interp, sub_pmc, sub_pmc_sub);
sub_pmc_sub->start_offs = 0;
- CURRENT_CONTEXT_FIELD(current_sub) = sub_pmc;
+ CURRENT_CONTEXT_FIELD(interp, current_sub) = sub_pmc;
return sub_pmc;
}
@@ -970,15 +970,15 @@
Parrot_on_exit(interp, print_profile, NULL);
/* Let's kick the tires and light the fires--call interpreter.c:runops. */
- main_sub = CURRENT_CONTEXT_FIELD(current_sub);
+ main_sub = CURRENT_CONTEXT_FIELD(interp, current_sub);
/* if no sub was marked being :main, we create a dummy sub with offset 0 */
if (!main_sub)
main_sub = set_current_sub(interp);
- CURRENT_CONTEXT_FIELD(current_sub) = NULL;
- CURRENT_CONTEXT_FIELD(constants) = interp->code->const_table->constants;
+ CURRENT_CONTEXT_FIELD(interp, current_sub) = NULL;
+ CURRENT_CONTEXT_FIELD(interp, constants) = interp->code->const_table->constants;
Parrot_runops_fromc_args(interp, main_sub, "vP", userargv);
}
@@ -1247,7 +1247,7 @@
run_native = func;
if (interp->code && interp->code->const_table)
- CURRENT_CONTEXT_FIELD(constants) = interp->code->const_table->constants;
+ CURRENT_CONTEXT_FIELD(interp, constants) = interp->code->const_table->constants;
runops(interp, interp->resume_offset);
}
Modified: branches/context_pmc3/src/exceptions.c
==============================================================================
--- branches/context_pmc3/src/exceptions.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/exceptions.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -253,7 +253,7 @@
/* Set up the continuation context of the handler in the interpreter. */
else if (PMC_cont(handler)->current_results)
address = pass_exception_args(interp, "P", address,
- CURRENT_CONTEXT, exception);
+ CURRENT_CONTEXT(interp), exception);
if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
/* it's a C exception handler */
@@ -389,7 +389,8 @@
/* Note the thrower.
* XXX TT#596 - pass in current context instead when we have context PMCs. */
- VTABLE_set_attr_str(interp, exception, CONST_STRING(interp, "thrower"), CURRENT_CONTEXT_FIELD(current_cont));
+ /* Don't split line. It will break CONST_STRING handling */
+ VTABLE_set_attr_str(interp, exception, CONST_STRING(interp, "thrower"), CURRENT_CONTEXT_FIELD(interp, current_cont));
/* it's a C exception handler */
if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
@@ -402,7 +403,7 @@
address = VTABLE_invoke(interp, handler, NULL);
if (PMC_cont(handler)->current_results)
address = pass_exception_args(interp, "P", address,
- CURRENT_CONTEXT, exception);
+ CURRENT_CONTEXT(interp), exception);
PARROT_ASSERT(return_point->handler_start == NULL);
return_point->handler_start = address;
longjmp(return_point->resume, 2);
Modified: branches/context_pmc3/src/extend.c
==============================================================================
--- branches/context_pmc3/src/extend.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/extend.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -1046,7 +1046,7 @@
va_start(ap, signature);
PMC_get_sub(interp, sub_pmc, sub);
- CURRENT_CONTEXT_FIELD(constants) = sub->seg->const_table->constants;
+ CURRENT_CONTEXT_FIELD(interp, constants) = sub->seg->const_table->constants;
result = Parrot_runops_fromc_arglist(interp, sub_pmc, signature, ap);
va_end(ap);
@@ -1079,7 +1079,7 @@
va_start(ap, signature);
PMC_get_sub(interp, sub_pmc, sub);
- CURRENT_CONTEXT_FIELD(constants) = sub->seg->const_table->constants;
+ CURRENT_CONTEXT_FIELD(interp, constants) = sub->seg->const_table->constants;
result = Parrot_runops_fromc_arglist_reti(interp, sub_pmc, signature, ap);
va_end(ap);
@@ -1112,7 +1112,7 @@
va_start(ap, signature);
PMC_get_sub(interp, sub_pmc, sub);
- CURRENT_CONTEXT_FIELD(constants) = sub->seg->const_table->constants;
+ CURRENT_CONTEXT_FIELD(interp, constants) = sub->seg->const_table->constants;
result = Parrot_runops_fromc_arglist_retf(interp, sub_pmc, signature, ap);
va_end(ap);
Modified: branches/context_pmc3/src/gc/alloc_register.c
==============================================================================
--- branches/context_pmc3/src/gc/alloc_register.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/gc/alloc_register.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -320,13 +320,13 @@
Parrot_push_context(PARROT_INTERP, ARGIN(const INTVAL *n_regs_used))
{
ASSERT_ARGS(Parrot_push_context)
- PMC * const old = CURRENT_CONTEXT;
+ PMC * const old = CURRENT_CONTEXT(interp);
PMC * const ctx = Parrot_set_new_context(interp, n_regs_used);
- CONTEXT_FIELD(ctx, caller_ctx) = old;
+ CONTEXT_FIELD(interp, ctx, caller_ctx) = old;
/* doesn't change */
- CONTEXT_FIELD(ctx, current_sub) = CONTEXT_FIELD(old, current_sub);
+ CONTEXT_FIELD(interp, ctx, current_sub) = CONTEXT_FIELD(interp, old, current_sub);
/* copy more ? */
return ctx;
@@ -349,11 +349,11 @@
Parrot_pop_context(PARROT_INTERP)
{
ASSERT_ARGS(Parrot_pop_context)
- PMC * const ctx = CURRENT_CONTEXT;
- PMC * const old = CONTEXT_FIELD(ctx, caller_ctx);
+ PMC * const ctx = CURRENT_CONTEXT(interp);
+ PMC * const old = CONTEXT_FIELD(interp, ctx, caller_ctx);
/* restore old, set cached interpreter base pointers */
- CURRENT_CONTEXT = old;
+ CURRENT_CONTEXT(interp) = old;
}
@@ -437,10 +437,10 @@
Parrot_set_new_context(PARROT_INTERP, ARGIN(const INTVAL *number_regs_used))
{
ASSERT_ARGS(Parrot_set_new_context)
- PMC *old = CURRENT_CONTEXT;
+ PMC *old = CURRENT_CONTEXT(interp);
PMC *ctx = Parrot_alloc_context(interp, number_regs_used, old);
- CURRENT_CONTEXT = ctx;
+ CURRENT_CONTEXT(interp) = ctx;
return ctx;
}
@@ -470,7 +470,7 @@
{
ASSERT_ARGS(Parrot_clear_i)
int i;
- for (i = 0; i < CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]); ++i)
+ for (i = 0; i < CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]); ++i)
REG_INT(interp, i) = 0;
}
@@ -491,7 +491,7 @@
{
ASSERT_ARGS(Parrot_clear_s)
int i;
- for (i = 0; i < CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_STR]); ++i)
+ for (i = 0; i < CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_STR]); ++i)
REG_STR(interp, i) = NULL;
}
@@ -512,7 +512,7 @@
{
ASSERT_ARGS(Parrot_clear_p)
int i;
- for (i = 0; i < CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_PMC]); ++i)
+ for (i = 0; i < CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_PMC]); ++i)
REG_PMC(interp, i) = PMCNULL;
}
@@ -533,7 +533,7 @@
{
ASSERT_ARGS(Parrot_clear_n)
int i;
- for (i = 0; i < CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]); ++i)
+ for (i = 0; i < CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]); ++i)
REG_NUM(interp, i) = 0.0;
}
Modified: branches/context_pmc3/src/gc/mark_sweep.c
==============================================================================
--- branches/context_pmc3/src/gc/mark_sweep.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/gc/mark_sweep.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -207,7 +207,7 @@
Parrot_gc_mark_PObj_alive(interp, obj);
/* mark the current context. */
- Parrot_gc_mark_PObj_alive(interp, (PObj*)CURRENT_CONTEXT);
+ Parrot_gc_mark_PObj_alive(interp, (PObj*)CURRENT_CONTEXT(interp));
/* mark the dynamic environment. */
Parrot_gc_mark_PObj_alive(interp, (PObj*)interp->dynamic_env);
Modified: branches/context_pmc3/src/global.c
==============================================================================
--- branches/context_pmc3/src/global.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/global.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -375,10 +375,10 @@
ASSERT_ARGS(Parrot_make_namespace_autobase)
PMC *base_ns;
if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
- base_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ base_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
else
base_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
- CURRENT_CONTEXT_FIELD(current_HLL));
+ CURRENT_CONTEXT_FIELD(interp, current_HLL));
return Parrot_make_namespace_keyed(interp, base_ns, key);
}
@@ -531,7 +531,7 @@
Parrot_find_global_cur(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname))
{
ASSERT_ARGS(Parrot_find_global_cur)
- PMC * const ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
return Parrot_find_global_n(interp, ns, globalname);
}
@@ -678,7 +678,7 @@
Parrot_find_name_op(PARROT_INTERP, ARGIN(STRING *name), SHIM(void *next))
{
ASSERT_ARGS(Parrot_find_name_op)
- PMC * const ctx = CURRENT_CONTEXT;
+ PMC * const ctx = CURRENT_CONTEXT(interp);
PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
PMC *g;
@@ -788,7 +788,7 @@
Parrot_store_sub_in_namespace(PARROT_INTERP, ARGIN(PMC *sub_pmc))
{
ASSERT_ARGS(Parrot_store_sub_in_namespace)
- const INTVAL cur_id = CURRENT_CONTEXT_FIELD(current_HLL);
+ const INTVAL cur_id = CURRENT_CONTEXT_FIELD(interp, current_HLL);
PMC *ns;
Parrot_Sub_attributes *sub;
@@ -798,7 +798,7 @@
/* store relative to HLL namespace */
PMC_get_sub(interp, sub_pmc, sub);
- CURRENT_CONTEXT_FIELD(current_HLL) = sub->HLL_id;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = sub->HLL_id;
ns = get_namespace_pmc(interp, sub_pmc);
@@ -824,7 +824,7 @@
}
/* restore HLL_id */
- CURRENT_CONTEXT_FIELD(current_HLL) = cur_id;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = cur_id;
Parrot_unblock_GC_mark(interp);
}
Modified: branches/context_pmc3/src/global_setup.c
==============================================================================
--- branches/context_pmc3/src/global_setup.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/global_setup.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -215,7 +215,7 @@
interp->root_namespace = pmc_new(interp, enum_class_NameSpace);
Parrot_init_HLL(interp);
- CURRENT_CONTEXT_FIELD(current_namespace) =
+ CURRENT_CONTEXT_FIELD(interp, current_namespace) =
VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace, 0);
/* We need a class hash */
Modified: branches/context_pmc3/src/hll.c
==============================================================================
--- branches/context_pmc3/src/hll.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/hll.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -446,7 +446,7 @@
Parrot_get_ctx_HLL_type(PARROT_INTERP, INTVAL core_type)
{
ASSERT_ARGS(Parrot_get_ctx_HLL_type)
- const INTVAL hll_id = CURRENT_CONTEXT_FIELD(current_HLL);
+ const INTVAL hll_id = CURRENT_CONTEXT_FIELD(interp, current_HLL);
return Parrot_get_HLL_type(interp, hll_id, core_type);
}
@@ -468,7 +468,7 @@
Parrot_get_ctx_HLL_namespace(PARROT_INTERP)
{
ASSERT_ARGS(Parrot_get_ctx_HLL_namespace)
- return Parrot_get_HLL_namespace(interp, CURRENT_CONTEXT_FIELD(current_HLL));
+ return Parrot_get_HLL_namespace(interp, CURRENT_CONTEXT_FIELD(interp, current_HLL));
}
/*
Modified: branches/context_pmc3/src/interp/inter_create.c
==============================================================================
--- branches/context_pmc3/src/interp/inter_create.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/interp/inter_create.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -157,7 +157,7 @@
interp->resume_flag = RESUME_INITIAL;
/* main is called as a Sub too - this will get depth 0 then */
- //CURRENT_CONTEXT_FIELD(recursion_depth) = (UINTVAL)-1;
+ //CURRENT_CONTEXT_FIELD(interp, recursion_depth) = (UINTVAL)-1;
interp->recursion_limit = RECURSION_LIMIT;
/* PANIC will fail until this is done */
@@ -213,9 +213,9 @@
#endif
/* clear context introspection vars */
- CURRENT_CONTEXT_FIELD(current_sub) = NULL;
- CURRENT_CONTEXT_FIELD(current_cont) = NULL;
- CURRENT_CONTEXT_FIELD(current_object) = NULL;
+ CURRENT_CONTEXT_FIELD(interp, current_sub) = NULL;
+ CURRENT_CONTEXT_FIELD(interp, current_cont) = NULL;
+ CURRENT_CONTEXT_FIELD(interp, current_object) = NULL;
/* Load the core op func and info tables */
interp->op_lib = PARROT_CORE_OPLIB_INIT(1);
Modified: branches/context_pmc3/src/interp/inter_misc.c
==============================================================================
--- branches/context_pmc3/src/interp/inter_misc.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/interp/inter_misc.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -285,19 +285,19 @@
ASSERT_ARGS(interpinfo_p)
switch (what) {
case CURRENT_SUB:
- return CURRENT_CONTEXT_FIELD(current_sub);
+ return CURRENT_CONTEXT_FIELD(interp, current_sub);
case CURRENT_CONT:
{
- PMC * const cont = CURRENT_CONTEXT_FIELD(current_cont);
+ PMC * const cont = CURRENT_CONTEXT_FIELD(interp, current_cont);
if (!PMC_IS_NULL(cont) && cont->vtable->base_type ==
enum_class_RetContinuation)
return VTABLE_clone(interp, cont);
return cont;
}
case CURRENT_OBJECT:
- return CURRENT_CONTEXT_FIELD(current_object);
+ return CURRENT_CONTEXT_FIELD(interp, current_object);
case CURRENT_LEXPAD:
- return CURRENT_CONTEXT_FIELD(lex_pad);
+ return CURRENT_CONTEXT_FIELD(interp, lex_pad);
default: /* or a warning only? */
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
"illegal argument in interpinfo");
Modified: branches/context_pmc3/src/jit.c
==============================================================================
--- branches/context_pmc3/src/jit.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/jit.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -287,7 +287,7 @@
int arg_type;
PMC *sig;
if (argn >= args) {
- sig = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, cur_op[1]);
+ sig = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT(interp), cur_op[1]);
arg_type = VTABLE_get_integer_keyed_int(interp,
sig, argn - args);
arg_type &= (PARROT_ARG_TYPE_MASK | PARROT_ARG_CONSTANT);
@@ -396,8 +396,8 @@
{
int typ;
- cur_section->ru[0].registers_used = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
- cur_section->ru[3].registers_used = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]);
+ cur_section->ru[0].registers_used = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
+ cur_section->ru[3].registers_used = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]);
cur_section->ru[1].registers_used = cur_section->ru[2].registers_used = 0;
for (typ = 0; typ < 4; typ++) {
@@ -1304,7 +1304,7 @@
if (offs >= sub->start_offs && offs < sub->end_offs) {
for (i = 0; i < 4; i++)
- CURRENT_CONTEXT_FIELD(n_regs_used[i]) = sub->n_regs_used[i];
+ CURRENT_CONTEXT_FIELD(interp, n_regs_used[i]) = sub->n_regs_used[i];
return;
}
@@ -1425,7 +1425,7 @@
/* remember register usage */
for (i = 0; i < 4; i++)
- n_regs_used[i] = CURRENT_CONTEXT_FIELD(n_regs_used[i]);
+ n_regs_used[i] = CURRENT_CONTEXT_FIELD(interp, n_regs_used[i]);
set_reg_usage(interp, code_start);
@@ -1679,7 +1679,7 @@
/* restore register usage */
for (i = 0; i < 4; i++)
- CURRENT_CONTEXT_FIELD(n_regs_used[i]) = n_regs_used[i];
+ CURRENT_CONTEXT_FIELD(interp, n_regs_used[i]) = n_regs_used[i];
/* Do fixups before converting offsets */
(arch_info->jit_dofixup)(jit_info, interp);
Modified: branches/context_pmc3/src/jit/i386/core.jit
==============================================================================
--- branches/context_pmc3/src/jit/i386/core.jit Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/jit/i386/core.jit Sat Aug 22 09:29:44 2009 (r40715)
@@ -1458,7 +1458,7 @@
opcode_t *params;
int skip;
- constants = CURRENT_CONTEXT_FIELD(constants);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
params = jit_info->optimizer->sections->begin;
sig_params = constants[params[1]]->u.key;
op_i = 2 + VTABLE_elements(interp, sig_params);
@@ -1466,7 +1466,7 @@
offset = jit_info->arena.op_map[op_i].offset;
/* TODO preserve necessary regs */
assert(*CUR_OPCODE == PARROT_OP_get_results_pc);
- constants = CURRENT_CONTEXT_FIELD(constants);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
sig_result = constants[CUR_OPCODE[1]]->u.key;
if (!VTABLE_elements(interp, sig_result))
skip = -1;
@@ -1500,7 +1500,7 @@
PackFile_Constant ** constants;
PMC *sig_result;
- constants = CURRENT_CONTEXT_FIELD(constants);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
sig_result = constants[CUR_OPCODE[1]]->u.key;
if (!VTABLE_elements(interp, sig_result))
return;
Modified: branches/context_pmc3/src/jit/i386/jit_defs.c
==============================================================================
--- branches/context_pmc3/src/jit/i386/jit_defs.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/jit/i386/jit_defs.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -1232,7 +1232,7 @@
PMC *sig_pmc;
INTVAL *sig_bits, i, n;
- sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
+ sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT(interp), CUR_OPCODE[1]);
GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
n = VTABLE_elements(interp, sig_pmc);
jit_info->n_args = n;
@@ -1268,7 +1268,7 @@
int i, used_i, save_i;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
save_i = reg_info->n_preserved_I;
for (i = save_i; i < used_i; ++i) {
@@ -1284,7 +1284,7 @@
int i, used_i, save_i;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
save_i = reg_info->n_preserved_I;
/* note - reversed order of jit_save_regs */
@@ -1308,8 +1308,8 @@
int i, used_i, used_n;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
- used_n = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
+ used_n = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]);
jit_emit_sub_ri_i(interp, jit_info->native_ptr, emit_ESP,
(used_i * sizeof (INTVAL) + used_n * sizeof (FLOATVAL)));
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
@@ -1339,8 +1339,8 @@
int i, used_i, used_n;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
- used_n = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
+ used_n = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]);
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
for (i = 0; i < used_i; ++i) {
@@ -1369,7 +1369,7 @@
PMC *sig_pmc;
INTVAL *sig_bits, sig;
- sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
+ sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT(interp), CUR_OPCODE[1]);
if (!VTABLE_elements(interp, sig_pmc))
return;
GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
@@ -1443,7 +1443,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"set_args_jit - can't do that yet ");
- constants = CURRENT_CONTEXT_FIELD(constants);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
sig_args = constants[CUR_OPCODE[1]]->u.key;
if (!VTABLE_elements(interp, sig_args))
@@ -1748,8 +1748,8 @@
L1 = NATIVECODE;
emitm_calll(NATIVECODE, 0);
/* check type of return value */
- constants = CURRENT_CONTEXT_FIELD(constants);
- result = CURRENT_CONTEXT_FIELD(current_results);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
+ result = CURRENT_CONTEXT_FIELD(interp, current_results);
sig_result = constants[result[1]]->u.key;
if (!VTABLE_elements(interp, sig_result))
goto no_result;
Modified: branches/context_pmc3/src/jit_defs.c
==============================================================================
--- branches/context_pmc3/src/jit_defs.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/jit_defs.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -1232,7 +1232,7 @@
PMC *sig_pmc;
INTVAL *sig_bits, i, n;
- sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
+ sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT(interp), CUR_OPCODE[1]);
GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
n = VTABLE_elements(interp, sig_pmc);
jit_info->n_args = n;
@@ -1268,7 +1268,7 @@
int i, used_i, save_i;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
save_i = reg_info->n_preserved_I;
for (i = save_i; i < used_i; ++i) {
@@ -1284,7 +1284,7 @@
int i, used_i, save_i;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
save_i = reg_info->n_preserved_I;
/* note - reversed order of jit_save_regs */
@@ -1308,8 +1308,8 @@
int i, used_i, used_n;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
- used_n = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
+ used_n = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]);
jit_emit_sub_ri_i(interp, jit_info->native_ptr, emit_ESP,
(used_i * sizeof (INTVAL) + used_n * sizeof (FLOATVAL)));
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
@@ -1339,8 +1339,8 @@
int i, used_i, used_n;
const jit_arch_regs *reg_info;
- used_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
- used_n = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]);
+ used_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
+ used_n = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]);
reg_info = &jit_info->arch_info->regs[jit_info->code_type];
for (i = 0; i < used_i; ++i) {
@@ -1369,7 +1369,7 @@
PMC *sig_pmc;
INTVAL *sig_bits, sig;
- sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
+ sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT(interp), CUR_OPCODE[1]);
if (!VTABLE_elements(interp, sig_pmc))
return;
GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
@@ -1443,7 +1443,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"set_args_jit - can't do that yet ");
- constants = CURRENT_CONTEXT_FIELD(constants);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
sig_args = constants[CUR_OPCODE[1]]->u.key;
if (!VTABLE_elements(interp, sig_args))
@@ -1748,8 +1748,8 @@
L1 = NATIVECODE;
emitm_calll(NATIVECODE, 0);
/* check type of return value */
- constants = CURRENT_CONTEXT_FIELD(constants);
- result = CURRENT_CONTEXT_FIELD(current_results);
+ constants = CURRENT_CONTEXT_FIELD(interp, constants);
+ result = CURRENT_CONTEXT_FIELD(interp, current_results);
sig_result = constants[result[1]]->u.key;
if (!VTABLE_elements(interp, sig_result))
goto no_result;
Modified: branches/context_pmc3/src/multidispatch.c
==============================================================================
--- branches/context_pmc3/src/multidispatch.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/multidispatch.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -1229,7 +1229,7 @@
{
ASSERT_ARGS(mmd_add_multi_to_namespace)
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
- interp->HLL_namespace, CURRENT_CONTEXT_FIELD(current_HLL));
+ interp->HLL_namespace, CURRENT_CONTEXT_FIELD(interp, current_HLL));
PMC * const ns = Parrot_make_namespace_keyed_str(interp, hll_ns, ns_name);
PMC *multi_sub = Parrot_get_global(interp, ns, sub_name);
Modified: branches/context_pmc3/src/oo.c
==============================================================================
--- branches/context_pmc3/src/oo.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/oo.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -216,7 +216,7 @@
{
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace,
- CURRENT_CONTEXT_FIELD(current_HLL));
+ CURRENT_CONTEXT_FIELD(interp, current_HLL));
PMC * const ns = Parrot_get_namespace_keyed(interp,
hll_ns, key);
@@ -427,7 +427,7 @@
/* First check in current HLL namespace */
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
- CURRENT_CONTEXT_FIELD(current_HLL));
+ CURRENT_CONTEXT_FIELD(interp, current_HLL));
PMC * const ns = Parrot_get_namespace_keyed_str(interp, hll_ns, name);
PMC * const _class = PMC_IS_NULL(ns)
? PMCNULL : VTABLE_get_class(interp, ns);
Modified: branches/context_pmc3/src/ops/core.ops
==============================================================================
--- branches/context_pmc3/src/ops/core.ops Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/ops/core.ops Sat Aug 22 09:29:44 2009 (r40715)
@@ -447,7 +447,7 @@
inline op yield() :flow {
opcode_t *dest = expr NEXT();
- PMC * const p = CURRENT_CONTEXT_FIELD(current_sub);
+ PMC * const p = CURRENT_CONTEXT_FIELD(interp, current_sub);
dest = (opcode_t *)p->vtable->invoke(interp, p, dest);
goto ADDRESS(dest);
}
@@ -456,14 +456,14 @@
opcode_t *dest;
PMC * const p = $1;
dest = expr NEXT();
- interp->current_cont = CURRENT_CONTEXT_FIELD(current_cont);
+ interp->current_cont = CURRENT_CONTEXT_FIELD(interp, current_cont);
PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL;
dest = (opcode_t *)p->vtable->invoke(interp, p, dest);
goto ADDRESS(dest);
}
inline op returncc() :flow {
- PMC * const p = CURRENT_CONTEXT_FIELD(current_cont);
+ PMC * const p = CURRENT_CONTEXT_FIELD(interp, current_cont);
opcode_t * const dest = (opcode_t *)p->vtable->invoke(interp,
p, expr NEXT());
goto ADDRESS(dest);
@@ -527,7 +527,7 @@
PMC * const signature = $1;
INTVAL argc;
- CURRENT_CONTEXT_FIELD(current_results) = _this;
+ CURRENT_CONTEXT_FIELD(interp, current_results) = _this;
argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
@@ -541,10 +541,10 @@
opcode_t *src_indexes, *dst_indexes;
interp->current_params = _this;
- ctx = CURRENT_CONTEXT;
- ccont = CONTEXT_FIELD(ctx, current_cont);
+ ctx = CURRENT_CONTEXT(interp);
+ ccont = CONTEXT_FIELD(interp, ctx, current_cont);
- caller_ctx = CONTEXT_FIELD(ctx, caller_ctx);
+ caller_ctx = CONTEXT_FIELD(interp, ctx, caller_ctx);
src_indexes = interp->current_args;
dst_indexes = interp->current_params;
@@ -555,8 +555,8 @@
parrot_pass_args(interp, caller_ctx, ctx, src_indexes, dst_indexes, PARROT_PASS_PARAMS);
if (PObj_get_FLAGS(ccont) & SUB_FLAG_TAILCALL) {
PObj_get_FLAGS(ccont) &= ~SUB_FLAG_TAILCALL;
- --CONTEXT_FIELD(ctx, recursion_depth);
- CONTEXT_FIELD(ctx, caller_ctx) = CONTEXT_FIELD(caller_ctx, caller_ctx);
+ --CONTEXT_FIELD(interp, ctx, recursion_depth);
+ CONTEXT_FIELD(interp, ctx, caller_ctx) = CONTEXT_FIELD(interp, caller_ctx, caller_ctx);
interp->current_args = NULL;
}
argc = VTABLE_elements(interp, signature);
@@ -572,9 +572,9 @@
opcode_t *src_indexes, *dest_indexes;
interp->current_returns = _this;
- ctx = CURRENT_CONTEXT;
- caller_ctx = CONTEXT_FIELD(ctx, caller_ctx);
- ccont = CONTEXT_FIELD(ctx, current_cont);
+ ctx = CURRENT_CONTEXT(interp);
+ caller_ctx = CONTEXT_FIELD(interp, ctx, caller_ctx);
+ ccont = CONTEXT_FIELD(interp, ctx, current_cont);
if (PMC_cont(ccont)->address) {
/* Call is from runops_fromc */
@@ -586,17 +586,17 @@
}
src_indexes = interp->current_returns;
- dest_indexes = CONTEXT_FIELD(caller_ctx, current_results);
+ dest_indexes = CONTEXT_FIELD(interp, caller_ctx, current_results);
interp->current_returns = NULL;
/* does this need to be here */
interp->current_args = NULL;
parrot_pass_args(interp, ctx, caller_ctx, src_indexes, dest_indexes, PARROT_PASS_RESULTS);
}
- else if (CONTEXT_FIELD(caller_ctx, results_signature)) {
+ else if (CONTEXT_FIELD(interp, caller_ctx, results_signature)) {
/* We have a dynamic result signature, from pcc_invoke */
parrot_pass_args(interp, ctx, caller_ctx, interp->current_returns,
- CONTEXT_FIELD(caller_ctx, current_results), PARROT_PASS_RESULTS);
+ CONTEXT_FIELD(interp, caller_ctx, current_results), PARROT_PASS_RESULTS);
}
argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
@@ -613,11 +613,11 @@
inline op result_info(out PMC) {
/* Get context of callee from return continuation. */
- PMC * const cc = CURRENT_CONTEXT_FIELD(current_cont);
+ PMC * const cc = CURRENT_CONTEXT_FIELD(interp, current_cont);
PMC *sig = NULL;
if (cc && PMC_cont(cc)->to_ctx) {
/* caller context has results */
- opcode_t * const results = CONTEXT_FIELD(PMC_cont(cc)->to_ctx, current_results);
+ opcode_t * const results = CONTEXT_FIELD(interp, PMC_cont(cc)->to_ctx, current_results);
if (results) {
/* get results PMC index and get PMC. */
sig = PF_CONST(PMC_cont(cc)->seg, results[1])->u.key;
Modified: branches/context_pmc3/src/ops/debug.ops
==============================================================================
--- branches/context_pmc3/src/ops/debug.ops Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/ops/debug.ops Sat Aug 22 09:29:44 2009 (r40715)
@@ -121,7 +121,7 @@
inline op getline(out INT) {
Parrot_Context_info info;
- Parrot_Context_get_info(interp, CURRENT_CONTEXT, &info);
+ Parrot_Context_get_info(interp, CURRENT_CONTEXT(interp), &info);
$1 = info.line;
}
@@ -133,7 +133,7 @@
inline op getfile(out STR) {
Parrot_Context_info info;
- Parrot_Context_get_info(interp, CURRENT_CONTEXT, &info);
+ Parrot_Context_get_info(interp, CURRENT_CONTEXT(interp), &info);
$1 = info.file;
}
Modified: branches/context_pmc3/src/ops/object.ops
==============================================================================
--- branches/context_pmc3/src/ops/object.ops Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/ops/object.ops Sat Aug 22 09:29:44 2009 (r40715)
@@ -142,7 +142,7 @@
VTABLE_get_string(interp, VTABLE_get_class(interp, object)));
}
else {
- interp->current_cont = CURRENT_CONTEXT_FIELD(current_cont);
+ interp->current_cont = CURRENT_CONTEXT_FIELD(interp, current_cont);
PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL;
interp->current_object = object;
dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
@@ -157,7 +157,7 @@
opcode_t *dest;
- interp->current_cont = CURRENT_CONTEXT_FIELD(current_cont);
+ interp->current_cont = CURRENT_CONTEXT_FIELD(interp, current_cont);
PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL;
interp->current_object = object;
dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
Modified: branches/context_pmc3/src/ops/pic.ops
==============================================================================
--- branches/context_pmc3/src/ops/pic.ops Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/ops/pic.ops Sat Aug 22 09:29:44 2009 (r40715)
@@ -138,12 +138,12 @@
/* avoid load dependencies - intermix derefs
* - yes, confusing but faster
*/
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
src_pc = interp->current_args;
mic = (Parrot_MIC *) cur_opcode[1];
- caller_ctx = CONTEXT_FIELD(ctx, caller_ctx);
+ caller_ctx = CONTEXT_FIELD(interp, ctx, caller_ctx);
if (src_pc) {
- src_pred = (void**) src_pc - CONTEXT_FIELD(caller_ctx, pred_offset);
+ src_pred = (void**) src_pc - CONTEXT_FIELD(interp, caller_ctx, pred_offset);
sig = (PMC*)(src_pred[1]);
}
else {
@@ -154,16 +154,16 @@
if (lru->u.signature == sig) {
if (sig) {
n = ((arg_pass_f)lru->f.real_function)(interp, sig,
- (char*)CONTEXT_FIELD(caller_ctx, bp.regs_i), src_pred,
+ (char*)CONTEXT_FIELD(interp, caller_ctx, bp.regs_i), src_pred,
_reg_base, (void**)cur_opcode);
}
else
n = 2;
- ccont = CONTEXT_FIELD(ctx, current_cont);
+ ccont = CONTEXT_FIELD(interp, ctx, current_cont);
if (PObj_get_FLAGS(ccont) & SUB_FLAG_TAILCALL) {
PObj_get_FLAGS(ccont) &= ~SUB_FLAG_TAILCALL;
- --CONTEXT_FIELD(ctx, recursion_depth);
- CONTEXT_FIELD(ctx, caller_ctx) = CONTEXT_FIELD(caller_ctx, caller_ctx);
+ --CONTEXT_FIELD(interp, ctx, recursion_depth);
+ CONTEXT_FIELD(interp, ctx, caller_ctx) = CONTEXT_FIELD(interp, caller_ctx, caller_ctx);
interp->current_args = NULL;
}
@@ -186,9 +186,9 @@
Parrot_cont *cc;
int n;
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
mic = (Parrot_MIC *) cur_opcode[1];
- ccont = CONTEXT_FIELD(ctx, current_cont);
+ ccont = CONTEXT_FIELD(interp, ctx, current_cont);
cc = PMC_cont(ccont);
if (!cc->address) {
interp->current_returns = CUR_OPCODE;
@@ -197,9 +197,9 @@
}
caller_ctx = cc->to_ctx;
interp->current_args = NULL;
- dest_pc = CONTEXT_FIELD(caller_ctx, current_results);
+ dest_pc = CONTEXT_FIELD(interp, caller_ctx, current_results);
if (dest_pc) {
- dest_pred = (void**) dest_pc - CONTEXT_FIELD(caller_ctx, pred_offset);
+ dest_pred = (void**) dest_pc - CONTEXT_FIELD(interp, caller_ctx, pred_offset);
sig = (PMC*)(dest_pred[1]);
}
else {
@@ -211,7 +211,7 @@
if (sig) {
n = ((arg_pass_f)lru->f.real_function)(interp, mic->m.sig,
_reg_base, (void**)cur_opcode,
- (char*)CONTEXT_FIELD(caller_ctx, bp.regs_i), dest_pred);
+ (char*)CONTEXT_FIELD(interp, caller_ctx, bp.regs_i), dest_pred);
}
else
n = 2;
@@ -244,12 +244,12 @@
INTVAL i, n_args, *sig_bits;
PMC *sig;
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
mic = (Parrot_MIC *) cur_opcode[1];
/* get_results */
- pc = CONTEXT_FIELD(ctx, current_results);
+ pc = CONTEXT_FIELD(interp, ctx, current_results);
if (pc) {
- pred_pc = (void**) pc - CONTEXT_FIELD(ctx, pred_offset);
+ pred_pc = (void**) pc - CONTEXT_FIELD(interp, ctx, pred_offset);
sig = (PMC*)(pred_pc[1]);
ASSERT_SIG_PMC(sig);
PARROT_ASSERT(VTABLE_elements(interp, sig) <= 1);
Modified: branches/context_pmc3/src/ops/var.ops
==============================================================================
--- branches/context_pmc3/src/ops/var.ops Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/ops/var.ops Sat Aug 22 09:29:44 2009 (r40715)
@@ -37,7 +37,7 @@
=cut
op store_lex(in STR, invar PMC) {
- PMC * const ctx = CURRENT_CONTEXT;
+ PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = $1;
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
@@ -62,7 +62,7 @@
=cut
op find_lex(out PMC, in STR) {
- PMC * const ctx = CURRENT_CONTEXT;
+ PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = $2;
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
@@ -92,12 +92,12 @@
op find_caller_lex(out PMC, in STR) {
STRING * const lex_name = $2;
- PMC * ctx = CURRENT_CONTEXT;
+ PMC * ctx = CURRENT_CONTEXT(interp);
PMC * result = PMCNULL;
- for (ctx = CONTEXT_FIELD(ctx, caller_ctx);
+ for (ctx = CONTEXT_FIELD(interp, ctx, caller_ctx);
!PMC_IS_NULL(ctx) && PMC_IS_NULL(result);
- ctx = CONTEXT_FIELD(ctx, caller_ctx))
+ ctx = CONTEXT_FIELD(interp, ctx, caller_ctx))
{
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
if (!PMC_IS_NULL(lex_pad)) {
@@ -130,12 +130,12 @@
=cut
op get_namespace(out PMC) {
- PMC * const cur_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const cur_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
$1 = cur_ns;
}
op get_namespace(out PMC, in PMC) {
- PMC * const cur_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const cur_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, $2);
$1 = PMC_IS_NULL(ns) ? PMCNULL : ns;
@@ -218,12 +218,12 @@
=cut
op get_global(out PMC, in STR) {
- PMC * const cur_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const cur_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
$1 = Parrot_find_global_op(interp, cur_ns, $2, expr NEXT());
}
op get_global(out PMC, in PMC, in STR) {
- PMC * const cur_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const cur_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
if (PMC_IS_NULL(cur_ns)) {
$1 = PMCNULL;
}
@@ -322,12 +322,12 @@
=cut
op set_global(in STR, invar PMC) {
- PMC * const cur_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const cur_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
Parrot_set_global(interp, cur_ns, $1, $2);
}
op set_global(in PMC, in STR, invar PMC) {
- PMC * const cur_ns = CURRENT_CONTEXT_FIELD(current_namespace);
+ PMC * const cur_ns = CURRENT_CONTEXT_FIELD(interp, current_namespace);
PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, $1);
Parrot_set_global(interp, ns, $2, $3);
Modified: branches/context_pmc3/src/packfile.c
==============================================================================
--- branches/context_pmc3/src/packfile.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/packfile.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -681,7 +681,7 @@
&& interp->run_core != PARROT_FAST_CORE)
interp->run_core = PARROT_FAST_CORE;
- CURRENT_CONTEXT_FIELD(constants) = interp->code->const_table->constants;
+ CURRENT_CONTEXT_FIELD(interp, constants) = interp->code->const_table->constants;
retval = (PMC *)Parrot_runops_fromc_args(interp, sub_pmc, "P");
interp->run_core = old;
@@ -759,7 +759,7 @@
/ sizeof (opcode_t *);
PObj_get_FLAGS(sub_pmc) &= ~SUB_FLAG_PF_MAIN;
- CURRENT_CONTEXT_FIELD(current_sub) = sub_pmc;
+ CURRENT_CONTEXT_FIELD(interp, current_sub) = sub_pmc;
}
else {
Parrot_warn(interp, PARROT_WARNINGS_ALL_FLAG,
@@ -3083,12 +3083,12 @@
}
interp->code = new_cs;
- CURRENT_CONTEXT_FIELD(constants) = really
+ CURRENT_CONTEXT_FIELD(interp, constants) = really
? find_constants(interp, new_cs->const_table)
: new_cs->const_table->constants;
/* new_cs->const_table->constants; */
- CURRENT_CONTEXT_FIELD(pred_offset) =
+ CURRENT_CONTEXT_FIELD(interp, pred_offset) =
new_cs->base.data - (opcode_t*) new_cs->prederef.code;
if (really)
Modified: branches/context_pmc3/src/pic.c
==============================================================================
--- branches/context_pmc3/src/pic.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pic.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -698,20 +698,20 @@
PMC *caller_ctx;
opcode_t *args;
PMC * const sig1 = (PMC *)(pc[1]);
- PMC *ctx = CURRENT_CONTEXT;
+ PMC *ctx = CURRENT_CONTEXT(interp);
int type = 0;
/* check params */
if (op == PARROT_OP_set_returns_pc) {
- PMC * const ccont = CONTEXT_FIELD(ctx, current_cont);
+ PMC * const ccont = CONTEXT_FIELD(interp, ctx, current_cont);
if (!PMC_cont(ccont)->address)
return 0;
caller_ctx = PMC_cont(ccont)->to_ctx;
- args = CONTEXT_FIELD(caller_ctx, current_results);
+ args = CONTEXT_FIELD(interp, caller_ctx, current_results);
}
else {
- caller_ctx = CONTEXT_FIELD(ctx, caller_ctx);
+ caller_ctx = CONTEXT_FIELD(interp, ctx, caller_ctx);
args = interp->current_args;
}
@@ -720,7 +720,7 @@
int n;
/* check current_args signature */
- sig2 = CONTEXT_FIELD(caller_ctx, constants[const_nr])->u.key;
+ sig2 = CONTEXT_FIELD(interp, caller_ctx, constants[const_nr])->u.key;
n = parrot_pic_check_sig(interp, sig1, sig2, &type);
if (n == -1)
@@ -799,14 +799,14 @@
opcode_t *op, n;
int flags;
- PMC * const ctx = CURRENT_CONTEXT;
+ PMC * const ctx = CURRENT_CONTEXT(interp);
PMC * const sig_args = (PMC *)(pc[1]);
ASSERT_SIG_PMC(sig_args);
n = VTABLE_elements(interp, sig_args);
- interp->current_args = (opcode_t*)pc + CONTEXT_FIELD(ctx, pred_offset);
+ interp->current_args = (opcode_t*)pc + CONTEXT_FIELD(interp, ctx, pred_offset);
pc += 2 + n;
- op = (opcode_t*)pc + CONTEXT_FIELD(ctx, pred_offset);
+ op = (opcode_t*)pc + CONTEXT_FIELD(interp, ctx, pred_offset);
if (*op != PARROT_OP_set_p_pc)
return 0;
@@ -820,7 +820,7 @@
return 0;
pc += 3; /* results */
- op = (opcode_t *)pc + CONTEXT_FIELD(ctx, pred_offset);
+ op = (opcode_t *)pc + CONTEXT_FIELD(interp, ctx, pred_offset);
if (*op != PARROT_OP_get_results_pc)
return 0;
@@ -829,7 +829,7 @@
sig_results = (PMC *)(pc[1]);
ASSERT_SIG_PMC(sig_results);
- CONTEXT_FIELD(ctx, current_results) = (opcode_t *)pc + CONTEXT_FIELD(ctx, pred_offset);
+ CONTEXT_FIELD(interp, ctx, current_results) = (opcode_t *)pc + CONTEXT_FIELD(interp, ctx, pred_offset);
if (!parrot_pic_is_safe_to_jit(interp, sub, sig_args, sig_results, &flags))
return 0;
Modified: branches/context_pmc3/src/pmc.c
==============================================================================
--- branches/context_pmc3/src/pmc.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -911,7 +911,7 @@
/* anchor at parent, aka current_namespace, that is 'parrot' */
VTABLE_set_pmc_keyed_str(interp,
- CURRENT_CONTEXT_FIELD(current_namespace), class_name, ns);
+ CURRENT_CONTEXT_FIELD(interp, current_namespace), class_name, ns);
}
_class = vtable->pmc_class;
Modified: branches/context_pmc3/src/pmc/class.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/class.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/class.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -189,7 +189,7 @@
}
else {
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
- interp->HLL_namespace, CURRENT_CONTEXT_FIELD(current_HLL));
+ interp->HLL_namespace, CURRENT_CONTEXT_FIELD(interp, current_HLL));
new_namespace = Parrot_make_namespace_keyed(interp, hll_ns, name_arg);
}
@@ -1161,13 +1161,13 @@
/* Check that we have all methods listed in resolve list. */
const int resolve_count = VTABLE_elements(interp,
_class->resolve_method);
- const INTVAL cur_hll = CURRENT_CONTEXT_FIELD(current_HLL);
+ const INTVAL cur_hll = CURRENT_CONTEXT_FIELD(INTERP, current_HLL);
const INTVAL num_parents = VTABLE_elements(interp, _class->parents);
INTVAL mro_length;
int i;
/* don't use HLL mappings for internal-only data */
- CURRENT_CONTEXT_FIELD(current_HLL) = 0;
+ CURRENT_CONTEXT_FIELD(INTERP, current_HLL) = 0;
for (i = 0; i < resolve_count; i++) {
STRING * const check_meth =
@@ -1204,7 +1204,7 @@
}
}
- CURRENT_CONTEXT_FIELD(current_HLL) = cur_hll;
+ CURRENT_CONTEXT_FIELD(INTERP, current_HLL) = cur_hll;
}
/* Set instantiated flag. */
Modified: branches/context_pmc3/src/pmc/continuation.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/continuation.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/continuation.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -221,7 +221,7 @@
VTABLE opcode_t *invoke(void *next) {
Parrot_cont *cc = PMC_cont(SELF);
- PMC *from_ctx = CURRENT_CONTEXT;
+ PMC *from_ctx = CURRENT_CONTEXT(interp);
PMC *to_ctx = cc->to_ctx;
opcode_t *pc = cc->address;
UNUSED(next)
@@ -231,9 +231,9 @@
/* pass args to where caller wants result */
if (cc->current_results)
- CONTEXT_FIELD(to_ctx, current_results) = cc->current_results;
+ CONTEXT_FIELD(interp, to_ctx, current_results) = cc->current_results;
- if (CONTEXT_FIELD(to_ctx, current_results) && INTERP->current_args) {
+ if (CONTEXT_FIELD(interp, to_ctx, current_results) && INTERP->current_args) {
/*
* the register pointer is already switched back
* to the caller, therefore the registers of the
@@ -242,7 +242,7 @@
* therefore we have to block GC
*/
opcode_t *src_indexes = interp->current_args;
- opcode_t *dest_indexes = CONTEXT_FIELD(to_ctx, current_results);
+ opcode_t *dest_indexes = CONTEXT_FIELD(interp, to_ctx, current_results);
interp->current_args = NULL;
Parrot_block_GC_mark(INTERP);
@@ -286,7 +286,7 @@
METHOD caller() {
Parrot_cont *cc = PMC_cont(SELF);
- PMC *caller = CONTEXT_FIELD(cc->to_ctx, current_sub);
+ PMC *caller = CONTEXT_FIELD(interp, cc->to_ctx, current_sub);
Parrot_Sub_attributes *sub;
if (!caller)
@@ -312,7 +312,7 @@
METHOD continuation() {
Parrot_cont *cc = PMC_cont(SELF);
- PMC *cont = CONTEXT_FIELD(cc->to_ctx, current_cont);
+ PMC *cont = CONTEXT_FIELD(interp, cc->to_ctx, current_cont);
if (cont)
RETURN(PMC *cont);
Modified: branches/context_pmc3/src/pmc/coroutine.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/coroutine.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/coroutine.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -49,7 +49,7 @@
if (co->ctx && (PObj_get_FLAGS(sub_pmc) & SUB_FLAG_CORO_FF)) {
Parrot_io_eprintf(tracer, " to '%Ss'",
Parrot_full_sub_name(interp,
- CONTEXT_FIELD(CONTEXT_FIELD(co->ctx, caller_ctx), current_sub)));
+ CONTEXT_FIELD(interp, CONTEXT_FIELD(interp, co->ctx, caller_ctx), current_sub)));
}
Parrot_io_eprintf(tracer, "\n# ");
@@ -144,27 +144,27 @@
"tail call to coro not allowed");
/* first time set current sub, cont, object */
- caller_ctx = CURRENT_CONTEXT;
+ caller_ctx = CURRENT_CONTEXT(interp);
ctx = Parrot_set_new_context(INTERP, co->n_regs_used);
co->ctx = ctx;
- CONTEXT_FIELD(ctx, caller_ctx) = caller_ctx;
+ CONTEXT_FIELD(INTERP, ctx, caller_ctx) = caller_ctx;
PMC_cont(ccont)->from_ctx = ctx;
- CONTEXT_FIELD(ctx, current_sub) = SELF;
- CONTEXT_FIELD(ctx, current_HLL) = co->HLL_id;
- CONTEXT_FIELD(ctx, current_namespace) = co->namespace_stash;
- CONTEXT_FIELD(ctx, current_cont) = ccont;
- CONTEXT_FIELD(ctx, current_object) = NULL;
+ CONTEXT_FIELD(INTERP, ctx, current_sub) = SELF;
+ CONTEXT_FIELD(INTERP, ctx, current_HLL) = co->HLL_id;
+ CONTEXT_FIELD(INTERP, ctx, current_namespace) = co->namespace_stash;
+ CONTEXT_FIELD(INTERP, ctx, current_cont) = ccont;
+ CONTEXT_FIELD(INTERP, ctx, current_object) = NULL;
INTERP->current_object = NULL;
INTERP->current_cont = NULL;
/* create pad if needed */
if (!PMC_IS_NULL(co->lex_info)) {
- CONTEXT_FIELD(ctx, lex_pad) = pmc_new_init(INTERP,
+ CONTEXT_FIELD(INTERP, ctx, lex_pad) = pmc_new_init(INTERP,
Parrot_get_ctx_HLL_type(interp, enum_class_LexPad),
co->lex_info);
- VTABLE_set_pointer(INTERP, CONTEXT_FIELD(ctx, lex_pad), ctx);
+ VTABLE_set_pointer(INTERP, CONTEXT_FIELD(INTERP, ctx, lex_pad), ctx);
}
PObj_get_FLAGS(SELF) |= SUB_FLAG_CORO_FF;
@@ -186,12 +186,12 @@
ctx = co->ctx;
/* and the recent call context */
- ccont = CONTEXT_FIELD(ctx, current_cont);
- CONTEXT_FIELD(ctx, caller_ctx) = PMC_cont(ccont)->to_ctx
- = CURRENT_CONTEXT;
+ ccont = CONTEXT_FIELD(INTERP, ctx, current_cont);
+ CONTEXT_FIELD(INTERP, ctx, caller_ctx) = PMC_cont(ccont)->to_ctx
+ = CURRENT_CONTEXT(interp);
/* set context to coro context */
- CURRENT_CONTEXT = ctx;
+ CURRENT_CONTEXT(interp) = ctx;
}
else {
PMC *ccont;
@@ -201,7 +201,7 @@
/* switch back to last remembered code seg and context */
wanted_seg = co->caller_seg;
- ccont = CONTEXT_FIELD(co->ctx, current_cont);
+ ccont = CONTEXT_FIELD(INTERP, co->ctx, current_cont);
ctx = PMC_cont(ccont)->to_ctx;
if (! ctx) {
@@ -214,7 +214,7 @@
"Cannot resume dead coroutine.");
}
- CURRENT_CONTEXT = ctx;
+ CURRENT_CONTEXT(interp) = ctx;
}
/* toggle address */
Modified: branches/context_pmc3/src/pmc/exception.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/exception.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/exception.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -763,7 +763,7 @@
Parrot_Sub_attributes *sub;
/* Get sub and put it in the hash. */
- PMC *sub_pmc = CONTEXT_FIELD(cur_ctx, current_sub);
+ PMC *sub_pmc = CONTEXT_FIELD(interp, cur_ctx, current_sub);
if (!sub_pmc)
sub_pmc = PMCNULL;
@@ -778,7 +778,7 @@
PackFile_ByteCode *seg = sub->seg;
opcode_t *pc = cont && cur_ctx == cont->to_ctx
? cont->address
- : CONTEXT_FIELD(cur_ctx, current_pc);
+ : CONTEXT_FIELD(interp, cur_ctx, current_pc);
annotations = PackFile_Annotations_lookup(interp,
seg->annotations, pc - seg->base.data,
@@ -793,7 +793,7 @@
/* Push frame and go to next caller. */
VTABLE_push_pmc(interp, result, frame);
- cur_ctx = CONTEXT_FIELD(cur_ctx, caller_ctx);
+ cur_ctx = CONTEXT_FIELD(interp, cur_ctx, caller_ctx);
}
}
Modified: branches/context_pmc3/src/pmc/exporter.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/exporter.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/exporter.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -109,7 +109,7 @@
VTABLE void init() {
/* Set up the object. */
SET_ATTR_ns_src(INTERP, SELF, PMCNULL);
- SET_ATTR_ns_dest(INTERP, SELF, CURRENT_CONTEXT_FIELD(current_namespace));
+ SET_ATTR_ns_dest(INTERP, SELF, CURRENT_CONTEXT_FIELD(INTERP, current_namespace));
SET_ATTR_globals(INTERP, SELF, PMCNULL);
/* Set flags for custom GC mark and destroy. */
Modified: branches/context_pmc3/src/pmc/nci.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/nci.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/nci.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -331,7 +331,7 @@
*/
if (cont && cont != NEED_CONTINUATION &&
(PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
- cont = CURRENT_CONTEXT_FIELD(current_cont);
+ cont = CURRENT_CONTEXT_FIELD(INTERP, current_cont);
next = VTABLE_invoke(INTERP, cont, next);
}
Modified: branches/context_pmc3/src/pmc/object.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/object.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/object.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -27,11 +27,11 @@
get_attrib_index(PARROT_INTERP, PMC *self, STRING *name)
{
Parrot_Class_attributes * const _class = PARROT_CLASS(self);
- const INTVAL cur_hll = CURRENT_CONTEXT_FIELD(current_HLL);
+ const INTVAL cur_hll = CURRENT_CONTEXT_FIELD(interp, current_HLL);
int num_classes, i;
INTVAL retval;
- CURRENT_CONTEXT_FIELD(current_HLL) = 0;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = 0;
/* First see if we can find it in the cache. */
retval = VTABLE_get_integer_keyed_str(interp,
@@ -40,7 +40,7 @@
/* there's a semi-predicate problem with a retval of 0 */
if (retval
|| VTABLE_exists_keyed_str(interp, _class->attrib_cache, name)) {
- CURRENT_CONTEXT_FIELD(current_HLL) = cur_hll;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = cur_hll;
return retval;
}
@@ -65,12 +65,12 @@
VTABLE_set_integer_keyed_str(interp, _class->attrib_cache, name,
index);
- CURRENT_CONTEXT_FIELD(current_HLL) = cur_hll;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = cur_hll;
return index;
}
}
- CURRENT_CONTEXT_FIELD(current_HLL) = cur_hll;
+ CURRENT_CONTEXT_FIELD(interp, current_HLL) = cur_hll;
return -1;
}
Modified: branches/context_pmc3/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/parrotinterpreter.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/parrotinterpreter.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -478,11 +478,11 @@
Parrot_ex_throw_from_c_args(interp, NULL, CONTROL_ERROR,
"No such caller depth");
- ctx = CURRENT_CONTEXT;
+ ctx = CURRENT_CONTEXT(interp);
if (outer) {
for (; level; --level) {
- ctx = CONTEXT_FIELD(ctx, outer_ctx);
+ ctx = CONTEXT_FIELD(interp, ctx, outer_ctx);
if (PMC_IS_NULL(ctx))
Parrot_ex_throw_from_c_args(interp, NULL,
CONTROL_ERROR, "No such outer depth");
@@ -490,7 +490,7 @@
}
else {
for (; level; --level) {
- cont = CONTEXT_FIELD(ctx, current_cont);
+ cont = CONTEXT_FIELD(interp, ctx, current_cont);
if (PMC_IS_NULL(cont) || !PMC_cont(cont)->seg)
Parrot_ex_throw_from_c_args(interp, NULL,
@@ -498,51 +498,50 @@
ctx = PMC_cont(cont)->to_ctx;
- if (PMC_IS_NULL(CONTEXT_FIELD(ctx, current_sub)))
+ if (PMC_IS_NULL(CONTEXT_FIELD(interp, ctx, current_sub)))
Parrot_ex_throw_from_c_args(interp, NULL,
CONTROL_ERROR, "No such caller depth");
}
}
if (item == outer)
- return CONTEXT_FIELD(ctx, current_sub);
+ return CONTEXT_FIELD(interp, ctx, current_sub);
s = CONST_STRING(interp, "sub");
if (Parrot_str_equal(interp, item, s))
- return CONTEXT_FIELD(ctx, current_sub);
+ return CONTEXT_FIELD(interp, ctx, current_sub);
s = CONST_STRING(interp, "lexpad");
if (Parrot_str_equal(interp, item, s))
- return CONTEXT_FIELD(ctx, lex_pad);
+ return CONTEXT_FIELD(interp, ctx, lex_pad);
s = CONST_STRING(interp, "namespace");
if (Parrot_str_equal(interp, item, s))
- return CONTEXT_FIELD(ctx, current_namespace);
+ return CONTEXT_FIELD(interp, ctx, current_namespace);
s = CONST_STRING(interp, "continuation");
if (Parrot_str_equal(interp, item, s))
- return VTABLE_clone(interp, CONTEXT_FIELD(ctx, current_cont));
+ return VTABLE_clone(interp, CONTEXT_FIELD(interp, ctx, current_cont));
s = CONST_STRING(interp, "annotations");
if (Parrot_str_equal(interp, item, s)) {
- PMC *sub_pmc = CONTEXT_FIELD(ctx, current_sub);
- if (ctx == CURRENT_CONTEXT) {
+ PMC *sub_pmc = CONTEXT_FIELD(interp, ctx, current_sub);
+ if (ctx == CURRENT_CONTEXT(interp)) {
/* We can't know the current program counter for the currently
* executing sub, so can't return annotations for that. */
- if (ctx == CONTEXT(interp))
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "Cannot get annotations at depth 0; use annotations op instead.");
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+ "Cannot get annotations at depth 0; use annotations op instead.");
}
if (!PMC_IS_NULL(sub_pmc)
&& sub_pmc->vtable->base_type == enum_class_Sub) {
Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
- opcode_t *pc = CONTEXT_FIELD(ctx, current_pc);
+ opcode_t *pc = CONTEXT_FIELD(interp, ctx, current_pc);
PMC_get_sub(interp, sub_pmc, sub);
seg = sub->seg;
@@ -803,7 +802,7 @@
METHOD hll_map(PMC *core_type, PMC *hll_type) {
INTVAL core_type_id = VTABLE_type(INTERP, core_type);
INTVAL hll_type_id = VTABLE_type(INTERP, hll_type);
- INTVAL hll_id = CURRENT_CONTEXT_FIELD(current_HLL);
+ INTVAL hll_id = CURRENT_CONTEXT_FIELD(interp, current_HLL);
Parrot_register_HLL_type(INTERP, hll_id, core_type_id, hll_type_id);
}
Modified: branches/context_pmc3/src/pmc/role.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/role.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/role.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -102,7 +102,7 @@
/* Namespace is nested in the current namespace and with the name of
* the role. */
role->_namespace = Parrot_make_namespace_keyed_str(interp,
- CURRENT_CONTEXT_FIELD(current_namespace), role->name);
+ CURRENT_CONTEXT_FIELD(interp, current_namespace), role->name);
}
/* Otherwise, we may just have a namespace. */
Modified: branches/context_pmc3/src/pmc/sub.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/sub.pmc Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/pmc/sub.pmc Sat Aug 22 09:29:44 2009 (r40715)
@@ -274,7 +274,7 @@
*
*/
pc = sub->seg->base.data + sub->start_offs;
- caller_ctx = CURRENT_CONTEXT;
+ caller_ctx = CURRENT_CONTEXT(interp);
ccont = INTERP->current_cont;
INTERP->current_cont = NULL;
@@ -286,13 +286,13 @@
/* plain subroutine call
* create new context, place it in interpreter */
context = Parrot_set_new_context(INTERP, sub->n_regs_used);
- CONTEXT_FIELD(context, current_sub) = SELF;
- CONTEXT_FIELD(context, caller_ctx) = caller_ctx;
- CONTEXT_FIELD(context, current_pc) = pc;
- CONTEXT_FIELD(context, current_cont) = ccont;
+ CONTEXT_FIELD(interp, context, current_sub) = SELF;
+ CONTEXT_FIELD(interp, context, caller_ctx) = caller_ctx;
+ CONTEXT_FIELD(interp, context, current_pc) = pc;
+ CONTEXT_FIELD(interp, context, current_cont) = ccont;
/* check recursion/call depth */
- if (++CONTEXT_FIELD(context, recursion_depth) > INTERP->recursion_limit)
+ if (++CONTEXT_FIELD(interp, context, recursion_depth) > INTERP->recursion_limit)
Parrot_ex_throw_from_c_args(INTERP, next, CONTROL_ERROR,
"maximum recursion depth exceeded");
@@ -309,37 +309,37 @@
}
if (!PMC_IS_NULL(INTERP->current_object)) {
- CONTEXT_FIELD(context, current_object) = INTERP->current_object;
+ CONTEXT_FIELD(interp, context, current_object) = INTERP->current_object;
INTERP->current_object = NULL;
}
- CONTEXT_FIELD(context, current_HLL) = sub->HLL_id;
- CONTEXT_FIELD(context, current_namespace) = sub->namespace_stash;
+ CONTEXT_FIELD(interp, context, current_HLL) = sub->HLL_id;
+ CONTEXT_FIELD(interp, context, current_namespace) = sub->namespace_stash;
/* create pad if needed
* TODO move this up in front of argument passing
* and factor out common code with coroutine pmc
*/
if (!PMC_IS_NULL(sub->lex_info)) {
- CONTEXT_FIELD(context, lex_pad) = pmc_new_init(INTERP,
+ CONTEXT_FIELD(interp, context, lex_pad) = pmc_new_init(INTERP,
Parrot_get_ctx_HLL_type(interp, enum_class_LexPad),
sub->lex_info);
- VTABLE_set_pointer(INTERP, CONTEXT_FIELD(context, lex_pad), context);
+ VTABLE_set_pointer(INTERP, CONTEXT_FIELD(interp, context, lex_pad), context);
}
if (sub->outer_ctx) {
/* set outer context */
- CONTEXT_FIELD(context, outer_ctx) = sub->outer_ctx;
+ CONTEXT_FIELD(interp, context, outer_ctx) = sub->outer_ctx;
}
else {
/* autoclose */
PMC *c;
- for (c = context; !CONTEXT_FIELD(c, outer_ctx); c = CONTEXT_FIELD(c, outer_ctx)) {
+ for (c = context; !CONTEXT_FIELD(interp, c, outer_ctx); c = CONTEXT_FIELD(interp, c, outer_ctx)) {
PMC *outer_pmc;
Parrot_Sub_attributes *current_sub, *outer_sub;
- PMC_get_sub(INTERP, CONTEXT_FIELD(c, current_sub), current_sub);
+ PMC_get_sub(INTERP, CONTEXT_FIELD(interp, c, current_sub), current_sub);
outer_pmc = current_sub->outer_sub;
if (PMC_IS_NULL(outer_pmc))
@@ -350,20 +350,20 @@
if (!outer_sub->ctx) {
PMC * const dummy = Parrot_alloc_context(INTERP,
outer_sub->n_regs_used, NULL);
- CONTEXT_FIELD(dummy, current_sub) = outer_pmc;
+ CONTEXT_FIELD(interp, dummy, current_sub) = outer_pmc;
if (!PMC_IS_NULL(outer_sub->lex_info)) {
- CONTEXT_FIELD(dummy, lex_pad )= pmc_new_init(INTERP,
+ CONTEXT_FIELD(interp, dummy, lex_pad )= pmc_new_init(INTERP,
Parrot_get_ctx_HLL_type(interp, enum_class_LexPad),
outer_sub->lex_info);
- VTABLE_set_pointer(INTERP, CONTEXT_FIELD(dummy, lex_pad), dummy);
+ VTABLE_set_pointer(INTERP, CONTEXT_FIELD(interp, dummy, lex_pad), dummy);
}
- CONTEXT_FIELD(dummy, outer_ctx) = outer_sub->outer_ctx;
+ CONTEXT_FIELD(interp, dummy, outer_ctx) = outer_sub->outer_ctx;
outer_sub->ctx = dummy;
}
- CONTEXT_FIELD(c, outer_ctx) = outer_sub->ctx;
+ CONTEXT_FIELD(interp, c, outer_ctx) = outer_sub->ctx;
}
}
@@ -377,10 +377,10 @@
&& pc[2] == PARROT_OP_get_params_pc))) {
/* TODO keep it or resize it */
- --CONTEXT_FIELD(context, recursion_depth);
+ --CONTEXT_FIELD(interp, context, recursion_depth);
PObj_get_FLAGS(ccont) &= ~SUB_FLAG_TAILCALL;
- CONTEXT_FIELD(context, caller_ctx) = CONTEXT_FIELD(caller_ctx, caller_ctx);
+ CONTEXT_FIELD(interp, context, caller_ctx) = CONTEXT_FIELD(interp, caller_ctx, caller_ctx);
//Parrot_free_context(INTERP, caller_ctx, 1);
}
@@ -968,12 +968,12 @@
* outer context. */
/* (CONTEXT(interp)->caller_ctx->caller_ctx->current_sub */
- tmp = CONTEXT_FIELD(CURRENT_CONTEXT_FIELD(caller_ctx), caller_ctx);
- if (CONTEXT_FIELD(tmp, current_sub) == outer)
+ tmp = CONTEXT_FIELD(interp, CURRENT_CONTEXT_FIELD(interp, caller_ctx), caller_ctx);
+ if (CONTEXT_FIELD(interp, tmp, current_sub) == outer)
sub->outer_ctx = tmp;
/* else if (CONTEXT(interp)->caller_ctx->current_sub == outer) */
- else if (CONTEXT_FIELD(CURRENT_CONTEXT_FIELD(caller_ctx), current_sub) == outer)
- sub->outer_ctx = CURRENT_CONTEXT_FIELD(caller_ctx);
+ else if (CONTEXT_FIELD(interp, CURRENT_CONTEXT_FIELD(interp, caller_ctx), current_sub) == outer)
+ sub->outer_ctx = CURRENT_CONTEXT_FIELD(interp, caller_ctx);
}
METHOD get_multisig() {
Modified: branches/context_pmc3/src/runcore/cores.c
==============================================================================
--- branches/context_pmc3/src/runcore/cores.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/runcore/cores.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -282,7 +282,7 @@
ASSERT_ARGS(runops_fast_core)
/* disable pc */
- CURRENT_CONTEXT_FIELD(current_pc) = NULL;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = NULL;
while (pc) {
DO_OP(pc, interp);
@@ -314,7 +314,7 @@
ASSERT_ARGS(runops_cgoto_core)
/* disable pc */
- CURRENT_CONTEXT_FIELD(current_pc) = NULL;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = NULL;
#ifdef HAVE_COMPUTED_GOTO
pc = cg_core(pc, interp);
@@ -403,7 +403,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"attempt to access code outside of current code segment");
- CURRENT_CONTEXT_FIELD(current_pc) = pc;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = pc;
DO_OP(pc, interp);
trace_op(interp, code_start, code_end, pc);
@@ -457,7 +457,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"attempt to access code outside of current code segment");
- CURRENT_CONTEXT_FIELD(current_pc) = pc;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = pc;
DO_OP(pc, interp);
}
@@ -490,7 +490,7 @@
"attempt to access code outside of current code segment");
Parrot_gc_mark_and_sweep(interp, GC_TRACE_FULL);
- CURRENT_CONTEXT_FIELD(current_pc) = pc;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = pc;
DO_OP(pc, interp);
}
@@ -530,7 +530,7 @@
while (pc) {/* && pc >= code_start && pc < code_end) */
opcode_t cur_op;
- CURRENT_CONTEXT_FIELD(current_pc) = pc;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = pc;
profile->cur_op = cur_op = *pc + PARROT_PROF_EXTRA;
profile->starttime = Parrot_floatval_time();
profile->data[cur_op].numcalls++;
@@ -591,7 +591,7 @@
pc);
}
- CURRENT_CONTEXT_FIELD(current_pc) = pc;
+ CURRENT_CONTEXT_FIELD(interp, current_pc) = pc;
DO_OP(pc, interp);
if (interp->pdb->state & PDB_STOPPED) {
Modified: branches/context_pmc3/src/runcore/main.c
==============================================================================
--- branches/context_pmc3/src/runcore/main.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/runcore/main.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -188,10 +188,10 @@
ASSERT_ARGS(prederef_args)
const PackFile_ConstTable * const const_table = interp->code->const_table;
- const int regs_n = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_NUM]);
- const int regs_i = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_INT]);
- const int regs_p = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_PMC]);
- const int regs_s = CURRENT_CONTEXT_FIELD(n_regs_used[REGNO_STR]);
+ const int regs_n = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_NUM]);
+ const int regs_i = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_INT]);
+ const int regs_p = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_PMC]);
+ const int regs_s = CURRENT_CONTEXT_FIELD(interp, n_regs_used[REGNO_STR]);
/* prederef var part too */
const int m = opinfo->op_count;
@@ -315,7 +315,7 @@
/* first arguments - PIC needs it */
/* check for RT#58044 */
- PARROT_ASSERT(CURRENT_CONTEXT_FIELD(n_regs_used));
+ PARROT_ASSERT(CURRENT_CONTEXT_FIELD(interp, n_regs_used));
prederef_args(pc_prederef, interp, pc, opinfo);
@@ -541,7 +541,7 @@
N * sizeof (void *));
#endif
/* calc and remember pred_offset */
- CURRENT_CONTEXT_FIELD(pred_offset) = pc - (opcode_t *)temp;
+ CURRENT_CONTEXT_FIELD(interp, pred_offset) = pc - (opcode_t *)temp;
/* fill with the prederef__ opcode function */
if (which == PARROT_SWITCH_CORE || which == PARROT_SWITCH_JIT_CORE)
Modified: branches/context_pmc3/src/scheduler.c
==============================================================================
--- branches/context_pmc3/src/scheduler.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/scheduler.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -482,10 +482,10 @@
Parrot_cx_add_handler_local(PARROT_INTERP, ARGIN(PMC *handler))
{
ASSERT_ARGS(Parrot_cx_add_handler_local)
- if (PMC_IS_NULL(CURRENT_CONTEXT_FIELD(handlers)))
- CURRENT_CONTEXT_FIELD(handlers) = pmc_new(interp, enum_class_ResizablePMCArray);
+ if (PMC_IS_NULL(CURRENT_CONTEXT_FIELD(interp, handlers)))
+ CURRENT_CONTEXT_FIELD(interp, handlers) = pmc_new(interp, enum_class_ResizablePMCArray);
- VTABLE_unshift_pmc(interp, CURRENT_CONTEXT_FIELD(handlers), handler);
+ VTABLE_unshift_pmc(interp, CURRENT_CONTEXT_FIELD(interp, handlers), handler);
}
@@ -506,7 +506,7 @@
Parrot_cx_delete_handler_local(PARROT_INTERP, ARGIN(STRING *handler_type))
{
ASSERT_ARGS(Parrot_cx_delete_handler_local)
- PMC *handlers = CURRENT_CONTEXT_FIELD(handlers);
+ PMC *handlers = CURRENT_CONTEXT_FIELD(interp, handlers);
if (PMC_IS_NULL(handlers))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -577,7 +577,7 @@
Parrot_cx_count_handlers_local(PARROT_INTERP, ARGIN(STRING *handler_type))
{
ASSERT_ARGS(Parrot_cx_count_handlers_local)
- PMC *handlers = CURRENT_CONTEXT_FIELD(handlers);
+ PMC *handlers = CURRENT_CONTEXT_FIELD(interp, handlers);
INTVAL elements;
if (PMC_IS_NULL(handlers))
@@ -865,10 +865,10 @@
* Note that we are now trying to handle the new exception,
* not the initial task argument (exception or whatever).
*/
- context = CONTEXT_FIELD(keep_context, caller_ctx);
+ context = CONTEXT_FIELD(interp, keep_context, caller_ctx);
keep_context = NULL;
- if (context && !PMC_IS_NULL(CONTEXT_FIELD(context, handlers)))
- iter = VTABLE_get_iter(interp, CONTEXT_FIELD(context, handlers));
+ if (context && !PMC_IS_NULL(CONTEXT_FIELD(interp, context, handlers)))
+ iter = VTABLE_get_iter(interp, CONTEXT_FIELD(interp, context, handlers));
else
iter = PMCNULL;
}
@@ -884,9 +884,9 @@
context = (PMC *)VTABLE_get_pointer(interp, task);
}
else {
- context = CURRENT_CONTEXT;
- if (!PMC_IS_NULL(CONTEXT_FIELD(context, handlers)))
- iter = VTABLE_get_iter(interp, CONTEXT_FIELD(context, handlers));
+ context = CURRENT_CONTEXT(interp);
+ if (!PMC_IS_NULL(CONTEXT_FIELD(interp, context, handlers)))
+ iter = VTABLE_get_iter(interp, CONTEXT_FIELD(interp, context, handlers));
}
}
@@ -916,9 +916,9 @@
}
/* Continue the search in the next context up the chain. */
- context = CONTEXT_FIELD(context, caller_ctx);
- if (context && !PMC_IS_NULL(CONTEXT_FIELD(context, handlers)))
- iter = VTABLE_get_iter(interp, CONTEXT_FIELD(context, handlers));
+ context = CONTEXT_FIELD(interp, context, caller_ctx);
+ if (context && !PMC_IS_NULL(CONTEXT_FIELD(interp, context, handlers)))
+ iter = VTABLE_get_iter(interp, CONTEXT_FIELD(interp, context, handlers));
else
iter = PMCNULL;
}
Modified: branches/context_pmc3/src/sub.c
==============================================================================
--- branches/context_pmc3/src/sub.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/sub.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -66,10 +66,10 @@
{
ASSERT_ARGS(new_continuation)
Parrot_cont * const cc = mem_allocate_typed(Parrot_cont);
- PMC * const to_ctx = to ? to->to_ctx : CURRENT_CONTEXT;
+ PMC * const to_ctx = to ? to->to_ctx : CURRENT_CONTEXT(interp);
cc->to_ctx = to_ctx;
- cc->from_ctx = CURRENT_CONTEXT;
+ cc->from_ctx = CURRENT_CONTEXT(interp);
cc->runloop_id = 0;
if (to) {
cc->seg = to->seg;
@@ -80,7 +80,7 @@
cc->address = NULL;
}
- cc->current_results = CONTEXT_FIELD(to_ctx, current_results);
+ cc->current_results = CONTEXT_FIELD(interp, to_ctx, current_results);
return cc;
}
@@ -102,8 +102,8 @@
ASSERT_ARGS(new_ret_continuation)
Parrot_cont * const cc = mem_allocate_typed(Parrot_cont);
- cc->to_ctx = CURRENT_CONTEXT;
- cc->from_ctx = CURRENT_CONTEXT; /* filled in during a call */
+ cc->to_ctx = CURRENT_CONTEXT(interp);
+ cc->from_ctx = CURRENT_CONTEXT(interp); /* filled in during a call */
cc->runloop_id = 0;
cc->seg = interp->code;
cc->current_results = NULL;
@@ -149,7 +149,7 @@
{
ASSERT_ARGS(invalidate_retc_context)
PMC *ctx = PMC_cont(cont)->from_ctx;
- cont = CONTEXT_FIELD(ctx, current_cont);
+ cont = CONTEXT_FIELD(interp, ctx, current_cont);
while (1) {
/*
@@ -160,8 +160,8 @@
if (!cont || cont->vtable != interp->vtables[enum_class_RetContinuation])
break;
cont->vtable = interp->vtables[enum_class_Continuation];
- ctx = CONTEXT_FIELD(ctx, caller_ctx);
- cont = CONTEXT_FIELD(ctx, current_cont);
+ ctx = CONTEXT_FIELD(interp, ctx, caller_ctx);
+ cont = CONTEXT_FIELD(interp, ctx, current_cont);
}
}
@@ -264,7 +264,7 @@
info->fullname = NULL;
/* is the current sub of the specified context valid? */
- if (PMC_IS_NULL(CONTEXT_FIELD(ctx, current_sub))) {
+ if (PMC_IS_NULL(CONTEXT_FIELD(interp, ctx, current_sub))) {
info->subname = Parrot_str_new(interp, "???", 3);
info->nsname = info->subname;
info->fullname = Parrot_str_new(interp, "??? :: ???", 10);
@@ -273,10 +273,10 @@
}
/* fetch Parrot_sub of the current sub in the given context */
- if (!VTABLE_isa(interp, CONTEXT_FIELD(ctx, current_sub), CONST_STRING(interp, "Sub")))
+ if (!VTABLE_isa(interp, CONTEXT_FIELD(interp, ctx, current_sub), CONST_STRING(interp, "Sub")))
return 1;
- PMC_get_sub(interp, CONTEXT_FIELD(ctx, current_sub), sub);
+ PMC_get_sub(interp, CONTEXT_FIELD(interp, ctx, current_sub), sub);
/* set the sub name */
info->subname = sub->name;
@@ -287,18 +287,18 @@
}
else {
info->nsname = VTABLE_get_string(interp, sub->namespace_name);
- info->fullname = Parrot_full_sub_name(interp, CONTEXT_FIELD(ctx, current_sub));
+ info->fullname = Parrot_full_sub_name(interp, CONTEXT_FIELD(interp, ctx, current_sub));
}
/* return here if there is no current pc */
- if (CONTEXT_FIELD(ctx, current_pc) == NULL)
+ if (CONTEXT_FIELD(interp, ctx, current_pc) == NULL)
return 1;
/* calculate the current pc */
- info->pc = CONTEXT_FIELD(ctx, current_pc) - sub->seg->base.data;
+ info->pc = CONTEXT_FIELD(interp, ctx, current_pc) - sub->seg->base.data;
/* determine the current source file/line */
- if (CONTEXT_FIELD(ctx, current_pc)) {
+ if (CONTEXT_FIELD(interp, ctx, current_pc)) {
const size_t offs = info->pc;
size_t i, n;
opcode_t *pc = sub->seg->base.data;
@@ -346,7 +346,7 @@
ASSERT_ARGS(Parrot_Context_infostr)
Parrot_Context_info info;
STRING *res = NULL;
- const char * const msg = (CURRENT_CONTEXT == ctx)
+ const char * const msg = (CURRENT_CONTEXT(interp) == ctx)
? "current instr.:"
: "called from Sub";
@@ -379,8 +379,8 @@
{
ASSERT_ARGS(Parrot_find_pad)
while (1) {
- PMC * const lex_pad = CONTEXT_FIELD(ctx, lex_pad);
- PMC *outer = CONTEXT_FIELD(ctx, outer_ctx);
+ PMC * const lex_pad = CONTEXT_FIELD(interp, ctx, lex_pad);
+ PMC *outer = CONTEXT_FIELD(interp, ctx, outer_ctx);
if (!outer)
return lex_pad;
@@ -408,11 +408,11 @@
Parrot_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
{
ASSERT_ARGS(Parrot_capture_lex)
- PMC * const ctx = CURRENT_CONTEXT;
+ PMC * const ctx = CURRENT_CONTEXT(interp);
Parrot_Sub_attributes *current_sub;
Parrot_Sub_attributes *sub;
- PMC_get_sub(interp, CONTEXT_FIELD(ctx, current_sub), current_sub);
+ PMC_get_sub(interp, CONTEXT_FIELD(interp, ctx, current_sub), current_sub);
/* MultiSub gets special treatment */
if (VTABLE_isa(interp, sub_pmc, CONST_STRING(interp, "MultiSub"))) {
@@ -504,7 +504,7 @@
{
ASSERT_ARGS(Parrot_continuation_check)
PMC *to_ctx = cc->to_ctx;
- PMC *from_ctx = CURRENT_CONTEXT;
+ PMC *from_ctx = CURRENT_CONTEXT(interp);
if (PMC_IS_NULL(to_ctx))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -532,7 +532,7 @@
/* debug print before context is switched */
if (Interp_trace_TEST(interp, PARROT_TRACE_SUB_CALL_FLAG)) {
- PMC * const sub = CONTEXT_FIELD(to_ctx, current_sub);
+ PMC * const sub = CONTEXT_FIELD(interp, to_ctx, current_sub);
Parrot_io_eprintf(interp, "# Back in sub '%Ss', env %p\n",
Parrot_full_sub_name(interp, sub),
@@ -540,7 +540,7 @@
}
/* set context */
- CURRENT_CONTEXT = to_ctx;
+ CURRENT_CONTEXT(interp) = to_ctx;
}
Modified: branches/context_pmc3/src/warnings.c
==============================================================================
--- branches/context_pmc3/src/warnings.c Sat Aug 22 08:43:18 2009 (r40714)
+++ branches/context_pmc3/src/warnings.c Sat Aug 22 09:29:44 2009 (r40715)
@@ -54,7 +54,7 @@
interp;
Parrot_io_eprintf(tracer, "%Ss\n",
Parrot_Context_infostr(interp,
- CURRENT_CONTEXT));
+ CURRENT_CONTEXT(interp)));
}
/*
More information about the parrot-commits
mailing list