Branch: refs/heads/smoke-me/davem/exception_issues
  Home:   https://github.com/Perl/perl5
  Commit: 01c852de0c995750136760bb322d77dd949ffd2b
      
https://github.com/Perl/perl5/commit/01c852de0c995750136760bb322d77dd949ffd2b
  Author: David Mitchell <da...@iabyn.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

  Changed paths:
    M pp_ctl.c
    M t/re/pat_re_eval.t

  Log Message:
  -----------
  fix panic from eval {} inside /(?{...})/

GH #19680

Normally in code like

    eval {.... };

then even if the eval is the last statement in the file or sub, the
OP_LEAVETRY isn't the last op in the execution path: it's followed
by an OP_LEAVE or OP_LEAVESUB or whatever, which will be the op to
resume execution from after an exception is caught.

However, if the eval is the *last* thing within a regex code block:

    /(?{ ...; eval {....}; })/

then the op_next pointer of the OP_LEAVETRY op is actually NULL.

This confused S_docatch(), which wrongly assumed that a NULL
PL_restartop indicated that the caught exception should be rethrown,
popping execution back to the outer perl_run() call and hence leading to
the confused panic warning:

    "panic: restartop in perl_run"

The fix is to to separate out the "do we need to re-throw" test,
(PL_restartjmpenv != PL_top_env), from the "no more ops so no need to
re-enter the runops loop" test, (!PL_restartop).


  Commit: 9d9e1f62f0e77937375a90cb91d2e74164274e20
      
https://github.com/Perl/perl5/commit/9d9e1f62f0e77937375a90cb91d2e74164274e20
  Author: David Mitchell <da...@iabyn.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

  Changed paths:
    M pp_ctl.c

  Log Message:
  -----------
  pp_ctl.c: revamp S_docatch() and docs

Document fully what S_docatch() does, and remove the one macro which
calls it, replacing all the call-sites with a direct call to docatch().

docatch() is a core part of perl's internal exception handling, and as
such is conceptually complex. It was made even more complex by
v5.27.0-75-gd7e3f70f30, which causes functions like pp_entertry() to
recursively call themselves sometimes. But this detail was hidden by
the RUN_PP_CATCHABLY() macro, which included a hidden 'return'.
By unwrapping this trivial macro, it makes the flow of control much
easier to understand.

I've also added an extra assert(!CATCH_GET), to emphasise that this
setting is reset following the JMPENV_PUSH() call.

Apart from that, there should be no functional differences.


  Commit: 88e90941796e830de4d80de3a1d9fad3da2356eb
      
https://github.com/Perl/perl5/commit/88e90941796e830de4d80de3a1d9fad3da2356eb
  Author: David Mitchell <da...@iabyn.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

  Changed paths:
    M pod/perlinterp.pod

  Log Message:
  -----------
  perlinterp.pod: rewrite Exception handing section

I first created this section back in 2005. Some things have changed
since then, and my understanding of some details has improved. So this
commit is a major rewrite of this section to make it more comprehensible,
as well as lots of little pod fixups.


  Commit: ffae5f9254768646eb54f4174b0bf57fa9d97e7e
      
https://github.com/Perl/perl5/commit/ffae5f9254768646eb54f4174b0bf57fa9d97e7e
  Author: David Mitchell <da...@iabyn.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

  Changed paths:
    M cop.h
    M intrpvar.h
    M pp.c
    M pp_hot.c

  Log Message:
  -----------
  s/JUMPENV/JMPENV/g

Although one of the macros associated with the JMPENV facility
is inconsistently called JMPENV_JUMP(), fix all code comments
and debugging output to eliminate any references to JUMPENV.


  Commit: d3dc41afac7748dcdb1c22915b78bf8e01ccd528
      
https://github.com/Perl/perl5/commit/d3dc41afac7748dcdb1c22915b78bf8e01ccd528
  Author: David Mitchell <da...@iabyn.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

  Changed paths:
    M t/op/catch.t

  Log Message:
  -----------
  t/op/catch.t: add comments explaining its purpose

This test file didn't have any comments explaining what it was for:
especially confusing as there's no 'catch' op.


  Commit: 8812d58daf01b1df2fb165e267b064164f252691
      
https://github.com/Perl/perl5/commit/8812d58daf01b1df2fb165e267b064164f252691
  Author: David Mitchell <da...@iabyn.com>
  Date:   2022-05-28 (Sat, 28 May 2022)

  Changed paths:
    M cop.h

  Log Message:
  -----------
  cop.h: fix je_mustcatch code comment.

The comment explaining what the je_mustcatch field does was
incorrectly updated in 1999! Change it back to what it was originally.


Compare: https://github.com/Perl/perl5/compare/01c852de0c99%5E...8812d58daf01

Reply via email to