[svn:parrot] r48911 - branches/oplib_handling_cleanup/src/runcore
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Fri Sep 10 18:10:05 UTC 2010
Author: plobsing
Date: Fri Sep 10 18:10:04 2010
New Revision: 48911
URL: https://trac.parrot.org/parrot/changeset/48911
Log:
eliminate now defunct parts of dynop_register
Modified:
branches/oplib_handling_cleanup/src/runcore/main.c
Modified: branches/oplib_handling_cleanup/src/runcore/main.c
==============================================================================
--- branches/oplib_handling_cleanup/src/runcore/main.c Fri Sep 10 18:01:50 2010 (r48910)
+++ branches/oplib_handling_cleanup/src/runcore/main.c Fri Sep 10 18:10:04 2010 (r48911)
@@ -296,21 +296,12 @@
dynop_register(PARROT_INTERP, ARGIN(PMC *lib_pmc))
{
ASSERT_ARGS(dynop_register)
- op_lib_t *lib, *core;
- oplib_init_f init_func;
- op_func_t *new_func_table;
- op_info_t *new_info_table;
- size_t i, n_old, n_new, n_tot;
+ op_lib_t *lib;
+ oplib_init_f init_func;
if (n_interpreters > 1) {
- /* This is not supported because oplibs are always shared.
- * If we mem_sys_reallocate() the op_func_table while another
- * interpreter is running using that exact op_func_table,
- * this will cause problems
- * Also, the mapping from op name to op number is global even for
- * dynops (!). The mapping is done by get_op in core_ops.c (even for
- * dynops) and uses a global hash as a cache and relies on modifications
- * to the static-scoped core_op_lib data structure to see dynops.
+ /* This is not supported yet because interp->all_op_libs
+ * and interp->op_hash are shared.
*/
Parrot_ex_throw_from_c_args(interp, NULL, 1, "loading a new dynoplib while "
"more than one thread is running is not supported.");
@@ -331,56 +322,10 @@
/* if we are registering an op_lib variant, called from below the base
* names of this lib and the previous one are the same */
if (interp->n_libs >= 2
- && (STREQ(interp->all_op_libs[interp->n_libs-2]->name, lib->name))) {
- /* registering is handled below */
+ && (STREQ(interp->all_op_libs[interp->n_libs-2]->name, lib->name)))
return;
- }
parrot_hash_oplib(interp, lib);
- return;
-
- n_old = interp->op_count;
- n_new = lib->op_count;
- n_tot = n_old + n_new;
- core = PARROT_CORE_OPLIB_INIT(interp, 1);
-
- PARROT_ASSERT(interp->op_count == core->op_count);
-
- if (core->flags & OP_FUNC_IS_ALLOCATED) {
- new_func_table = mem_gc_realloc_n_typed_zeroed(interp,
- core->op_func_table, n_tot, n_old, op_func_t);
- new_info_table = mem_gc_realloc_n_typed_zeroed(interp,
- core->op_info_table, n_tot, n_old, op_info_t);
- }
- else {
- /* allocate new op_func and info tables */
- new_func_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t);
- new_info_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_info_t);
-
- /* copy old */
- for (i = 0; i < n_old; ++i) {
- new_func_table[i] = interp->op_func_table[i];
- new_info_table[i] = interp->op_info_table[i];
- }
- }
-
- /* add new */
- for (i = n_old; i < n_tot; ++i) {
- new_func_table[i] = ((op_func_t*)lib->op_func_table)[i - n_old];
- new_info_table[i] = lib->op_info_table[i - n_old];
- }
-
- /* deinit core, so that it gets rehashed */
- (void) PARROT_CORE_OPLIB_INIT(interp, 0);
-
- /* set table */
- core->op_func_table = interp->op_func_table = new_func_table;
- core->op_info_table = interp->op_info_table = new_info_table;
- core->op_count = interp->op_count = n_tot;
- core->flags = OP_FUNC_IS_ALLOCATED | OP_INFO_IS_ALLOCATED;
-
- /* done for plain core */
- dynop_register_switch(interp, n_old, n_new);
}
@@ -408,15 +353,6 @@
}
-static void
-dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new)
-{
- ASSERT_ARGS(dynop_register_switch)
- op_lib_t * const lib = PARROT_CORE_OPLIB_INIT(interp, 1);
- lib->op_count = n_old + n_new;
-}
-
-
/*
=item C<void disable_event_checking(PARROT_INTERP)>
More information about the parrot-commits
mailing list