| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This mentions the UTF8 flag and moves the discussion to perlapi, where
it belongs, IMHO.
|
|
|
|
|
| |
SvEND does not point to the last character, but to a spot
just after it.
|
|
|
|
|
|
| |
SVpad_STATE is only used on SVs which hold PAD names; make it share the
same flags bit as SVprv_WEAKREF/SVf_IVisUV. Together with the previous
commit, this frees up a single bit in SvFLAGS, 0x00010000.
|
|
|
|
|
|
|
|
|
|
|
| |
SVs_PADSTALE is only meaningful with SVs_PADMY, while
SVs_PADTMP is only meaningful with !SVs_PADMY,
so let them share the same flag bit.
Note that this doesn't yet free a bit in SvFLAGS, as the two
bits are also used for SVpad_STATE, SVpad_TYPED.
(This is is follow-on to 62bb6514085e5eddc42b4fdaf3713ccdb7f1da85.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commit introduced some code that concatenates a pv on to
an sv and then does SvUTF8_on on the sv if the pv was utf8.
That can’t work if the sv was in Latin-1 (or single-byte) encoding
and contained extra-ASCII characters. Nor can it work if bytes are
appended to a utf8 sv. Both produce mangled utf8.
There is apparently no function apart from sv_catsv that handle
this. So I’ve modified sv_catpvn_flags to handle this if passed the
SV_CATUTF8 (concatenating a utf8 pv) or SV_CATBYTES (cancatenating a
byte pv) flag.
This avoids the overhead of creating a new sv (in fact, sv_catsv
even copies its rhs in some cases, so that would mean creating two
new svs). It might even be worthwhile to redefine sv_catsv in terms
of this....
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are so many parts of the core (mostly pp functions or functions
they call) that need a glob or a globref, including many that call
get-magic at the wrong time (or not at all in some cases, that it
makes sense to add a macro to do it.
It can be used like this:
if (gv = MAYBE_DEREF_GV(sv)) /* calls get-magic */
{
}
else { /* avoid magic here */
}
|
|
|
|
|
| |
Under a DEBUGGING build, this reduces the size of the perl binary by about
10%, and reduces the time to run the test suite by about 10-20%% (!)
|
|
|
|
|
|
|
|
| |
There's no reason for these two flags to ever both be on.
Fix the one place that was doing this, and assert that this never happens.
If this doesn't break anything, it opens the door to freeing a bit in
SvFLAGS. (woo hoo!)
|
|
|
|
|
|
|
|
| |
SvIsCOW was ignoring the fact that it might be passed a
typeglob, which made its behaviour contradict its docs.
This fixes that and, in doing so, simplifies the
upcoming Internals::SvREADONLY fix.
|
|
|
|
|
|
|
|
| |
This should reduce the complexity of code dealing with GVs, as they no longer
try to play several different incompatible roles.
(As suggested by Ben Morrow. However, it didn't turn out to be as
straightforward as one might have hoped).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the 256 byte Boyer-Moore table was stored in the buffer of SvPVX()
after the raw string by extending the buffer.
Given that the scalar is alway upgraded to add PERL_MAGIC_bm magic, to clear
the table and other flags, there's no extra memory cost in using mg_ptr in the
MAGIC struct to point directly to the table.
I believe that this removes the last place in the core that stores data beyond
SvCUR().
|
|
|
|
|
|
|
| |
This reduces the complexity of the union declarations in sv.h.
As B.xs is accessing the structures/unions directly, instead of using the
macros, it needs a patch too.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't set BmFLAGS() in Perl_fbm_compile()
Originally fbm_compile() had an I32 flags argument, which seems to have been
part of case folding/locale improvements. bbce6d69784bf43b removed this.
SvTAIL() was only used in once place until c277df42229d99fe. 2779dcf1a3ceec16
added the U32 flags argument to fbm_compile(), not used until cf93c79d660ae36c.
That commit also added FBMcf_TAIL and FBMcf_TAIL{z,Z,DOLLAR} but didn't use the
last three. Additionally, it stored the BmFLAGS as part of the compiled table:
+ table[-1] = flags; /* Not used yet */
f722798beaa43749 added FBMcf_TAIL_DOLLARM, renumbered FBMcf_TAIL{z,Z,DOLLAR},
but still didn't use anything other than FBMcf_TAIL.
The core, nothing on CPAN, and nothing visible to Google codesearch, has ever
used the 4 specialist flags. The only use is 0 or FBMcf_TAIL, which is in
lockstep with SvTAIL() of 0 or non-0.
|
|
|
|
| |
This eliminates potential confusion between SVpad_NAME and SVpbm_VALID.
|
| |
|
|
|
|
|
|
| |
This was added (with contents) in b162af07ec759e1b. The contents were moved
elsewhere in the refactoring of ac09da3b9065d6e7, but that change failed to
remove the block it had now emptied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Formats are compiled down to a sequence of U32 opcodes in doparseform().
Previously the block of opcodes was stored in the buffer of SvPVX() after
the raw string by extending the buffer, and calculating the first U32 aligned
address after SvCUR(). A flag bit on the scalar was set to signal this hackery,
tested with SvCOMPILED()
The flag bit used happened to be the same as one of the two used by to signal
Boyer-Moore compiled scalars. The assumption was that no scalar can be used for
both. Unfortunately, this isn't quite true.
Given that the scalar is alway upgraded to PVMG to add PERL_MAGIC_fm magic,
to clear the cached compiled version, there's no extra memory cost in using
mg_ptr in the MAGIC struct to point directly to the block of U32 opcodes. The
test for "is there a compiled version" can switch to mg_find(..., PERL_MAGIC_fm)
returning a pointer, and the use of a flag bit abolished.
Retain SvCOMPILED() and SvCOMPILED_{on,off}() as compatibility for XS code on
CPAN - the first is always 0, the other two now no-ops.
|
|
|
|
|
|
| |
We can't move Perl_sv_cmp() and Perl_sv_cmp_locale() to mathoms.c, as they
are referenced by function pointer in pp_sort.c - pointers which require the
specific current calling signature.
|
| |
|
|
|
|
| |
This reverts commit cffb36981555111f364a511fb5763f65ea748c0e.
|
|
|
|
|
| |
Anywhere an API function takes a string in pvn form, ensure that there
are corresponding pv, pvs, and sv APIs.
|
|
|
|
| |
Stop set-magic from being called after ref-to-glob assignment.
|
|
|
|
| |
This time I *really* broke the Windows build!
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are left from PERL_OBJECT, which was an implementation of
multiplicity using C++ objects. PERL_OBJECT was removed in 5.8, but the
macros seem to have been cargo-culted all over the core (including in
places where they would have been inappropriate originally). Since they
now do exactly nothing, it's cleaner to remove them.
I have left the definitions in perl.h, under #ifndef PERL_CORE, since
some CPAN XS code uses them (also often incorrectly). I have also left
STATIC alone, since it seems potentially more useful and is much more
ingrained.
The only appearance of these macros this patch doesn't touch is in
Devel-PPPort, because that's a CPAN module.
|
|
|
|
|
| |
Rather than just recording whether an SV was cloned (sv->sv_debug_cloned),
record the address of the SV we were cloned from.
|
|
|
|
|
|
|
|
|
| |
When accessing a file handle for reading, this reduces pointer dereferences by
1, which will reduce CPU cache pressure.
As SVt_PVIO is also the default type provided to source filters, the code needs
to allow them to continue to use the sv_u for SvPVX(). Re-use the existing
IOf_FAKE_DIRP to signal this, as it's only set when a source filter is added.
|
| |
|
|
|
|
|
|
|
| |
_XPVIO_TAIL was added in 167f2c4d08e1e800, but has only been used in 1 location
since xpvio_allocated was removed in b6f609162799aa49. This restores the header
layout to the situation as it was before 167f2c4d08e1e800, although there are
changes to the structure itself.
|
|
|
|
|
|
|
|
|
|
| |
Track all SVs created by sv_dup() that have a 0 reference count. If they still
have a 0 reference count at the end of cloning, assign a reference to each to
the temps stack. As the temps stack is cleared at thread exit, SVs book keeping
will be correct and consistent before perl_destruct() makes its check for
leaked scalars.
Remove special case code for checking each @_ and the parent's temp stack.
|
|
|
|
| |
Not source or binary compatible with maint-5.12.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In most places, ops checked their args for overload *before* doing
mg_get(). This meant that, among other issues, tied vars that
returned overloaded objects wouldn't trigger calling the
overloaded method. (Actually, for tied and arrays and hashes, it
still often would since mg_get gets called beforehand in rvalue
context).
This patch does the following:
Makes sure get magic is called first.
Moves most of the overload code formerly included by macros at the
start of each pp function into the separate helper functions
Perl_try_amagic_bin, Perl_try_amagic_un, S_try_amagic_ftest,
with 3 new wrapper macros:
tryAMAGICbin_MG, tryAMAGICun_MG, tryAMAGICftest_MG.
This made the code 3800 bytes smaller.
Makes sure that FETCH is not called multiple times. Much of this
bit was helped by some earlier work from Father Chrysostomos.
Added new functions and macros sv_inc_nomg(), sv_dec_nomg(),
dPOPnv_nomg, dPOPXiirl_ul_nomg, dPOPTOPnnrl_nomg, dPOPTOPiirl_ul_nomg
dPOPTOPiirl_nomg, SvIV_please_nomg, SvNV_nomg (again, some of
these were based on Father Chrysostomos's work).
Fixed the list version of the repeat operator (x): it now only
calls overloaded methods for the scalar version:
(1,2,$overloaded) x 10
no longer erroneously calls
x_method($overloaded,10))
The only thing I haven't checked/fixed yet is overloading the
iterator operator, <>.
|
|
|
|
|
|
|
| |
Replaced with xcv_depth and xfm_lines respectively. Both structures might
benefit from some field re-ordering.
Update the descriptive comments in the definition of union _xivu.
|
|
|
|
| |
This was the only user of xivu_hv in union _xivu, so remove that too.
|
|
|
|
| |
This was the only user of xivu_p1 in union _xivu, so remove that too.
|
| |
|
| |
|
|
|
|
|
|
| |
While trying to coerce an SV into a string or whatever, stop if you
suddenly discover it's overloaded (this may not happen until after you've
called it's get magic)
|
| |
|
|
|
|
|
| |
Instead, allocate a private arena chain per pointer table, and free that chain
when its pointer table is freed. Patch from RT #72598.
|
|
|
|
|
|
| |
This helps statically initializing union members on gcc,
otherwise we get "initializer element is not computable at load time".
This speeds up initializing larger B::C/B::CC compiled programs with -O1/-O2 by 10%.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
and tweaking Perl_sv_upgrade().
|