# New Ticket Created by  Leopold Toetsch 
# Please include the string:  [perl #17143]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17143 >


This patch make predereferenced run mode working again (all perl6 tests 
are ok, when run with -P).

Please apply.


Some numbers:

running 100 generations of perl6/examples/life.p6 with GC turned off, 
run via imcc's parrot interpreter:

$ time perl6 -r -RG examples/life.p6 100
....
real    0m21.342s

Same with predereferenced code:
$ time perl6 -r -RGP examples/life.p6 100

real    0m16.765s


Predereferenced + some invariants pulled ouf of loops:
$ time perl6 -r -RGP -O2 examples/life.p6 100

real    0m13.930s

Running JITted fails after ~20 secs with »Array index out of bounds!«.


Execution times for life.pasm (perl6 calls assemble.pl and parrot):

$ time perl6  ../../examples/assembly/life.pasm
5000 generations in 15.919521 seconds. 314.079800 generations/sec
....
real    0m16.758s

$ time perl6 -Rj ../../examples/assembly/life.pasm # JIT
5000 generations in 10.095044 seconds. 495.292547 generations/sec
....
real    0m10.924s

$ time perl6 -RP ../../examples/assembly/life.pasm
5000 generations in 11.817448 seconds. 423.103194 generations/sec

real    0m12.657s

So predereferencing seems to be a big win in execution time for not too 
much optimized code and is near JIT code in speed.

leo


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/37176/30078/266822/interpreter.c.diff

--- interpreter.c       Fri Aug 23 11:37:00 2002
+++ /home/lt/src/parrot-leo/interpreter.c       Wed Sep 11 10:30:52 2002
@@ -263,6 +263,7 @@
             pc_prederef[i] = (void *)(ptrcast_t)prederef_op_func[pc[i]];
             break;
 
+        case PARROT_ARG_KI:
         case PARROT_ARG_I:
             pc_prederef[i] = (void *)&interpreter->ctx.int_reg.registers[pc[i]];
             break;
@@ -279,6 +280,7 @@
             pc_prederef[i] = (void *)&interpreter->ctx.string_reg.registers[pc[i]];
             break;
 
+        case PARROT_ARG_KIC:
         case PARROT_ARG_IC:
             pc_prederef[i] = (void *)&pc[i];
             break;
@@ -300,7 +302,13 @@
                 &interpreter->code->const_table->constants[pc[i]]->string;
             break;
 
+        case PARROT_ARG_KC:
+            pc_prederef[i] = (void *)
+                &interpreter->code->const_table->constants[pc[i]]->key;
+            break;
         default:
+            internal_exception(ARG_OP_NOT_HANDLED,
+                               "Unhandled argtype %d\n",opinfo->types[i]);
             break;
         }
 

Reply via email to