On Sat, Aug 03, 2002 at 11:35:08AM +0100, Nicholas Clark wrote:

> I presume in the general case I'd have to know whether to call
> Parrot_jit_normal_op() or Parrot_jit_cpcf_op(), so could there be a subroutine
> in jit.c that I could call to make the correct decision for me?

Here is a patch for the necessary function.

Index: jit.c
===================================================================
RCS file: /cvs/public/parrot/jit.c,v
retrieving revision 1.21
diff -u -r1.21 jit.c
--- jit.c       2 Aug 2002 03:24:02 -0000       1.21
+++ jit.c       3 Aug 2002 19:13:05 -0000
@@ -303,6 +303,18 @@
             (ptrdiff_t)(jit_info->native_ptr - jit_info->arena_start);
 }
 
+/* An op jitting function can call this function to emit the appropriate
+ * generic code to invoke the op function for the current op */
+
+void Parrot_jit_fallback(Parrot_jit_info *jit_info, struct Parrot_Interp * 
+interpreter){
+    if(interpreter->op_info_table[*jit_info->cur_op].jump){
+        Parrot_jit_cpcf_op(jit_info, interpreter);
+    }
+    else {
+        Parrot_jit_normal_op(jit_info, interpreter);
+    }
+}
+
 /*
  * Local variables:
  * c-indentation-style: bsd
Index: include/parrot/jit.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/jit.h,v
retrieving revision 1.16
diff -u -r1.16 jit.h
--- include/parrot/jit.h        7 Jun 2002 04:58:45 -0000       1.16
+++ include/parrot/jit.h        3 Aug 2002 19:13:06 -0000
@@ -97,6 +97,8 @@
                         struct Parrot_Interp * interpreter);
 void Parrot_jit_normal_op(Parrot_jit_info *jit_info, 
                           struct Parrot_Interp * interpreter);
+void Parrot_jit_fallback(Parrot_jit_info *jit_info, 
+                         struct Parrot_Interp * interpreter);
 
 Parrot_jit_optimizer_t *
 optimize_jit(struct Parrot_Interp *, 

-- 
Jason

Reply via email to