After some discussion on #parrot about the slowness of the gcdebug
core with HLL programs, I've done this proof of concept patch: it
skips the gc run the first n opcodes, with n defined by setting an
environment variable.

Example of usage:

PARROT_GCDEBUG_SKIP=85000 ../../parrot --runcore=gcdebug perl6.pbc testprog.p6

-- 
Salu2
Index: src/runops_cores.c
===================================================================
--- src/runops_cores.c	(revisión: 28017)
+++ src/runops_cores.c	(copia de trabajo)
@@ -242,13 +242,28 @@
 opcode_t *
 runops_gc_debug_core(PARROT_INTERP, ARGIN(opcode_t *pc))
 {
+    static int flag = 0;
+    static unsigned long counter= 0;
+
+    if (! flag) {
+        flag= 1;
+        char * str = getenv("PARROT_GCDEBUG_SKIP");
+        if (str)
+            counter = strtoul(str, 0, 0);
+    }
+
     while (pc) {
         if (pc < code_start || pc >= code_end)
             real_exception(interp, NULL, 1,
                     "attempt to access code outside of current code segment");
 
-        Parrot_do_dod_run(interp, 0);
-        CONTEXT(interp)->current_pc = pc;
+        if (counter == 0) {
+            Parrot_do_dod_run(interp, 0);
+            CONTEXT(interp)->current_pc = pc;
+        }
+        else {
+            --counter;
+        }
 
         DO_OP(pc, interp);
     }

Reply via email to