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



This patch implements the <null> op (cf. set.ops) for the i386
JIT Core.  Mainly, it does a "mov reg, imm" (or "mov mem, imm"
if the parrot register is not mapped to a processor register).

Since the specific i386 mov instructions required are already
there in jit_emit.h, only core.jit needs to be patched so as
to have yet one more op being jitted.
Thanks,
Stéphane



-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/63268/46567/4e9cac/nullop_jit_i386.patch

--- ../parrot_2003-08-20_070000/jit/i386/core.jit       2003-07-31 09:00:04.000000000 
+0200
+++ jit/i386/core.jit   2003-08-20 22:26:05.000000000 +0200
@@ -110,6 +110,38 @@
     }
 }
 
+; -- null op.
+TEMPLATE Parrot_null_x {
+    if (MAP[1]) {
+        jit_emit_mov_ri<_N>(NATIVECODE, MAP[1], <val>);
+    }
+    else {
+        jit_emit_mov_mi<_N>(NATIVECODE, &INT_REG[1], <val>);
+    }
+}
+ 
+Parrot_null_i {
+    Parrot_null_x s/<_N>/_i/ s/<val>/0/
+}
+ 
+Parrot_null_p {
+    Parrot_null_x s/<_N>/_i/ s/INT_R/PMC_R/ s/<val>/NULL/
+}
+ 
+Parrot_null_s {
+    Parrot_null_x s/<_N>/_i/ s/INT_R/STRING_R/ s/<val>/NULL/
+}
+
+Parrot_null_n {
+    FLOATVAL zero = 0;
+    if (MAP[1]) {
+        jit_emit_mov_ri_ni(NATIVECODE, MAP[1], &zero);
+    }
+    else {
+        jit_emit_mov_mi_ni(NATIVECODE, &NUM_REG[1], &zero);
+    }
+}
+
 TEMPLATE Parrot_binop_x_x {
     if (MAP[1] && MAP[2]) {
         jit_emit_<op>_rr<_N>(NATIVECODE, MAP[1], MAP[2]);

Reply via email to