[svn:parrot] r40714 - in branches/context_pmc3: . include/parrot lib/Parrot/OpTrans lib/Parrot/Pmc2c src src/call src/gc src/jit/i386 src/ops src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Aug 22 08:43:20 UTC 2009


Author: bacek
Date: Sat Aug 22 08:43:18 2009
New Revision: 40714
URL: https://trac.parrot.org/parrot/changeset/40714

Log:
Restore behavior of CONTEXT macro to avoid deprecation cicle.

* CONTEXT(interp) returns underlying Parrot_Context pointer.
* New CURRENT_CONTEXT macro returns Context PMC.

Modified:
   branches/context_pmc3/MANIFEST
   branches/context_pmc3/include/parrot/interpreter.h
   branches/context_pmc3/lib/Parrot/OpTrans/C.pm
   branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm
   branches/context_pmc3/lib/Parrot/OpTrans/CGoto.pm
   branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.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/exceptions.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/jit.c
   branches/context_pmc3/src/jit/i386/jit_defs.c
   branches/context_pmc3/src/jit_defs.c
   branches/context_pmc3/src/ops/core.ops
   branches/context_pmc3/src/ops/debug.ops
   branches/context_pmc3/src/ops/pic.ops
   branches/context_pmc3/src/ops/var.ops
   branches/context_pmc3/src/pic.c
   branches/context_pmc3/src/pmc/continuation.pmc
   branches/context_pmc3/src/pmc/coroutine.pmc
   branches/context_pmc3/src/pmc/parrotinterpreter.pmc
   branches/context_pmc3/src/pmc/sub.pmc
   branches/context_pmc3/src/scheduler.c
   branches/context_pmc3/src/sub.c
   branches/context_pmc3/src/warnings.c

Modified: branches/context_pmc3/MANIFEST
==============================================================================
--- branches/context_pmc3/MANIFEST	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/MANIFEST	Sat Aug 22 08:43:18 2009	(r40714)
@@ -951,6 +951,7 @@
 include/parrot/cclass.h                                     [main]include
 include/parrot/charset.h                                    [main]include
 include/parrot/compiler.h                                   [main]include
+include/parrot/context.h                                    [main]include
 include/parrot/core_types.h                                 [main]include
 include/parrot/datatypes.h                                  [main]include
 include/parrot/debugger.h                                   [main]include

Modified: branches/context_pmc3/include/parrot/interpreter.h
==============================================================================
--- branches/context_pmc3/include/parrot/interpreter.h	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/include/parrot/interpreter.h	Sat Aug 22 08:43:18 2009	(r40714)
@@ -194,13 +194,15 @@
 } Prederef;
 
 
-#define CONTEXT(interp) ((interp)->ctx)
+#define CONTEXT(interp) Parrot_ctx_get_context(interp, interp->ctx)
+
 
 /*
  * Helper macros to fetch fields from context.
  */
-#define CONTEXT_FIELD(ctx, name) ((Parrot_ctx_get_context(interp, ctx))->name)
-#define CURRENT_CONTEXT_FIELD(name) CONTEXT_FIELD(CONTEXT(interp), name)
+#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 CHUNKED_CTX_MEM 0           /* no longer works, but will be reinstated

Modified: branches/context_pmc3/lib/Parrot/OpTrans/C.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/C.pm	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/lib/Parrot/OpTrans/C.pm	Sat Aug 22 08:43:18 2009	(r40714)
@@ -60,7 +60,7 @@
 #define NREG(i) REG_NUM(interp, cur_opcode[i])
 #define PREG(i) REG_PMC(interp, cur_opcode[i])
 #define SREG(i) REG_STR(interp, cur_opcode[i])
-#define CONST(i) Parrot_ctx_constants(interp, CONTEXT(interp))[cur_opcode[i]]
+#define CONST(i) Parrot_ctx_constants(interp, interp->ctx)[cur_opcode[i]]
 END
 }
 

