[svn:parrot] r46435 - trunk/src/call

jimmy at svn.parrot.org jimmy at svn.parrot.org
Sun May 9 08:40:30 UTC 2010


Author: jimmy
Date: Sun May  9 08:40:29 2010
New Revision: 46435
URL: https://trac.parrot.org/parrot/changeset/46435

Log:
use macro instead of inline fuction, C89 doesn't like it

Modified:
   trunk/src/call/context.c
   trunk/src/call/context_accessors.c

Modified: trunk/src/call/context.c
==============================================================================
--- trunk/src/call/context.c	Sun May  9 08:25:23 2010	(r46434)
+++ trunk/src/call/context.c	Sun May  9 08:40:29 2010	(r46435)
@@ -84,13 +84,6 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*ctx);
 
-PARROT_INLINE
-PARROT_CANNOT_RETURN_NULL
-static Parrot_Context * get_context_struct_fast(PARROT_INTERP,
-    ARGIN(PMC *ctx))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 static void init_context(PARROT_INTERP,
     ARGMOD(PMC *pmcctx),
     ARGIN_NULLOK(PMC *pmcold))
@@ -112,9 +105,6 @@
 #define ASSERT_ARGS_clear_regs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(ctx))
-#define ASSERT_ARGS_get_context_struct_fast __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(ctx))
 #define ASSERT_ARGS_init_context __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pmcctx))
@@ -146,7 +136,7 @@
 Parrot_pcc_get_sub(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_sub)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_sub;
 }
 
