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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Thu Sep 10 22:27:45 UTC 2009


Author: chromatic
Date: Thu Sep 10 22:27:45 2009
New Revision: 41187
URL: https://trac.parrot.org/parrot/changeset/41187

Log:
[context] Replaced a Context VTABLE call in Parrot_pcc_constants() with a
get_context_struct_fast() call and revised code in init_context() to use
get_context_struct_fast() when possible -- thanks to bacek for the suggestion.
The result is another ~1.5% performance improvement.

Modified:
   trunk/src/call/context.c

Modified: trunk/src/call/context.c
==============================================================================
--- trunk/src/call/context.c	Thu Sep 10 22:17:00 2009	(r41186)
+++ trunk/src/call/context.c	Thu Sep 10 22:27:45 2009	(r41187)
@@ -224,13 +224,14 @@
 =cut
 
 */
+
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 struct PackFile_Constant **
 Parrot_pcc_constants(PARROT_INTERP, ARGIN(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_constants)
-    return ((Parrot_Context*)(VTABLE_get_pointer(interp, ctx)))->constants;
+    return get_context_struct_fast(interp, ctx)->constants;
 }
 
 
@@ -1137,10 +1138,12 @@
 init_context(PARROT_INTERP, ARGMOD(PMC *pmcctx), ARGIN_NULLOK(PMC *pmcold))
 {
     ASSERT_ARGS(init_context)
-    Parrot_Context *ctx = get_context_struct_fast(interp, pmcctx);
+    Parrot_Context *ctx    = get_context_struct_fast(interp, pmcctx);
 
-    /* pmcold may be null, so use the maybe null case */
-    Parrot_Context *old = Parrot_pcc_get_context_struct(interp, pmcold);
+    /* pmcold may be null */
+    Parrot_Context *old    = PMC_IS_NULL(pmcold)
+                           ? NULL
+                           : get_context_struct_fast(interp, pmcold);
 
     ctx->current_results   = NULL;
     ctx->results_signature = NULL;


More information about the parrot-commits mailing list