----- Original Message -----
From: "Leopold Toetsch" <[EMAIL PROTECTED]>
To: "K Stol" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, August 31, 2003 5:27 PM
Subject: Re: [CVS ci] exit opcode


> K Stol <[EMAIL PROTECTED]> wrote:
>
> > From: "Leopold Toetsch" <[EMAIL PROTECTED]>
> >> But with the constant Sub PMC in the packfile execution could start
> >> at "_main" then.
>
> > I couldn't follow the constant Sub PMC thread (didn't understand, maybe
a
> > WTHI subject?).
>
> The PIR assembler inside Parrot generates one entry per ".pcc_sub" in
> the constant packfile segment. As we have strings, numbers, and keys in
> the constant table, now there are PMCs too.
>
> A constant Sub PMC has label, sub entry offset, and end offset as
> information. When the constant table gets constructed at packfile load
> time, a Sub PMC is created and finally the offset converted to the
> absolute address, where the Sub happened to be loaded in memory.
> Also the name of the Sub (the label) is put into the interpreter's
> global stash with the Sub as value.
>
>   find_global P1, "_sub"
>   I0 = P1
>
> is the same as
>
>   I0 = addr "_sub" # set_addr
>
> for subroutines known at compile time. The former works for subroutines
> too, that got loaded later with the C<load_bytecode> opcode.

Ok, thanks for your explanation.
>
> > It sounds kinda odd to have an exception while exiting is quite a normal
> > action. It's just an op being executed with expected behaviour. Kinda
weird
> > to call it an exception (or throw one for that matter).
>
> The C<exit> can happen deeply inside some called subs. The exception
> can be caught e.g. in main, to do some cleanup before really shutting
> down. Makes sense to me.

You've got a point there. But it's a bit a matter of taste I think. I seems
a bit odd to me that an exception is thrown while nothing unexpected is
done. Cleaning up is ok, of course. But IMHO an exception is an error in the
program after which the program can exit in a nice way (handle these
exceptions nicely).
So, popping an integer from the stack into a N-register, for example is an
exception (well, in that particular case it's a bug, probably), or when a
stack underflow occurs. Those thinks sound like exceptions to me. But
exiting the program is quite a normal thing.

Oh well, it's not *that* important. :-)

Klaas-Jan


Reply via email to