summaryrefslogtreecommitdiff
path: root/op.c
Commit message (Collapse)AuthorAgeFilesLines
* v2 of patch to add := operator for simple aliasingChip Salzenberg2011-07-031-1/+80
| | | | many limitations, but it works, and can be expanded
* RT 64804: tainting with index() of a constantDavid Mitchell2011-06-281-1/+4
| | | | | | | | | At compile time, ck_index with a tainted constant set PL_tainted, which remained on during the rest of compilation, tainting all other constants. Fix this by saving and restoring PL_tainted across the call to fbm_compile, which is what sets PL_tainted.
* Fix context propagation below return()Vincent Pit2011-06-271-13/+0
| | | | | | | | | | | | | A.k.a. "RT #38809 strikes back". Back in the time of perl 5.003, there was no void context, so "do" blocks below a return needed special handling to use the dynamic context of the caller instead of the static context implied by the return op location. But nowadays context is applied by the scalarvoid(), scalar() and list() functions, and they all already skip the return ops. "do" blocks below a return don't get a static context, and GIMME_V ought to correctly return the caller's context. The old workaround isn't even required anymore.
* Correctly preserve the stack on an implicit break.Vincent Pit2011-06-261-20/+7
| | | | | | | | | | | | | | | | | | | | | | Perl generates a 'break' op with the special flag set at the end of every 'when' block. This makes it difficult to handle both the case of an implicit break, where the stack has to be preserved, and the case of an explicit break, which must obliterate the stack, with the same pp function. Stack handling should naturally occur in 'leavewhen', but it is effectively called only when the block issues a 'continue'. In order to preserve the stack, we change the respective roles of 'break', 'continue' and 'leavewhen' ops : - Special 'break' ops are no longer generated for implicit breaks. Just as before, they give the control back to the 'leavegiven' op. - 'continue' ops now directly forward to the op *following* the 'leavewhen' op of the current 'when' block. - 'leavewhen' is now only called at the natural end of a 'when' block. It adjusts the stack to make sure returned values survive the temp cleanup, then issues a 'next' or go to the current 'leavegiven' depending on whether it is enclosed in a for loop or a given block. This fixes [perl #93548].
* Allow the \$ proto to accept any scalar lvalue [perl #91846]Father Chrysostomos2011-06-241-2/+16
| | | | | | | | | | | | | | | | | This makes the \$ prototype’s parsing the same as the second argument to read(), making it possible to create a custom myread() function that has the same syntax. This is handled in two places in the prototype-parsing code, to avoid calling scalar() on the op if another character in \[...] will accept it. I don’t know what the consequences of that would be. So it calls Perl_op_lvalue_flags in the $ case only if it is not inside brackets. Then in the ] case it checks to see whether there was a $. OP_READ, not OP_ENTERSUB, is passed as the type to Perl_op_lvalue_flags, since OP_ENTERSUB would allow sub foo(\$) to accept an array as an argument. OP_RECV and OP_SYSREAD would have worked, too.
* Make Perl_op_lvalue_flags provide a no-croak optionFather Chrysostomos2011-06-241-0/+1
| | | | This is in preparation for making the \$ prototype accept any lvalue.
* op_lvalue .= _flagsFather Chrysostomos2011-06-241-1/+1
| | | | | | | | | | Add flags param to op_lvalue, so that the caller can ask it not to croak when encountering an unmodifiable op (upcoming). This is in preparation for making the \$ prototype accept any lvalue. There is no mathom, as the changes that this will support are by no means suitable for maint.
* Stop ‘sub :lvalue :Foo’ from applying :lvalue to defined subsFather Chrysostomos2011-06-211-1/+3
| | | | | | | | | | This is something that commit 885ef6f missed. See ticket #68758 and the perldelta diff in this commit. I thought that the prototype-application inconsistencies mention in <2C7C1BF5-A814-4F5E-B10E-E431B71BA8CA@cpan.org> would get in the way of this, but I found that the easiest way to fix it actually did not change any of that. So those issues can wait till another day.
* Allow ‘sub x :lvalue’ to apply to XSUBs and stubsFather Chrysostomos2011-06-171-2/+6
| | | | | | | | | | | | | | | | This was disabled in 5.12 (with a warning) by commit 885ef6f5, because applying the attribute to a Perl sub isn’t effective: it does not mod- ify the op tree accordingly. But applying an attribute to an XSUB after the fact is perfectly fine, and is the only way to do it (either with declarative syntax or attributes.pm). This commit restores the old behaviour of declarative for XSUBs. (attributes.pm never stopped working.) Commit 885ef6f5 also stopped a declaration from applying the flag to an undefined subroutine if it happens to have been assigned from else- where. It does not make sense to allow the :method attribute to be applied to such a sub, but not :lvalue.
* Split OP_AELEMFAST_LEX out from OP_AELEMFAST.Nicholas Clark2011-06-121-4/+5
| | | | | | | | | | | | | 6a077020aea1c5f0 extended the OP_AELEMFAST optimisation to lexical arrays. Previously OP_AELEMFAST was only used as an optimisation for OP_GV, which is a PADOP/SVOP. However, by reusing the same opcode, and signalling (pad) lexical vs package, it introduced a myriad of special cases, because OP_PADAV is a BASEOP (not a PADOP), whilst OP_AELEMFAST is a PADOP/SVOP (which is larger). Using two OP numbers allows each variant to have the correct OP flags in PL_opargs. Both can continue to share the same C code.
* Scalar keys assignment through lvalue subsFather Chrysostomos2011-06-091-2/+2
| | | | | | | | | | This used not to work: sub foo :lvalue { keys %wallet } foo = 37; Now it does. It was just a matter of following the right code path in op_lvalue when the parent op is a leavesublv instead of a sassign.
* Fix my + attrs + list assignmentFather Chrysostomos2011-06-081-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This script works in 5.6.x: #!perl -l sub MODIFY_SCALAR_ATTRIBUTES { return } # need these sub MODIFY_ARRAY_ATTRIBUTES { return } # for it to sub MODIFY_HASH_ATTRIBUTES { return } # compile my ($x,@y,%z) : Bent = 72; # based on example from attributes.pm’s pod print $x; print "ok"; $ pbpaste|perl5.6.2 72 ok (pbpaste is a Mac command that outputs the clipboard contents.) In 5.8.0 to 5.8.8: $ pbpaste|perl5.8.1 ok So the assignment never happens. And with warnings: $ pbpaste|perl5.8.1 -w Bizarre copy of ARRAY in aassign at - line 5. In 5.8.9 it gets slightly worse: $ pbpaste|perl5.8.9 Bizarre copy of ARRAY in aassign at - line 5. So warnings are not required to trigger the error. If my ($x,@y,%z) is changed to my($x,$y), there is no error, but the assignment doesn’t happen. This was broken in 5.8.0 by this change: commit 95f0a2f1ffc68ef908768ec5d39e4102afd28c1e Author: Spider Boardman <spider@orb.nashua.nh.us> Date: Sat Dec 8 19:09:23 2001 -0500 Re: attributes are broken Message-Id: <200112090509.AAA02053@Orb.Nashua.NH.US> p4raw-id: //depot/perl@13543 (Is there a ‘hereby’ missing from that subject? :-) Oddly enough, that was the commit that put the attribute and list assignment example in attribute.pm’s pod. This change caused the bizarre assignment error to occur more often in 5.8.9 and 5.10.0, but I don’t think it’s actually relevant (just try- ng to see how long I can get this commit message): commit f17e6c41cacfbc6fe88a5ea5e01ba690dfdc7f2e Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com> Date: Wed Jul 5 20:00:10 2006 +0000 Fix a bug on setting OPpASSIGN_COMMON on a AASSIGN op when the left side is made out a list declared with our(). In this case OPpLVAL_INTRO isn't set on the left op, so we just remove that check. Add new tests. p4raw-id: //depot/perl@28488 What’s happening is that there is an extra pushmark in the list when attributes are present: $ perl5.14.0 -MO=Concise -e 'my ($a,@b):foo' o <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 39 -e:1) v:{ ->3 n <@> list vKPM/128 ->o 3 <0> pushmark vM/128 ->4 4 <0> padsv[$a:39,40] vM/LVINTRO ->5 5 <0> padav[@b:39,40] vM/LVINTRO ->6 6 <0> pushmark v ->7 <------- right here e <1> entersub[t3] vKS*/NOMOD,TARG ->f 7 <0> pushmark s ->8 8 <$> const[PV "attributes"] sM ->9 9 <$> const[PV "main"] sM ->a b <1> srefgen sKM/1 ->c - <1> ex-list lKRM ->b a <0> padsv[$a:39,40] sRM ->b c <$> const[PV "foo"] sM ->d d <$> method_named[PV "import"] ->e m <1> entersub[t4] vKS*/NOMOD,TARG ->n f <0> pushmark s ->g g <$> const[PV "attributes"] sM ->h h <$> const[PV "main"] sM ->i j <1> srefgen sKM/1 ->k - <1> ex-list lKRM ->j i <0> padsv[@b:39,40] sRM ->j k <$> const[PV "foo"] sM ->l l <$> method_named[PV "import"] ->m -e syntax OK That leaves an extra mark that confuses pp_aassign, which doesn’t know what it’s supposed to be reading and what it’s supposed to be assign- ing to (hence the bizarre copy). The pushmark is the result of the concatenation of two lists, the sec- ond one beginning with a pushmark (as listops do by default). The con- catenation occurs in Perl_my_attrs, at this spot (in the ‘else’): if (rops) { if (maybe_scalar && o->op_type == OP_PADSV) { o = scalar(op_append_list(OP_LIST, rops, o)); o->op_private |= OPpLVAL_INTRO; } else o = op_append_list(OP_LIST, o, rops); } So this commit make that ‘else’ clause check for a pushmark and oblit- erate it if present, before concatenating the lists.
* [perl #7946] Lvalue subs do not autovivifyFather Chrysostomos2011-06-031-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes autovivification work with lvalue subs. It follows the same technique used by other autovivifiable ops (aelem, helem, tc.), except that, due to flag constraints, it uses a single flag and instead checks the op tree at run time to find out what sort of thing to vivify. The flag constraints are that these two flags: #define OPpENTERSUB_HASTARG 32 /* Called from OP tree. */ #define OPpENTERSUB_NOMOD 64 /* Immune to op_lvalue() for :attrlist. */ conflict with these: #define OPpDEREF (32|64) /* autovivify: Want ref to something: */ #define OPpDEREF_AV 32 /* Want ref to AV. */ #define OPpDEREF_HV 64 /* Want ref to HV. */ #define OPpDEREF_SV (32|64) /* Want ref to SV. */ Renumbering HASTARG and NOMOD is problematic, as there are places in op.c that change entersubs into rv2cvs, and the entersub and rv2cv flags would conflict. Setting the flags correctly when changing the type is hard and would result in subtle bugs if not done perfectly. Ops like ${...} don’t actually autovivify; it’s the op inside that does it. In those cases, the parent op is flagged with OPpDEREFed, and it skips get-magic, as it has already been called by the inner op. Since entersub is now marked as being an autovivifying op, ${...} in lvalue context ends up skipping get-magic if there is a foo() inside. And this affects even regular subs. So pp_leavesub and pp_return have to call get-magic; hence the new tests in gmagic.t.
* Make empty lvalue subs work correctlyFather Chrysostomos2011-05-311-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In perl 5.8.1 and earlier, sub{} would return @_ in list context. This was fixed in 5.8.2 for regular subs, but not lvalue subs. Before the syntactic restriction on return values was removed in commit 145b2bb, there was a bug affecting compilation of empty subs before any use statement: $ perl5.14.0 -e 'sub foo :lvalue {}' Can't modify stub in lvalue subroutine return at -e line 1, near "{}" Execution of -e aborted due to compilation errors. $ perl5.14.0 -le 'use sigtrap; sub foo :lvalue {} print "ok"' ok But I digress. :-) Up to 5.14, lvalue subs were still returning @_, or, rather, the ele- ments of @_ as separate scalars: $ perl5.14.0 -Mre -le '(sub :lvalue {}->($a,$b))=(3,4); print "$a $b"' Useless use of "re" pragma at -e line 0 3 4 (Not exactly useless, eh? The -Mre allows the sub to compile.) This commit fixes that bug.
* Allow rvalue syntax in expr returned from lvalue subFather Chrysostomos2011-05-311-1/+2
| | | | | | | This changes the syntax of the last statement and the arguments to ‘return’ in an lvalue subroutine to be the same as that of a non- lvalue routine. This almost finishes the work begun by commit fa1e92c. (return still needs to enforce the same rules as leavesublv.)
* [perl #90888] each(ARRAY) on scalar context should wrapped into defined()Hojung Yoon2011-05-241-3/+6
| | | | | | | | | | | | | | | | | "perldoc -f each" says that if each() is performed on ARRAY in scalar context, it will return only the index in an array. Calling each(HASH) in scalar context worked well but calling each(ARRAY) didn't because it was not wrapped into defined OPCODE. So, in Perl_newWHILEOP() and Perl_newLOOPOP(), they are modified to check them and wrap with defined OP if needed. In S_new_logop(), it's reasonable to warn if return value of each(ARRAY) is being used for boolean value, as it's first return value will be "0", the false. issue: #90888 link: http://rt.perl.org/rt3/Public/Bug/Display.html?id=90888
* Perl_ck_split: Avoid unnecessary assignmentMichael Witten2011-05-191-2/+3
| | | | Signed-off-by: Michael Witten <mfwitten@gmail.com>
* In Perl_op_clear(), uncomment the call to mad_free()Nicholas Clark2011-05-191-12/+2
| | | | | Free the MADPROPs when freeing their parent OP, now that all the other bugs are fixed.
* In S_fold_constants() under MAD, need to copy the SV representing the result.Nicholas Clark2011-05-191-1/+9
| | | | | | | | | For the non-MAD case (the historical default), it was fine to use pad_swipe() (which doesn't adjust any part of the OS), because the OS was freed soon after. However, the MAD code doesn't free the OS, hence as-was, without this change, the OS still thought that it owned the pad slot, and much jollity resulted as two different parts of the code fought over whichever SV had the bad luck to next be billeted there.
* Under ithreads, convert SVOPs stored in MADPROPs to PADOPs.Nicholas Clark2011-05-191-0/+41
| | | | | | | | | | Else if a child thread attempts to free an optree with MADPROPs containing OPs pointing directly to SVs, it will by trying to free SVs to the wrong interpreter, at which point bad things(tm) happen. (There still seems to be some fixing needed for the MADPROPs direct pointers, but as no tests are failing because of them, I'm postponing them until the failures are addressed)
* Allocate MADPROPs using PerlMemShared_malloc()Nicholas Clark2011-05-191-3/+2
| | | | | | | As the MADPROPs are referenced from the optree, which is itself shared, MADPROPs can't use the default malloc(), which is per i-thread, lest a child thread frees the optree, and bad things(tm) happen. (a "free to wrong pool" panic if you're on Win32, or elsewhere if you've got DEBUGGING)
* Make keys $scalar an lvalueFather Chrysostomos2011-04-181-0/+1
| | | | | | | | | | | | | | This does a run-time check to see whether $scalar is a hash ref, and dies if it is not. This is to keep keys \@_ consistent with keys @_. I cannot simply use OPf_MOD, since that indicates *potential* lvalue context (including subroutine args). So, instead, I take advantage of the fact that OPf_SPECIAL is always set on the LHS of an assignment (usually to indicate that local() should not erase the value).
* Make keys/value/each $scalar accept only unblessed refsFather Chrysostomos2011-04-181-2/+7
| | | | See ticket #80626.
* Make push/shift $scalar accept only unblessed aryrefsFather Chrysostomos2011-04-181-45/+9
| | | | See ticket #80626.
* [perl #87064] eval no longer shares filtersFather Chrysostomos2011-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit: commit f07ec6dd59215a56bc1159449a9631be7a02a94d Author: Zefram <zefram@fysh.org> Date: Wed Oct 13 19:05:19 2010 +0100 remove filter inheritance option from lex_start 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. string evals could inherit the same source filter space as the cur- rently compiling code. Despite what the quoted commit message says, sharing source filters allows filters to be inherited in both direc- tions: A source filter created when the eval is being compiled also applies to the file with which it is sharing its space. There are at least 20 CPAN distributions relying on this behaviour (or, rather, what could be considered a Test::More bug). So this com- mit restores the source-filter-sharing capability. It does not change the current API or make public the API for sharing source filters, as this is supposed to be a temporary stop-gap measure for 5.14.
* allow wrap-around of PL_cop_seqmaxDavid Mitchell2011-02-061-0/+2
| | | | | | | | | | | | After a large number of evals, PL_cop_seqmax (a U32) will wrap around again to zero. Make the code handle this case by: 1) When incrementing PL_cop_seqmax, never allow its value to become equal to PERL_PADSEQ_INTRO; 2) When testing for COP_SEQ_RANGE_LOW < seq <= COP_SEQ_RANGE_HIGH, allow for the fact that _HIGH may be lower than _LOW. This is a final fix for [perl #83364].
* add GvCV_set() and GvGP_set() macros.David Mitchell2011-01-211-6/+6
| | | | | | | | and make GvCV() and GvGP() rvalue-only. This it to allow a future commit to eliminate some backref magic between GV and CVs, which will require complete control over assignment to the gp_cv slot.
* provide an explicit cast to the enum parameter for C++Tony Cook2011-01-211-1/+1
|
* CH] Change usage of regex/op common to common namesKarl Williamson2011-01-161-1/+1
| | | | | | | | | This patch changes the core functions to use the common names for the fields that are shared between op.c and regcomp.c, just for consistency of using one name throughout the core for the same thing. A grep of cpan shows that both names are used in various modules; so both names must be retained.
* Use multi-bit field for regex character setKarl Williamson2011-01-161-4/+3
| | | | | | | | | | | | | The /d, /l, and /u regex modifiers are mutually exclusive. This patch changes the field that stores the character set to use more than one bit with an enum determining which one. This data structure more closely follows the semantics of their being mutually exclusive, and conserves bits as well, and is better expandable. A small API is added to set and query the bit field. This patch is not .xs source backwards compatible. A handful of cpan programs are affected.
* .pm: rename variables to reflect expanded usageKarl Williamson2011-01-161-1/+1
| | | | | Certain variables have /dul in their names. /a is about to be added; and maybe more, so give a more generic name to avoid future confusion
* op.c: Remove unnecessary flagKarl Williamson2011-01-091-2/+1
| | | | This flag no longer does anything
* Generate pp_* prototypes in pp_proto.h, and remove pp.symNicholas Clark2011-01-091-2/+2
| | | | | | | | | | | Eliminate the #define pp_foo Perl_pp_foo(pTHX) macros, and update the 13 locations that relied on them. regen/opcode.pl now generates prototypes for the PP functions directly, into pp_proto.h. It no longer writes pp.sym, and regen/embed.pl no longer reads this, removing the only ordering dependency in the regen scripts. opcode.pl is now responsible for prototypes for pp_* functions. (embed.pl remains responsible for ck_* functions, reading from regen/opcodes)
* Fix typos (spelling errors) in Perl sources.Peter J. Acklam) (via RT2011-01-071-2/+2
| | | | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81904] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 > Signed-off-by: Abigail <abigail@abigail.be>
* make <expr> always overload if expr is overloadedDavid Mitchell2011-01-021-0/+1
| | | | | | | | Due to the way that '<> as glob' was parsed differently from '<> as filehandle' from 5.6 onwards, something like <$foo[0]> didn't handle overloading, even where $foo[0] was an overloaded object. This was contrary to the docs for overload, and meant that <> couldn't be used as a general overloaded iterator operator.
* call pp_glob() even when its being skippedDavid Mitchell2011-01-021-6/+16
| | | | | | | | | | | | | | Currently when an external Perl glob function is used (which is most of the time), the OP_GLOB op is removed and replaced with the pair: GV("CORE::GLOBAL::glob"), ENTERSUB. This commit re-adds the OP_GLOB to the op tree, but with OPf_SPECIAL set; and pp_glob() is updated to just return if OPf_SPECIAL is set. Thus there's no change in outward functionality with this commit. However, by always calling pp_glob(), it will allow us (in the next commit) to handle iterator overloading consistently, regardless of whether the internal globbing function is used or not.
* ck_glob() - add a little code commentDavid Mitchell2011-01-021-1/+1
|
* mark blockhooks API as experimentalZefram2010-12-131-1/+1
|
* [perl #68658] attributes turn "state" into "my"Father Chrysostomos2010-12-081-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is for two reasons: • In S_my_kid, the attribute-handling code comes before the code that marks the padop as being a state instead of a my, which it knows to do based on the value of PL_parser->in_my. The attribute-handling code begins by setting PL_parser->in_my to FALSE, preventing the code that follows from doing its job. So now PL_parser->in_my is read at the top of S_my_kid, before the attribute code, with the statehood recorded in a boolean. Then the code that marks the padop as being state checks that boolean instead of in_my. • A lexical variable declaration that has an attribute and is assigned to in the same expression compiles to something similar to: (attributes->import(... \$x ...), my $x) = 3; where the list is actually in scalar context, returning the my $x which is then assigned to (something that cannot be expressed directly in Perl syntax). So Perl_ck_sassign needs to take that list op into account when creating the ‘once’ op that actually makes state assignment work. Up till now it was just looking for a padsv on its LHS. This commit makes it check also for a list op whose last item is a padsv.
* Avoid setting PL_cv_has_eval unnecessarilyFather Chrysostomos2010-12-071-1/+1
| | | | | | | | | | Quoting op.c: /* /$x/ may cause an eval, since $x might be qr/(?{..})/ */ But the (?{..})’s compilation is only ever reached in the scope of ‘use re 'eval'’, so we can avoid setting PL_cv_has_eval (and the slight overhead that entails) when that pragma is off.
* [perl #77762] Constant assignment warningFather Chrysostomos2010-11-301-1/+2
| | | | | | | | | | | | With this patch: $ ./perl -we 'sub A () {1}; if (0) {my $foo = A or die}' $ ./perl -we 'sub A () {1}; if (0) {my $foo = 1 or die}' Found = in conditional, should be == at -e line 1. Since the value of a constant may not be known at the time the program is written, it should be perfectly acceptable to do a constant assign- ment in a conditional.
* [perl #63540] bizarre closure lossageFather Chrysostomos2010-11-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main::b in this example shows a null op that has the if() statement attached to it. $ perl -MO=Concise,a,b -e 'my $x;sub a {$x}; sub b{if($x){}0}' main::a: 3 <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->3 1 <;> nextstate(main 2 -e:1) v ->2 2 <0> padsv[$x:FAKE:] ->3 main::b: a <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->a 4 <;> nextstate(main 5 -e:1) v ->5 - <1> null vK/1 ->8 6 <|> and(other->7) vK/1 ->8 5 <0> padsv[$x:FAKE:] s ->6 - <@> scope vK ->- 7 <0> stub v ->8 8 <;> nextstate(main 5 -e:1) v ->9 9 <$> const[IV 0] s ->a -e syntax OK Perl_op_const_sv has: if (type == OP_NEXTSTATE || type == OP_NULL || type == OP_PUSHMARK) continue; It traverses from the null to the const. The const’s op_next pointer points to the leavesub, so it is taken to be a constant. It returns to newATTRSUB, which turns on CvCONST without assigning a constant value. Later, cv_clone (called by pp_anoncode) calls op_const_sv again. The latter returns the SV from the first PADSV it finds, which is the $x in if($x). This commit stops op_const_sv from skipping over null ops that have children.
* [perl #79178] STORE/FETCH of tie()d hash get stringified keyFather Chrysostomos2010-11-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This bug has been present in non-threaded builds for a long time. Change 38bb37b9aa introduced it to threaded builds. $hash{...} makes its operand a shared-PV scalar if it is an OP_CONST. But \"foo" is also an OP_CONST, as is anything generated with use constant. This is the sort of thing that results: $ perl5.8.5 -MO=Concise -e '$a{\"foo"}' 7 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 6 <2> helem vK/2 ->7 4 <1> rv2hv sKR/1 ->5 3 <$> gv(*a) s ->4 5 <$> const(PVIV "SCALAR(0x81b378)") s ->6 -e syntax OK (My 5.8.5 installation is non-threaded.) See the "SCALAR(0x81b378)" in there? So this commit skips that optimisation if the key is ROK or if it is a PVMG or higher.
* [perl #78908] Reinstate mod for one more stable releaseFather Chrysostomos2010-11-261-0/+8
|
* Clarify op_lvalue’s docsFather Chrysostomos2010-11-261-4/+8
| | | | as requested by Reini Urban [perl #78908]
* [perl #78810] PERLDB_NOOPT ignored by adjacent nextstate optimisationFather Chrysostomos2010-11-261-1/+1
| | | | | As mentioned in the RT ticket, ac56e7d did not take PERLDB_NOOPT into account.
* Make BEGIN {require 5.12.0} behave as documented.Nicholas Clark2010-11-251-1/+24
| | | | | | Previously in a BEGIN block, require was behaving identically to use 5.12.0 - ie erroneously executing the use feature ':5.12.0'; and use strict; use warnings behaviour, which only use was documented to provide.
* Refactor newATTRSUB()'s logic for grafting a sub definition to an existing stubNicholas Clark2010-11-181-5/+20
| | | | | | | | | | | Previously it was using cv_undef() to (partially) free the target CV (the pre-existing stub), before donating it the padlist and outside pointers from the source CV (the definition, just compiled), and then freeing up the remains of the source CV. Instead, explicitly exchange padlist and outside pointers, explicitly assign other fields that need changing (file and stash), and assert that various CvFLAGS are as we expect them.
* Convert newSUB() to a macro wrapping Perl_newATTRSUB()Nicholas Clark2010-11-171-6/+0
| | | | | Provide a Perl_newSUB() function in mathoms.c for anyone referencing it by its full name.
* Move Perl_cv_undef() from op.c to pad.cNicholas Clark2010-11-161-68/+0
| | | | This will allow the non-API function Perl_pad_undef to be inlined into it.