Modified: branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/lib/Parrot/OpTrans/CGP.pm	Sat Aug 22 08:43:18 2009	(r40714)
@@ -68,7 +68,7 @@
     return $pred_def . <<END;
 /* defines - $0 -> $type */
 #  define opcode_to_prederef(i, op)   \\
-     (opcode_t *) (op   - CONTEXT_FIELD(CONTEXT(i), pred_offset))
+     (opcode_t *) (op   - CONTEXT_FIELD(i->ctx, pred_offset))
 END
 }
 

Modified: branches/context_pmc3/lib/Parrot/OpTrans/CGoto.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/CGoto.pm	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/lib/Parrot/OpTrans/CGoto.pm	Sat Aug 22 08:43:18 2009	(r40714)
@@ -73,7 +73,7 @@
 #define NREG(i) REG_NUM(interp, cur_opcode[i])
 #define PREG(i) REG_PMC(interp, cur_opcode[i])
 #define SREG(i) REG_STR(interp, cur_opcode[i])
-#define CONST(i) Parrot_ctx_constants(interp, CONTEXT(interp))[i]
+#define CONST(i) Parrot_ctx_constants(interp, interp->ctx)[i]
 END
 }
 

Modified: branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/lib/Parrot/OpTrans/CSwitch.pm	Sat Aug 22 08:43:18 2009	(r40714)
@@ -76,7 +76,7 @@
     return $pred_def . <<END;
 /* defines - $0 -> $type */
 #  define opcode_to_prederef(i, op)   (op ? \\
-     (opcode_t*) (op   - CONTEXT_FIELD(CONTEXT(i), pred_offset)) : (opcode_t*)NULL)
+     (opcode_t*) (op   - CONTEXT_FIELD(i->ctx, pred_offset)) : (opcode_t*)NULL)
 END
 }
 

Modified: branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm
==============================================================================
--- branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/lib/Parrot/Pmc2c/PCCMETHOD.pm	Sat Aug 22 08:43:18 2009	(r40714)
@@ -394,7 +394,7 @@
     PMC      * const _param_sig   = pmc_new(interp, enum_class_FixedIntegerArray);
     PMC      *_return_sig         = PMCNULL;
 
-    PMC        *_caller_ctx = CONTEXT(interp);
+    PMC        *_caller_ctx = interp->ctx;
     PMC * const _ret_cont   = new_ret_continuation_pmc(interp, NULL);
     PMC        *_ctx        = Parrot_push_context(interp, _n_regs_used);
     PMC        *_ccont      = PMCNULL;

Modified: branches/context_pmc3/src/call/ops.c
==============================================================================
--- branches/context_pmc3/src/call/ops.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/call/ops.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -169,7 +169,7 @@
         Parrot_ex_throw_from_c_args(interp, NULL, 1,
             "Subroutine returned a NULL address");
 
-    ctx    = CONTEXT(interp);
+    ctx    = CURRENT_CONTEXT;
     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 = CONTEXT(interp);
+    PMC * const old_ctx = CURRENT_CONTEXT;
 
     interp->current_cont   = new_ret_continuation_pmc(interp, NULL);
     interp->current_object = obj;
@@ -264,7 +264,7 @@
             "no get_params in sub");
      */
 
-    ctx    = CONTEXT(interp);
+    ctx    = CURRENT_CONTEXT;
     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    = CONTEXT(interp);
+    ctx    = CURRENT_CONTEXT;
     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 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/call/pcc.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -489,13 +489,13 @@
     init_call_stats(st);
 
     if (PMC_IS_NULL(interp->args_signature))
