Não é mais possível fazer postagens ou usar assinaturas novas da Usenet nos Grupos do Google. O conteúdo histórico continua disponível.
Dismiss

Exception handlers and calling conventions

0 visualização
Pular para a primeira mensagem não lida

Leopold Toetsch

não lida,
11 de jul. de 2005, 07:39:0811/07/2005
para Perl 6 Internals
In the old calling scheme the exception object arrived as P5 in the
handler. This doesn't really fit into the new scheme.

I can see two ways to go:

Store the exception (or an array of unhandled exceptions) in the
interpreter and make exceptions available as:

a) e = interpinfo .INTERPINFO_EXCEPTION

b) via the get_params opcode

The latter would reflect the exception call being an internal
continuation invocation:

push_eh handler
# throw
handler: # handler:
get_params "(0)", e # .param pmc e

(Except that .param isn't allowed in arbitrary position currently)

Proposals welcome,
leo

Autrijus Tang

não lida,
11 de jul. de 2005, 09:59:4911/07/2005
para Leopold Toetsch, Perl 6 Internals
On Mon, Jul 11, 2005 at 01:39:08PM +0200, Leopold Toetsch wrote:
> I can see two ways to go:
>
> a) e = interpinfo .INTERPINFO_EXCEPTION
>
> b) via the get_params opcode
>
> The latter would reflect the exception call being an internal
> continuation invocation:
>
> push_eh handler
> # throw
> handler: # handler:
> get_params "(0)", e # .param pmc e
>
> (Except that .param isn't allowed in arbitrary position currently)

If arbitary-position .param for inner subroutines can be made to work,
b) is by far more straightforward. This also plays well P6's notion
that all non-local exits, including return(), are conceptually
exceptions, so it makes sense to use the same pairs of calling
convention opcodes.

Thanks,
/Autrijus/

Roger Browne

não lida,
3 de out. de 2005, 09:46:5403/10/2005
para Perl 6 Internals
On 11 July, Leopold Toetsch wrote:
> In the old calling scheme the exception object arrived as P5 in the
> handler. This doesn't really fit into the new scheme.

Leo, did you change the handling of P5? I have some PIR code that works
differently under 0.2.3 and 0.3.0:

.sub "main" @MAIN
push_eh MAIN_HANDLER
foo()
clear_eh
end
MAIN_HANDLER:
print "in main handler\n"
rethrow P5
.end

.sub "foo"
push_eh FOO_HANDLER
new $P1, .Exception
$P1["_message"] = "my_error_message"
throw $P1
clear_eh
.return()
FOO_HANDLER:
print "in foo handler\n"
rethrow P5
.end

Under 0.2.3 it prints

in foo handler
in main handler

before failing, which in my opinion is the expected behaviour. Under
0.3.0 it prints this before failing:

in foo handler
in main handler
in main handler

If you agree that the 0.3.0 behaviour is wrong, I'll file a bug report.

Regards,
Roger Browne

Leopold Toetsch

não lida,
3 de out. de 2005, 10:48:4503/10/2005
para Roger Browne, Perl 6 Internals
Roger Browne wrote:

> Leo, did you change the handling of P5? I have some PIR code that works
> differently under 0.2.3 and 0.3.0:

The exception object iss still P5 in the handler, no changes here yet.

> If you agree that the 0.3.0 behaviour is wrong, I'll file a bug report.

But the MAIN_HANDLER is catching twice, which looks like a bug to me.

> Regards,
> Roger Browne

leo

Leopold Toetsch

não lida,
3 de out. de 2005, 11:08:2003/10/2005
para Roger Browne, Perl 6 Internals
Roger Browne wrote:

> in foo handler
> in main handler
> in main handler

Fixed. Now the main handler catches just once.

> Regards,
> Roger Browne

Thanks for testing,
leo

0 nova mensagem