----- Original Message ----- From: "Leopold Toetsch" <[EMAIL PROTECTED]> To: "K Stol" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, August 31, 2003 7:43 AM Subject: Re: [CVS ci] exit opcode
> K Stol <[EMAIL PROTECTED]> wrote: > > > From: "Leopold Toetsch" <[EMAIL PROTECTED]> > >> .pcc_sub _main prototyped # only one "_main" allowed like in C > > > This is not *that* ugly, just look at C, for example. Any C program should > > have a "main", so > > it's not that strange to have a special 'purpose sub'. > > I think as C can live with that we can too ;-) > :-) IMHO, yes > > Also, (I just realize while typing this), how does IMCC decide where to > > start executing? Is it just at the first sub it sees? > > Currently imcc doesn't do anything special: It just emits the code one > compilation unit after the other. Execution starts at the first > statement of the first unit. > 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?). > > > Another thought: (I assume "exit_ic" is a special op for exiting the > > interpreter?) > > Its the internal notation of the C<exit> opcode taking an INT argument. Oh yaa, I forgot: exit_integer-constant, ic > > > isn't it possible to *not* use an "exit_ic" op, but just do a "return"? > > I know a PASM file should end with "end", but somehow it would be nice to > > just do a "return", and this return op will return to the calling procedure, > > which happens to be the Parrot interpreter. > > Sure. An empty return block (one without the explicit ".return 0" > directive would boil down to just C<end>. I'm not sure yet, if the > interpreter itself should through a SystemExit exception. Its probably > not necessary. Languages like Python that need it, can emit C<exit 0> to > get the desired behavior. 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). > > > Klaas-Jan > > leo >