[svn:parrot] r40241 - in branches/bsr_jsr_ret: compilers/imcc compilers/pge examples/subs

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Thu Jul 23 23:17:04 UTC 2009


Author: whiteknight
Date: Thu Jul 23 23:17:04 2009
New Revision: 40241
URL: https://trac.parrot.org/parrot/changeset/40241

Log:
[bsr_jsr_ret] update more files, including ripping out some now-unused code from IMCC

Modified:
   branches/bsr_jsr_ret/compilers/imcc/cfg.c
   branches/bsr_jsr_ret/compilers/imcc/parser_util.c
   branches/bsr_jsr_ret/compilers/pge/README.pod
   branches/bsr_jsr_ret/examples/subs/bsr_ret.pasm

Modified: branches/bsr_jsr_ret/compilers/imcc/cfg.c
==============================================================================
--- branches/bsr_jsr_ret/compilers/imcc/cfg.c	Thu Jul 23 23:07:30 2009	(r40240)
+++ branches/bsr_jsr_ret/compilers/imcc/cfg.c	Thu Jul 23 23:17:04 2009	(r40241)
@@ -439,74 +439,6 @@
                 bb_add_edge(unit, bb, unit->bb_list[0]);
         }
 
-        if (STREQ(bb->end->opname, "ret")) {
-            Instruction *sub;
-            IMCC_debug(interp, DEBUG_CFG, "found ret in bb %d\n", i);
-
-            /* now go back, find labels and connect these with bsrs */
-
-            /* this doesn't work, if this is a local backward sub call
-             * the bsr isn't chained yet so the pred_list is empty
-             *
-             * s. #25948
-             */
-            if (!bb->pred_list) {
-                unsigned int j;
-
-                for (j = i; j < unit->n_basic_blocks; j++) {
-                    Basic_block * const b_bsr = unit->bb_list[j];
-
-                    if (STREQ(b_bsr->end->opname, "bsr")) {
-                        SymReg *addr = get_branch_reg(b_bsr->end);
-
-                        if (addr)
-                            bb_findadd_edge(interp, unit, b_bsr, addr);
-                    }
-                }
-            }
-            /* end #25948 */
-
-            for (pred = bb->pred_list; pred; pred = pred->next) {
-                int found = 0;
-
-                if (STREQ(pred->from->end->opname, "bsr")) {
-                    int j;
-                    {
-                        SymReg * const r = pred->from->end->symregs[0];
-                        sub              = pred->to->start;
-
-                        if ((sub->type & ITLABEL)
-                        &&   STREQ(sub->symregs[0]->name, r->name))
-                            found = 1;
-                    }
-invok:
-                    j = pred->from->index;
-
-                    if (found) {
-                        IMCC_debug(interp, DEBUG_CFG,
-                                "\tcalled from bb %d '%I'\n",
-                                j, pred->from->end);
-
-                        for (; sub && sub != bb->end; sub = sub->next) {
-                            unit->bb_list[sub->bbindex]->flag |= BB_IS_SUB;
-                        }
-
-                        bb_add_edge(unit, bb, unit->bb_list[j + 1]);
-
-                        IMCC_debug(interp, DEBUG_CFG, "\tand does saveall no\n");
-                    }
-                }
-                else if (STREQ(pred->from->end->opname, "invoke")) {
-                    found = 1;
-                    sub   = pred->to->start;
-                    goto invok;
-                }
-
-                if (!found)
-                    IMCC_debug(interp, DEBUG_CFG, "\tcalled from unknown!\n");
-            }
-        }
-
         last = bb;
     }
 

Modified: branches/bsr_jsr_ret/compilers/imcc/parser_util.c
==============================================================================
--- branches/bsr_jsr_ret/compilers/imcc/parser_util.c	Thu Jul 23 23:07:30 2009	(r40240)
+++ branches/bsr_jsr_ret/compilers/imcc/parser_util.c	Thu Jul 23 23:17:04 2009	(r40241)
@@ -555,8 +555,7 @@
         ||  STREQ(name, "returncc"))
             ins->type |= IF_goto;
         else if (STREQ(fullname, "jump_i")
-             ||  STREQ(fullname, "branch_i")
-             ||  STREQ(fullname, "bsr_i"))
+             ||  STREQ(fullname, "branch_i"))
             IMCC_INFO(interp)->dont_optimize = 1;
     }
     else if (STREQ(name, "set") && n == 2) {

Modified: branches/bsr_jsr_ret/compilers/pge/README.pod
==============================================================================
--- branches/bsr_jsr_ret/compilers/pge/README.pod	Thu Jul 23 23:07:30 2009	(r40240)
+++ branches/bsr_jsr_ret/compilers/pge/README.pod	Thu Jul 23 23:17:04 2009	(r40241)
@@ -118,8 +118,7 @@
 and reduction phases before being sent to code generation to
 produce a PIR subroutine.
 
-The generated PIR code uses bsr/ret for its internal backtracking
-(optimized for tailcalls) and uses Parrot calling conventions for
+The generated PIR code uses Parrot calling conventions for
 all interfaces with external callers/callees such as subrules.
 
 PGE also uses Parrot coroutines for the matching

Modified: branches/bsr_jsr_ret/examples/subs/bsr_ret.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/subs/bsr_ret.pasm	Thu Jul 23 23:07:30 2009	(r40240)
+++ branches/bsr_jsr_ret/examples/subs/bsr_ret.pasm	Thu Jul 23 23:17:04 2009	(r40241)
@@ -20,21 +20,24 @@
 
 =cut
 
-MAIN:	print "Main\n"
-	bsr TESTSUB
-	print "Main: Return from TestSub\n"
-END:	end
+MAIN:
+    new P1, 'ResizableIntegerArray'
+    print "Main\n"
+    local_branch P1, TESTSUB
+    print "Main: Return from TestSub\n"
+END:
+    end
 
 
 TESTSUB:
-	print "TestSub\n"
-	bsr NESTSUB
-	print "TestSub: Ret from NestSub\n"
-	ret
+    print "TestSub\n"
+    local_branch P1, NESTSUB
+    print "TestSub: Ret from NestSub\n"
+    local_return P1
 
 NESTSUB:
-	print "NestSub\n"
-	ret
+    print "NestSub\n"
+    local_return P1
 
 # Local Variables:
 #   mode: pir


More information about the parrot-commits mailing list