@@ -166,7 +156,7 @@
 Parrot_pcc_set_sub(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *sub))
 {
     ASSERT_ARGS(Parrot_pcc_set_sub)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_sub    = sub;
 
     if (sub && !PMC_IS_NULL(sub)) {
@@ -215,33 +205,6 @@
 
 /*
 
-=item C<static Parrot_Context * get_context_struct_fast(PARROT_INTERP, PMC
-*ctx)>
-
-Fetches Parrot_Context from Context PMC.  This is a static, inlineable function
-so it only works within this file.  It also only works if you *know* that ctx
-is a valid PMC, so be careful.  This is an encapsulation-breaking optimization
-that improves performance measurably.  Use responsibly.  Never export this
-function.
-
-=cut
-
-*/
-
-
-PARROT_INLINE
-PARROT_CANNOT_RETURN_NULL
-static Parrot_Context *
-get_context_struct_fast(PARROT_INTERP, ARGIN(PMC *ctx))
-{
-    ASSERT_ARGS(get_context_struct_fast)
-
-    /* temporarily violate encapsulation; big speedup here */
-    return PMC_data_typed(ctx, Parrot_Context *);
-}
-
-/*
-
 =item C<static void clear_regs(PARROT_INTERP, Parrot_Context *ctx)>
 
 Clears all registers in a context.  PMC and STRING registers contain PMCNULL
@@ -298,12 +261,12 @@
 init_context(PARROT_INTERP, ARGMOD(PMC *pmcctx), ARGIN_NULLOK(PMC *pmcold))
 {
     ASSERT_ARGS(init_context)
-    Parrot_Context * const ctx    = get_context_struct_fast(interp, pmcctx);
+    Parrot_Context * const ctx    = CONTEXT_STRUCT(pmcctx);
 
     /* pmcold may be null */
     Parrot_Context *old    = PMC_IS_NULL(pmcold)
                            ? NULL
-                           : get_context_struct_fast(interp, pmcold);
+                           : CONTEXT_STRUCT(pmcold);
 
     PARROT_ASSERT_MSG(!PMC_IS_NULL(pmcctx), "Can't initialise Null CallContext");
 
@@ -745,7 +708,7 @@
 {
     ASSERT_ARGS(Parrot_pcc_get_INTVAL_reg)
     PARROT_ASSERT(Parrot_pcc_get_regs_used(interp, ctx, REGNO_INT) > idx);
-    return &(get_context_struct_fast(interp, ctx)->bp.regs_i[idx]);
+    return &(CONTEXT_STRUCT(ctx)->bp.regs_i[idx]);
 }
 
 /*
@@ -766,7 +729,7 @@
 {
     ASSERT_ARGS(Parrot_pcc_get_FLOATVAL_reg)
     PARROT_ASSERT(Parrot_pcc_get_regs_used(interp, ctx, REGNO_NUM) > idx);
-    return &(get_context_struct_fast(interp, ctx)->bp.regs_n[-1L - idx]);
+    return &(CONTEXT_STRUCT(ctx)->bp.regs_n[-1L - idx]);
 }
 
 /*
@@ -787,7 +750,7 @@
 {
     ASSERT_ARGS(Parrot_pcc_get_STRING_reg)
     PARROT_ASSERT(Parrot_pcc_get_regs_used(interp, ctx, REGNO_STR) > idx);
-    return &(get_context_struct_fast(interp, ctx)->bp_ps.regs_s[idx]);
+    return &(CONTEXT_STRUCT(ctx)->bp_ps.regs_s[idx]);
 }
 
 /*
@@ -807,7 +770,7 @@
 {
     ASSERT_ARGS(Parrot_pcc_get_PMC_reg)
     PARROT_ASSERT(Parrot_pcc_get_regs_used(interp, ctx, REGNO_PMC) > idx);
-    return &(get_context_struct_fast(interp, ctx)->bp_ps.regs_p[-1L - idx]);
+    return &(CONTEXT_STRUCT(ctx)->bp_ps.regs_p[-1L - idx]);
 }
 
 /*
@@ -824,7 +787,7 @@
 Parrot_pcc_get_regs_used(PARROT_INTERP, ARGIN(PMC *ctx), int type)
 {
     ASSERT_ARGS(Parrot_pcc_get_regs_used)
-    return get_context_struct_fast(interp, ctx)->n_regs_used[type];
+    return CONTEXT_STRUCT(ctx)->n_regs_used[type];
 }
 
 /*
@@ -842,7 +805,7 @@
 Parrot_pcc_set_regs_used(PARROT_INTERP, ARGIN(PMC *ctx), int type, INTVAL num)
 {
     ASSERT_ARGS(Parrot_pcc_set_regs_used)
-    get_context_struct_fast(interp, ctx)->n_regs_used[type] = num;
+    CONTEXT_STRUCT(ctx)->n_regs_used[type] = num;
 }
 
 /*
@@ -860,7 +823,7 @@
 Parrot_pcc_get_regs_ni(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_regs_ni)
-    return &(get_context_struct_fast(interp, ctx)->bp);
+    return &(CONTEXT_STRUCT(ctx)->bp);
 }
 
 /*
@@ -878,7 +841,7 @@
 Parrot_pcc_set_regs_ni(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(Regs_ni *bp))
 {
     ASSERT_ARGS(Parrot_pcc_set_regs_ni)
-    get_context_struct_fast(interp, ctx)->bp = *bp;
+    CONTEXT_STRUCT(ctx)->bp = *bp;
 }
 
 /*
@@ -896,7 +859,7 @@
 Parrot_pcc_get_regs_ps(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_regs_ps)
-    return &(get_context_struct_fast(interp, ctx)->bp_ps);
+    return &(CONTEXT_STRUCT(ctx)->bp_ps);
 }
 
 /*
@@ -914,7 +877,7 @@
 Parrot_pcc_set_regs_ps(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(Regs_ps *bp_ps))
 {
     ASSERT_ARGS(Parrot_pcc_set_regs_ps)
-    get_context_struct_fast(interp, ctx)->bp_ps = *bp_ps;
+    CONTEXT_STRUCT(ctx)->bp_ps = *bp_ps;
 }
 
 

Modified: trunk/src/call/context_accessors.c
==============================================================================
--- trunk/src/call/context_accessors.c	Sun May  9 08:25:23 2010	(r46434)
+++ trunk/src/call/context_accessors.c	Sun May  9 08:40:29 2010	(r46435)
@@ -18,22 +18,6 @@
 
 /* HEADERIZER HFILE: include/parrot/context.h */
 
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-
-PARROT_INLINE
-PARROT_CANNOT_RETURN_NULL
-static Parrot_Context * get_context_struct_fast(PARROT_INTERP,
-    ARGIN(PMC *ctx))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-#define ASSERT_ARGS_get_context_struct_fast __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(ctx))
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-/* HEADERIZER END: static */
-
 /*
 
 =head2 Context API Functions
@@ -59,7 +43,7 @@
     if (PMC_IS_NULL(ctx))
         return NULL;
 
-    return get_context_struct_fast(interp, ctx);
+    return CONTEXT_STRUCT(ctx);
 }
 
 /*
@@ -82,7 +66,7 @@
 Parrot_pcc_get_constants_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_constants_func)
-    return get_context_struct_fast(interp, ctx)->constants;
+    return CONTEXT_STRUCT(ctx)->constants;
 }
 
 PARROT_EXPORT
@@ -92,7 +76,7 @@
         ARGIN_NULLOK(struct PackFile_Constant **constants))
 {
     ASSERT_ARGS(Parrot_pcc_set_constants_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->constants = constants;
 }
 
@@ -111,7 +95,7 @@
 Parrot_pcc_get_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_recursion_depth_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->recursion_depth;
 }
 
@@ -130,7 +114,7 @@
 Parrot_pcc_inc_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_inc_recursion_depth_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     return c->recursion_depth++;
 }
 
@@ -149,7 +133,7 @@
 Parrot_pcc_dec_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_dec_recursion_depth_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     return --c->recursion_depth;
 }
 
@@ -172,7 +156,7 @@
 Parrot_pcc_get_caller_ctx_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_caller_ctx_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->caller_ctx;
 }
 
@@ -181,7 +165,7 @@
 Parrot_pcc_set_caller_ctx_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(PMC *caller_ctx))
 {
     ASSERT_ARGS(Parrot_pcc_set_caller_ctx_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->caller_ctx = caller_ctx;
 }
 
@@ -204,7 +188,7 @@
 Parrot_pcc_get_outer_ctx_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_outer_ctx_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->outer_ctx;
 }
 
@@ -213,7 +197,7 @@
 Parrot_pcc_set_outer_ctx_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(PMC *outer_ctx))
 {
     ASSERT_ARGS(Parrot_pcc_set_outer_ctx_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->outer_ctx = outer_ctx;
 }
 
@@ -235,7 +219,7 @@
 Parrot_pcc_get_lex_pad_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_lex_pad_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->lex_pad;
 }
 
@@ -244,7 +228,7 @@
 Parrot_pcc_set_lex_pad_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(PMC *lex_pad))
 {
     ASSERT_ARGS(Parrot_pcc_set_lex_pad_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->lex_pad = lex_pad;
 }
 
@@ -267,7 +251,7 @@
 Parrot_pcc_get_namespace_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_namespace_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_namespace;
 }
 
@@ -276,7 +260,7 @@
 Parrot_pcc_set_namespace_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *_namespace))
 {
     ASSERT_ARGS(Parrot_pcc_set_namespace_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_namespace = _namespace;
 }
 
@@ -297,7 +281,7 @@
 Parrot_pcc_get_HLL_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_HLL_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_HLL;
 }
 
@@ -306,7 +290,7 @@
 Parrot_pcc_set_HLL_func(PARROT_INTERP, ARGIN(PMC *ctx), INTVAL hll)
 {
     ASSERT_ARGS(Parrot_pcc_set_HLL_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_HLL = hll;
 }
 
@@ -329,7 +313,7 @@
 Parrot_pcc_get_handlers_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_handlers_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->handlers;
 }
 
@@ -339,7 +323,7 @@
 Parrot_pcc_set_handlers_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(PMC *handlers))
 {
     ASSERT_ARGS(Parrot_pcc_set_handlers_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->handlers = handlers;
 }
 
@@ -362,7 +346,7 @@
 Parrot_pcc_get_continuation_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_continuation_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_cont;
 }
 
@@ -371,7 +355,7 @@
 Parrot_pcc_set_continuation_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *_continuation))
 {
     ASSERT_ARGS(Parrot_pcc_set_continuation_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_cont = _continuation;
 }
 
@@ -394,7 +378,7 @@
 Parrot_pcc_get_signature_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_signature_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_sig;
 }
 
@@ -403,7 +387,7 @@
 Parrot_pcc_set_signature_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *sig_object))
 {
     ASSERT_ARGS(Parrot_pcc_set_signature_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_sig = sig_object;
 }
 
@@ -425,7 +409,7 @@
 Parrot_pcc_get_object_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_object_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_object;
 }
 
@@ -434,7 +418,7 @@
 Parrot_pcc_set_object_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *object))
 {
     ASSERT_ARGS(Parrot_pcc_set_object_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_object = object;
 }
 
@@ -456,7 +440,7 @@
 Parrot_pcc_get_pc_func(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_pc_func)
-    const Parrot_Context *c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context *c = CONTEXT_STRUCT(ctx);
     return c->current_pc;
 }
 
@@ -465,7 +449,7 @@
 Parrot_pcc_set_pc_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(opcode_t *pc))
 {
     ASSERT_ARGS(Parrot_pcc_set_pc_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->current_pc = pc;
 }
 
@@ -485,7 +469,7 @@
 Parrot_pcc_warnings_on_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_warnings_on_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->warns |= flags;
     return c->warns;
 }
@@ -507,7 +491,7 @@
 Parrot_pcc_warnings_off_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_warnings_off_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->warns &= ~flags;
 }
 
@@ -528,7 +512,7 @@
 Parrot_pcc_warnings_test_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_warnings_test_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     return c->warns & flags;
 }
 
@@ -547,7 +531,7 @@
 Parrot_pcc_errors_on_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_errors_on_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->errors |= flags;
 }
 
@@ -567,7 +551,7 @@
 Parrot_pcc_errors_off_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_errors_off_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->errors &= ~flags;
 }
 
@@ -587,7 +571,7 @@
 Parrot_pcc_errors_test_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_errors_test_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     return c->errors & flags;
 }
 
@@ -607,7 +591,7 @@
 Parrot_pcc_trace_flags_on_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_trace_flags_on_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->trace_flags |= flags;
 }
 
@@ -628,7 +612,7 @@
 Parrot_pcc_trace_flags_off_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_trace_flags_off_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     c->trace_flags &= ~flags;
 }
 
@@ -648,7 +632,7 @@
 Parrot_pcc_trace_flags_test_func(PARROT_INTERP, ARGIN(PMC *ctx), UINTVAL flags)
 {
     ASSERT_ARGS(Parrot_pcc_trace_flags_test_func)
-    Parrot_Context * const c = get_context_struct_fast(interp, ctx);
+    Parrot_Context * const c = CONTEXT_STRUCT(ctx);
     return c->trace_flags & flags;
 }
 
@@ -679,7 +663,7 @@
 Parrot_pcc_get_int_constant_func(PARROT_INTERP, ARGIN(PMC *ctx), INTVAL idx)
 {
     ASSERT_ARGS(Parrot_pcc_get_int_constant_func)
-    const Parrot_Context * c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context * c = CONTEXT_STRUCT(ctx);
     PARROT_ASSERT(c->constants[idx]->type == 'i');
     return c->constants[idx]->u.integer;
 }
@@ -690,7 +674,7 @@
 Parrot_pcc_get_num_constant_func(PARROT_INTERP, ARGIN(PMC *ctx), INTVAL idx)
 {
     ASSERT_ARGS(Parrot_pcc_get_num_constant_func)
-    const Parrot_Context * c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context * c = CONTEXT_STRUCT(ctx);
     PARROT_ASSERT(c->constants[idx]->type == 'n');
     return c->constants[idx]->u.number;
 }
@@ -701,7 +685,7 @@
 Parrot_pcc_get_string_constant_func(PARROT_INTERP, ARGIN(PMC *ctx), INTVAL idx)
 {
     ASSERT_ARGS(Parrot_pcc_get_string_constant_func)
-    const Parrot_Context * c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context * c = CONTEXT_STRUCT(ctx);
     PARROT_ASSERT(c->constants[idx]->type == 's');
     return c->constants[idx]->u.string;
 }
@@ -712,41 +696,12 @@
 Parrot_pcc_get_pmc_constant_func(PARROT_INTERP, ARGIN(PMC *ctx), INTVAL idx)
 {
     ASSERT_ARGS(Parrot_pcc_get_pmc_constant_func)
-    const Parrot_Context * c = get_context_struct_fast(interp, ctx);
+    const Parrot_Context * c = CONTEXT_STRUCT(ctx);
     PARROT_ASSERT((c->constants[idx]->type == 'k')
             || (c->constants[idx]->type == 'p'));
     return c->constants[idx]->u.key;
 }
 
-
-
-/*
-
-=item C<static Parrot_Context * get_context_struct_fast(PARROT_INTERP, PMC
-*ctx)>
-
-Fetches Parrot_Context from Context PMC.  This is a static, inlineable function
-so it only works within this file.  It also only works if you *know* that ctx
-is a valid PMC, so be careful.  This is an encapsulation-breaking optimization
-that improves performance measurably.  Use responsibly.  Never export this
-function.
-
-=cut
-
-*/
-
-
-PARROT_INLINE
-PARROT_CANNOT_RETURN_NULL
-static Parrot_Context *
-get_context_struct_fast(PARROT_INTERP, ARGIN(PMC *ctx))
-{
-    ASSERT_ARGS(get_context_struct_fast)
-
-    /* temporarily violate encapsulation; big speedup here */
-    return PMC_data_typed(ctx, Parrot_Context *);
-}
-
 /*
 
 =back


More information about the parrot-commits mailing list