[svn:parrot] r49437 - trunk/src/runcore

plobsing at svn.parrot.org plobsing at svn.parrot.org
Mon Oct 4 05:30:44 UTC 2010


Author: plobsing
Date: Mon Oct  4 05:30:44 2010
New Revision: 49437
URL: https://trac.parrot.org/parrot/changeset/49437

Log:
lookup op name *before* executing the op
interp->code may not point to where we expect after the op

Modified:
   trunk/src/runcore/profiling.c

Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c	Mon Oct  4 04:26:32 2010	(r49436)
+++ trunk/src/runcore/profiling.c	Mon Oct  4 05:30:44 2010	(r49437)
@@ -317,6 +317,7 @@
 
     PMC         *argv;
     opcode_t    *preop_pc;
+    char        *preop_opname;
     UHUGEINTVAL  op_time;
     PPROF_DATA   pprof_data[PPROF_DATA_MAX + 1];
 
@@ -353,10 +354,11 @@
             Parrot_ex_throw_from_c_args(interp, NULL, 1,
                     "attempt to access code outside of current code segment");
 
-        preop_ctx_pmc = CURRENT_CONTEXT(interp);
-        preop_ctx = PMC_data_typed(preop_ctx_pmc, Parrot_Context*);
+        preop_ctx_pmc         = CURRENT_CONTEXT(interp);
+        preop_ctx             = PMC_data_typed(preop_ctx_pmc, Parrot_Context*);
         preop_ctx->current_pc = pc;
         preop_pc              = pc;
+        preop_opname          = interp->code->op_info_table[*pc]->name;
 
         ++runcore->level;
         Profiling_exit_check_CLEAR(runcore);
@@ -453,7 +455,7 @@
             pprof_data[PPROF_DATA_TIME] = op_time;
         }
         pprof_data[PPROF_DATA_LINE]   = preop_line;
-        pprof_data[PPROF_DATA_OPNAME] = (PPROF_DATA)(interp->code->op_info_table)[*preop_pc]->name;
+        pprof_data[PPROF_DATA_OPNAME] = preop_opname;
         runcore->output_fn(runcore, pprof_data, PPROF_LINE_OP);
     }
 


More information about the parrot-commits mailing list