Skip to content

Commit

Permalink
Revert my previous exceptions commit. It was wrong.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@31223 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
tene committed Sep 18, 2008
1 parent 35f750a commit de0efc9
Show file tree
Hide file tree
Showing 54 changed files with 209 additions and 320 deletions.
96 changes: 32 additions & 64 deletions compilers/bcg/t/BCG.t
Expand Up @@ -36,8 +36,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test consecutive startCodeGen()" );
$P1.startCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -54,8 +53,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test endCodeGen()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -72,8 +70,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to endCodeGen()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -92,8 +89,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test startSub() and endSub()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -111,8 +107,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to startSub()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -128,8 +123,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to startSub()" );
$P1.startSub("main","main")
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -146,8 +140,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to startSub() endSub()" );
$P1.endSub()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -163,8 +156,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to endSub()" );
$P1.endSub()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -185,8 +177,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test startCall() and endCall()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -205,8 +196,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startCall()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -226,8 +216,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endCall()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -243,8 +232,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endCall()" );
$P1.endCall()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -260,8 +248,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startCall()" );
$P1.startCall("foo")
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -282,8 +269,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test startOp() and endOp()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -302,8 +288,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startOp()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -323,8 +308,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endOp()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -340,8 +324,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endOp()" );
$P1.endOp()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -357,8 +340,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startOp()" );
$P1.startOp("print")
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -380,8 +362,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test val()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -400,8 +381,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad val()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -419,8 +399,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad val()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -436,8 +415,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad val()" );
$P1.val("1","int")
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -459,8 +437,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test var()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -479,8 +456,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad var()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -498,8 +474,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad var()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -515,8 +490,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad var()" );
$P1.var("P1","pmc")
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -536,8 +510,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test label()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -554,8 +527,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad label()" );
$P1.endCodeGen()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -571,8 +543,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad label()" );
$P1.label("wombat")
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand All @@ -599,8 +570,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test PASM output 1)" );
$P1.printPASM()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand Down Expand Up @@ -634,8 +604,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test PASM output 2" );
$P1.printPASM()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand Down Expand Up @@ -671,8 +640,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test PASM output 3" );
$P1.printPASM()
end
catch:
get_results '0,0', $P0, $P2
$S0 = $P0
get_results '0,0', $P0, $S0
print $S0
print "\n"
.end
Expand Down
2 changes: 1 addition & 1 deletion compilers/pct/src/PAST/Compiler.pir
Expand Up @@ -613,7 +613,7 @@ Return the POST representation of a C<PAST::Block>.
unless ctrlpast goto sub_done
bpost.'push'(ctrllabel)
bpost.'push_pirop'('.local pmc exception')
bpost.'push_pirop'('.get_results (exception, $P11)')
bpost.'push_pirop'('.get_results (exception, $S10)')
$I0 = isa ctrlpast, 'PAST::Node'
if $I0 goto control_past
if ctrlpast == 'return_pir' goto control_return
Expand Down
3 changes: 1 addition & 2 deletions compilers/pct/src/PCT/HLLCompiler.pir
Expand Up @@ -544,8 +544,7 @@ specifies the encoding to use for the input (e.g., "utf8").
say $P0
goto interactive_loop
interactive_trap:
get_results '0,0', $P0, $P1
$S0 = $P0
get_results '0,0', $P0, $S0
if $S0 == '' goto have_newline
$S1 = substr $S0, -1, 1
$I0 = is_cclass .CCLASS_NEWLINE, $S1, 0
Expand Down
14 changes: 6 additions & 8 deletions docs/compiler_faq.pod
Expand Up @@ -455,13 +455,12 @@ C<pop_eh>.
pop_eh
... # ok

An exception handler is called with two arguments: the exception and the
return continuation to resume execution.
An exception handler is called with two arguments: the exception and its
extracted message for your convenience.

handler: # exception
.get_results ($P0, $P1)
.get_results ($P0, $S0)
print 'Exception caught:'
$S0 = $P0['message']
say $S0
...

Expand All @@ -472,7 +471,7 @@ Rethrow the exception if it has a severity of C<EXCEPT_EXIT>.
.include 'except_severity.pasm'
...
handler:
.get_results ($P0, $P1)
.get_results ($P0, $S0)
$I0 = $P0['severity']
if $I0 == .EXCEPT_EXIT goto handle_exit
say 'Exception caught!'
Expand All @@ -491,10 +490,9 @@ Exception example:
exit 0

handler:
.local pmc exception, return
.local pmc exception
.local string message
.get_results (exception, return)
message = exception['message']
.get_results (exception, message)
print 'Exception: '
print message
print "\n"
Expand Down

0 comments on commit de0efc9

Please sign in to comment.