diff options
author | Vincent Pit <perl@profvince.com> | 2011-06-25 23:36:50 +0200 |
---|---|---|
committer | Vincent Pit <perl@profvince.com> | 2011-06-26 00:16:29 +0200 |
commit | c08f093b3e154c428f604f89f7feb633e6c97869 (patch) | |
tree | 5b3818b4c6011f1249a3d2a749bdc79fae6586a8 /op.h | |
parent | f02ea43cac371ecb59188f9654a0d99fd54db862 (diff) | |
download | perl-c08f093b3e154c428f604f89f7feb633e6c97869.tar.gz |
Correctly preserve the stack on an implicit break.
Perl generates a 'break' op with the special flag set at the end of every
'when' block. This makes it difficult to handle both the case of an
implicit break, where the stack has to be preserved, and the case of an
explicit break, which must obliterate the stack, with the same pp function.
Stack handling should naturally occur in 'leavewhen', but it is effectively
called only when the block issues a 'continue'.
In order to preserve the stack, we change the respective roles of 'break',
'continue' and 'leavewhen' ops :
- Special 'break' ops are no longer generated for implicit breaks. Just as
before, they give the control back to the 'leavegiven' op.
- 'continue' ops now directly forward to the op *following* the 'leavewhen'
op of the current 'when' block.
- 'leavewhen' is now only called at the natural end of a 'when' block.
It adjusts the stack to make sure returned values survive the temp cleanup,
then issues a 'next' or go to the current 'leavegiven' depending on whether
it is enclosed in a for loop or a given block.
This fixes [perl #93548].
Diffstat (limited to 'op.h')
-rw-r--r-- | op.h | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -132,7 +132,6 @@ Deprecated. Use C<GIMME_V> instead. * (runtime property) */ /* On OP_REQUIRE, was seen as CORE::require */ /* On OP_ENTERWHEN, there's no condition */ - /* On OP_BREAK, an implicit break */ /* On OP_SMARTMATCH, an implicit smartmatch */ /* On OP_ANONHASH and OP_ANONLIST, create a reference to the new anon hash or array */ |