From 4735873f63e59bbbe6f75a7ced929dad6e4a24de Mon Sep 17 00:00:00 2001 From: Stephen Weeks Date: Sat, 20 Sep 2008 22:40:41 -0600 Subject: [PATCH] Remove the second argument passed to exception handlers. You can get the message by stringifying the exception object. --- compilers/bcg/t/BCG.t | 96 ++++++++++++++++++--------- compilers/pct/src/PAST/Compiler.pir | 2 +- compilers/pct/src/PCT/HLLCompiler.pir | 3 +- docs/pdds/pdd19_pir.pod | 19 ++++-- languages/APL/src/parser/actions.pm | 2 +- languages/WMLScript/src/wmlsstdlibs.pir | 3 +- languages/WMLScript/wmls2pbc.pir | 3 +- languages/WMLScript/wmls2pir.pir | 3 +- languages/WMLScript/wmlsd.pir | 3 +- languages/WMLScript/wmlsi.pir | 3 +- languages/dotnet/build/translator.pl | 4 +- languages/dotnet/src/translator.pir | 5 +- languages/ecmascript/src/parser/actions.pm | 2 +- languages/forth/forth.pir | 2 +- languages/forth/test.pir | 2 +- languages/lua/luac2pir.pir | 3 +- languages/lua/luad.pir | 3 +- languages/lua/src/lib/bc.pir | 4 +- languages/lua/src/lib/glut.pir | 12 ++- languages/lua/src/lib/lfs.pir | 15 +++-- languages/lua/src/lib/luaaux.pir | 9 ++- languages/lua/src/lib/luabasic.pir | 3 +- languages/lua/src/lib/luacoroutine.pir | 3 +- languages/lua/src/lib/luadebug.pir | 3 +- languages/lua/src/lib/luaos.pir | 6 +- languages/perl6/src/builtins/control.pir | 8 +- languages/perl6/src/parser/actions.pm | 2 +- languages/pheme/pheme.pir | 2 +- languages/squaak/src/parser/actions.pm | 2 +- languages/tcl/runtime/builtin/dict.pir | 21 ++++-- languages/tcl/runtime/builtin/info.pir | 3 +- languages/tcl/runtime/builtin/inline.pir | 6 +- languages/tcl/runtime/conversions.pir | 6 +- languages/tcl/src/macros.pir | 3 +- languages/tcl/t/internals/select_option.t | 18 ++++-- languages/tcl/t/internals/select_switches.t | 11 ++- src/exceptions.c | 9 +-- src/ops/core.ops | 18 ++++- t/compilers/pge/p5regex/p5rx.t | 3 +- t/compilers/pge/perl6regex/01-regex.t | 3 +- t/library/pg.t | 3 +- t/op/calling.t | 3 +- t/op/exceptions.t | 36 +++++++---- t/op/sprintf.t | 3 +- t/pmc/bigint.t | 3 +- t/pmc/complex.t | 3 +- t/pmc/coroutine.t | 14 ++-- t/pmc/exception.t | 38 +++++++---- t/pmc/float.t | 3 +- t/pmc/namespace.t | 12 ++- t/pmc/resizablestringarray.t | 3 +- 51 files changed, 287 insertions(+), 162 deletions(-) diff --git a/compilers/bcg/t/BCG.t b/compilers/bcg/t/BCG.t index 9b0d4d9..37903cc 100644 --- a/compilers/bcg/t/BCG.t +++ b/compilers/bcg/t/BCG.t @@ -36,7 +36,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test consecutive startCodeGen()" ); $P1.startCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -53,7 +54,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test endCodeGen()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -70,7 +72,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to endCodeGen()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -89,7 +92,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test startSub() and endSub()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -107,7 +111,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to startSub()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -123,7 +128,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to startSub()" ); $P1.startSub("main","main") end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -140,7 +146,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to startSub() endSub()" ); $P1.endSub() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -156,7 +163,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad call to endSub()" ); $P1.endSub() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -177,7 +185,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test startCall() and endCall()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -196,7 +205,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startCall()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -216,7 +226,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endCall()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -232,7 +243,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endCall()" ); $P1.endCall() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -248,7 +260,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startCall()" ); $P1.startCall("foo") end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -269,7 +282,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test startOp() and endOp()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -288,7 +302,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startOp()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -308,7 +323,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endOp()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -324,7 +340,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad endOp()" ); $P1.endOp() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -340,7 +357,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad startOp()" ); $P1.startOp("print") end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -362,7 +380,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test val()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -381,7 +400,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad val()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -399,7 +419,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad val()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -415,7 +436,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad val()" ); $P1.val("1","int") end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -437,7 +459,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test var()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -456,7 +479,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad var()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -474,7 +498,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad var()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -490,7 +515,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad var()" ); $P1.var("P1","pmc") end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -510,7 +536,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test label()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -527,7 +554,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad label()" ); $P1.endCodeGen() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -543,7 +571,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test bad label()" ); $P1.label("wombat") end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -570,7 +599,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test PASM output 1)" ); $P1.printPASM() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -604,7 +634,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test PASM output 2" ); $P1.printPASM() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end @@ -640,7 +671,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "Test PASM output 3" ); $P1.printPASM() end catch: - get_results '0,0', $P0, $S0 + get_results '0,0', $P0 + $S0 = $P0 print $S0 print "\n" .end diff --git a/compilers/pct/src/PAST/Compiler.pir b/compilers/pct/src/PAST/Compiler.pir index aae8fad..6eec545 100644 --- a/compilers/pct/src/PAST/Compiler.pir +++ b/compilers/pct/src/PAST/Compiler.pir @@ -613,7 +613,7 @@ Return the POST representation of a C. unless ctrlpast goto sub_done bpost.'push'(ctrllabel) bpost.'push_pirop'('.local pmc exception') - bpost.'push_pirop'('.get_results (exception, $S10)') + bpost.'push_pirop'('.get_results (exception)') $I0 = isa ctrlpast, 'PAST::Node' if $I0 goto control_past if ctrlpast == 'return_pir' goto control_return diff --git a/compilers/pct/src/PCT/HLLCompiler.pir b/compilers/pct/src/PCT/HLLCompiler.pir index aa75a7a..0acc848 100644 --- a/compilers/pct/src/PCT/HLLCompiler.pir +++ b/compilers/pct/src/PCT/HLLCompiler.pir @@ -544,7 +544,8 @@ specifies the encoding to use for the input (e.g., "utf8"). say $P0 goto interactive_loop interactive_trap: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 if $S0 == '' goto have_newline $S1 = substr $S0, -1, 1 $I0 = is_cclass .CCLASS_NEWLINE, $S1, 0 diff --git a/docs/pdds/pdd19_pir.pod b/docs/pdds/pdd19_pir.pod index a39f3c3..29f257c 100644 --- a/docs/pdds/pdd19_pir.pod +++ b/docs/pdds/pdd19_pir.pod @@ -617,18 +617,13 @@ C<:slurpy>, C<:optional>, C<:opt_flag>, and C<:flat>. Using the C op you can install an exception handler. If an exception is thrown, Parrot will execute the installed exception handler. In order to retrieve the thrown exception, use the C<.get_results> directive. This -directive always takes 2 arguments: an exception object and a message string. - -{{ NOTE: Wouldn't it be more useful to make this flexible, or at least only -the exception object? The message can be retrieved from the exception object. -See RT #57436 }} +directive always takes one argument: an exception object. push_eh handler ... handler: .local pmc exception - .local string message - .get_results (exception, message) + .get_results (exception) ... This is syntactic sugar for the C op, but any flags set on the @@ -636,6 +631,16 @@ targets will be handled automatically by the PIR compiler. The C<.get_results> directive must be the first instruction of the exception handler; only declarations (.lex, .local) may come first. +To resume execution after handling the exception, just invoke the continuation +stored in the exception. + + ... + .get_results(exception) + ... + continuation = exception['resume'] + continuation() + ... + =head2 Syntactic Sugar Any PASM opcode is a valid PIR instruction. In addition, PIR defines some diff --git a/languages/APL/src/parser/actions.pm b/languages/APL/src/parser/actions.pm index 7c9ffe7..afdf897 100644 --- a/languages/APL/src/parser/actions.pm +++ b/languages/APL/src/parser/actions.pm @@ -18,7 +18,7 @@ value of the comment is passed as the second argument to the method. class APL::Grammar::Actions; method TOP($/) { - my $catchpir := " get_results '0,0', $P0, $S0\n print $S0\n exit 1\n"; + my $catchpir := " get_results '0', $P0\n $S0 = $P0\n print $S0\n exit 1\n"; my $past := PAST::Op.new( $( $ ), PAST::Op.new( :inline( $catchpir) ), :pasttype('try'), diff --git a/languages/WMLScript/src/wmlsstdlibs.pir b/languages/WMLScript/src/wmlsstdlibs.pir index bfa4991..fe32f90 100644 --- a/languages/WMLScript/src/wmlsstdlibs.pir +++ b/languages/WMLScript/src/wmlsstdlibs.pir @@ -111,7 +111,8 @@ helper for CALL_URL* opcodes. _handler_1: .local pmc e .local string msg - .get_results (e, msg) + .get_results (e) + msg = e print msg print "\n" $S0 = "verification failed (can't translate '" diff --git a/languages/WMLScript/wmls2pbc.pir b/languages/WMLScript/wmls2pbc.pir index 2239fc3..1e6813e 100644 --- a/languages/WMLScript/wmls2pbc.pir +++ b/languages/WMLScript/wmls2pbc.pir @@ -56,7 +56,8 @@ Francois Perrad. _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e print s print "\n" L1: diff --git a/languages/WMLScript/wmls2pir.pir b/languages/WMLScript/wmls2pir.pir index c46c3ca..6bab800 100644 --- a/languages/WMLScript/wmls2pir.pir +++ b/languages/WMLScript/wmls2pir.pir @@ -52,7 +52,8 @@ Francois Perrad. _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e print s print "\n" L1: diff --git a/languages/WMLScript/wmlsd.pir b/languages/WMLScript/wmlsd.pir index 03f8d39..2981217 100644 --- a/languages/WMLScript/wmlsd.pir +++ b/languages/WMLScript/wmlsd.pir @@ -50,7 +50,8 @@ Francois Perrad. _handler: .local pmc e .local string msg - .get_results (e, msg) + .get_results (e) + msg = e print msg print "\n" L1: diff --git a/languages/WMLScript/wmlsi.pir b/languages/WMLScript/wmlsi.pir index 708e0da..79eb619 100644 --- a/languages/WMLScript/wmlsi.pir +++ b/languages/WMLScript/wmlsi.pir @@ -81,7 +81,8 @@ Francois Perrad. _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e print s print "\n" L1: diff --git a/languages/dotnet/build/translator.pl b/languages/dotnet/build/translator.pl index 9269c4a..0197e9e 100644 --- a/languages/dotnet/build/translator.pl +++ b/languages/dotnet/build/translator.pl @@ -552,7 +552,7 @@ NOT_TRY_START: # Emit code to get the .NET exception object and check if it's of the type that # is accepted. - gen_pir = concat ".get_results (cur_exception, $S1000000)\n" + gen_pir = concat ".get_results (cur_exception)\n" gen_pir = concat "$P1000001 = cur_exception[\"obj\"]\n" class_type = eh.get_class_type() class_id = eh.get_class_id() @@ -611,7 +611,7 @@ NOT_TYPED_EH_START: # Emit code to get and stash the .NET exception object, then put a jump # label. - gen_pir = concat ".get_results (cur_exception, $S1000000)\nsaved_ehs[" + gen_pir = concat ".get_results (cur_exception)\nsaved_ehs[" tmp = i gen_pir = concat tmp gen_pir = concat "] = cur_exception\nFINALLY_" diff --git a/languages/dotnet/src/translator.pir b/languages/dotnet/src/translator.pir index 3e6f6da..ad8e2e4 100644 --- a/languages/dotnet/src/translator.pir +++ b/languages/dotnet/src/translator.pir @@ -10,7 +10,7 @@ .param int standalone .param int trace .local string pir_output, src, summary, tmp, emsg - .local pmc assembly, classes, class_order, type, e, entry_meth, entry_class + .local pmc assembly, classes, class_order, type, e, entry_meth, entry_class, c .local int is_dll, i, max_class, class_id, total_types, done_types # Instantiate a new assembly class. @@ -167,7 +167,8 @@ RESUME: inc i goto CLOOP trans_failure_handler: - .get_results (e, emsg) + .get_results (e) + emsg = e # Emit trace message. unless trace goto NOTRACE printerr " **FAILED** (" diff --git a/languages/ecmascript/src/parser/actions.pm b/languages/ecmascript/src/parser/actions.pm index dc5e320..cf7f120 100644 --- a/languages/ecmascript/src/parser/actions.pm +++ b/languages/ecmascript/src/parser/actions.pm @@ -239,7 +239,7 @@ method catch($/) { my $exid := $( $ ); ## Add a catch node to the try op that captures the ## exception object into the declared identifier. Thanks to Rakudo for this trick. - my $catchpir := " .get_results (%r, $S0)\n store_lex '" ~ $exid.name() ~ "', %r"; + my $catchpir := " .get_results (%r)\n store_lex '" ~ $exid.name() ~ "', %r"; $past.unshift( PAST::Op.new( :inline( $catchpir ) ) ); make $past; } diff --git a/languages/forth/forth.pir b/languages/forth/forth.pir index 9e0b540..bd29e4a 100644 --- a/languages/forth/forth.pir +++ b/languages/forth/forth.pir @@ -71,7 +71,7 @@ end: .return() exception: - get_results '0, 0', $P0, $S0 + get_results '0', $P0 $S0 = $P0[0] print $S0 print "\n" diff --git a/languages/forth/test.pir b/languages/forth/test.pir index a6f8c7d..0091e33 100644 --- a/languages/forth/test.pir +++ b/languages/forth/test.pir @@ -113,7 +113,7 @@ missing_output: exception: .local pmc except - get_results '0,0', except, $S0 + get_results '0', except output = except[0] compare: diff --git a/languages/lua/luac2pir.pir b/languages/lua/luac2pir.pir index c813692..0ed16be 100644 --- a/languages/lua/luac2pir.pir +++ b/languages/lua/luac2pir.pir @@ -48,7 +48,8 @@ Francois Perrad. _handler: .local pmc e .local string msg - .get_results (e, msg) + .get_results (e) + msg = e print msg print "\n" L1: diff --git a/languages/lua/luad.pir b/languages/lua/luad.pir index 24a8073..f93add9 100644 --- a/languages/lua/luad.pir +++ b/languages/lua/luad.pir @@ -51,7 +51,8 @@ Francois Perrad. _handler: .local pmc e .local string msg - .get_results (e, msg) + .get_results (e) + msg = e print msg print "\n" L1: diff --git a/languages/lua/src/lib/bc.pir b/languages/lua/src/lib/bc.pir index 5972af6..43e6f3c 100644 --- a/languages/lua/src/lib/bc.pir +++ b/languages/lua/src/lib/bc.pir @@ -168,7 +168,7 @@ LIST res = lua_newuserdata($P0, mt) .return (res) _handler: - .get_results ($P0, $S0) + .get_results ($P0) new res, 'LuaNil' .return (res) .endm @@ -398,7 +398,7 @@ LIST res = lua_newuserdata($P0, mt) .return (res) _handler: - .get_results ($P0, $S0) + .get_results ($P0) new res, 'LuaNil' .return (res) .end diff --git a/languages/lua/src/lib/glut.pir b/languages/lua/src/lib/glut.pir index 3c44cb6..d5c6d1d 100644 --- a/languages/lua/src/lib/glut.pir +++ b/languages/lua/src/lib/glut.pir @@ -138,7 +138,8 @@ not LuaGL _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e printerr "Error running lua script:\n\n " printerr s printerr " \n\n" @@ -178,7 +179,8 @@ not LuaGL _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e printerr "Error running lua script:\n\n " printerr s printerr " \n\n" @@ -274,7 +276,8 @@ not LuaGL _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e printerr "Error running lua script:\n\n " printerr s printerr " \n\n" @@ -340,7 +343,8 @@ not LuaGL _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e printerr "Error running lua script:\n\n " printerr s printerr " \n\n" diff --git a/languages/lua/src/lib/lfs.pir b/languages/lua/src/lib/lfs.pir index bd6cbc2..f691066 100644 --- a/languages/lua/src/lib/lfs.pir +++ b/languages/lua/src/lib/lfs.pir @@ -425,7 +425,8 @@ Returns C in case of success or C plus an error string. .local pmc msg .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e new nil, 'LuaNil' new msg, 'LuaString' $S0 = concat "Unable to change working directory to '", $S0 @@ -458,7 +459,8 @@ string. .local pmc msg .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e new nil, 'LuaNil' new msg, 'LuaString' set msg, s @@ -490,7 +492,8 @@ when there is no more entries. Raises an error if C is not a directory. _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e lua_error("cannot open ", $S0, ": ", s) .end @@ -563,7 +566,8 @@ C plus an error string. .local pmc msg .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e new nil, 'LuaNil' new msg, 'LuaString' set msg, s @@ -596,7 +600,8 @@ C plus an error string. .local pmc msg .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e new nil, 'LuaNil' new msg, 'LuaString' set msg, s diff --git a/languages/lua/src/lib/luaaux.pir b/languages/lua/src/lib/luaaux.pir index 1e17d1a..f40b8fb 100644 --- a/languages/lua/src/lib/luaaux.pir +++ b/languages/lua/src/lib/luaaux.pir @@ -585,7 +585,8 @@ messages and in debug information. $P0.'setfenv'(env) .return ($P0) _handler: - .get_results ($P0, $S0) + .get_results ($P0) + $S0 = $P0 null $P0 .return ($P0, $S0) .end @@ -607,7 +608,8 @@ messages and in debug information. $P0.'setfenv'(env) .return ($P0) _handler: - .get_results ($P0, $S0) + .get_results ($P0) + $S0 = $P0 null $P0 .return ($P0, $S0) .end @@ -948,7 +950,8 @@ This function never returns. _handler: .local pmc ex .local string msg - .get_results (ex, msg) + .get_results (ex) + msg = ex $P0 = getattribute ex, 'severity' if null $P0 goto L1 $I0 = $P0 diff --git a/languages/lua/src/lib/luabasic.pir b/languages/lua/src/lib/luabasic.pir index 1381544..cb3a9fa 100644 --- a/languages/lua/src/lib/luabasic.pir +++ b/languages/lua/src/lib/luabasic.pir @@ -531,7 +531,8 @@ In case of any error, C returns B plus the error message. .local pmc e .local string s .local pmc msg - .get_results (e, s) + .get_results (e) + s = e set status, 0 new msg, 'LuaString' set msg, s diff --git a/languages/lua/src/lib/luacoroutine.pir b/languages/lua/src/lib/luacoroutine.pir index a98316a..b128c61 100644 --- a/languages/lua/src/lib/luacoroutine.pir +++ b/languages/lua/src/lib/luacoroutine.pir @@ -136,7 +136,8 @@ C returns B plus the error message. _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = c $P0 = pop co_stack .return (0, s) .end diff --git a/languages/lua/src/lib/luadebug.pir b/languages/lua/src/lib/luadebug.pir index 80d5ecc..eea774e 100644 --- a/languages/lua/src/lib/luadebug.pir +++ b/languages/lua/src/lib/luadebug.pir @@ -99,7 +99,8 @@ function, and so have no direct access to local variables. _handler: .local pmc e .local string msg - .get_results (e, msg) + .get_results (e) + msg = e printerr msg printerr "\n" goto L1 diff --git a/languages/lua/src/lib/luaos.pir b/languages/lua/src/lib/luaos.pir index 6c68a24..5cd296f 100644 --- a/languages/lua/src/lib/luaos.pir +++ b/languages/lua/src/lib/luaos.pir @@ -302,7 +302,8 @@ describing the error. .local pmc msg .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e concat $S0, ': ' concat $S0, s new nil, 'LuaNil' @@ -338,7 +339,8 @@ fails, it returns B, plus a string describing the error. .local pmc msg .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e concat $S0, ': ' concat $S0, s new nil, 'LuaNil' diff --git a/languages/perl6/src/builtins/control.pir b/languages/perl6/src/builtins/control.pir index a3e39a4..d37e61c 100644 --- a/languages/perl6/src/builtins/control.pir +++ b/languages/perl6/src/builtins/control.pir @@ -103,10 +103,10 @@ the moment -- we'll do more complex handling a bit later.) pop_eh .return (list) handler: - .local pmc exception + .local pmc exception, continuation .local string message - .local pmc continuation - .get_results(exception,message) + .get_results(exception) + message = exception['message'] continuation = exception['resume'] $P0 = exception['payload'] list.push($P0) @@ -267,7 +267,7 @@ on error. goto done catch: - .get_results (exception, $S0) + .get_results (exception) goto done done: diff --git a/languages/perl6/src/parser/actions.pm b/languages/perl6/src/parser/actions.pm index d4716bb..07160df 100644 --- a/languages/perl6/src/parser/actions.pm +++ b/languages/perl6/src/parser/actions.pm @@ -416,7 +416,7 @@ method statement_prefix($/) { ## Add a catch node to the try op that captures the ## exception object into $!. - my $catchpir := " .get_results (%r, $S0)\n store_lex '$!', %r"; + my $catchpir := " .get_results (%r)\n store_lex '$!', %r"; $past.push( PAST::Op.new( :inline( $catchpir ) ) ); ## Add an 'else' node to the try op that clears $! if diff --git a/languages/pheme/pheme.pir b/languages/pheme/pheme.pir index d25284f..40a5b21 100644 --- a/languages/pheme/pheme.pir +++ b/languages/pheme/pheme.pir @@ -59,7 +59,7 @@ Start compilation by passing any command line C to the Pheme compiler. goto done exit_handler: - .get_results($P0, $S0) + .get_results($P0) .include 'except_severity.pasm' $I0 = $P0 if $I0 != .EXCEPT_EXIT goto rethrow_error diff --git a/languages/squaak/src/parser/actions.pm b/languages/squaak/src/parser/actions.pm index 5dcb558..827ee84 100644 --- a/languages/squaak/src/parser/actions.pm +++ b/languages/squaak/src/parser/actions.pm @@ -163,7 +163,7 @@ method try_statement($/) { ## generate instruction to retrieve the exception objct (and the exception message, ## that is passed automatically in PIR, this is stored into $S0 (but not used). - my $pir := " .get_results (%r, $S0)\n" + my $pir := " .get_results (%r)\n" ~ " store_lex '" ~ $exc.name() ~ "', %r"; $catch.unshift( PAST::Op.new( :inline($pir), :node($/) ) ); diff --git a/languages/tcl/runtime/builtin/dict.pir b/languages/tcl/runtime/builtin/dict.pir index 08bdad4..248ff12 100644 --- a/languages/tcl/runtime/builtin/dict.pir +++ b/languages/tcl/runtime/builtin/dict.pir @@ -61,7 +61,8 @@ no_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' @@ -418,7 +419,8 @@ bad_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' @@ -508,7 +510,8 @@ bad_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' @@ -715,7 +718,8 @@ bad_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' @@ -797,7 +801,8 @@ bad_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' @@ -858,7 +863,8 @@ bad_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' @@ -980,7 +986,8 @@ bad_args: goto got_dict dict_error: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 $I0 = index $S0, 'variable is array' if $I0 != -1 goto cant_dict_array dictionary = new 'TclDict' diff --git a/languages/tcl/runtime/builtin/info.pir b/languages/tcl/runtime/builtin/info.pir index 7110d9d..9c56cd8 100644 --- a/languages/tcl/runtime/builtin/info.pir +++ b/languages/tcl/runtime/builtin/info.pir @@ -129,7 +129,8 @@ bad_args: .return(1) nope: - get_results '0,0', $P0, $S0 + get_results '0', $P0 + $S0 = $P0 if $S0 == 'missing close-brace' goto fail if $S0 == 'missing close-bracket' goto fail if $S0 == 'missing "' goto fail diff --git a/languages/tcl/runtime/builtin/inline.pir b/languages/tcl/runtime/builtin/inline.pir index ca1151c..5990760 100644 --- a/languages/tcl/runtime/builtin/inline.pir +++ b/languages/tcl/runtime/builtin/inline.pir @@ -27,12 +27,14 @@ # First pass at RT#40748 compiler_error: - get_results '0,0', $P1, $S1 + get_results '0', $P1 + $S1 = $P1 $S1 = 'compile error: ' . $S1 die $S1 runtime_error: - get_results '0,0', $P1, $S1 + get_results '0', $P1 + $S1 = $P1 $S1 = 'runtime error: ' . $S1 die $S1 diff --git a/languages/tcl/runtime/conversions.pir b/languages/tcl/runtime/conversions.pir index 2e1f007..4c802b3 100644 --- a/languages/tcl/runtime/conversions.pir +++ b/languages/tcl/runtime/conversions.pir @@ -171,7 +171,8 @@ not_integer: die $S0 not_integer_eh: - get_results '0,0', $P99, $S99 + get_results '0', $P99 + $S99 = $P99 $I0 = index $S99, 'expected integer' if $I0 == -1 goto not_integer # got some other exception, rewrap it. rethrow $P99 # preserves the invalid octal message. @@ -227,7 +228,8 @@ end: .return($I0) bad_index: - get_results '0,0', $P99, $S99 + get_results '0', $P99 + $S99 = $P99 $S0 = 'bad index "' $S0 .= idx $S0 .= '": must be integer?[+-]integer? or end?[+-]integer?' diff --git a/languages/tcl/src/macros.pir b/languages/tcl/src/macros.pir index 6d36fdd..5472ac0 100644 --- a/languages/tcl/src/macros.pir +++ b/languages/tcl/src/macros.pir @@ -15,8 +15,7 @@ Preamble for any tcl-related exception handler. .macro catch () .local pmc exception - .local string exception_message_unused_XXX - get_results '0,0', exception, exception_message_unused_XXX + get_results '0', exception .endm =head2 rethrow () diff --git a/languages/tcl/t/internals/select_option.t b/languages/tcl/t/internals/select_option.t index 5e6fc29..db3e7d4 100644 --- a/languages/tcl/t/internals/select_option.t +++ b/languages/tcl/t/internals/select_option.t @@ -67,7 +67,8 @@ done_1: $S2 = '' goto check_3 eh_3: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_3: $S3 = 'bad option "punk": must be dank, dark, or dunk' is($S2,$S3,message) @@ -80,7 +81,8 @@ check_3: $S2 = '' goto check_4 eh_4: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_4: $S3 = 'ambiguous option "da": must be dank, dark, or dunk' is($S2,$S3,message) @@ -93,7 +95,8 @@ check_4: $S2 = '' goto check_5 eh_5: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_5: $S3 = 'bad coke "punk": must be dank, dark, or dunk' is($S2,$S3,message) @@ -106,7 +109,8 @@ check_5: $S2 = '' goto check_6 eh_6: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_6: $S3 = 'ambiguous particle "da": must be dank, dark, or dunk' is($S2,$S3,message) @@ -122,7 +126,8 @@ check_6: $S2 = '' goto check_7 eh_7: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_7: $S3 = 'bad option "frank": must be bill or bob' is($S2,$S3,message) @@ -138,7 +143,8 @@ check_7: $S2 = '' goto check_8 eh_8: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_8: $S3 = 'ambiguous option "b": must be bill or bob' is($S2,$S3,message) diff --git a/languages/tcl/t/internals/select_switches.t b/languages/tcl/t/internals/select_switches.t index a5a8371..3bdb202 100644 --- a/languages/tcl/t/internals/select_switches.t +++ b/languages/tcl/t/internals/select_switches.t @@ -188,7 +188,8 @@ done_1: goto check_23 eh_23: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_23: is($S2, 'bad switch "-joke": must be -baz, -bob, or -joe', message) @@ -206,7 +207,8 @@ check_23: goto check_24 eh_24: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_24: is($S2, 'bad switch "-joke": must be -baz, -bob, -joe, or --', message) @@ -224,7 +226,8 @@ check_24: goto check_25 eh_25: - get_results '0,0', $P2, $S2 + get_results '0', $P2 + $S2 = $P2 check_25: is($S2, 'bad frob "-joke": must be -baz, -bob, -joe, or --', message) @@ -272,7 +275,7 @@ check_25: goto check_30 eh_30: - get_results '0,0', $P2, $S2 + get_results '0', $P2 check_30: is($S2, 'bad switch "-fail": must be -good0 or -good1', message) diff --git a/src/exceptions.c b/src/exceptions.c index 031bb5f..feefe76 100644 --- a/src/exceptions.c +++ b/src/exceptions.c @@ -199,9 +199,8 @@ Parrot_ex_throw_from_op(PARROT_INTERP, ARGIN(PMC *exception), ARGIN_NULLOK(void /* Set up the continuation context of the handler in the interpreter. */ if (PMC_cont(handler)->current_results) - address = pass_exception_args(interp, "PS", address, - CONTEXT(interp), exception, - VTABLE_get_string(interp, exception)); + address = pass_exception_args(interp, "P", address, + CONTEXT(interp), exception); if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) { /* it's a C exception handler */ @@ -257,7 +256,6 @@ void Parrot_ex_throw_from_c(PARROT_INTERP, ARGIN(PMC *exception)) { PMC * const handler = find_exception_handler(interp, exception); - STRING *msg = VTABLE_get_string(interp, exception); RunProfile * const profile = interp->profile; Parrot_runloop *return_point = interp->current_runloop; @@ -275,6 +273,7 @@ Parrot_ex_throw_from_c(PARROT_INTERP, ARGIN(PMC *exception)) if (Interp_debug_TEST(interp, PARROT_BACKTRACE_DEBUG_FLAG)) { int exitcode = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "exit_code")); + STRING *msg = VTABLE_get_string(interp, exception); PIO_eprintf(interp, "Parrot_ex_throw_from_c (severity:%d error:%d): %Ss\n", EXCEPT_error, exitcode, msg); @@ -289,7 +288,7 @@ Parrot_ex_throw_from_c(PARROT_INTERP, ARGIN(PMC *exception)) } /* Run the handler. */ - Parrot_runops_fromc_args(interp, handler, "vPS", exception, msg); + Parrot_runops_fromc_args(interp, handler, "vP", exception); /* After handling a C exception, you don't want to resume at the point * where the C exception was thrown, you want to resume the next outer diff --git a/src/ops/core.ops b/src/ops/core.ops index 0e04911..9fff52e 100644 --- a/src/ops/core.ops +++ b/src/ops/core.ops @@ -842,7 +842,10 @@ inline op die(in STR) :flow { PMC *exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, $1); opcode_t * const ret = expr NEXT(); - opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, ret); + PMC * resume = new_ret_continuation_pmc(interp, ret); + VTABLE_set_attr_str(interp, exception, + const_string(interp, "resume"), resume); + opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, resume); goto ADDRESS(dest); } @@ -852,7 +855,10 @@ inline op die(in PMC) :flow { ? NULL : VTABLE_get_string(interp, $1); PMC *exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg); - opcode_t *dest = Parrot_ex_throw_from_op(interp, exception, ret); + PMC * resume = new_ret_continuation_pmc(interp, ret); + VTABLE_set_attr_str(interp, exception, + const_string(interp, "resume"), resume); + opcode_t *dest = Parrot_ex_throw_from_op(interp, exception, resume); goto ADDRESS(dest); } @@ -862,7 +868,8 @@ inline op die(in INT, in INT) :flow { else { PMC *exception = Parrot_ex_build_exception(interp, $1, $2, NULL); opcode_t * const ret = expr NEXT(); - opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, ret); + PMC * resume = new_ret_continuation_pmc(interp, ret); + opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, resume); goto ADDRESS(dest); } } @@ -871,7 +878,10 @@ inline op exit(in INT) :flow { PMC *exception = Parrot_ex_build_exception(interp, EXCEPT_exit, $1, NULL); opcode_t * const ret = expr NEXT(); - opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, ret); + PMC * resume = new_ret_continuation_pmc(interp, ret); + VTABLE_set_attr_str(interp, exception, + const_string(interp, "resume"), resume); + opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, resume); goto ADDRESS(dest); } diff --git a/t/compilers/pge/p5regex/p5rx.t b/t/compilers/pge/p5regex/p5rx.t index 1793548..b88c832 100644 --- a/t/compilers/pge/p5regex/p5rx.t +++ b/t/compilers/pge/p5regex/p5rx.t @@ -255,7 +255,8 @@ Column 6, if present, contains a description of what is being tested. thrown: .local pmc exception .local string message - get_results '0,0', exception, message + get_results '0', exception + message = exception # remove /'s # $S0 = substr result, 0, 1 # if $S0 != '/' goto bad_error diff --git a/t/compilers/pge/perl6regex/01-regex.t b/t/compilers/pge/perl6regex/01-regex.t index 98068bb..881d910 100644 --- a/t/compilers/pge/perl6regex/01-regex.t +++ b/t/compilers/pge/perl6regex/01-regex.t @@ -273,7 +273,8 @@ Description of the test. thrown: .local pmc exception .local string message - get_results '0,0', exception, message + get_results '0', exception + message = exception say message # remove /'s $S0 = substr result, 0, 1 diff --git a/t/library/pg.t b/t/library/pg.t index be334c6..a66ac4e 100644 --- a/t/library/pg.t +++ b/t/library/pg.t @@ -229,7 +229,8 @@ EOT no_pg: .local pmc ex .local string msg - .get_results(ex, msg) + .get_results(ex) + msg = ex test.'skip'(N_TESTS) test.'finish'() .end diff --git a/t/op/calling.t b/t/op/calling.t index e1573c9..958a16d 100644 --- a/t/op/calling.t +++ b/t/op/calling.t @@ -515,7 +515,8 @@ pir_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too many - catch exceptio print $P0 print "never\n" arg_handler: - get_results "0,0", $P1, $S0 + get_results "0", $P1 + $S0 = $P1 print "caught: " print $S0 # $S1 = typeof $P1 diff --git a/t/op/exceptions.t b/t/op/exceptions.t index c5403bc..538a243 100644 --- a/t/op/exceptions.t +++ b/t/op/exceptions.t @@ -88,7 +88,8 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "get_results" ); print "not reached\n" end handler: - get_results "0,0", P0, S0 + get_results "0", P0 + set S0, P0 print "caught it\n" typeof S1, P0 print S1 @@ -116,7 +117,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "get_results - be sure registers are ok" ) print "not reached\n" end handler: - get_results "0,0", P1, S0 + get_results "0", P1 inc P0 print "ok\n" end @@ -138,7 +139,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', ".get_results() - PIR" ); _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e print "caught it\n" typeof S1, e print S1 @@ -164,7 +166,8 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "push_eh - throw - message" ); print "not reached\n" end _handler: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it\n" print S0 print "\n" @@ -218,13 +221,15 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "2 exception handlers" ); print "not reached\n" end _handler1: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it in 1\n" print S0 print "\n" end _handler2: - get_results "0,0", P0, S0 + get_results "0", P0 + set S0, P0 print "caught it in 2\n" print S0 print "\n" @@ -246,13 +251,15 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "2 exception handlers, throw next" ); print "not reached\n" end _handler1: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it in 1\n" print S0 print "\n" end _handler2: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it in 2\n" print S0 print "\n" @@ -284,7 +291,7 @@ pasm_output_is( <<'CODE', < is allowed for todo tests that should fail on any system. eh_sprintf: .local pmc exception .local string message - get_results '0,0', exception, message + get_results '0', exception + message = exception $I0 = index message, 'is not a valid sprintf format' if $I0 == -1 goto other_error $I0 = index expected, ' INVALID' diff --git a/t/pmc/bigint.t b/t/pmc/bigint.t index 68584c1..d5fdd59 100644 --- a/t/pmc/bigint.t +++ b/t/pmc/bigint.t @@ -416,7 +416,8 @@ for my $op ( "/", "%" ) { print "fail\\n" pop_eh OK: - get_results '0,0', \$P0, \$S0 + get_results '0', \$P0 + \$S0 = \$P0 print "ok\\n" print \$S0 print "\\n" diff --git a/t/pmc/complex.t b/t/pmc/complex.t index af70ec5..66f7306 100644 --- a/t/pmc/complex.t +++ b/t/pmc/complex.t @@ -399,7 +399,8 @@ for my $type ( qw( Complex Float Integer ) ) { print "fail\\n" pop_eh OK: - get_results '0,0', \$P0, \$S0 + get_results '0', \$P0 + \$S0 = \$P0 print "ok\\n" print \$S0 print "\\n" diff --git a/t/pmc/coroutine.t b/t/pmc/coroutine.t index d9d3b70..47e4545 100644 --- a/t/pmc/coroutine.t +++ b/t/pmc/coroutine.t @@ -125,7 +125,7 @@ lp: print "done\n" end _catchm: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch main\n" end @@ -137,7 +137,7 @@ corolp: yield branch corolp _catchc: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch coro\n" end CODE @@ -162,7 +162,7 @@ lp: print "done\n" end _catchm: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch main\n" end @@ -176,7 +176,7 @@ corolp: get_global P17, S0 branch corolp _catchc: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch coro\n" end CODE @@ -201,7 +201,7 @@ lp: print "done\n" end _catchm: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch main\n" end .pcc_sub _coro: @@ -237,7 +237,7 @@ lp: print "done\n" end _catchm: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch main\n" end @@ -251,7 +251,7 @@ corolp: get_global P17, S0 branch corolp _catchc: - get_results '0, 0' , P5, S0 + get_results '0', P5 print "catch coro\n" rethrow P5 end diff --git a/t/pmc/exception.t b/t/pmc/exception.t index c21a4e6..b587961 100644 --- a/t/pmc/exception.t +++ b/t/pmc/exception.t @@ -96,7 +96,8 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "get_results" ); print "not reached\n" end handler: - get_results "0,0", P0, S0 + get_results "0", P0 + set S0, P0 print "caught it\n" typeof S1, P0 print S1 @@ -136,7 +137,8 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "exception attributes" ); print "not reached\n" end handler: - get_results "0,0", P0, S0 + get_results "0", P0 + set S0, P0 print "caught it\n" getattribute P16, P0, 'message' print P16 @@ -180,7 +182,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "get_results - be sure registers are ok" ) print "not reached\n" end handler: - get_results "0,0", P1, S0 + get_results "0", P1 inc P0 print "ok\n" end @@ -204,7 +206,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', ".get_results() - PIR" ); _handler: .local pmc e .local string s - .get_results (e, s) + .get_results (e) + s = e print "caught it\n" typeof S1, e print S1 @@ -232,7 +235,8 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "push_eh - throw - message" ); print "not reached\n" end _handler: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it\n" print S0 print "\n" @@ -290,15 +294,17 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "2 exception handlers" ); print "not reached\n" end _handler1: - get_results "0,0", P5, S0 + get_results "0", P5 + getattribute P2, P5, "message" print "caught it in 1\n" - print S0 + print P2 print "\n" end _handler2: - get_results "0,0", P0, S0 + get_results "0", P0 + getattribute P2, P0, "message" print "caught it in 2\n" - print S0 + print P2 print "\n" end CODE @@ -320,13 +326,15 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "2 exception handlers, throw next" ); print "not reached\n" end _handler1: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it in 1\n" print S0 print "\n" end _handler2: - get_results "0,0", P5, S0 + get_results "0", P5 + set S0, P5 print "caught it in 2\n" print S0 print "\n" @@ -358,7 +366,8 @@ pasm_output_is( <<'CODE', < 'ne _invalid_sub: .local pmc exception .local string message - .get_results( exception, message ) + .get_results( exception ) + message = exception print message print "\n" .end @@ -1538,8 +1540,9 @@ pir_output_like( <<'CODE', <<'OUTPUT', 'del_namespace() with error' ); _invalid_ns: .local pmc exception .local string message - .get_results( exception, message ) + .get_results( exception ) + message = exception print message print "\n" .return() @@ -1622,8 +1625,9 @@ pir_output_like( <<'CODE', <<'OUTPUT', 'del_sub() with error' ); _invalid_sub: .local pmc exception .local string message - .get_results( exception, message ) + .get_results( exception ) + message = exception print message print "\n" .return() diff --git a/t/pmc/resizablestringarray.t b/t/pmc/resizablestringarray.t index 5b13a8b..cccfd08 100644 --- a/t/pmc/resizablestringarray.t +++ b/t/pmc/resizablestringarray.t @@ -1279,7 +1279,8 @@ err_2: .local pmc exception .local string message bad_type: - .get_results (exception, message) + .get_results (exception) + message = exception still_ok: like(message, 'illegal\ type\ for\ splice', "splice with a different type") .end -- 1.5.5.1