Author: leo
Date: Mon Apr 25 02:45:54 2005
New Revision: 7925

Modified:
   trunk/config/gen/makefiles/dynoplibs.in
   trunk/imcc/parser_util.c
   trunk/src/interpreter.c
Log:
make dynoplibs work again

Modified: trunk/config/gen/makefiles/dynoplibs.in
==============================================================================
--- trunk/config/gen/makefiles/dynoplibs.in     (original)
+++ trunk/config/gen/makefiles/dynoplibs.in     Mon Apr 25 02:45:54 2005
@@ -13,15 +13,15 @@
 # add your dynamic oplibs here
 
 all: myops_ops$(LOAD_EXT) myops_ops_cg$(LOAD_EXT) myops_ops_cgp$(LOAD_EXT) \
-     myops_ops_prederef$(LOAD_EXT) myops_ops_switch$(LOAD_EXT) \
+     myops_ops_switch$(LOAD_EXT) \
      \
      dan_ops$(LOAD_EXT) dan_ops_cg$(LOAD_EXT) dan_ops_cgp$(LOAD_EXT) \
-     dan_ops_prederef$(LOAD_EXT) dan_ops_switch$(LOAD_EXT)
+     dan_ops_switch$(LOAD_EXT)
 
 .SUFFIXES: .ops .c $(LOAD_EXT)
 
 # preserve .c if needed
-.PRECIOUS: %_ops.c %_ops_cgp.c %_ops_cg.c %_ops_prederef.c %_ops_switch.c
+.PRECIOUS: %_ops.c %_ops_cgp.c %_ops_cg.c %_ops_switch.c
 
 %_ops.c  : %.ops
        $(PERL) $(OPS2C) C --dynamic $<
@@ -32,9 +32,6 @@
 %_ops_cg.c  : %.ops
        $(PERL) $(OPS2C) CGoto --dynamic $<
 
-%_ops_prederef.c  : %.ops
-       $(PERL) $(OPS2C) CPrederef --dynamic $<
-
 %_ops_switch.c  : %.ops
        $(PERL) $(OPS2C) CSwitch --dynamic $<
 

Modified: trunk/imcc/parser_util.c
==============================================================================
--- trunk/imcc/parser_util.c    (original)
+++ trunk/imcc/parser_util.c    Mon Apr 25 02:45:54 2005
@@ -568,11 +568,11 @@
         /* emit a debug seg, if this op is seen */
         PARROT_WARNINGS_on(interpreter, PARROT_WARNINGS_ALL_FLAG);
     }
-#if 0
+#if 1
     else if (!strcmp(name, "loadlib")) {
         SymReg *r1 = r[1];   /* lib name */
         STRING *lib;
-        if (r1->type & VTCONST) {
+        if ((r1->type & VTCONST) && strstr(r1->name, "ops")) {
             /*
              * XXX we should not read in dynamic PMC classes
              *     OTOH we have to load dynamic opcodes

Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c     (original)
+++ trunk/src/interpreter.c     Mon Apr 25 02:45:54 2005
@@ -827,8 +827,12 @@
     op_info_t *new_info_table;
     size_t i, n_old, n_new, n_tot;
 
-    interpreter->all_op_libs = mem_sys_realloc(interpreter->all_op_libs,
-            sizeof(op_lib_t *) * (interpreter->n_libs + 1));
+    if (!interpreter->all_op_libs)
+        interpreter->all_op_libs = mem_sys_allocate(
+                sizeof(op_lib_t *) * (interpreter->n_libs + 1));
+    else
+        interpreter->all_op_libs = mem_sys_realloc(interpreter->all_op_libs,
+                sizeof(op_lib_t *) * (interpreter->n_libs + 1));
 
     init_func = get_op_lib_init(0, 0, lib_pmc);
     lib = init_func(1);
@@ -855,7 +859,7 @@
     core = PARROT_CORE_OPLIB_INIT(1);
 
     assert(interpreter->op_count == core->op_count);
-    new_evc_func_table = mem_sys_realloc(interpreter->evc_func_table,
+    new_evc_func_table = mem__sys_realloc(interpreter->evc_func_table,
             sizeof (void *) * n_tot);
     if (core->flags & OP_FUNC_IS_ALLOCATED) {
         new_func_table = mem_sys_realloc(core->op_func_table,
@@ -944,12 +948,33 @@
         for (i = 0; i < n_old; ++i)
             ops_addr[i] = ((void **)cg_lib->op_func_table)[i];
     }
+    /*
+     * XXX running CG and CGP ops currently works only via the wrapper
+     *
+     * the problem is:
+     *  The actual runcores cg_core and cgp_core are very big functions.
+     *  The C compiler usually addresses "spilled" registers in the C stack.
+     *  The loaded opcode lib is another possibly big function, but with
+     *  a likely different stack layout. Directly jumping around between
+     *  code locations in these two opcode functions works, but access
+     *  to stack-ed (or spilled) variables fails badly.
+     *
+     *  We would need to prepare the assembly source of the opcode
+     *  lib so that all variable access on the stack has the same
+     *  layout and compile the prepared assembly to ops_cgp?.o
+     *
+     *  The switched core is different anyway, as we can't extend the
+     *  compiled big switch statement with the new cases. We have
+     *  always to use the wrapper__ opcode called from the default case.
+     */
+#if 0
     /* check if the lib_pmc exists with a _xx flavor */
     new_init_func = get_op_lib_init(0, 0, lib_pmc);
     new_lib = new_init_func(1);
     op_variant = Parrot_sprintf_c(interpreter, "%s_ops%s",
             new_lib->name, cg_lib->suffix);
     lib_variant = Parrot_load_lib(interpreter, op_variant, NULL);
+#endif
     /*
      * XXX running CG and CGP ops currently works only via the wrapper
      */

Reply via email to