| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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().
|
|
|
|
|
|
| |
Calculate memory allocation using regexp and XPVIO, and the offset of the first
real structure member. This avoids tripping over alignment differences between
X* and x*_allocated, because x*_allocated doesn't have a double in it.
|
|
|
|
|
|
|
|
| |
This boolean parameter indicates if the function has been called
to update the overload magic table while looking up the DESTROY
method. In this case, it's probably best to avoid croaking if
those tables could not be updated (for example due to a method
that could not be loaded.)
|
| |
|
| |
|
|
|
|
| |
(and run "make regen")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider what currently happens when the tokenizer is scanning a string.
It looks through it byte-by-byte until it finds a character that forces
it to decide to go to utf8. It then calls sv_utf8_upgrade() with the
portion of the string scanned so far.
sv_utf8_upgrade() starts over from the beginning, and scans the string
byte-by-byte until it finds a character that varies between non-utf8 and
utf8. It then calls bytes_to_utf8().
bytes_to_utf8() allocates a new string that can handle the worst case
expansion, 2n+1, of the entire string, and starts over from the
beginning, and scans the input string byte-by-byte copying and
converting each character to the output string as it goes.
It doesn't return the size of the new string, so sv_utf8_upgrade()
assumes it is only as big as what actually got converted, throwing away
knowledge of any spare.
It then returns to the tokenizer, which immediately does a grow to get
space for the unparsed input. This is likely to cause a new string to
be allocated and copied from the one we had just created, even if that
string in actuality had enough space in it.
Thus, the invariant head portion of the string is scanned 3 times, and
probably 2 strings will be allocated and copied.
My solution to cutting this down is to do several things.
First, I added an extra flag for sv_utf8_upgrade that says don't bother
to check if the string needs to be converted to utf8, just assume it
does. This eliminates one of the passes.
I also added a new parameter to sv_utf8_upgrade that says when you
return, I want this much unused space in the string. That eliminates
the extra grow.
This was all done by renaming the current work-horse function from
sv_utf8_upgrade_flags to be sv_utf8_upgrade_flags_grow() and making the
current function name be a macro which calls the revised one with a 0
grow parameter.
I also improved the internal efficiency of sv_utf8_upgrade so that when
it does scan the string, it doesn't call bytes_to_utf8, but does the
conversion itself, using a fast memory copy instead of the byte-oriented
one for the invariant header, and it uses that header to get a better
estimate of the needed size of the new string, and it doesn't throw away
the knowledge of the allocated size.
And, if it is clear without scanning the whole string that the
conversion will fit in the already allocated string, it just uses that
instead of allocating and copying a new one, using the algorithm I
copied from the tokenizer. (In this case it does have to finish
scanning the whole string to get the correct size.) The comments have
details.
It still is byte-oriented. Vectorization et. al. could yield
performance improvements. One idea for that is in the comments.
The patch also includes a new synonym I created which is a more accurate
name than NATIVE_TO_ASCII.
|
| |
|
|
|
|
|
| |
but is failing on Windows. Anyways sv_utf8_upgrade_nomg() is
a macro anyways, so moving the documentation to sv.h.
|
|
|
|
|
| |
Also add new SvRV_const() macro for read-only access.
p4raw-id: //depot/perl@34804
|
|
|
|
|
|
|
| |
MUTABLE_SV() check. Use SvPVX_const() instead of SvPVX()
where only a const SV* is available. Also fix two falsely
consted pointers in Perl_sv_2pv_flags().
p4raw-id: //depot/perl@34770
|
|
|
| |
p4raw-id: //depot/perl@34613
|
|
|
|
|
|
|
|
|
|
| |
away const, returning a void *. Add MUTABLE_SV(sv) which uses this, and
replace all (SV *) casts either with MUTABLE_SV(sv), or (const SV *).
This probably still needs some work - assigning to SvPVX() and SvRV()
is now likely to generate a casting error. The core doesn't do this.
But as-is it's finding bugs that can be fixed.
p4raw-id: //depot/perl@34605
|
|
|
| |
p4raw-id: //depot/perl@34585
|
|
|
|
|
| |
Message-ID: <20081022013731.23b5a2e5@r2d2>
p4raw-id: //depot/perl@34568
|
|
|
|
|
| |
identical.
p4raw-id: //depot/perl@34134
|
|
|
|
|
| |
re-implemented SvOOK() to avoid using it)
p4raw-id: //depot/perl@34133
|
|
|
|
|
|
| |
Message-ID: <484D491D.9050704@x-ray.at>
Date: Mon, 09 Jun 2008 17:15:41 +0200
p4raw-id: //depot/perl@34038
|
|
|
|
|
|
| |
From: "Reini Urban" <rurban@x-ray.at>
Message-ID: <6910a60806080626kfda0dd1ja906513e8fd0aa39@mail.gmail.com>
p4raw-id: //depot/perl@34031
|