This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
13 years agoRT #76248: double-freed SV with nested sig-handler
David Mitchell [Mon, 1 Nov 2010 15:36:44 +0000 (15:36 +0000)]
RT #76248: double-freed SV with nested sig-handler

There was some buggy code in Perl_sighandler() related to getting an SV
with the signal name to pass to the perl-level handler function.
`
Basically:

on threaded builds, a sig handler that died leaked PL_psig_name[sig];
on unthreaded builds, in a recursive handler that died, PL_sig_sv was
prematurely freed.

PL_sig_sv was originally just a file static var that was not
recursion-save anyway, and got promoted to perlvars.h when it should
instead have been done away with. So I've got rid of it now, and
rationalised the code, which fixed the two issues listed above.

Also added an assert which makes the dodgy manual popping of the save
stack slightly less dodgy.

13 years agoRT 75254: Slow GC after Scalar::Util::weaken
David Mitchell [Sun, 31 Oct 2010 17:01:10 +0000 (17:01 +0000)]
RT 75254: Slow GC after Scalar::Util::weaken

Freeing lots of weak RVs to the same object results in quadratic
search through the backrefs array. This is probably sufficiently rare
that its not worth the expense of replacing the array with a ptr table
(say); but in the meantime, this patch makes the code as tight as
possible, and adds a check for the sv being at element 0, so that
both types of linear create/destroy order are optimised (previously only
created last / deleted first order was quick). It's still slow for random
deletion order. The RT code, modified to give high-res timing for the
return from the sub, and with various types of destruct order, gives the
following timings:

        LIFO   FIFO random
before 0.05s 17.37s 17.28s
now    0.04s  0.04s 12.05s

13 years agoMerge B's interpreter structure accesses for SV* types into intrpvar_sv_common.
Nicholas Clark [Mon, 1 Nov 2010 11:14:27 +0000 (11:14 +0000)]
Merge B's interpreter structure accesses for SV* types into intrpvar_sv_common.

On this platform this reduces the object size by 4.5K.

13 years agoAll callers of get_op_bitspec() in Opcode.xs pass len, so don't call strlen().
Nicholas Clark [Mon, 1 Nov 2010 15:41:53 +0000 (15:41 +0000)]
All callers of get_op_bitspec() in Opcode.xs pass len, so don't call strlen().

This commit brought to you by the campaign for elimination of strlen().

13 years agoSmall refactoring of op_names_init() and put_op_bitspec() in Opcode.xs
Nicholas Clark [Mon, 1 Nov 2010 15:07:45 +0000 (15:07 +0000)]
Small refactoring of op_names_init() and put_op_bitspec() in Opcode.xs

Change op_names_init() to use memset() rather than a longhand loop, and to
call put_op_bitspec() with an explicit length by using STR_WITH_LEN().
As all calls to put_op_bitspec() now pass in a length, remove the code to call
strlen() if the passed-in length is zero.

This commit brought to you by the campaign for elimination of strlen().

13 years agoRefactor Storable::{net_,}pstore to return undef/true, instead of 1 or 0.
Nicholas Clark [Mon, 1 Nov 2010 13:08:07 +0000 (13:08 +0000)]
Refactor Storable::{net_,}pstore to return undef/true, instead of 1 or 0.

This allows their only caller, Storable::_store(), to be simplified, as $ret
will now have the correct values for its documented interface.

Also, replace C<$ret = undef> with C<undef $ret>, as the latter is equivalent,
but uses 1 fewer op.

13 years agoMerge the implementation of B::sv_{undef,no,yes} using ALIAS.
Nicholas Clark [Mon, 1 Nov 2010 09:56:59 +0000 (09:56 +0000)]
Merge the implementation of B::sv_{undef,no,yes} using ALIAS.

On this platform, this reduces the object code size by around .75K.

13 years agoRefactor the error handling logic in Storable::_store().
Nicholas Clark [Mon, 1 Nov 2010 07:47:50 +0000 (07:47 +0000)]
Refactor the error handling logic in Storable::_store().

The logic remains:

1: If the close fails, set $ret to undef, and attempt to unlink the file
2: If the eval set $@, attempt to unlink the file
3: If the unlink is attempted and fails, warn

However, the new code avoids using low-precedence or and a statement modifier,
both for flow control, in the same statement, which I certainly found confusing.
It also now avoids the implicit *three*-state logic for $ret, which previously
was attaching distinct meanings to true, false and undefined.

The new code has (some) flow control inside an if(), and enters a block (which
it seems that the old code strove hard to avoid - blocks are a small runtime
cost). However the block entry is only for the error case, so this should not
matter.

13 years agoRemove S_get_isa_hash
Father Chrysostomos [Mon, 1 Nov 2010 06:47:59 +0000 (23:47 -0700)]
Remove S_get_isa_hash

It no longer serves much purpose, as of 7311f41d6.

13 years agoAllow push/pop/keys/etc to act on references
David Golden [Thu, 9 Sep 2010 21:22:02 +0000 (17:22 -0400)]
Allow push/pop/keys/etc to act on references

All built-in functions that operate directly on array or hash
containers now also accept hard references to arrays or hashes:

  |----------------------------+---------------------------|
  | Traditional syntax         | Terse syntax              |
  |----------------------------+---------------------------|
  | push @$arrayref, @stuff    | push $arrayref, @stuff    |
  | unshift @$arrayref, @stuff | unshift $arrayref, @stuff |
  | pop @$arrayref             | pop $arrayref             |
  | shift @$arrayref           | shift $arrayref           |
  | splice @$arrayref, 0, 2    | splice $arrayref, 0, 2    |
  | keys %$hashref             | keys $hashref             |
  | keys @$arrayref            | keys $arrayref            |
  | values %$hashref           | values $hashref           |
  | values @$arrayref          | values $arrayref          |
  | ($k,$v) = each %$hashref   | ($k,$v) = each $hashref   |
  | ($k,$v) = each @$arrayref  | ($k,$v) = each $arrayref  |
  |----------------------------+---------------------------|

This allows these built-in functions to act on long dereferencing
chains or on the return value of subroutines without needing to wrap
them in C<@{}> or C<%{}>:

  push @{$obj->tags}, $new_tag;  # old way
  push $obj->tags,    $new_tag;  # new way

  for ( keys %{$hoh->{genres}{artists}} ) {...} # old way
  for ( keys $hoh->{genres}{artists}    ) {...} # new way

For C<push>, C<unshift> and C<splice>, the reference will auto-vivify
if it is not defined, just as if it were wrapped with C<@{}>.

Calling C<keys> or C<values> directly on a reference gives a
substantial performance improvement over explicit dereferencing.

For C<keys>, C<values>, C<each>, when overloaded dereferencing is
present, the overloaded dereference is used instead of dereferencing
the underlying reftype.  Warnings are issued about assumptions made in
the following three ambiguous cases:

  (a) If both %{} and @{} overloading exists, %{} is used
  (b) If %{} overloading exists on a blessed arrayref, %{} is used
  (c) If @{} overloading exists on a blessed hashref, @{} is used

13 years ago[perl #78580] Stop a simple *glob from calling get-magic
Father Chrysostomos [Mon, 1 Nov 2010 00:02:44 +0000 (17:02 -0700)]
[perl #78580] Stop a simple *glob from calling get-magic

This also happens to apply to *{ $::{glob} }, but not to *{\*glob} or
*{$thing = *glob}.

In other words, it’s only when the operand is a real glob, and not a
reference or a SVt_FAKE glob.

13 years agoUpdate parent to CPAN version 0.224
Chris 'BinGOs' Williams [Mon, 1 Nov 2010 00:23:12 +0000 (00:23 +0000)]
Update parent to CPAN version 0.224

  [DELTA]

  0.224  20101031
    . Change assignment @ISA = (@ISA, 'new::class')
      to use push @ISA, 'new::class'
      This should make class creation faster from 5.10 onwards
      and reverts a change made in 2.14. If this is critically slow for you
      and you can't upgrade your version of Perl, use the old way.

13 years agoperlunicode.pod: Add detail on utf8/locale conflicts
Karl Williamson [Sun, 31 Oct 2010 20:04:15 +0000 (14:04 -0600)]
perlunicode.pod: Add detail on utf8/locale conflicts

13 years agoregcomp.h: Remove unused #define
Karl Williamson [Sun, 31 Oct 2010 19:37:11 +0000 (13:37 -0600)]
regcomp.h: Remove unused #define

ANYOF_RUNTIME() is no longer used, so can be removed.

I had long tried to figure out what the purpose of this was, and
discovered it really had none.

I think it must have had something to do with locales at one time.  But
locales don't do well with utf8, and I don't know how to make it better.
In any event this wasn't actually accomplishing anything.

13 years agoreginclass: Remove redundant test
Karl Williamson [Sun, 31 Oct 2010 19:31:13 +0000 (13:31 -0600)]
reginclass: Remove redundant test

The previous re-ordering of this function makes it clear that this test
doesn't do anything.  It is testing the charclass bitmap, but that was
already done in the re-ordered block from a previous commit, so if it
didn't succeed there, it won't succeed here.

In fact, trying to understand why this code was here was what led me to
figure out that it wasn't, and that things could be sped up by doing the
reordering.

13 years agoreginclass: Reorder fastest first
Karl Williamson [Sun, 31 Oct 2010 19:17:34 +0000 (13:17 -0600)]
reginclass: Reorder fastest first

This patch simply moves the block of code that does the bitmap tests in
front of the block of code that deals with potential things not in the
bit map.  The reason to do this is that it is faster to find things in
the bitmap, than to have to create a utf8 swash.

The patch also adds some comments, and the first block doesn't have to
test if there has been a match, and the second block does, so if
statements for those two blocks are adjusted accordingly.

The proof that this doesn't break anything stems from the fact that the
routine never stops early.  If there wasn't a match in the first block
of code, it would execute the second block.  Thus swapping the order
doesn't affect the outcome.  The side effects of the first block are
reading in the swash.  These side effects won't happen if it no longer
gets executed, because the other block matched.  And thus an error could
be introduced if there were coding errors elsewhere that didn't
initialize the swash before using it.  But that doesn't appear to be the
case, as all tests pass.

13 years agoreginclass: Remove unnecessary test
Karl Williamson [Sun, 31 Oct 2010 18:45:50 +0000 (12:45 -0600)]
reginclass: Remove unnecessary test

The previous changes have made it clear that this test never was useful,
so remove it.

13 years agoreginclass: Make explicit the length assumptions
Karl Williamson [Sun, 31 Oct 2010 18:36:49 +0000 (12:36 -0600)]
reginclass: Make explicit the length assumptions

reginclass assumes that can match always at least one character.  Make
that explicit, and now that we have that length always saved, don't
recalculate it.

13 years agoreginclass: Rename variable for clarity
Karl Williamson [Sun, 31 Oct 2010 18:31:11 +0000 (12:31 -0600)]
reginclass: Rename variable for clarity

Several other variables in the routine have the previous name

13 years agoregcomp.h: Clean up some comments
Karl Williamson [Sun, 31 Oct 2010 18:07:43 +0000 (12:07 -0600)]
regcomp.h: Clean up some comments

13 years agoANYOF_LARGE is now the same as ANYOF_CLASS
Karl Williamson [Sun, 31 Oct 2010 18:05:23 +0000 (12:05 -0600)]
ANYOF_LARGE is now the same as ANYOF_CLASS

These two #defines now mean the same thing.  Free up bit used by
ANYOF_LARGE

13 years agoregexec.c: reorder statements for speed
Karl Williamson [Sun, 31 Oct 2010 17:50:08 +0000 (11:50 -0600)]
regexec.c: reorder statements for speed

The call to reginclass is guaranteed by constness to not change
locinput, so if going to fail don't waste time calling it.

13 years agoregexec.c: Add clarifying comment
Karl Williamson [Sun, 31 Oct 2010 17:20:43 +0000 (11:20 -0600)]
regexec.c: Add clarifying comment

13 years agoreginclass: add some consts to prototype
Karl Williamson [Sun, 31 Oct 2010 16:37:55 +0000 (10:37 -0600)]
reginclass: add some consts to prototype

13 years agoregexec.c: Remove redundant line.
Karl Williamson [Sun, 31 Oct 2010 16:33:50 +0000 (10:33 -0600)]
regexec.c: Remove redundant line.

Now that reginclass is guaranteed to return the match length upon
success, the caller need not do it again.

13 years agoreginclass: Return matched length even if not utf8
Karl Williamson [Sun, 31 Oct 2010 16:21:14 +0000 (10:21 -0600)]
reginclass: Return matched length even if not utf8

This also allows for less special case testing

13 years agoreginclass: Change variable name for clarity.
Karl Williamson [Sun, 31 Oct 2010 15:20:41 +0000 (09:20 -0600)]
reginclass: Change variable name for clarity.

13 years agoregexec.c: Document existing reginclass behavior
Karl Williamson [Sun, 31 Oct 2010 15:11:39 +0000 (09:11 -0600)]
regexec.c: Document existing reginclass behavior

13 years agoperldelta up to 7cb18e1b02
Father Chrysostomos [Sun, 31 Oct 2010 21:35:59 +0000 (14:35 -0700)]
perldelta up to 7cb18e1b02

13 years agoMerge Storable::{is_storing,is_retrieving} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 21:20:08 +0000 (21:20 +0000)]
Merge Storable::{is_storing,is_retrieving} using ALIAS.

13 years agoStorable::{last_op_in_netorder,is_storing,is_retrieving} are all boolean.
Nicholas Clark [Sun, 31 Oct 2010 20:52:25 +0000 (20:52 +0000)]
Storable::{last_op_in_netorder,is_storing,is_retrieving} are all boolean.

Hence they can have return type bool, which allows xsubpp to generate slightly
simpler (and smaller) code, and at run time avoids using a temporary for the
return value.

13 years agoMerge Storable::{,net_}pstore and Storable::{,net_}mstore using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 20:32:20 +0000 (20:32 +0000)]
Merge Storable::{,net_}pstore and Storable::{,net_}mstore using ALIAS.

Remove the static functions {,net}[mp]store(), which were trivial wrappers
around do_store(). Instead call do_store() directly, using the ALIAS index
as the flag. Less code.

On this platform, this reduces the object code by over 1K. (Over 1%)

13 years agoAdd l1_char_class_tab.h to Make dependencies
Karl Williamson [Sat, 30 Oct 2010 21:35:00 +0000 (15:35 -0600)]
Add l1_char_class_tab.h to Make dependencies

13 years agoregcomp.c: No longer need _C_C_T_ and variant macro
Karl Williamson [Sat, 30 Oct 2010 22:55:42 +0000 (16:55 -0600)]
regcomp.c: No longer need _C_C_T_ and variant macro

Now, all calls have been converted to the more general case; can remove
the old one, and rename the new one to have the same name as the old one

13 years ago[:posix:] now works under /u
Karl Williamson [Sat, 30 Oct 2010 22:48:55 +0000 (16:48 -0600)]
[:posix:] now works under /u

This patch is part of fixing the Unicode bug.  The /u regex modifier now
applies to posix character classes.  This resolves [perl #18281].

The Todo tests in reg_posicc.t have all been made not todo.

13 years agol1_char_class_tab.h: Wrong for ALNUMC
Karl Williamson [Sat, 30 Oct 2010 21:33:34 +0000 (15:33 -0600)]
l1_char_class_tab.h: Wrong for ALNUMC

The generated table was wrong in the Latin1 range for characters with
the ALNUMC property

13 years agoNits in re pods
Karl Williamson [Sat, 30 Oct 2010 21:23:11 +0000 (15:23 -0600)]
Nits in re pods

13 years agoDOCs: Clarify that \w matches marks and \Pc
Karl Williamson [Sat, 30 Oct 2010 21:20:24 +0000 (15:20 -0600)]
DOCs: Clarify that \w matches marks and \Pc

The previous documentation really didn't specify what \w is.  It matches
the underscore, but also all other connector punctuation, plus any
marks, such as diacritical accents that occur within a word.

13 years agoAdd consistent synonyms for \p{PosxFOO}
Karl Williamson [Sat, 30 Oct 2010 16:13:48 +0000 (10:13 -0600)]
Add consistent synonyms for \p{PosxFOO}

This patch adds a set of synonyms \p{XPosixFOO} for the full extended
Unicode version of \p{PosixFOO}, so only one rule need be remembered.
Similarly, \p{XPerlSpace} is added to preserve the rule for the one
similar class that doesn't have Posix in its name.

Prior to this patch there was no exact equivalent to \p{PosixPunct}
extended beyond ASCII.

13 years agoRevert "Add consistent synonyms for \p{PosxFOO}"
Father Chrysostomos [Sun, 31 Oct 2010 17:23:39 +0000 (10:23 -0700)]
Revert "Add consistent synonyms for \p{PosxFOO}"

This reverts commit d5944336d74c819152158dabfd806d49ad0ecb21.

13 years agoMerge the XS implementation of all B::MG accessors using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 14:10:32 +0000 (14:10 +0000)]
Merge the XS implementation of all B::MG accessors using ALIAS.

On this platform, this reduces the object code size by over 5K.

13 years agoBump Safe's version to 2.29
Rafael Garcia-Suarez [Sun, 31 Oct 2010 13:17:20 +0000 (14:17 +0100)]
Bump Safe's version to 2.29

13 years agoAdd &version::vxs::VCMP to Safe's default share
Rafael Garcia-Suarez [Sun, 31 Oct 2010 13:08:53 +0000 (14:08 +0100)]
Add &version::vxs::VCMP to Safe's default share

This is to accomodate this new function in version.pm 0.85.

13 years agoAdd consistent synonyms for \p{PosxFOO}
Karl Williamson [Sat, 30 Oct 2010 16:13:48 +0000 (10:13 -0600)]
Add consistent synonyms for \p{PosxFOO}

This patch adds a set of synonyms \p{XPosixFOO} for the full extended
Unicode version of \p{PosixFOO}, so only one rule need be remembered.
Similarly, \p{XPerlSpace} is added to preserve the rule for the one
similar class that doesn't have Posix in its name.

13 years agoperlrecharclass: Nits
Karl Williamson [Sat, 30 Oct 2010 16:13:35 +0000 (10:13 -0600)]
perlrecharclass: Nits

13 years agomktables: Clarify \d description for perluniprops
Karl Williamson [Sat, 30 Oct 2010 15:53:06 +0000 (09:53 -0600)]
mktables: Clarify \d description for perluniprops

13 years agomktables: Add tests for wrong equivalence attempts
Karl Williamson [Sat, 30 Oct 2010 15:43:50 +0000 (09:43 -0600)]
mktables: Add tests for wrong equivalence attempts

mktables allows for multiple tables to be made equivalent, which in Unix
terminology means that they are essentially symbolic links.  However
this should happen only when they have the same code points in them to
begin with.  This adds a little more error checking.

13 years agoRT 75082: recv() with MSG_TRUNC flag SEGV
David Mitchell [Sun, 31 Oct 2010 12:44:39 +0000 (12:44 +0000)]
RT 75082: recv() with MSG_TRUNC flag SEGV

The recv() system call, with the MSG_TRUNC flag, returns the
true size of the packet, even if it is larger than the supplied buffer.
Since perl's equivalent recv() function doesn't return the size
(apart from what's implied as the returned length of the buffer), there
doesn't seem to to be any way to return this value to the caller. So
silently ignore it.

Before, we were setting SvCUR to the size, even if it was larger than
the buffer. Which was Bad.

13 years agoMerge the implementation of B::{main_root,main_start} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 12:42:52 +0000 (12:42 +0000)]
Merge the implementation of B::{main_root,main_start} using ALIAS.

13 years agoRT 72246: rcatline memory leak on bad $/
David Mitchell [Sun, 31 Oct 2010 11:50:16 +0000 (11:50 +0000)]
RT 72246: rcatline memory leak on bad $/

When allocating a temporary SV, make sure it will get freed if we die.

13 years agoadjust output of -Dm
David Mitchell [Sun, 31 Oct 2010 10:31:56 +0000 (10:31 +0000)]
adjust output of -Dm

The address printed for malloc() didn't always match that for free().
Print the malloc() address *after* any modification by PERL_TRACK_MEMPOOL

13 years agoUpdate Unicode-Collate to CPAN version 0.64
Chris 'BinGOs' Williams [Sun, 31 Oct 2010 11:46:43 +0000 (11:46 +0000)]
Update Unicode-Collate to CPAN version 0.64

  [DELTA]

  0.64  Sun Oct 31 14:17:29 2010
    - U::C::Locale newly supports locale: ja.
    - added Unicode::Collate::CJK::JISX0208 for ja.
    - a subroutine specified in 'overrideCJK' or 'overrideHangul' is allowed
      to return an integer or undef value.
    - fix: Ideographs Ext.A are assigned since UCA Version 9 (Unicode 3.1).
           This fix should affect only the case of (UCA_Version => 8).

13 years agoMerge the implementation of B::{dowarn,sub_generation} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 11:39:53 +0000 (11:39 +0000)]
Merge the implementation of B::{dowarn,sub_generation} using ALIAS.

13 years agoMerge the implementation of B::{minus_c,save_BEGINSs} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 09:52:40 +0000 (09:52 +0000)]
Merge the implementation of B::{minus_c,save_BEGINSs} using ALIAS.

13 years agoRemove the conditional #define of OPpPAD_STATE from the BOOT block in B.xs
Nicholas Clark [Sun, 31 Oct 2010 09:43:15 +0000 (09:43 +0000)]
Remove the conditional #define of OPpPAD_STATE from the BOOT block in B.xs

This can now be done with less code in the Makefile.PL since commit
b1826b71659a2c08 changed B to use ExtUtils::Constant

13 years agoRemove the variables stash and export_ok from the BOOT block in B.xs
Nicholas Clark [Sun, 31 Oct 2010 09:31:31 +0000 (09:31 +0000)]
Remove the variables stash and export_ok from the BOOT block in B.xs

These are no longer needed since commit b1826b71659a2c08 changed how B was
generating its exported constants.

13 years agoMerge the implementation of B::HE::{VAL,SVKEY_force} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 08:35:14 +0000 (08:35 +0000)]
Merge the implementation of B::HE::{VAL,SVKEY_force} using ALIAS.

13 years agoMerge the implementation of B::CV::{XSUB,XSUBANY} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 08:16:54 +0000 (08:16 +0000)]
Merge the implementation of B::CV::{XSUB,XSUBANY} using ALIAS.

13 years agoTests for [perl #77358]
Father Chrysostomos [Sun, 31 Oct 2010 01:32:22 +0000 (18:32 -0700)]
Tests for [perl #77358]

13 years ago[perl #77358] ISA warnings after aliasing packages
Father Chrysostomos [Sun, 31 Oct 2010 01:19:56 +0000 (18:19 -0700)]
[perl #77358] ISA warnings after aliasing packages

This commit makes mro_package_moved call mro_isa_changed_in on the
stash that has been assigned if it did not have an effective name
(HvENAME) before the assignment.

This is what was happening:

{package Right} # autovivify it
@thing::ISA = qw[Left];
*Left:: = delete $::{"Right::"};

When Right is deleted, it is not attached to the symbol table any
more, so it has no effective name. mro_isa_changed_in3 is called on
it, which resets the caches and then proceeds to cache a new isa linearisation. The new linearisation, of course, does not use the
name ‘Left’.

When Right is assigned over the top of Left, Right is given an
HvENAME of ‘Left’. Then mro_isa_changed_is3 is called on the
original Left, which, in turn, calls mro_isa_changed on its sub-
classes. So thing’s isa linearisation is calculated, which is just
‘thing’ + get_linear_isa(Left) (where ‘Left’ now refers to what was previously called Right). This ends up using the bad linearisation.

So the linearisation of a heretofore effectively nameless stash must
be recalculated, but after it has been given a name.

If it has an effective name already, then it appears elsewhere in the
symbol table, and its effective name does not change. (The name added
simply becomes an alternative to switch to should the HvENAME become
invalid.) So the existing isa cache is fine and we do not need to call
mro_isa_changed_in.

(That is a rather lengthy commit message, is it not?)

13 years agoSet stash names before calling mro_isa_changed_in3
Father Chrysostomos [Sat, 30 Oct 2010 21:27:48 +0000 (14:27 -0700)]
Set stash names before calling mro_isa_changed_in3

mro_isa_changed_in3 cannot update isa caches properly if it only sees
an intermediate state.

13 years agoMake B::HV::NAME an ALIAS of B::GV::NAME, as both convert HEKs to SVs.
Nicholas Clark [Sat, 30 Oct 2010 20:29:39 +0000 (21:29 +0100)]
Make B::HV::NAME an ALIAS of B::GV::NAME, as both convert HEKs to SVs.

Previously B::HV::NAME was a simple XS wrapper around HvNAME(), which meant a
conversion to a char *, and then back to an SV.

13 years agoMerge B::BM::PREVIOUS, B::BM::RARE and B::BM::USEFUL into the common accessor.
Nicholas Clark [Sat, 30 Oct 2010 20:02:58 +0000 (21:02 +0100)]
Merge B::BM::PREVIOUS, B::BM::RARE and B::BM::USEFUL into the common accessor.

On this platform this reduces object code size by over 2K.

13 years agoMerge branch 'blead' of perl5.git.perl.org:/gitroot/perl into blead
David Mitchell [Sat, 30 Oct 2010 19:37:32 +0000 (20:37 +0100)]
Merge branch 'blead' of perl5.git.perl.org:/gitroot/perl into blead

13 years agoMerge B::HV::MAX and B::HV::KES into the common accessor.
Nicholas Clark [Sat, 30 Oct 2010 19:34:39 +0000 (20:34 +0100)]
Merge B::HV::MAX and B::HV::KES into the common accessor.

On this platform this reduces object code size by about 1.5K

13 years agoRT #63790: &{PL_sv_yes} corrupted mark stack
David Mitchell [Sat, 30 Oct 2010 19:15:18 +0000 (20:15 +0100)]
RT #63790: &{PL_sv_yes} corrupted mark stack

Calling a subref whose value was PL_sv_yes, and without args,
failed to pop an entry off the mark stack

13 years agoMerge all B::CV structure accesses into the common accessor code.
Nicholas Clark [Sat, 30 Oct 2010 19:06:56 +0000 (20:06 +0100)]
Merge all B::CV structure accesses into the common accessor code.

On this platform this reduces the object size by 7K.

(CvDEPTH() was changed from a long to I32 in change bb17208353b2f15e in 2006 -
B.xs was never updated)

13 years agoMerge B::AV::MAX and B::FM::LINES into the common accessor.
Nicholas Clark [Sat, 30 Oct 2010 17:22:41 +0000 (18:22 +0100)]
Merge B::AV::MAX and B::FM::LINES into the common accessor.

On this platform this reduces object code size by over 1.5K

13 years agoMerge all B::IO structure accesses into the common accessor code.
Nicholas Clark [Sat, 30 Oct 2010 16:15:27 +0000 (17:15 +0100)]
Merge all B::IO structure accesses into the common accessor code.

On this platform this reduces the object size by 9K.

(IoLINES(), IoPAGE(), IoPAGE_LEN() and IoLINES_LEFT() were changed from
long to IV in commit 11a7ac70a867da65 in 2001 - B.xs was never updated)

13 years agoComment typo
Father Chrysostomos [Sat, 30 Oct 2010 16:48:44 +0000 (09:48 -0700)]
Comment typo

13 years agoMove the meta->isa code from UNIVERSAL::isa to mro_get_linear_isa
Father Chrysostomos [Sat, 30 Oct 2010 16:38:24 +0000 (09:38 -0700)]
Move the meta->isa code from UNIVERSAL::isa to mro_get_linear_isa

This is so that it can be used for PL_isarev bookkeeping as well.

This will have no effect on the speed of DFS classes. C3 classes on
which ->isa is never called will have a slight slowdown. (We could
always add an API for setting meta->isa if we want to avoid that.)

13 years agoMerge B::GV::{STASH,GvFLAGS} into the common accessor.
Nicholas Clark [Sat, 30 Oct 2010 13:56:53 +0000 (14:56 +0100)]
Merge B::GV::{STASH,GvFLAGS} into the common accessor.

On this platform this reduces the object code size by over 1K.

13 years agoSwitch UNIVERSAL::isa over to HvENAME
Father Chrysostomos [Sat, 30 Oct 2010 13:52:24 +0000 (06:52 -0700)]
Switch UNIVERSAL::isa over to HvENAME

13 years agoSuppress warning from gv.t
Father Chrysostomos [Sat, 30 Oct 2010 13:52:00 +0000 (06:52 -0700)]
Suppress warning from gv.t

13 years agoA plethora of isarev tests
Father Chrysostomos [Sat, 30 Oct 2010 13:51:33 +0000 (06:51 -0700)]
A plethora of isarev tests

13 years agoCorrect reference to get_linear_isa in get_isarev’ description
Father Chrysostomos [Sat, 30 Oct 2010 12:48:41 +0000 (05:48 -0700)]
Correct reference to get_linear_isa in get_isarev’ description

13 years agoTo-do tests for isarev (more to come)
Father Chrysostomos [Sat, 30 Oct 2010 12:46:47 +0000 (05:46 -0700)]
To-do tests for isarev (more to come)

13 years agoIncrease mro’s version
Father Chrysostomos [Sat, 30 Oct 2010 12:15:36 +0000 (05:15 -0700)]
Increase mro’s version

13 years agoMerge the direct structure lookup for B::{PV,PVMG,PVLV} to the common routine.
Nicholas Clark [Sat, 30 Oct 2010 13:26:53 +0000 (14:26 +0100)]
Merge the direct structure lookup for B::{PV,PVMG,PVLV} to the common routine.

On this platform this reduces the object code size by about 5K.

13 years agoMerge the direct structure lookup for B::IV:: and B::NV:: into 1 routine.
Nicholas Clark [Sat, 30 Oct 2010 12:43:34 +0000 (13:43 +0100)]
Merge the direct structure lookup for B::IV:: and B::NV:: into 1 routine.

As for OPs and GPs, encode the type and offset in the XS alias integer.
Use different names for the type macros, to give them different constant
values, to allow the 3 accessor routines to have no gaps in the values used
for the set of types that they deal with. Otherwise, at least 1 switch
statement would compile to a jump table with "holes".

On this platform, this refactoring reduces the object code size by 4.5K.

13 years agoMerge the implementation of B::IV::{needs64bits,packiv} using ALIAS.
Nicholas Clark [Sat, 30 Oct 2010 11:09:26 +0000 (12:09 +0100)]
Merge the implementation of B::IV::{needs64bits,packiv} using ALIAS.

13 years ago257e0650 used the "wrong" croak() - correct B::GV:SV to use Perl_croak().
Nicholas Clark [Sat, 30 Oct 2010 10:40:08 +0000 (11:40 +0100)]
257e0650 used the "wrong" croak() - correct B::GV:SV to use Perl_croak().

Perl_croak() is a variable argument C function, hence can't have a macro to
permit the use of croak() with/without a context pointer. croak *is* defined
as a macro, substituting croak_nocontext. But we have a context to hand, so we
can use Perl_croak() directly.

13 years agoMerge B::GV::{file,name} using ALIAS.
Nicholas Clark [Sat, 30 Oct 2010 10:10:18 +0000 (11:10 +0100)]
Merge B::GV::{file,name} using ALIAS.

This saves about 700 bytes of object code on this platform.

13 years agoFor B's GP accessors, encode the type and offset in the XS alias integer.
Nicholas Clark [Sat, 30 Oct 2010 09:35:27 +0000 (10:35 +0100)]
For B's GP accessors, encode the type and offset in the XS alias integer.

This allows most of the code for simple structure lookups in the GP of a GV to
be merged into one XS routine. This saves over 5.5K of object code on this
platform.

13 years agoIn B.xs, move the direct COP access for stash and file into the common code.
Nicholas Clark [Sat, 30 Oct 2010 08:03:29 +0000 (09:03 +0100)]
In B.xs, move the direct COP access for stash and file into the common code.

Both pairs of accessors are provided for both ithreads and not, but for each,
one pair is direct structure access, and 1 pair "faked up" with a more comple
macro. The direct structure access pair uses the common code (B::OP::next)

This reduces the object code by about 1K for both threaded and unthreaded
builds.

13 years agoMacros are not called with aTHX_
Father Chrysostomos [Sat, 30 Oct 2010 06:11:51 +0000 (23:11 -0700)]
Macros are not called with aTHX_

13 years agoSwitch S_mro_get_linear_isa_c3 to HvENAME
Father Chrysostomos [Sat, 30 Oct 2010 05:55:07 +0000 (22:55 -0700)]
Switch S_mro_get_linear_isa_c3 to HvENAME

13 years agoRemove the #ifdef PERL_CORE surrounding the HvENAME* macros
Father Chrysostomos [Sat, 30 Oct 2010 05:51:13 +0000 (22:51 -0700)]
Remove the #ifdef PERL_CORE surrounding the HvENAME* macros

13 years agoAdd HvENAME_HEK
Father Chrysostomos [Sat, 30 Oct 2010 05:26:34 +0000 (22:26 -0700)]
Add HvENAME_HEK

13 years agoAdd docs for hv_ename_*
Father Chrysostomos [Sat, 30 Oct 2010 05:17:44 +0000 (22:17 -0700)]
Add docs for hv_ename_*

13 years agoperlmroapi: suggest HvNAME as a fallback
Father Chrysostomos [Sat, 30 Oct 2010 05:12:55 +0000 (22:12 -0700)]
perlmroapi: suggest HvNAME as a fallback

13 years agoAdd test for the crashes fixed in 00169e2
Father Chrysostomos [Sat, 30 Oct 2010 05:07:32 +0000 (22:07 -0700)]
Add test for the crashes fixed in 00169e2

13 years agoSwitch the core MRO code over to HvENAME
Father Chrysostomos [Sat, 30 Oct 2010 03:45:34 +0000 (20:45 -0700)]
Switch the core MRO code over to HvENAME

This has the side-effect of fixing these one-liners:

$ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = *a'
Bus error
$ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = []'
Bus error
$ perl5.13.6 -le'sub baz; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;'
Bus error
$ perl5.13.6 -le'sub foo::bar; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;'
Bus error

In the first two cases the crash was inadvertently fixed (isn’t it
nice when that happens?) in 5.13.6 (by 6f86b615fa7), but there was
still a fatal error:
Can't call mro_isa_changed_in() on anonymous symbol table at -e line 1.

Because sv_clear calls ->DESTROY, if an object’s stash has been
detached from the symbol table, mro_get_linear_isa can be called on a
hash with no HvENAME. So HvNAME is used as a fallback for those cases.

13 years agoAdd HvENAME
Father Chrysostomos [Fri, 29 Oct 2010 15:59:33 +0000 (08:59 -0700)]
Add HvENAME

Add HvENAME as an alias for HvENAME_get and make it public.

This is now the preferred name for use in isa caches.

13 years agoIn S_hv_delete_common, call mro_package_moved after the deletion
Father Chrysostomos [Fri, 29 Oct 2010 13:17:28 +0000 (06:17 -0700)]
In S_hv_delete_common, call mro_package_moved after the deletion

13 years agoFix Math::BigInt::FastCalc build under Win32 with croak_xs_usage().
George Greer [Sat, 30 Oct 2010 00:39:33 +0000 (20:39 -0400)]
Fix Math::BigInt::FastCalc build under Win32 with croak_xs_usage().

13 years agoMerge B::COP::{cop_seq,hints,line} into the common B::OP accessor XS code.
Nicholas Clark [Fri, 29 Oct 2010 20:40:18 +0000 (21:40 +0100)]
Merge B::COP::{cop_seq,hints,line} into the common B::OP accessor XS code.

On this platform, this saves almost 2.5K.

Keep IVp last in the switch values, as it's only used for ithreads. Otherwise
there would be an avoidable hole in the jump table for the non-ithreads object
code.

13 years agoMerge B::PADOP::{gv,sv} using the ALIAS mechanism.
Nicholas Clark [Fri, 29 Oct 2010 20:01:08 +0000 (21:01 +0100)]
Merge B::PADOP::{gv,sv} using the ALIAS mechanism.

On this platform, this saves around 600 bytes.

13 years agoMerge B::PADOP::padix into the common B::OP accessor XS code.
Nicholas Clark [Fri, 29 Oct 2010 19:43:49 +0000 (20:43 +0100)]
Merge B::PADOP::padix into the common B::OP accessor XS code.

On this platform, this saves about 800 bytes.

13 years agoSort the MANIFEST (after change 1222f39eae03eee3)
Nicholas Clark [Fri, 29 Oct 2010 20:18:56 +0000 (22:18 +0200)]
Sort the MANIFEST (after change 1222f39eae03eee3)