develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Does perl really need to use sigsetjmp? (18% performancehit)

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
January 21, 2001 13:33
Subject:
Re: Does perl really need to use sigsetjmp? (18% performancehit)
Message ID:
5.0.2.1.0.20010121162611.02af21c0@24.8.96.48
At 12:11 PM 1/21/01 +0000, Alan Burlison wrote:
>Note that even if we used C++ it wouldn't help us in this case, because
>although C++ does exceptions, it knows nothing about threads, mutexes or
>CVs.  I suspect the perl6 interpreter loop will look something like:
>
>         while (! end of script) {
>                 if (at cancellation point) {
>                         if (signal detected)
>                                 call script signal handler;
>                         if (something died)
>                                 rollback stack;
>                 } else {
>                         do next OP;
>                 }
>         }

I'm waffling between checking between every op, or having an op that 
explicitly checks. (Possibly the end-of-statement cleanup op would do this)

>In other words the C level signal handler will have to do no more than
>setting a flag, as will the implementation of die().  By cancellation
>point I mean somewhere that is defined as 'safe', i.e. not holding any
>mutexes or waiting on any CVs etc.

I'm not sure the core should really care about that. It's arguably not the 
interpreter's problem. (Though it's not a strong argument)

>   I suspect a reasonable thing might
>be to have a special 'Now it is safe' opcode that is put out by the
>compiler at the appropriate places.  It would be nice if this
>corresponded to a syntactic boundary such as an entire statement, so
>that for example
>
>         my $a = $b * $c / $d;
>
>was guaranteed to either to be fully evaluated or not at all.

The question, then, is what do we do with function calls in there (say, $a 
= $b + foo()), and what about really long running statements like:

   $a = $b + 12 while 1;


					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About