| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
MAD = Misc Attribute Decoration; unmaintained attempt at preserving
the Perl parse tree more faithfully so that automatic conversion to
Perl 6 would have been easier.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this fixup the build breaks on Win32. Previously it was enabled using
a second regular expression to parse the bison version string. This
effectively duplicates the first regular expression that parses the bison
version string to determine if the version of bison found can be used.
The second regular expression could get missed when changing the first, as
happened with commit f5cf236ddbe8e24e. So refactor the code to extract the
bison version once, and then use this later as a simple numeric comparison.
With this change, we can actually use bison 2.7 to regenerate perly.*
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was brought up in ticket #43425.
The new slab allocator for ops (8be227ab5e) makes a CV responsible for
cleaning up its ops if it is freed prematurely (before the root is
attached).
Certain syntax errors involving formats can cause the parser to free
the CV owning an op when that op is on the PL_nextval stack.
This happens in these cases:
format =
@
use; format
strict
.
format =
@
;use
strict
.
format foo require bar
In the first two cases it is the line containing ‘strict’ that is
being interpreted as a format picture line and being fed through
force_next by S_scan_formline.
Then the error condition kicks in after the force, causing a
LEAVE_SCOPE in the parser (perly.c) which frees the sub owning the
const op for the format picture. Then a token with a freed op is fed
to the parser.
To make this clearer, when the second case above is parsed, the tokens
produced are as follows:
format =
[;] [formline] "@\n" [,]
; use [<word>]
[;] [formline] <freed>
[;] .
Notice how there is an implicit semicolon before each (implicit)
formline. Notice also how there is an implicit semicolon before the
final dot.
The <freed> thing represents the "strict\n" constant after it has been
freed. (-DT displays it as THING(opval=op_freed).)
When the implicit semicolon is emitted before a formline, the next two
tokens (formline and the string constant for this format picture line)
are put on to the PL_nextval stack via force_next.
It is when the implicit semicolon before "strict\n" is emitted that
the parser sees the error (there is only one path through the gram-
mar that uses the USE token, and it must have two WORDs following it;
therefore a semicolon after one WORD is an immediate error), calling
LEAVE_SCOPE, which frees the sub created by ‘use’, which owns the
const op on the PL_nextval stack containing the word "strict" and con-
sequently frees it.
I thought I could fix this by putting an implicit do { ... } around
the argument line. (This would fix another bug, whereby the argument
line in a format can ‘leak out’ of the formline(...).) But this does
not solve anything, as we end up with four tokens ( } ; formline
const ) on the PL_nextval stack when we emit the implicit semicolon
after ‘use’, instead of two.
format=
@
;use
strict
.
will turn into
format =
[;] [formline] "@\n" [,]
[do] [{] ; use [<word>] [;] [}]
[;] [formline] "strict\n"/<freed>
[;] .
It is when the lexer reaches "strict" that it will emit the semicolon
after the use. So we will be in the same situation as before.
So fixing the fact that the argument line can ‘leak out’ of the
formline and start a new statement won’t solve this particu-
lar problem.
I tried eliminating the LEAVE_SCOPE. (See
<https://rt.perl.org/rt3/Ticket/Display.html?id=43425#txn-273447>
where Dave Mitchell explains that the LEAVE_SCOPE is not strictly nec-
essary, but it is ‘still good to ensure that the savestack gets cor-
rectly popped during error recovery’.) That does not help, because
the lexer itself does ENTER/LEAVE to make sure form_lex_state and
lex_formbrack get restored properly after the lexer exits the format
(see 583c9d5cccf and 64a408986cf).
So when the final dot is reached, the ‘use’ CV is freed. Then an op
tree that includes the now-freed "strict\n" const op is passed to
newFORM, which tries to do op_free(block) (as of 3 commits ago; before
that the errors were more catastrophic), and ends up freeing an op
belonging to a freed slab.
Removing LEAVE_SCOPE did actually fix ‘format foo require bar’,
because there is no ENTER/LEAVE involved there, as the = (ENTER) has
not been reached yet. It was failing because ‘require bar’ would call
force_next for "bar", and then feed a REQUIRE token to the parser,
which would immediately see the error and call LEAVE_SCOPE (free-
ing the format), with the "bar" (belonging to the format’s slab)
still pending.
The final solution I came up with was to reuse an mechanism I came up
with earlier. Since the savestack may cause ops to outlive their CVs
due to SAVEFREEOP, opslab_force_free (called when an incomplete CV is
freed prematurely) will skip any op with o->op_savestack set. The
nextval stack can use the same flag. To make sure nothing goes awry
(we don’t want the same op on the nextval stack and the savestack at
the same time), I added a few assertions.
|
|
|
|
|
| |
bison-2.5.1 adds less superfluous semicolons at the end of action blocks,
but works fine.
|
| |
|
|
|
|
|
|
|
| |
Sync copyright dates with actual changes according to git history.
[Plus run regen_perly.h to update the SHA-256 checksums, and
regen/regcharclass.pl to update regcharclass.h]
|
|
|
|
| |
Merge together many calls to open_new() and read_only_top().
|
|
|
|
| |
Update the SHA256s where necessary in the generated files.
|
|
|
|
|
|
|
| |
bison isn't available everywhere, so we can't simply re-run regen_perly.pl to
verify that perly.{act,h,tab} are up to date. So instead store the SHA-256 of
the input files, and extend t/porting/regen.t to check that the input files
haven't been changed subsequently.
|
|
|
|
|
|
|
|
|
| |
Use safer_open() and read_only_bottom_close_and_rename() from regen_lib.pl
Consistently use 3 argument open and lexical file handles.
A side effect of this change is that the generated files are no longer made
read-only on disk - if this is desirable, then probably better to change
regen_lib.pl so that all generated files are made read-only.
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81894]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81894 >
Signed-off-by: Abigail <abigail@abigail.be>
|
| |
|
|
|
|
|
| |
Make regen_perly.pl use rename_if_different() to avoid overwriting files
that aren't actually changing.
|
| |
|
| |
|
| |
|
|
|
| |
p4raw-id: //depot/perl@29569
|
|
|
| |
p4raw-id: //depot/perl@29564
|
|
|
|
|
|
|
|
|
| |
- fix MAD coredump in tr///
- fix mad coredump in multi-line string literals
- kill some MAD uninit value warnings
- don't allow assignment to $n in perly.y
- make op_dump handle op_latefree flags
p4raw-id: //depot/perl@29548
|
|
|
|
|
|
| |
and rename to yy_type_tab[]. Then use this table to improve stack
dumping with -Dpv
p4raw-id: //depot/perl@29500
|
|
|
| |
p4raw-id: //depot/perl@29449
|
|
|
| |
p4raw-id: //depot/perl@29443
|
|
|
|
|
|
|
|
| |
with a reference to "perly.y" in "perly.h"
See the thread here for details:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-07/msg00460.html
p4raw-id: //depot/perl@28593
|
|
|
|
|
|
|
|
| |
When bison pops states during error recovery, any states holding
an OP would leak the OP. Create an extra YY table that tells us
which states are of type opval, and when popping one of those,
free the op.
p4raw-id: //depot/perl@28315
|
|
|
|
|
| |
the regen_perly target call it for both perly.y and madly.y.
p4raw-id: //depot/perl@27479
|
|
|
|
|
|
|
| |
nonassoc, just like the UNIOP token it's patterned after.
(While we're at it, allow to use bison 2.1 to regenerate
the parser files.)
p4raw-id: //depot/perl@25746
|
|
|
|
|
|
|
| |
Message-Id: <20050902004136.GA2656@efn.org>
Allow any variant of bison 1.875 to be used
p4raw-id: //depot/perl@25353
|
|
|
| |
p4raw-id: //depot/perl@24411
|
|
|
| |
p4raw-id: //depot/perl@24106
|
|
|
| |
p4raw-id: //depot/perl@23959
|
|
process
p4raw-id: //depot/perl@22302
|