develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34302 - branches/pctloop2/compilers/pct/src/PAST

From:
pmichaud
Date:
December 23, 2008 16:12
Subject:
[svn:parrot] r34302 - branches/pctloop2/compilers/pct/src/PAST
Message ID:
20081224001232.20D48CBA12@x12.develooper.com
Author: pmichaud
Date: Tue Dec 23 16:12:31 2008
New Revision: 34302

Modified:
   branches/pctloop2/compilers/pct/src/PAST/Compiler.pir

Log:
[pct]:  Add the exception handler to the loop_gen code.  Now we just test.


Modified: branches/pctloop2/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/pctloop2/compilers/pct/src/PAST/Compiler.pir	(original)
+++ branches/pctloop2/compilers/pct/src/PAST/Compiler.pir	Tue Dec 23 16:12:31 2008
@@ -1283,6 +1283,13 @@
     $P0 = get_hll_global ['POST'], 'Ops'
     ops = $P0.'new'()
 
+    .local string handreg
+    handreg = self.'uniquereg'('P')
+    ops.'push_pirop'('new', handreg, "'ExceptionHandler'")
+    ops.'push_pirop'('set_addr', handreg, handlabel)
+    ops.'push_pirop'('callmethod', '"handle_types"', handreg, .CONTROL_LOOP_NEXT, .CONTROL_LOOP_REDO, .CONTROL_LOOP_LAST)
+    ops.'push_pirop'('push_eh', handreg)
+
     unless bodyfirst goto bodyfirst_done
     ops.'push_pirop'('goto', redolabel)
   bodyfirst_done:
@@ -1300,7 +1307,15 @@
   body_done:
     ops.'push'(nextlabel)
     ops.'push_pirop'('goto', testlabel)
+    ops.'push'(handlabel)
+    ops.'push_pirop'('.local pmc exception')
+    ops.'push_pirop'('.get_results (exception)')
+    $S0 = self.'uniquereg'('P')
+    ops.'push_pirop'('getattribute', $S0, 'exception', "'type'")
+    ops.'push_pirop'('eq', $S0, .CONTROL_LOOP_NEXT, nextlabel)
+    ops.'push_pirop'('eq', $S0, .CONTROL_LOOP_REDO, redolabel)
     ops.'push'(donelabel)
+    ops.'push_pirop'('pop_eh')
     .return (ops)
 .end
   



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About