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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Fri Sep 4 20:48:50 UTC 2009


Author: chromatic
Date: Fri Sep  4 20:48:48 2009
New Revision: 40975
URL: https://trac.parrot.org/parrot/changeset/40975

Log:
[PCC] Made Parrot_pcc_get_context_struct() poke into the Context PMC's data
member directly, rather than going through the get_pointer VTABLE.  This is a
big performance improvement (11.35% in primes.pasm), but it's also not as
dangerous as it sounds for two reasons:

    * nothing extends the Context PMC, so it's safe for the time being

    * anything that did extend the Context PMC would need a similar struct here
    anyway

This can be a temporary optimization until we stop extra context fetching in
ops bodies.

Modified:
   trunk/src/call/context.c

Modified: trunk/src/call/context.c
==============================================================================
--- trunk/src/call/context.c	Fri Sep  4 19:52:48 2009	(r40974)
+++ trunk/src/call/context.c	Fri Sep  4 20:48:48 2009	(r40975)
@@ -170,10 +170,12 @@
 Parrot_pcc_get_context_struct(PARROT_INTERP, ARGIN_NULLOK(PMC *ctx))
 {
     ASSERT_ARGS(Parrot_pcc_get_context_struct)
+
     if (PMC_IS_NULL(ctx))
         return NULL;
 
-    return (Parrot_Context*)(VTABLE_get_pointer(interp, ctx));
+    /* temporarily violate encapsulation; big speedup here */
+    return PMC_data_typed(ctx, Parrot_Context *);
 }
 
 /*


More information about the parrot-commits mailing list