-        Parrot_init_arg_op(interp, CONTEXT(interp), interp->current_args,
+        Parrot_init_arg_op(interp, CURRENT_CONTEXT, interp->current_args,
                            &st->src);
     else
-        Parrot_init_arg_indexes_and_sig_pmc(interp, CONTEXT(interp),
+        Parrot_init_arg_indexes_and_sig_pmc(interp, CURRENT_CONTEXT,
             interp->current_args, interp->args_signature, &st->src);
 
-    Parrot_init_arg_sig(interp, CONTEXT(interp), sig, NULL, &st->dest);
+    Parrot_init_arg_sig(interp, CURRENT_CONTEXT, sig, NULL, &st->dest);
 }
 
 
@@ -516,7 +516,7 @@
 Parrot_init_ret_nci(PARROT_INTERP, ARGOUT(call_state *st), ARGIN(const char *sig))
 {
     ASSERT_ARGS(Parrot_init_ret_nci)
-    PMC *ctx                 = CONTEXT(interp);
+    PMC *ctx                 = CURRENT_CONTEXT;
     PMC * const current_cont = CONTEXT_FIELD(ctx, current_cont);
 
     /* if this NCI call was a taicall, return results to caller's get_results
@@ -525,7 +525,7 @@
         ctx = PMC_cont(current_cont)->to_ctx;
 
     /* TODO simplify all */
-    Parrot_init_arg_sig(interp, CONTEXT(interp), sig, NULL, &st->src);
+    Parrot_init_arg_sig(interp, CURRENT_CONTEXT, sig, NULL, &st->src);
 
     /* Non-constant signatures are stored in ctx->results_signature instead of
      * in the constants table. */
@@ -1933,7 +1933,7 @@
     ASSERT_ARGS(parrot_pass_args_fromc)
     call_state st;
 
-    Parrot_init_arg_op(interp, CONTEXT(interp), dest, &st.dest);
+    Parrot_init_arg_op(interp, CURRENT_CONTEXT, 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, CONTEXT(interp), sig, NULL,
+        todo = Parrot_init_arg_sig(interp, CURRENT_CONTEXT, sig, NULL,
             &st->dest);
 
         if (todo) {

Modified: branches/context_pmc3/src/debug.c
==============================================================================
--- branches/context_pmc3/src/debug.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/debug.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -2211,7 +2211,7 @@
 PDB_check_condition(PARROT_INTERP, ARGIN(const PDB_condition_t *condition))
 {
     ASSERT_ARGS(PDB_check_condition)
-    PMC *ctx = CONTEXT(interp);
+    PMC *ctx = CURRENT_CONTEXT;
 
     TRACEDEB_MSG("PDB_check_condition");
 
@@ -3512,7 +3512,7 @@
 
     /* information about the current sub */
     PMC *sub = interpinfo_p(interp, CURRENT_SUB);
-    PMC *ctx = CONTEXT(interp);
+    PMC *ctx = CURRENT_CONTEXT;
 
     if (!PMC_IS_NULL(sub)) {
         str = Parrot_Context_infostr(interp, ctx);

Modified: branches/context_pmc3/src/exceptions.c
==============================================================================
--- branches/context_pmc3/src/exceptions.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/exceptions.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -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,
-                CONTEXT(interp), exception);
+                CURRENT_CONTEXT, exception);
 
     if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
         /* it's a C exception handler */
@@ -402,7 +402,7 @@
     address = VTABLE_invoke(interp, handler, NULL);
     if (PMC_cont(handler)->current_results)
         address = pass_exception_args(interp, "P", address,
-                CONTEXT(interp), exception);
+                CURRENT_CONTEXT, exception);
     PARROT_ASSERT(return_point->handler_start == NULL);
     return_point->handler_start = address;
     longjmp(return_point->resume, 2);

Modified: branches/context_pmc3/src/gc/alloc_register.c
==============================================================================
--- branches/context_pmc3/src/gc/alloc_register.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/gc/alloc_register.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -320,7 +320,7 @@
 Parrot_push_context(PARROT_INTERP, ARGIN(const INTVAL *n_regs_used))
 {
     ASSERT_ARGS(Parrot_push_context)
-    PMC * const old = CONTEXT(interp);
+    PMC * const old = CURRENT_CONTEXT;
     PMC * const ctx = Parrot_set_new_context(interp, n_regs_used);
 
     CONTEXT_FIELD(ctx, caller_ctx)  = old;
@@ -349,11 +349,11 @@
 Parrot_pop_context(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_pop_context)
-    PMC * const ctx = CONTEXT(interp);
+    PMC * const ctx = CURRENT_CONTEXT;
     PMC * const old = CONTEXT_FIELD(ctx, caller_ctx);
 
     /* restore old, set cached interpreter base pointers */
-    CONTEXT(interp)      = old;
+    CURRENT_CONTEXT      = 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 = CONTEXT(interp);
+    PMC *old = CURRENT_CONTEXT;
     PMC *ctx = Parrot_alloc_context(interp, number_regs_used, old);
 
-    CONTEXT(interp)          = ctx;
+    CURRENT_CONTEXT          = ctx;
 
     return ctx;
 }

Modified: branches/context_pmc3/src/gc/mark_sweep.c
==============================================================================
--- branches/context_pmc3/src/gc/mark_sweep.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/gc/mark_sweep.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -207,7 +207,7 @@
         Parrot_gc_mark_PObj_alive(interp, obj);
 
     /* mark the current context. */
-    Parrot_gc_mark_PObj_alive(interp, (PObj*)CONTEXT(interp));
+    Parrot_gc_mark_PObj_alive(interp, (PObj*)CURRENT_CONTEXT);
 
     /* 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 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/global.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -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     = CONTEXT(interp);
+    PMC * const ctx     = CURRENT_CONTEXT;
     PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
     PMC *g;
 

Modified: branches/context_pmc3/src/jit.c
==============================================================================
--- branches/context_pmc3/src/jit.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/jit.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -287,7 +287,7 @@
         int arg_type;
         PMC *sig;
         if (argn >= args) {
-            sig = Parrot_ctx_get_pmc_constant(interp, CONTEXT(interp), cur_op[1]);
+            sig = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, cur_op[1]);
             arg_type = VTABLE_get_integer_keyed_int(interp,
                     sig, argn - args);
             arg_type &= (PARROT_ARG_TYPE_MASK | PARROT_ARG_CONSTANT);

Modified: branches/context_pmc3/src/jit/i386/jit_defs.c
==============================================================================
--- branches/context_pmc3/src/jit/i386/jit_defs.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/jit/i386/jit_defs.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -1232,7 +1232,7 @@
     PMC *sig_pmc;
     INTVAL *sig_bits, i, n;
 
-    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CONTEXT(interp), CUR_OPCODE[1]);
+    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
     GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
     n = VTABLE_elements(interp, sig_pmc);
     jit_info->n_args = n;
@@ -1369,7 +1369,7 @@
     PMC *sig_pmc;
     INTVAL *sig_bits, sig;
 
-    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CONTEXT(interp), CUR_OPCODE[1]);
+    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
     if (!VTABLE_elements(interp, sig_pmc))
         return;
     GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);

Modified: branches/context_pmc3/src/jit_defs.c
==============================================================================
--- branches/context_pmc3/src/jit_defs.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/jit_defs.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -1232,7 +1232,7 @@
     PMC *sig_pmc;
     INTVAL *sig_bits, i, n;
 
-    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CONTEXT(interp), CUR_OPCODE[1]);
+    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
     GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
     n = VTABLE_elements(interp, sig_pmc);
     jit_info->n_args = n;
@@ -1369,7 +1369,7 @@
     PMC *sig_pmc;
     INTVAL *sig_bits, sig;
 
-    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CONTEXT(interp), CUR_OPCODE[1]);
+    sig_pmc = Parrot_ctx_get_pmc_constant(interp, CURRENT_CONTEXT, CUR_OPCODE[1]);
     if (!VTABLE_elements(interp, sig_pmc))
         return;
     GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);

Modified: branches/context_pmc3/src/ops/core.ops
==============================================================================
--- branches/context_pmc3/src/ops/core.ops	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/ops/core.ops	Sat Aug 22 08:43:18 2009	(r40714)
@@ -541,7 +541,7 @@
     opcode_t *src_indexes, *dst_indexes;
 
     interp->current_params = _this;
-    ctx = CONTEXT(interp);
+    ctx = CURRENT_CONTEXT;
     ccont = CONTEXT_FIELD(ctx, current_cont);
 
     caller_ctx = CONTEXT_FIELD(ctx, caller_ctx);
@@ -572,7 +572,7 @@
     opcode_t *src_indexes, *dest_indexes;
 
     interp->current_returns = _this;
-    ctx                     = CONTEXT(interp);
+    ctx                     = CURRENT_CONTEXT;
     caller_ctx              = CONTEXT_FIELD(ctx, caller_ctx);
     ccont                   = CONTEXT_FIELD(ctx, current_cont);
 

Modified: branches/context_pmc3/src/ops/debug.ops
==============================================================================
--- branches/context_pmc3/src/ops/debug.ops	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/ops/debug.ops	Sat Aug 22 08:43:18 2009	(r40714)
@@ -121,7 +121,7 @@
 
 inline op getline(out INT) {
   Parrot_Context_info info;
-  Parrot_Context_get_info(interp, CONTEXT(interp), &info);
+  Parrot_Context_get_info(interp, CURRENT_CONTEXT, &info);
   $1 = info.line;
 }
 
@@ -133,7 +133,7 @@
 
 inline op getfile(out STR) {
   Parrot_Context_info info;
-  Parrot_Context_get_info(interp, CONTEXT(interp), &info);
+  Parrot_Context_get_info(interp, CURRENT_CONTEXT, &info);
   $1 = info.file;
 }
 

Modified: branches/context_pmc3/src/ops/pic.ops
==============================================================================
--- branches/context_pmc3/src/ops/pic.ops	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/ops/pic.ops	Sat Aug 22 08:43:18 2009	(r40714)
@@ -138,7 +138,7 @@
     /* avoid load dependencies - intermix derefs
      * - yes, confusing but faster
      */
-    ctx = CONTEXT(interp);
+    ctx = CURRENT_CONTEXT;
     src_pc = interp->current_args;
     mic = (Parrot_MIC *) cur_opcode[1];
     caller_ctx = CONTEXT_FIELD(ctx, caller_ctx);
@@ -186,7 +186,7 @@
     Parrot_cont *cc;
     int n;
 
-    ctx = CONTEXT(interp);
+    ctx = CURRENT_CONTEXT;
     mic = (Parrot_MIC *) cur_opcode[1];
     ccont = CONTEXT_FIELD(ctx, current_cont);
     cc = PMC_cont(ccont);
@@ -244,7 +244,7 @@
     INTVAL i, n_args, *sig_bits;
     PMC *sig;
 
-    ctx = CONTEXT(interp);
+    ctx = CURRENT_CONTEXT;
     mic = (Parrot_MIC *) cur_opcode[1];
     /* get_results */
     pc = CONTEXT_FIELD(ctx, current_results);

Modified: branches/context_pmc3/src/ops/var.ops
==============================================================================
--- branches/context_pmc3/src/ops/var.ops	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/ops/var.ops	Sat Aug 22 08:43:18 2009	(r40714)
@@ -37,7 +37,7 @@
 =cut
 
 op store_lex(in STR, invar PMC) {
-    PMC     * const ctx      = CONTEXT(interp);
+    PMC     * const ctx      = CURRENT_CONTEXT;
     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      = CONTEXT(interp);
+    PMC     * const ctx      = CURRENT_CONTEXT;
     STRING  * const lex_name = $2;
     PMC     * const lex_pad  = Parrot_find_pad(interp, lex_name, ctx);
 
@@ -92,7 +92,7 @@
 
 op find_caller_lex(out PMC, in STR) {
     STRING  * const lex_name = $2;
-    PMC     * ctx            = CONTEXT(interp);
+    PMC     * ctx            = CURRENT_CONTEXT;
     PMC     * result         = PMCNULL;
 
     for (ctx = CONTEXT_FIELD(ctx, caller_ctx);

Modified: branches/context_pmc3/src/pic.c
==============================================================================
--- branches/context_pmc3/src/pic.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/pic.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -698,7 +698,7 @@
     PMC                *caller_ctx;
     opcode_t           *args;
     PMC         * const sig1 = (PMC *)(pc[1]);
-    PMC                *ctx  = CONTEXT(interp);
+    PMC                *ctx  = CURRENT_CONTEXT;
     int                 type = 0;
 
     /* check params */
@@ -799,7 +799,7 @@
     opcode_t *op, n;
     int flags;
 
-    PMC * const ctx      = CONTEXT(interp);
+    PMC * const ctx      = CURRENT_CONTEXT;
     PMC * const sig_args = (PMC *)(pc[1]);
 
     ASSERT_SIG_PMC(sig_args);

Modified: branches/context_pmc3/src/pmc/continuation.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/continuation.pmc	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/pmc/continuation.pmc	Sat Aug 22 08:43:18 2009	(r40714)
@@ -221,7 +221,7 @@
 
     VTABLE opcode_t *invoke(void *next) {
         Parrot_cont *cc           = PMC_cont(SELF);
-        PMC         *from_ctx     = CONTEXT(interp);
+        PMC         *from_ctx     = CURRENT_CONTEXT;
         PMC         *to_ctx       = cc->to_ctx;
         opcode_t    *pc           = cc->address;
         UNUSED(next)

Modified: branches/context_pmc3/src/pmc/coroutine.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/coroutine.pmc	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/pmc/coroutine.pmc	Sat Aug 22 08:43:18 2009	(r40714)
@@ -144,7 +144,7 @@
                         "tail call to coro not allowed");
 
             /* first time set current sub, cont, object */
-            caller_ctx = CONTEXT(interp);
+            caller_ctx = CURRENT_CONTEXT;
             ctx        = Parrot_set_new_context(INTERP, co->n_regs_used);
 
             co->ctx                   = ctx;
@@ -188,10 +188,10 @@
             /* and the recent call context */
             ccont                 = CONTEXT_FIELD(ctx, current_cont);
             CONTEXT_FIELD(ctx, caller_ctx) = PMC_cont(ccont)->to_ctx
-                                  = CONTEXT(interp);
+                                  = CURRENT_CONTEXT;
 
             /* set context to coro context */
-            CONTEXT(interp)       = ctx;
+            CURRENT_CONTEXT       = ctx;
         }
         else {
             PMC *ccont;
@@ -214,7 +214,7 @@
                                "Cannot resume dead coroutine.");
             }
 
-            CONTEXT(interp)      = ctx;
+            CURRENT_CONTEXT      = ctx;
         }
 
         /* toggle address */

Modified: branches/context_pmc3/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/parrotinterpreter.pmc	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/pmc/parrotinterpreter.pmc	Sat Aug 22 08:43:18 2009	(r40714)
@@ -478,7 +478,7 @@
             Parrot_ex_throw_from_c_args(interp, NULL, CONTROL_ERROR,
                 "No such caller depth");
 
-        ctx = CONTEXT(interp);
+        ctx = CURRENT_CONTEXT;
 
         if (outer) {
             for (; level; --level) {
@@ -531,7 +531,7 @@
 
         if (Parrot_str_equal(interp, item, s)) {
             PMC        *sub_pmc = CONTEXT_FIELD(ctx, current_sub);
-            if (ctx == CONTEXT(interp)) {
+            if (ctx == CURRENT_CONTEXT) {
                 /* We can't know the current program counter for the currently
                  * executing sub, so can't return annotations for that. */
                 if (ctx == CONTEXT(interp))

Modified: branches/context_pmc3/src/pmc/sub.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/sub.pmc	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/pmc/sub.pmc	Sat Aug 22 08:43:18 2009	(r40714)
@@ -274,7 +274,7 @@
          *
          */
         pc                   = sub->seg->base.data + sub->start_offs;
-        caller_ctx           = CONTEXT(interp);
+        caller_ctx           = CURRENT_CONTEXT;
         ccont                = INTERP->current_cont;
         INTERP->current_cont = NULL;
 

Modified: branches/context_pmc3/src/scheduler.c
==============================================================================
--- branches/context_pmc3/src/scheduler.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/scheduler.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -884,7 +884,7 @@
         context = (PMC *)VTABLE_get_pointer(interp, task);
     }
     else {
-        context = CONTEXT(interp);
+        context = CURRENT_CONTEXT;
         if (!PMC_IS_NULL(CONTEXT_FIELD(context, handlers)))
             iter = VTABLE_get_iter(interp, CONTEXT_FIELD(context, handlers));
     }

Modified: branches/context_pmc3/src/sub.c
==============================================================================
--- branches/context_pmc3/src/sub.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/sub.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -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 : CONTEXT(interp);
+    PMC            * const to_ctx = to ? to->to_ctx : CURRENT_CONTEXT;
 
     cc->to_ctx        = to_ctx;
-    cc->from_ctx      = CONTEXT(interp);
+    cc->from_ctx      = CURRENT_CONTEXT;
     cc->runloop_id    = 0;
     if (to) {
         cc->seg       = to->seg;
@@ -102,8 +102,8 @@
     ASSERT_ARGS(new_ret_continuation)
     Parrot_cont * const cc = mem_allocate_typed(Parrot_cont);
 
-    cc->to_ctx          = CONTEXT(interp);
-    cc->from_ctx        = CONTEXT(interp);    /* filled in during a call */
+    cc->to_ctx          = CURRENT_CONTEXT;
+    cc->from_ctx        = CURRENT_CONTEXT;    /* filled in during a call */
     cc->runloop_id      = 0;
     cc->seg             = interp->code;
     cc->current_results = NULL;
@@ -346,7 +346,7 @@
     ASSERT_ARGS(Parrot_Context_infostr)
     Parrot_Context_info info;
     STRING             *res = NULL;
-    const char * const  msg = (CONTEXT(interp) == ctx)
+    const char * const  msg = (CURRENT_CONTEXT == ctx)
         ? "current instr.:"
         : "called from Sub";
 
@@ -408,7 +408,7 @@
 Parrot_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
 {
     ASSERT_ARGS(Parrot_capture_lex)
-    PMC            * const ctx          = CONTEXT(interp);
+    PMC            * const ctx          = CURRENT_CONTEXT;
     Parrot_Sub_attributes *current_sub;
     Parrot_Sub_attributes *sub;
 
@@ -504,7 +504,7 @@
 {
     ASSERT_ARGS(Parrot_continuation_check)
     PMC *to_ctx       = cc->to_ctx;
-    PMC *from_ctx     = CONTEXT(interp);
+    PMC *from_ctx     = CURRENT_CONTEXT;
 
     if (PMC_IS_NULL(to_ctx))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -540,7 +540,7 @@
     }
 
     /* set context */
-    CONTEXT(interp)      = to_ctx;
+    CURRENT_CONTEXT      = to_ctx;
 }
 
 

Modified: branches/context_pmc3/src/warnings.c
==============================================================================
--- branches/context_pmc3/src/warnings.c	Sat Aug 22 07:58:00 2009	(r40713)
+++ branches/context_pmc3/src/warnings.c	Sat Aug 22 08:43:18 2009	(r40714)
@@ -54,7 +54,7 @@
         interp;
     Parrot_io_eprintf(tracer, "%Ss\n",
             Parrot_Context_infostr(interp,
-                CONTEXT(interp)));
+                CURRENT_CONTEXT));
 }
 
 /*


More information about the parrot-commits mailing list