[svn:parrot] r40536 - in branches/pluggable_runcore/src: interp runcore
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Fri Aug 14 00:10:29 UTC 2009
Author: chromatic
Date: Fri Aug 14 00:10:29 2009
New Revision: 40536
URL: https://trac.parrot.org/parrot/changeset/40536
Log:
Enable runcore destruction only in parentmost interpreter; ensure destruction
regardness of presence of Parrot's really destroy CLI flag.
Modified:
branches/pluggable_runcore/src/interp/inter_create.c
branches/pluggable_runcore/src/runcore/main.c
Modified: branches/pluggable_runcore/src/interp/inter_create.c
==============================================================================
--- branches/pluggable_runcore/src/interp/inter_create.c Fri Aug 14 00:02:58 2009 (r40535)
+++ branches/pluggable_runcore/src/interp/inter_create.c Fri Aug 14 00:10:29 2009 (r40536)
@@ -367,6 +367,10 @@
/* Now the PIOData gets also cleared */
Parrot_io_finish(interp);
+ /* deinit runcores and dynamic op_libs */
+ if (!interp->parent_interpreter)
+ Parrot_runcore_destroy(interp);
+
/*
* now all objects that need timely destruction should be finalized
* so terminate the event loop
@@ -442,15 +446,6 @@
/* free vtables */
parrot_free_vtables(interp);
- /* dynop libs */
- if (interp->n_libs > 0) {
- mem_sys_free(interp->op_info_table);
- mem_sys_free(interp->op_func_table);
-
- /* deinit op_lib */
- Parrot_runcore_destroy(interp);
- }
-
MUTEX_DESTROY(interpreter_array_mutex);
mem_sys_free(interp);
Modified: branches/pluggable_runcore/src/runcore/main.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/main.c Fri Aug 14 00:02:58 2009 (r40535)
+++ branches/pluggable_runcore/src/runcore/main.c Fri Aug 14 00:10:29 2009 (r40536)
@@ -701,23 +701,9 @@
{
ASSERT_ARGS(Parrot_runcore_destroy)
op_lib_t *cg_lib;
- size_t num_cores = interp->cores ?
- sizeof (interp->cores) / sizeof (Parrot_runcore_t *) : 1;
+ size_t num_cores = interp->num_cores;
size_t i;
-#ifdef HAVE_COMPUTED_GOTO
- cg_lib = PARROT_CORE_CGP_OPLIB_INIT(1);
-
- if (cg_lib->op_func_table)
- mem_sys_free(cg_lib->op_func_table);
- cg_lib->op_func_table = NULL;
-
- cg_lib = PARROT_CORE_CG_OPLIB_INIT(1);
- if (cg_lib->op_func_table)
- mem_sys_free(cg_lib->op_func_table);
- cg_lib->op_func_table = NULL;
-#endif
-
for (i = 0; i < num_cores; ++i) {
Parrot_runcore_t *core = interp->cores[i];
runcore_destroy_fn_type destroy = core->destroy;
@@ -733,6 +719,28 @@
interp->cores = NULL;
interp->run_core = NULL;
+
+ /* dynop libs */
+ if (interp->n_libs <= 0)
+ return;
+
+#ifdef HAVE_COMPUTED_GOTO
+ cg_lib = PARROT_CORE_CGP_OPLIB_INIT(1);
+
+ if (cg_lib->op_func_table)
+ mem_sys_free(cg_lib->op_func_table);
+ cg_lib->op_func_table = NULL;
+
+ cg_lib = PARROT_CORE_CG_OPLIB_INIT(1);
+ if (cg_lib->op_func_table)
+ mem_sys_free(cg_lib->op_func_table);
+ cg_lib->op_func_table = NULL;
+#endif
+
+ mem_sys_free(interp->op_info_table);
+ mem_sys_free(interp->op_func_table);
+ interp->op_info_table = NULL;
+ interp->op_func_table = NULL;
}
More information about the parrot-commits
mailing list