Resumable exceptions #2

Patrick R. Michaud pmichaud at pobox.com
Thu Oct 30 13:19:20 UTC 2008


On Thu, Oct 30, 2008 at 06:52:20AM -0600, Stephen Weeks wrote:
> EHs are marked as "used" in src/scheduler.c:760
> 
> src/pmc/exceptionhandler.pmc:214-219 contain the logic for "If I am
> marked as used, decline to handle the exception."  

Are these the lines you're referring to (220-223 on my system)?

            /* The exception handler has already been used before. */
            else if (VTABLE_get_integer(INTERP, SELF)) {
                RETURN(INTVAL 0);
            }


> If you want to preserve the idea of a disabled exception handler 
> still in the list of EHs in the context, you'll want to reorder the 
> logic there so that it declines before it checks to see if a type 
> or severity filter is in place.

I'm trying to eliminate the notion of "invoking an exception handler
disables it", so that subsequent thrown exceptions re-trigger an
existing handler.  

I tried removing the above lines from exceptionhandler.pmc, 
but even after doing that my test program still gives the same
results as before:

  $ cat x.pir
    .sub main :main
        push_eh catcher
        'foo'()
        pop_eh
        say 'ok 4'
        .return ()
      catcher:
        .get_results ($P0)
        $P1 = $P0['resume']
        $P1()
    .end
  
    .sub 'foo'
        say 'ok 1'
        $P0 = new 'Exception'
        throw $P0
        say 'ok 2'
        $P0 = new 'Exception'
        throw $P0
        say 'ok 3'
    .end
  $ ./parrot x.pir
  ok 1
  ok 2
  No exception handler and no message
  current instr.: 'foo' pc 45 (x.pir:19)
  called from Sub 'main' pc 28 (x.pir:10)
  $

So, I'm misunderstanding something here.
 
Pm 


More information about the parrot-dev mailing list