Author: leo
Date: Fri May 27 08:26:34 2005
New Revision: 8179

Modified:
   trunk/src/global_setup.c
   trunk/src/runops_cores.c
Log:
test distinct interpreter for tracing

* fix creation of secondary interpreter WRT loaded PMCs/classes
* USE_TRACE_INTERP basically works except with the trace opcode



Modified: trunk/src/global_setup.c
==============================================================================
--- trunk/src/global_setup.c    (original)
+++ trunk/src/global_setup.c    Fri May 27 08:26:34 2005
@@ -73,11 +73,12 @@ init_world(Interp *interpreter)
      * TODO allocate core vtable table only once - or per interpreter
      *      divide globals into real globals and per interpreter
      */
-    if (!Parrot_base_vtables)
+    if (!Parrot_base_vtables) {
         Parrot_base_vtables =
             mem_sys_allocate_zeroed(sizeof(VTABLE *) * PARROT_MAX_CLASSES);
-    enum_class_max = enum_class_core_max;
-    class_table_size = PARROT_MAX_CLASSES;
+        enum_class_max = enum_class_core_max;
+        class_table_size = PARROT_MAX_CLASSES;
+    }
 
     /* Call base vtable class constructor methods */
     Parrot_initialize_core_pmcs(interpreter);

Modified: trunk/src/runops_cores.c
==============================================================================
--- trunk/src/runops_cores.c    (original)
+++ trunk/src/runops_cores.c    Fri May 27 08:26:34 2005
@@ -98,10 +98,12 @@ because C<Parrot_destroy()> fails to cle
 
 */
 
+#define USE_TRACE_INTERP 0
+
 opcode_t *
 runops_slow_core(Interp *interpreter, opcode_t *pc)
 {
-#ifdef USE_TRACE_INTERP
+#if USE_TRACE_INTERP
     Interp * trace_i;
     struct Parrot_Context *trace_ctx;
 #endif
@@ -120,8 +122,12 @@ runops_slow_core(Interp *interpreter, op
         interpreter->code->base.size)
 
 
-#ifdef USE_TRACE_INTERP
+#if USE_TRACE_INTERP
     if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
+        /* XXX reentering run loop: store this interpreter in
+         * some debug structure
+         * XXX leak
+         */
         trace_i = make_interpreter(interpreter, NO_FLAGS);
         Parrot_init(trace_i);
         /* remember old context */
@@ -147,9 +153,10 @@ runops_slow_core(Interp *interpreter, op
         DO_OP(pc, interpreter);
 
         if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
-#ifdef USE_TRACE_INTERP
+#if USE_TRACE_INTERP
             mem_sys_memcopy(&trace_i->ctx, &interpreter->ctx,
                     sizeof(struct Parrot_Context));
+            trace_i->code = interpreter->code;
             trace_op(trace_i, code_start, code_end, pc);
 #else
             trace_op(interpreter, code_start, code_end, pc);
@@ -164,7 +171,7 @@ runops_slow_core(Interp *interpreter, op
             }
         }
     }
-#ifdef USE_TRACE_INTERP
+#if USE_TRACE_INTERP
     if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
         /* restore trace context */
         mem_sys_memcopy(&trace_i->ctx, trace_ctx,

Reply via email to