[svn:parrot] r41048 - in branches/pluggable_runcore: include/parrot src/runcore

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Sep 6 08:47:20 UTC 2009


Author: bacek
Date: Sun Sep  6 08:47:17 2009
New Revision: 41048
URL: https://trac.parrot.org/parrot/changeset/41048

Log:
Store core id in runcore_t and use it dynop_register_xx

Modified:
   branches/pluggable_runcore/include/parrot/runcore_api.h
   branches/pluggable_runcore/src/runcore/cores.c
   branches/pluggable_runcore/src/runcore/main.c

Modified: branches/pluggable_runcore/include/parrot/runcore_api.h
==============================================================================
--- branches/pluggable_runcore/include/parrot/runcore_api.h	Sun Sep  6 07:34:46 2009	(r41047)
+++ branches/pluggable_runcore/include/parrot/runcore_api.h	Sun Sep  6 08:47:17 2009	(r41048)
@@ -30,6 +30,7 @@
 
 struct runcore_t {
     STRING                  *name;
+    int                      id;
     oplib_init_f             opinit;
     runcore_runops_fn_type   runops;
     runcore_destroy_fn_type  destroy;
@@ -46,6 +47,7 @@
 
 struct profiling_runcore_t {
     STRING                      *name;
+    int                          id;
     oplib_init_f                 opinit;
     Parrot_runcore_runops_fn_t   runops;
     Parrot_runcore_destroy_fn_t  destroy;

Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c	Sun Sep  6 07:34:46 2009	(r41047)
+++ branches/pluggable_runcore/src/runcore/cores.c	Sun Sep  6 08:47:17 2009	(r41048)
@@ -445,6 +445,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "slow");
+    coredata->id               = PARROT_SLOW_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->runops           = runops_slow_core;
     coredata->prepare_run      = NULL;
@@ -476,6 +477,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "fast");
+    coredata->id               = PARROT_FAST_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->runops           = runops_fast_core;
     coredata->destroy          = NULL;
@@ -504,6 +506,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "switch");
+    coredata->id               = PARROT_SWITCH_CORE;
     coredata->opinit           = PARROT_CORE_SWITCH_OPLIB_INIT;
     coredata->runops           = runops_switch_core;
     coredata->prepare_run      = init_prederef;
@@ -532,6 +535,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "jit");
+    coredata->id               = PARROT_JIT_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->prepare_run      = init_jit_run;
     coredata->runops           = runops_jit_core;
@@ -560,6 +564,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "switch_jit");
+    coredata->id               = PARROT_SWITCH_JIT_CORE;
     coredata->opinit           = PARROT_CORE_SWITCH_OPLIB_INIT;
     coredata->destroy          = NULL;
     coredata->prepare_run      = init_prederef;
@@ -589,6 +594,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "exec");
+    coredata->id               = PARROT_EXEC_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->runops           = runops_exec_core;
     coredata->destroy          = NULL;
@@ -615,6 +621,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "gc_debug");
+    coredata->id               = PARROT_GC_DEBUG_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->runops           = runops_gc_debug_core;
     coredata->destroy          = NULL;
@@ -643,6 +650,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "debugger");
+    coredata->id               = PARROT_DEBUGGER_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->prepare_run      = init_prederef;
     coredata->runops           = runops_debugger_core;
@@ -673,6 +681,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "cgp");
+    coredata->id               = PARROT_CGP_CORE;
     coredata->opinit           = PARROT_CORE_CGP_OPLIB_INIT;
     coredata->prepare_run      = init_prederef;
     coredata->runops           = runops_cgp_core;
@@ -704,6 +713,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "cgoto");
+    coredata->id               = PARROT_CGOTO_CORE;
     coredata->opinit           = PARROT_CORE_CG_OPLIB_INIT;
     coredata->runops           = runops_cgoto_core;
     coredata->destroy          = NULL;
@@ -734,6 +744,7 @@
 
     Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "cgp_jit");
+    coredata->id               = PARROT_CGP_JIT_CORE;
     coredata->opinit           = PARROT_CORE_CGP_OPLIB_INIT;
     coredata->prepare_run      = init_prederef;
     coredata->runops           = runops_cgp_core;
@@ -767,6 +778,7 @@
     Parrot_profiling_runcore_t *coredata =
                                  mem_allocate_typed(Parrot_profiling_runcore_t);
     coredata->name             = CONST_STRING(interp, "profiling");
+    coredata->id               = PARROT_PROFILING_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
     coredata->runops           = (Parrot_runcore_runops_fn_t) init_profiling_core;
     coredata->destroy          = NULL;

Modified: branches/pluggable_runcore/src/runcore/main.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/main.c	Sun Sep  6 07:34:46 2009	(r41047)
+++ branches/pluggable_runcore/src/runcore/main.c	Sun Sep  6 08:47:17 2009	(r41048)
@@ -961,7 +961,7 @@
     }
 
     /* if we are running this core, update event check ops */
-    if ((int)interp->run_core == cg_lib->core_type) {
+    if (interp->run_core->id == cg_lib->core_type) {
         size_t i;
 
         for (i = n_old; i < n_tot; ++i)


More information about the parrot-commits mailing list