summaryrefslogtreecommitdiff
path: root/pp_ctl.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote branch 'zefram/zefram/reliable_exception' into bleadRafael Garcia-Suarez2010-05-041-40/+16
|\ | | | | | | | | Conflicts: pp_ctl.c
| * bring G_KEEPERR back to the realm of sanityZefram2010-04-231-23/+2
| | | | | | | | | | | | | | | | | | Makes the G_KEEPERR logic more consistent, and in particular make it sensibly handle non-string exceptions. An exception in a destructor is now always emitted as a warning, and never copied or merged into $@ of the surrounding context. No more clobbering exceptions being handled elsewhere, and no more double reporting. This fixes the rest of [perl #74538].
| * SV-based interfaces for dieing and warningZefram2010-04-231-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions croak_sv(), die_sv(), mess_sv(), and warn_sv(), each act much like their _sv-less counterparts, but take a single SV argument instead of sprintf-like format and args. They will accept RVs, passing them through as such. This means there's no more need to clobber ERRSV in order to throw a structured exception. pp_warn() and pp_die() are rewritten to use the _sv interfaces. This fixes part of [perl #74538]. It also means that a structured warning object will be passed through to $SIG{__WARN__} instead of being stringified, thus bringing warn in line with die with respect to structured exception objects. The new functions and their existing counterparts are all fully documented.
| * make die reliably hand error to post-eval codeZefram2010-04-211-38/+34
| | | | | | | | | | | | | | | | | | Put the exception into $@ last thing before longjmping to the op following the eval block, where previously it went into $@ before unwinding the stack. This change means that the exception is not liable to be lost by $@ being clobbered by destructors, cleanup code, or restoration after "local $@". The code running immediately after eval can now rely on $@ accurately indicating the exception status of the eval.
* | Save the popped cx->blk_eval.old_namesv before calling LEAVEVincent Pit2010-04-261-12/+30
| | | | | | | | | | | | | | | | It's fine to still refer to cx members between POPEVAL and LEAVE, but there are a few places where the namesv is read after LEAVE happens. This is bad because LEAVE can call arbitrary code ; in particular, it can call a destructor that does call_sv(cv, G_EVAL), in which case the old eval context cx gets overwritten by the new one and cx->blk_eval.old_namesv points to garbage.
* | unwinding target nominated by separate globalZefram2010-04-251-11/+3
|/ | | | | | | | When unwinding due to die, the new global PL_restartjmpenv points to the JMP_ENV at which longjmping should stop and control should be transferred to PL_restartop. This replaces the previous use of cxstack[cxstack_ix+1].blk_eval.cur_top_env, located in a nominally-discarded context frame.
* Fix RT #74290 - regression for labels immediately before string evals.Nicholas Clark2010-04-171-1/+12
| | | | | | Fix location identified by Father Chrysostomos, who also offered a patch, but this patch is more efficient, as it avoids any allocation. Test code based on his test example.
* Move PERL_ASYNC_CHECK() from the runloop to control flow OPs.Nicholas Clark2010-04-151-0/+7
| | | | | | | | | For the typical code this gives a 5% speedup, and removes the cost of "safe signals". Tight looping code will show less gains, but should never be slower. Subtle bugs might remain - there might be constructions that enter the runloop (where signals used to be dispatched) but don't contain any PERL_ASYNC_CHECK() calls themselves.
* fix RT 23810: eval and tied methodsDavid Mitchell2010-04-081-12/+60
| | | | | | | | | | | Something like the following ended up corrupted: sub FETCH { eval 'BEGIN{syntax err}' } The croak on error popped back the context stack etc to the EVAL pushed by entereval, but the corresponding JUMPENV_PUSH(3) unwound all the way to the outer perl_run, losing all the mg_get() related parts of the C stack. It turns out that the run-time parts of pp_entereval were protected with a new JUMPENV level, but the compile-time parts weren't. Add this.
* improve -Dl debugging outputDavid Mitchell2010-03-301-10/+9
| | | | | In particular, distinguish between scope and context stack push/pops, show depth of JUMPENV stack, and show STACKINFO push/pops
* RT #67962: $1 treated as tainted in untainted matchDavid Mitchell2010-03-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the issue in the following: use re 'taint'; $tainted =~ /(...)/; # $1 now correctly tainted $untainted =~ s/(...)/$1/; # $untainted now incorrectly tainted The problem stems from when $1 is updated. pp_substcont, which is called after the replacement expression has been evaluated, checks the returned expression for taintedness, and if so, taints the variable being substituted. For a substitution like s/(...)/x$1/ this works fine: the expression "x".$1 causes $1's get magic to be called, which sets $1 based on the recent match, and is marked as not tainted. Thus the returned expression is untainted. In the variant s/(...)/$1/, the returned value on the stack is $1 itself, and its get magic hasn't been called yet. So it still has the tainted flag from the previous pattern. The solution is to mg_get the returned expression *before* testing for taintedness.
* In Perl_sv_compile_2op(), remove a suggestion to merge code with pp_entersub.Nicholas Clark2010-03-131-1/+8
| | | | Add a comment explaining the problems with this function.
* Add perlintern.pod documentation docatch + prescan_versionReini Urban2010-03-081-0/+14
| | | | docatch - perl run-time exception handling
* fix qr// and get-magic problemsFather Chrysostomos2010-01-191-12/+13
| | | | | [N.B. I converted package name separators from q{'} to q{::} in the test files as suggested by demerphq. -- dagolden]
* Avoid a double SV leak in an error state branch of pp_require.Nicholas Clark2010-01-151-4/+4
| | | | Avoid using a sprintf format for a constant value (0).
* Back out the {ENTER,LEAVE}_with_name("sub") part of d343c3ef45381352 for now.Nicholas Clark2010-01-141-3/+3
| | | | | | | | | | It's conflicting with an established pattern in XS code, working around the inability of the XS SCOPE: keyword to actually provide anything useful. The minor amount of extra debugging it gives here is not worth the external trouble it causes. Revisit this once we can provide a meaningful option to disable the ENTER/LEAVE around XSUBs.
* tweak to pp_ctl.c gives smaller object codeAlex Davies2009-12-161-5/+10
|
* [perl #70764] $' fails to initialized for pre-compiled regular expression ↵Father Chrysostomos2009-12-141-0/+20
| | | | | | | | | | | | | | | | | | | matches The match vars are associated with the regexp that last matched successfully. In the case of $str =~ $qr or /$qr/, since the $qr could be used in multiple scopes that need their own sets of match vars, the $qr is cloned by Perl_reg_temp_copy as of change 30677/28d8d7f. This happens in pp_regcomp before pp_match has stringified the LHS, hence the bug. In short, /$gror/ is not equivalent to ($which = !$which) ? /$gror/ : /$gror/, which is weird. Attached is a patch, which admittedly is a hack, but fixes this particular side effect of what is probably a bad design, by stringifying the LHS in pp_regcomp, and having pp_match skip get-magic in such cases. A real fix far exceeds my capabalities, and would also be very intrusive according to <http://www.nntp.perl.org/group/perl.perl5.porters/2007/03/msg122415.html>.
* Allocate the right HVRafael Garcia-Suarez2009-12-071-1/+1
| | | | | This will solve an obscure bug in smart-match involving nested data structures containing the same elements.
* Fix [perl #71078] Smart match against @_ gives false negativesRafael Garcia-Suarez2009-12-071-1/+2
| | | | @_ can contain NULLs for undefined elements
* -Dmad minitest failure bisectZefram2009-11-261-4/+4
| | | | | | | | | | | | | | | | | | | | I wrote: >In my tests with -Dmad, I'm still getting a test failure ("panic: input >overflow") from t/op/incfilter.t. The underlying problem is the filter >layer mishandling things when a filter function gives it a multiline >string, so it generates an invalid SV state (strlen(SvPVX(PL_linestr)) >> SvCUR(PL_linestr)). This faulty state also occurs without -Dmad, >and so doesn't appear to be Mad-related, it just doesn't in practice >cause the test panic without -Dmad. I'm investigating this bug now. It's fixed by the attached patch. Since the bug is an inconsistency in the SV data structure, it can't be sensibly tested from Perl code, so I'm at a loss for writing a test script. Hopefully that panic with -Dmad is sufficient. -zefram Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
* deprecate "goto" to jump into a constructGerard Goossen2009-11-211-0/+6
|
* Force OP_REQUIRE to scalar context at the end of ck_require and don't let it ↵Gerard Goossen2009-11-211-8/+2
| | | | become void context. Fixes problem with require not always being in scalar context.
* Fix compiler warnings:Jerry D. Hedden2009-11-131-2/+2
| | | | | | | pp_ctl.c: In function `Perl_pp_return': pp_ctl.c:2092: warning: 'retop' might be used uninitialized in this function pp_ctl.c: In function `Perl_pp_last': pp_ctl.c:2214: warning: 'nextop' might be used uninitialized in this function
* Add ENTER_with_name and LEAVE_with_name to automaticly check for matching ↵Gerard Goossen2009-11-121-41/+41
| | | | ENTER/LEAVE when debugging is enabled
* move JMPENV_JUMP to die_where and mark it as "noreturn"Gerard Goossen2009-11-061-3/+4
|
* Implement the 'qr' overload type.Ben Morrow2009-11-011-4/+31
| | | | | | | | | | | If this is defined, it will be called instead of stringification whenever an object is used as a regexp or interpolated into a regexp. This will fall back to stringification even without C<fallback => 1>, for compatibility. An overloaded 'qr' must return either a REGEXP or a ref to a REGEXP (such as created by qr//). Any further overloading on the return value will be ignored.
* Use of SV* instead of message, msglen, utf8 to contain error messageGerard Goossen2009-11-011-11/+14
|
* S_run_user_filter() can use the filter GV itself for the cache buffer.Nicholas Clark2009-10-231-9/+9
| | | | This saves allocating an extra SV head and body.
* RT#69616: regexp SVs lose regexpness in assignmentBen Morrow2009-10-221-1/+1
| | | | | | | | It uses reg_temp_copy to copy the REGEXP onto the destination SV without needing to copy the underlying pattern structure. This means changing the prototype of reg_temp_copy, so it can copy onto a passed-in SV, but it isn't API (and probably shouldn't be exported) so I don't think this is a problem.
* Remove the venerable fatal error "Runaway format"Rafael Garcia-Suarez2009-10-221-5/+0
| | | | | This solves bug "[perl #69927] wrong runaway error for write", which is a link to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=77707
* Add Perl_ck_warner(), which combines Perl_ckwarn() and Perl_warner().Nicholas Clark2009-10-121-13/+9
| | | | | | | Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code size (about 0.2%), for 1 more function call if warnings are not enabled. However, if we're now in the L1 or L2 cache when we weren't previously, that's still going to be a speed win.
* add more positive gofs GPOS tests and fix some bugs tooYves Orton2009-09-101-5/+8
|
* Corrupt filename when setting %INC entry in a @INC hookSalvador Ortiz Garcia2009-09-061-1/+1
| | | | | | | The code in pp_ctl.c after calling an @INC hook blindly assumes that the SV setted by the user in %INC is an SVPV (SvPOK true) for setting the filename. So when the user uses other scalar types, the output of __FILE__, warn, die, caller, etc. shows random garbage.
* Add clear magic to %^H so that the HE chain is reset when you empty it.Zefram2009-08-211-4/+1
| | | | This fixes [perl #68590] : %^H not lexical enough.
* add -DM flag to track smartmatch resolutionDavid Mitchell2009-08-201-4/+52
|
* In pp_caller, remove a GvMULTI_on() by adding GV_ADDMULTI to gv_fetchpvs().Nicholas Clark2009-08-081-3/+2
|
* Teach goto how to cross given/when blocksVincent Pit2009-07-221-0/+2
|
* Simplify the code that sets $_ in given()Rafael Garcia-Suarez2009-07-211-7/+1
| | | | | $_ is guaranteed to be lexical here, because the parser did an allocmy when parsing the given() statement.
* Fast enabling of strictures when version 5.11.0 is requiredRafael Garcia-Suarez2009-07-071-4/+1
| | | | | We don't load strict.pm, we just manipulate the hint bits. Plus more tests.
* use strict by default if "use 5.011" is in effect!Steffen Mueller2009-07-071-0/+8
|
* Make C<undef ~~ 0> and C<undef ~~ ""> not match (like in 5.10.0)Rafael Garcia-Suarez2009-07-011-0/+4
| | | | | | This makes ~~ commutative with regard to undef, and fixes an inconsistency, since C<undef ~~ [0]> was not matching, and ~~ should be distributive in this case.
* Trim all trailing / from "." in @INC when filling %INCRafael Garcia-Suarez2009-06-251-2/+4
| | | | | | This fixes bug #66942 : as a / was left in the directory name, $INC{"Foo.pm"} for a file loaded from the current directory was given the incorrect value "/Foo.pm".
* Fix [RT#63110] -- two small memory leaks were introduced in 5b9c067Alex Vandiver2009-05-301-1/+4
|
* Allow ~~ overloading on the left side, when the right side is a plain scalarRafael Garcia-Suarez2009-05-241-2/+19
|
* In the ~~ implementation, consistently use the SV-aware API for hash keys.Rafael Garcia-Suarez2009-05-241-13/+4
| | | | This way, we can handle tied hashes such as ones that have references as keys.
* WIN32 preprocessor symbols is usually tested with #ifdef, not #ifJan Dubois2009-05-141-1/+1
| | | | | | Doesn't really make a difference as WIN32 is defined as '1' when it is defined, but there is something to be said for consistent usage.
* do/require don't treat '.\foo' or '..\foo' as "absolute paths" on Windows.Christoph Lamprecht2009-05-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both 'do' and 'require' treat paths *explicitly* relative to the current directory (starting with './' or '../') as a special form of absolute path. That means they can be loaded directly and don't need to be resolved via @INC, so they don't rely on '.' being in @INC (unless running in taint mode). This behavior is "documented" in the P5P thread "Coderefs in @INC" from 2002. The code is missing special treatment of backslashes on Windows so that '.\\' and '..\\' are handled in the same manner. This change fixes http://rt.perl.org/rt3/Public/Bug/Display.html?id=63492 (Note that the references to taint mode in the bug report are only relevant as far as taint mode removes '.' from @INC). This change also fixes the following Scalar-List-Utils bug report: http://rt.cpan.org/Public/Bug/Display.html?id=25430 The Scalar::Util test failure in t/p_tainted.t only manifests itself under Test::Harness 3, and only outside the Perl core: * Test::Harness 2 (erroneously) puts '-I.' on the commandline in taint mode and runs something like this: `perl -I. t/p_tainted.t` so '.\t\tainted.t' can be found via '.' in @INC. * Core Perl runs something like this from the t/ directory: `..\perl.exe -I../lib ../ext/List-Util/t/p_tainted.t` so '.\..\ext\List-Util\t\tained.t' can be found via '../lib' in @INC. Signed-off-by: Jan Dubois <jand@activestate.com>
* Implement Hash/Array ~~ Regex (with tests)Rafael Garcia-Suarez2009-05-091-29/+45
|
* Treat blessed references on the left of C<~~> as scalarsRafael Garcia-Suarez2009-05-091-18/+35
|