| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactoring of the grammar around statements. New production <barestmt>
encompasses a statement without label. It includes all statement types,
including declarations, with no unnecessary intermediate non-terminals.
It generates an op tree for the statement's content, with no leading
state op. The <fullstmt> production has just one rule, consisting of
optional label followed by <barestmt>. It puts a state op on the front
of the statement's content ops.
To support the regular statement op structure, the op sequence for for(;;)
loops no longer has a second state op between the initialisation and
the loop. Instead, the unstack op type is slightly adapted to achieve
the stack clearing without a state op.
The newFOROP() constructor function no longer generates a state op,
that now being the job of the <fullstmt> production. Consequently it
no longer takes a parameter stating what label is to go in the state op.
This brings it in line with the other op constructors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is yet another patch in preparation for [perl #75176] (I keep
saying that.).
It uses the recently-added functions hv_name_add and hv_name_delete, to add and remove names when mro_package_moved is called.
mro_package_moved’s calling convention needed to change to make this
work, which is the bulk of the patch.
Code that was calling mro_package_moved was also doing it sometimes
when it was unnecessary. If the stash being assigned over had no name,
then there was no possibiiity of its being in the symbol table.
This probably fixes [perl #77358] (isa warnings), though I have not
tested that yet.
One user-visible change this introduces is that a detached glob whose
stash loses its name will no longer stringify the same way (a bit like
a glob that loses its stash pointer; except that it becomes
*__ANON__::foo instead of "").
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Expose cop hint hashes as a type COPHH, with a cophh_* API which is a
macro layer over the refcounted_he_* API. The documentation for cophh_*
describes purely API-visible behaviour, whereas the refcounted_he_*
documentation describes the functions mainly in terms of the
implementation. Revise the cop_hints_* API, using the flags parameter
consistently and reimplementing in terms of cophh_*. Use the cophh_*
and cop_hints_* functions consistently where appropriate.
[Modified by the committer to update two calls to
Perl_refcounted_he_fetch recently added to newPMOP.]
|
|
|
|
|
| |
New API function parse_block() parses a code block, including surrounding
braces. The block is a lexical scope, but not inherently a dynamic scope.
|
|
|
|
|
| |
lex_start() is added to the API, marked experimental, and documented.
It also gains a flags parameter for foreseeable future use.
|
|
|
|
|
|
|
| |
The lex_end() function is redundant, because the lexer context object
is actually finalised by parser_free(), triggered by the save stack.
The lex_end() function has historically been empty, except when the
PL_doextract global was being misused to store lexer state.
|
|
|
|
|
|
|
|
| |
The only uses of lex_start that had the new_filter parameter false,
to make the new lexer context share source filters with the previous
lexer context, were uses with rsfp null, which therefore never invoked
source filters. Inheriting source filters from a logically unrelated
file seems like a silly idea anyway.
|
|
|
|
| |
so newcomers can find it more easily
|
|
|
|
|
| |
The existence of main::main::... caused mro_package_moved to break
Text::Template, and probably Acme::Meta as well.
|
|
|
|
|
| |
Also rename the underlying function to op_linklist, to match the other
API op functions.
|
|
|
|
|
|
| |
Put into the API op_append_elem, op_prepend_elem, and op_append_list. All
renamed from op_-less internal names. Parameter types for op_append_list
changed to match the rest of the op API and avoid some casting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the problem of isa cache linearisations’ and method caches’
not being reset on nonexistent packages when they are replaced with
real packages as a result of parent stashes’ being moved. This can
happen in cases like this:
@left::ISA = 'outer::inner';
@right::ISA = 'clone::inner';
{package outer::inner}
*clone:: = \%outer::;
print "ok 1", "\n" if left->isa("clone::inner");
print "ok 2", "\n" if right->isa("outer::inner");
This changes mro_package_moved’s parameter list as documented in the
diff for mro.c. See also the new comments in that function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is necessary for an upcoming bug fix.
(For this bug:
@left::ISA = 'outer::inner';
@right::ISA = 'clone::inner';
*clone:: = \%outer::;
print left->isa('clone::inner'),"\n";
print right->isa('outer::inner'),"\n";
)
This commit actually replaces mro_isa_changed_in with
mro_isa_changed_in3. See the docs for it in the diff for mro.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New magic type PERL_MAGIC_checkcall attaches a function to a CV, which
will be called as the second half of the op checker for an entersub
op calling that CV. Default state, in the absence of this magic,
is to process the CV's prototype if it has one, or apply list context
to all the arguments if not. New API functions cv_get_call_checker()
and cv_set_call_checker() provide a clean interface to this facility,
hiding the internal use of magic.
Expose in the API the new functions rv2cv_op_cv(),
ck_entersub_args_list(), ck_entersub_args_proto(), and
ck_entersub_args_proto_or_list(), which are meaningful segments of
standard entersub op checking and are likely to be useful in plugged-in
call checker functions.
Expose new API function op_contextualize(), which is a public interface
to the internal scalar()/list()/scalarvoid() functions. This API is
likely to be required in most plugged-in call checker functions.
Incidentally add new function mg_free_type(), in the API, which will
remove magic of one type from an SV. (mg_free() removes all magic,
and there isn't anything else more selective.)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In sv_clear(), rather than calling av_undef(), iterate over the AV's
elements. This is the first stage in making sv_clear() non-recursive,
and thus non-stack-blowing when freeing deeply nested structures.
Since we no longer have the stack to maintain the chain of AVs currently
being iterated over, we instead store a pointer to the previous AV in the
AvARRAY[AvMAX] slot of the currently-being-iterated AV. Since our first
action is to pop the first SV, that slot is guaranteed to be free, and
(in theory) nothing should be messing with the AV while we iterate over
its elements, so that slot should remain undisturbed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This only applies to glob-to-glob assignments and deletions of stash
elements. Other types of stash manipulation are dealt with by subse-
quent patches.
It adds mro_package_moved, a private function that iterates through
subpackages, calling mro_isa_changed_in on each.
This is related to [perl #75176], but is not the same bug. It simply
got in the way of fixing [perl #75176].
|
|
|
|
|
|
|
| |
Previously yylex() was conditionally populating @AnyDBM_File::ISA (if it was not
set, and the token dbmopen was seen), and init_predump_symbols() was populating
@IO::File::ISA (unconditionally, but this is so early that nothing previously
could have set it). This refactoring eliminates code duplication.
|
|
|
|
| |
997daa56862a0fc7 eliminated the need for passing these in.
|
|
|
|
|
|
| |
The previous macro generated over .5K of object code. This is in every shared
object, and is only called once. Hence this change increases the perl binary
by about .5K (once), to save .5K for every XS module loaded.
|
|
|
|
| |
XS_VERSION_BOOTCHECK() is the public API.
|
|
|
|
|
|
|
|
|
|
| |
Multiple code paths were dereferencing version objects without
checking the underlying type, which could result in segmentation
faults per RT#78286
This patch consolidates all dereferencing into vverify() and
has vverify return the underlying HV or NULL instead of
a boolean value.
|
|
|
|
|
|
| |
The macro expansion generates over 1K of object code. This is in every shared
object, and is only called once. Hence this change increases the perl binary
by about 1K (once), to save 1K for every XS module loaded.
|
|
|
|
|
| |
New API function parse_stmtseq() parses a sequence of statements, up to
closing brace or EOF.
|
| |
|
|
|
|
| |
This means that it isn't (needlessly) copied into proto.h
|
|
|
|
|
|
|
| |
These, and the "functions with flag 'n' should come before here" comments are
holdouts from the long-gone PERL_OBJECT implementation. This doesn't change
the linkage type of any externally visible functions under g++ - just some
static functions. This follows on from 77d8c8d52bcb3950.
|
|
|
|
|
| |
Anywhere an API function takes a string in pvn form, ensure that there
are corresponding pv, pvs, and sv APIs.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make embed.pl fully responsible for generating prototypes and embedding macros
for pp_* and ck_* functions, placing them in embed.h and proto.h
opcode.pl no longer generates pp_proto.h
Remove the (effectively) duplicate explicit entries for (all but 2) ck_*
functions from embed.fnc
We can't actually remove pp_proto.h from the distribution *yet*, as
ExtUtils::MM_Unix and ExtUtils::MM_VMS have hardcoded lists of the installed
headers. Once this is resolved, we can.
|
| |
|
|
|
|
|
|
| |
This fixes ! by changing sv_2bool to sv_2bool_flags (with a macro
wrapper) and adding SvTRUE_nomg. It also corrects the docs that state
incorrectly that SvTRUE does not handle magic.
|
|
|
|
|
|
| |
This patch changes sv_eq, sv_cmp, sv_cmp_locale and sv_collxfrm
to _flags forms, with macros under the old names for sv_eq and
sv_collxfrm, but functions for sv_cmp* since pp_sort.c needs them.
|
|
|
|
|
|
|
| |
This patch extracts regcurly from regcomp.c and converts it
to a static inline function in a new file dquote_static.c
that is now #included by regcomp.c and toke.c. This change
will require 'make regen'.
|
|
|
|
|
| |
Add a new flag 'O' in embed.fnc to generate a macro mapping perl_$func() to
$func(). The macro for call_atexit() is far too special to do this way.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's was intended as a temporary namespace only, and we really don't want to
ship it in any release until we've figured out what it should really look like.
This reverts commit 05c0d6bbe3ec5cc9af99d105b8648ad02ed7cc95,
"add sv_reftype_len() and make sv_reftype() be a wrapper for it"
commit 792477b9c2e4c75cb03d07bd6d25dc7e1fdf448e,
"create the "mauve" temporary namespace for things like reftype"
commit 8df6b97c1de8326d50ac9c8cae4bf716393b45bb,
"mauve.t needs access to %Config, make sure it's available"
commit cfe9162d0d593cd12a979c73df82c7509b324343,
"use more efficient sv_reftype_len() interface"
and commit 47b13905e23c2a72acdde8bb4669e25e5eaefec4
"add more tests to lib/mauve.t so it tests also that mauve::reftype can return "LVALUE""
There's a `mauve' branch still containing all the code for the temporary mauve
namespace. That should be used to work on it until it's mostly ready to be
released, and only then merged to blead. Alternatively, it should be deleted if
another way to provide mauve's features in the core is found.
|
| |
|
|
|
|
|
|
| |
VMS seems to have a 31 character limitation for external symbols. To be able to
fit into that, rename 'coerce_qwlist_to_paren_list' to
'munge_qwlist_to_paren_list'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These provided a non-public API for the hash and array code to donate free
memory direct to the SV head allocation routines, instead of returning it
to the malloc system with free().
I assume that on some older mallocs this could offer significant benefits.
However, my benchmarking on a modern malloc couldn't detect any significant
effect (positive or negative) on removing the code. Its (continued) presence,
however, has downsides
a: slightly more code complexity
b: slightly larger interpreter structure
c: in the steady state, if net creation of SVs is zero, 1 chunk of allocated
but unused memory will exist (per thread)
So I think it best to remove it.
|
|
|
|
|
|
|
|
|
|
| |
This makes a qw(...) list literal a distinct token type for the
parser, where previously it was munged into a "(",THING,")" sequence.
The change means that qw(...) can't accidentally supply parens to parts
of the grammar that want real parens. Due to many bits of code taking
advantage of that by "foreach my $x qw(...) {}", this patch also includes
a hack to coerce qw(...) to the old-style parenthesised THING, emitting
a deprecation warning along the way.
|
|
|
|
|
| |
This way c++ compilers like us again, as we don't do jumps that skip
initialisations anymore.
|
|
|
|
|
|
|
| |
Add hinthash_fetch(sv|pv[ns]) as a replacement for refcounted_he_fetch,
which is not API (and should not be). Also add caller_cx, as the correct
XS equivalent to caller(). Lots of modules seem to have copies of this,
so a proper API function will be more maintainable in future.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
yyparse() becomes reentrant. The yacc stack and related resources
are allocated in yyparse(), rather than in lex_start(), and they are
localised to yyparse(), preserving their values from any outer parser.
yyparse() now takes a parameter which determines which production it
will parse at the top level. New API function parse_fullstmt() uses this
facility to parse just a single statement. The top-level single-statement
production that is used for this then messes with the parser's head so
that the parsing stops without seeing EOF, and any lookahead token seen
after the statement is pushed back to the lexer.
|
|
|
|
|
|
|
|
|
|
| |
From a suggestion from Ben Morrow.
The first argument used to be struct refcounted_he *, which exposed an
implementation detail - that the COP's labels are (now) stored in this way.
Google Code Search and an unpacked CPAN both fail to find any users of this
API, so the impact should be minimal.
|
|
|
|
|
|
|
| |
Instead pass in a COP, as suggested by Ben Morrow. Also add length and flags
parameters, and remove the comment suggesting this change. The underlying
storage mechanism can honour length and UTF8/not, so there is no harm in
exposing this one level higher.
|
|
|
|
|
|
|
|
|
| |
sv_reftype() mostly returns strings whose length is known at compile
time, so we can avoid a strlen() call if we return the length.
Additionally, the non-length interface is potentially buggy in the
face of class names which contain "\0", therefore providing a way
to obtain the true length allows us to avoid any trickyness.
|
|
|
|
|
|
|
|
| |
New variable PL_rpeepp makes it possible for extensions to hook
the per-op-chain part of the peephole optimiser (which recurses into
side chains). The existing variable PL_peepp still allows hooking the
per-sub part of the peephole optimiser, maintaining perfect backward
compatibility.
|
|
|
|
|
|
| |
Even though it isn't in the public API, some worry that we shouldn't
change it, as it's currently public, but may be made into an in-line
function known only to the two .c files that should call it.
|
| |
|