Author: leo
Date: Thu Feb  9 08:11:23 2006
New Revision: 11486

Modified:
   trunk/compilers/imcc/main.c
   trunk/include/parrot/interpreter.h
   trunk/src/embed.c
   trunk/src/interpreter.c
   trunk/src/pic_jit.c
Log:
PIC/JIT - verfiy, if sub is JITtable 2

* add sanity checks
  - JIT only if -j comandline switch was given too
* ./parrot -Cj  or ./parrot -Sj now enable JIT recompiling of
  predereferenced code
* extends runcore selection and related code to cope with multiple
  runcore flags



Modified: trunk/compilers/imcc/main.c
==============================================================================
--- trunk/compilers/imcc/main.c (original)
+++ trunk/compilers/imcc/main.c Thu Feb  9 08:11:23 2006
@@ -142,7 +142,7 @@ the GNU General Public License or the Ar
 #define SET_FLAG(flag)   Parrot_set_flag(interp, flag)
 #define SET_DEBUG(flag)  Parrot_set_debug(interp, flag)
 #define SET_TRACE(flag)  Parrot_set_trace(interp, flag)
-#define SET_CORE(core)   Parrot_set_run_core(interp, core)
+#define SET_CORE(core)   interp->run_core |= core
 
 #define OPT_GC_DEBUG     128
 #define OPT_DESTROY_FLAG 129

Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h  (original)
+++ trunk/include/parrot/interpreter.h  Thu Feb  9 08:11:23 2006
@@ -68,11 +68,13 @@ typedef enum {
     PARROT_SLOW_CORE,                         /* slow bounds/trace/profile 
core */
     PARROT_FUNCTION_CORE = PARROT_SLOW_CORE,
     PARROT_FAST_CORE      = 0x01,             /* fast DO_OP core */
-    PARROT_SWITCH_CORE    = 0x02,             /*  P                */
-    PARROT_CGP_CORE       = 0x06,             /* CP                */
-    PARROT_CGOTO_CORE     = 0x04,             /* C    = cgoto      */
-    PARROT_JIT_CORE       = 0x10,             /* TODO arange bits for P 
testing */
-    PARROT_EXEC_CORE      = 0x20              /* TODO Parrot_exec_run variants 
*/
+    PARROT_SWITCH_CORE    = 0x02,             /*   P   = prederef   */
+    PARROT_CGP_CORE       = 0x06,             /*  CP                */
+    PARROT_CGOTO_CORE     = 0x04,             /*  C    = cgoto      */
+    PARROT_JIT_CORE       = 0x10,             /* J     = JIT        */
+    PARROT_CGP_JIT_CORE   = 0x16,             /* JCP                */
+    PARROT_SWITCH_JIT_CORE  = 0x12,           /* J P                */
+    PARROT_EXEC_CORE      = 0x20          /* TODO Parrot_exec_run variants */
 } Parrot_Run_core_t;
 
 /* &end_gen */

Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c   (original)
+++ trunk/src/embed.c   Thu Feb  9 08:11:23 2006
@@ -747,9 +747,11 @@ Parrot_runcode(Interp *interpreter, int 
                 PIO_eprintf(interpreter, "Fast core");
                 break;
             case PARROT_SWITCH_CORE:
+            case PARROT_SWITCH_JIT_CORE:
                 PIO_eprintf(interpreter, "Switch core");
                 break;
             case PARROT_CGP_CORE:
+            case PARROT_CGP_JIT_CORE:
                 PIO_eprintf(interpreter, "CGP core");
                 break;
             case PARROT_CGOTO_CORE:

Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c     (original)
+++ trunk/src/interpreter.c     Thu Feb  9 08:11:23 2006
@@ -182,7 +182,9 @@ do_prederef(void **pc_prederef, Parrot_I
     prederef_args(pc_prederef, interpreter, pc, opinfo);
     switch (type) {
         case PARROT_SWITCH_CORE:
+        case PARROT_SWITCH_JIT_CORE:
         case PARROT_CGP_CORE:
+        case PARROT_CGP_JIT_CORE:
             parrot_PIC_prederef(interpreter, *pc, pc_prederef, type);
             break;
         default:
@@ -283,10 +285,12 @@ get_op_lib_init(int core_op, int which, 
     if (core_op) {
         switch (which) {
             case PARROT_SWITCH_CORE:
+            case PARROT_SWITCH_JIT_CORE:
                 init_func = PARROT_CORE_SWITCH_OPLIB_INIT;
                 break;
 #ifdef HAVE_COMPUTED_GOTO
             case PARROT_CGP_CORE:
+            case PARROT_CGP_JIT_CORE:
                 init_func = PARROT_CORE_CGP_OPLIB_INIT;
                 break;
             case PARROT_CGOTO_CORE:
@@ -515,7 +519,9 @@ prepare_for_run(Parrot_Interp interprete
             (void) init_jit(interpreter, interpreter->code->base.data);
             break;
         case PARROT_SWITCH_CORE:
+        case PARROT_SWITCH_JIT_CORE:
         case PARROT_CGP_CORE:
+        case PARROT_CGP_JIT_CORE:
             init_prederef(interpreter, interpreter->run_core);
             break;
         default:
@@ -731,6 +737,7 @@ runops_int(Interp *interpreter, size_t o
 #endif
                 break;
             case PARROT_CGP_CORE:
+            case PARROT_CGP_JIT_CORE:
 #ifdef HAVE_COMPUTED_GOTO
                 core = runops_cgp;
 #else
@@ -738,6 +745,7 @@ runops_int(Interp *interpreter, size_t o
 #endif
                 break;
             case PARROT_SWITCH_CORE:
+            case PARROT_SWITCH_JIT_CORE:
                 core = runops_switch;
                 break;
             case PARROT_JIT_CORE:
@@ -756,6 +764,10 @@ runops_int(Interp *interpreter, size_t o
 #endif
                 core = runops_exec;
                 break;
+            default:
+                internal_exception(UNIMPLEMENTED,
+                        "ambigious runcore switch used");
+                break;
         }
 
 

Modified: trunk/src/pic_jit.c
==============================================================================
--- trunk/src/pic_jit.c (original)
+++ trunk/src/pic_jit.c Thu Feb  9 08:11:23 2006
@@ -148,6 +148,13 @@ parrot_pic_is_save_to_jit(Interp *interp
     /* simplify debugging */
     name = VTABLE_get_string(interpreter, sub);
 
+    /*
+     * 0) if runcore setting doesn't contain JIT
+     *    forget it
+     */
+    if (!(interpreter->run_core & PARROT_JIT_CORE))
+        return 0;
+
     /* 1) if the JIT system can't JIT_CODE_SUB_REGS_ONLY
      *    or the sub is using too many registers
      */ 

Reply via email to