summaryrefslogtreecommitdiff
path: root/perl.c
Commit message (Collapse)AuthorAgeFilesLines
* Turn $$ into a magical readonly variable that always fetches getpid() ↵Max Maischein2011-05-221-5/+0
| | | | | | | | | | | instead of caching it The intent is that by not caching $$, we eliminate one opportunity for bugs: If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$ may go out of sync with what getpid() returns. By always fetching the value of $$ via getpid(), this bug opportunity is eliminated. The overhead of always fetching $$ should be small and is likely only used for tempfile creation, which should be dwarfed by file system accesses.
* Add USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC} to the output of perl -VNicholas Clark2011-05-201-0/+12
| | | | | | These 4 compile-time options should be reported, as they have affect the behaviour of the interpreter binary (albeit only in a small area). They don't affect binary compatibility.
* #81026: Perl binary no longer relocatableJan Dubois2011-03-171-0/+8
| | | | | | | | | | | | Provide a preprocessor macro PERL_RELOCATABLE_INCPUSH to tell incpush_use_sep() to ignore the passed in len argument. This enables relocatable Perl distributions that patch the various paths at install time. Core Perl neither provides actual relocation scripts/programs, nor endorses this practise as being "supported"; this patch only makes it possible to create such tools. It is therefore undocumented outside the source level comments.
* Add PERL_PRESERVE_IVUV to non_bincompat_options.Nicholas Clark2011-03-121-0/+3
| | | | | | It's actually the default, but as all the C code is conditionally (not) compiled on the basis of that pre-processor macro, seems that it is the one that needs to be reported.
* 59d6f6a4c05afa7f was too aggressive, as it disabled #! line -I on miniperlNicholas Clark2011-03-051-1/+5
| | | | | Restore -I processing on the #! line for miniperl. This gets t/run/switchI.t and t/run/switchd-78586.t passing again under minitest.
* Avoid miniperl SEGVing when processing -I on the #! lineNicholas Clark2011-03-051-5/+10
| | | | | | | | | | | | | | | | | | A side-effect of change 3185893b8dec1062 was to force av in S_incpush() to be NULL, whilst other flag variables were still set as if it were non-NULL, for certain cases, only when compiled with -DPERL_IS_MINIPERL The "obvious" fix is to also set all the flag variables to 0 under -DPERL_IS_MINIPERL, to make everything consistent. However, this confuses (at least) the local version of gcc, which issues warnings about passing a NULL value (av, known always to be NULL) as a not-NULL parameter, despite the fact that all the relevant calls are inside blocks which are actually dead code, due to the if() conditions being const variables set to 0 under -DPERL_IS_MINIPERL. So to avoid future bug reports about compiler warnings, the least worst thing to do seems to be to use #ifndef to use the pre-processor to eliminate the dead code, and related variables.
* In S_incpush, unixify libdir earlier.Craig A. Berry2011-03-041-16/+15
| | | | | | | | | This allows, for example, -I[.lib] to have Unix format appendages added, such as "/buildcustomize.pl", "/sitecustomize.pl", etc. It was previously only being converted to Unix syntax to allow the addition of subdirectories, but the number of things that want to glue pieces onto lib/ have multiplied over the years.
* In S_incpush, omit subdirs when PERL_IS_MINIPERL.Craig A. Berry2011-03-041-0/+4
| | | | | | | | | | The new logic in S_parse_body that loads lib/buildcustomize.pl in miniperl relies on lib being in $INC[0], which it won't be if we've loaded version- and architecture-specific directories before lib. Since miniperl isn't installed and can't do dynamic loading, it doesn't really need those subdirectories, so skip loading them for miniperl.
* For miniperl, use the USE_SITECUSTOMIZE feature to load the build-time @INCNicholas Clark2011-02-151-3/+18
| | | | | | For miniperl (only), always enable USE_SITECUSTOMIZE, but change it to load a buildcustomize.pl file from $INC[0], if present. The default @INC for miniperl is '.', so by default this does nothing.
* Bump the perl -V copyright message, as it's now 2011Jesse Vincent2011-01-201-3/+3
|
* 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>
* Extend -d:foo=bar to make -d:-foo expand to C<no foo>, consistent with -M-fooNicholas Clark2010-11-251-4/+14
|
* Eliminate PL_dirtyFlorian Ragwitz2010-11-141-1/+0
| | | | | It now only exists as a compatibility macro for extensions that want to introspect it.
* Add ${^GLOBAL_PHASE}Florian Ragwitz2010-11-141-7/+24
| | | | This exposes the current top-level interpreter phase to perl space.
* regexec.c: Don't give up on fold matching earlyKarl Williamson2010-11-071-0/+2
| | | | | | | | | | | | | | | | | | | | As noted in the comments of the code, "a" =~ /[A]/i doesn't work currently (except that regcomp.c knows about the ASCII characters and corrects for it, but not always, for example in cases like "a" =~ /\p{Upper}/i. This patch catches all those). It works by computing a list of all characters that (singly) fold to another one, and then checking each of those. The maximum length of the list is 3 in the current Unicode standard. I believe that a better long-term solution is to do this at compile rather than execution time, by generating a closure of everything matched. But this can't be done now because the data structure would need to be extensively revamped to list all non-byte characters, and user-defined \p{} matches are not known at compile-time. And it doesn't handle the multi-char folds. There is a separate ticket for those.
* full API for cop hint hashesZefram2010-10-211-2/+2
| | | | | | | | | | | | | Expose cop hint hashes as a type COPHH, with a cophh_* API which is a macro layer over the refcounted_he_* API. The documentation for cophh_* describes purely API-visible behaviour, whereas the refcounted_he_* documentation describes the functions mainly in terms of the implementation. Revise the cop_hints_* API, using the flags parameter consistently and reimplementing in terms of cophh_*. Use the cophh_* and cop_hints_* functions consistently where appropriate. [Modified by the committer to update two calls to Perl_refcounted_he_fetch recently added to newPMOP.]
* add lex_start to the APIZefram2010-10-211-1/+1
| | | | | lex_start() is added to the API, marked experimental, and documented. It also gains a flags parameter for foreseeable future use.
* replace PL_doextract with better kinds of variableZefram2010-10-211-18/+15
| | | | | | | | PL_doextract had two unrelated jobs, neither best served by an interpreter global variable. The first was to track the -x command-line switch. That is replaced with a local variable in S_parse_body(). The second was to track whether the lexer is in the middle of a =pod section. That is replaced with an element in PL_parser.
* remove filter inheritance option from lex_startZefram2010-10-211-1/+1
| | | | | | | | 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.
* Create populate_isa() to de-duplicate logic to populate @ISA.Nicholas Clark2010-10-091-9/+38
| | | | | | | Previously yylex() was conditionally populating @AnyDBM_File::ISA (if it was not set, and the token dbmopen was seen), and init_predump_symbols() was populating @IO::File::ISA (unconditionally, but this is so early that nothing previously could have set it). This refactoring eliminates code duplication.
* eval_sv: followup fix to 4aca2f62efDavid Mitchell2010-10-031-4/+5
| | | | | My original fix broke the 'goto redo_body' path. Not that anything tests for this!
* better documentation for eval_sv() and G_KEEPERRDavid Mitchell2010-10-031-1/+2
|
* eval_sv() and eval_pv() don't fail on syntax errDavid Mitchell2010-10-031-7/+6
| | | | | | [perl #3719] eval_sv("some syntax err") cleared $@ and didn't return a failure indication. This also affected eval_pv() which calls eval_sv(). Fix this and add lots of tests.
* call defout/stderr destructors lastDavid Mitchell2010-09-201-5/+0
| | | | | | | | When calling the destructors for IO objects embedded in arena GVs, process PL_defoutgv and PL_stderrgv last. Yes, the test suite expects STDOUT to still work at this point. Indeed, one test in ref.t calls print from STDOUT's destructor (which is why pp_print needed a slight tweak to handle a null GV properly).
* fix PL_psig_pend freeingDavid Mitchell2010-09-201-2/+0
| | | | | | Commit 31c91b4357905486e81f901ad079da5735bdb7ba added a block of code to free PL_psig_pend in a signal-safe way, but omitted to remove the original unsafe freeing code above it. Removed with this commit.
* [perl #40388] perl_destruct() leaks PL_main_cvDavid Mitchell2010-09-201-0/+4
| | | | Well yes, it does, kinda; but it's harmless. Add a comment to that effect.
* [perl #40389] perl_destruct() leaks PL_defstashDavid Mitchell2010-09-201-0/+2
| | | | | | | | | | | | | | | | | With PERL_DESTRUCT_LEVEL >= 1, PL_defstash is explicitly freed, but doesn't actually get freed at that point due to a reference loop between %:: and *::. Break that loop to ensure that PL_defstash gets freed at that point. Actually, its not as serious as it sounds, as it would get freed a bit later anyway by sv_clean_all(), but this new way has these benefits: * it gets freed where you expect it to be * it gets freed cleanly, rather than by the more brutal sv_clean_all() (which can leave dangling pointers to freed SVs) * since its freed while *not* under the influence of PL_in_clean_all = TRUE, it's more likely to flag up bugs related to double-freeing etc. Indeed, the two previous commits to this are a result of that.
* function interface to parse Perl statementZefram2010-09-061-1/+1
| | | | | | | | | | | | | yyparse() becomes reentrant. The yacc stack and related resources are allocated in yyparse(), rather than in lex_start(), and they are localised to yyparse(), preserving their values from any outer parser. yyparse() now takes a parameter which determines which production it will parse at the top level. New API function parse_fullstmt() uses this facility to parse just a single statement. The top-level single-statement production that is used for this then messes with the parser's head so that the parsing stops without seeing EOF, and any lookahead token seen after the statement is pushed back to the lexer.
* PL_my_cxt_list is only available with PERL_IMPLICIT_CONTEXTTony Cook2010-09-011-0/+2
|
* PL_my_cxt_list leaksJirka Hruška2010-09-011-0/+4
| | | | | | [perl #77352] PL_my_cxt_list was never freed
* Remove CALL_FPTR and CPERLscope.Ben Morrow2010-08-201-1/+1
| | | | | | | | | | | | | | | | 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.
* For both opmini.o and perlmini.o define PERL_EXTERNAL_GLOB and PERL_IS_MINIPERLNicholas Clark2010-08-161-0/+3
| | | | | | Previously only opmini.o was compiled with -DPERL_EXTERNAL_GLOB, and only perlmini.o with -DPERL_IS_MINIPERL. Add "PERL_EXTERNAL_GLOB" to the output of (mini)perl -V if it is defined.
* DEBUG_LEAKING_SCALARS: add sv_debug_parentDavid Mitchell2010-08-011-2/+3
| | | | | Rather than just recording whether an SV was cloned (sv->sv_debug_cloned), record the address of the SV we were cloned from.
* Check API compatibility when loading xs modulesFlorian Ragwitz2010-07-261-0/+2
| | | | | | | | | | | | | This adds PL_apiversion, allowing the API version of a running interpreter to be introspected. It is used in the new XS_APIVERSION_BOOTCHECK macro, which is added to the _boot function of every XS module, to compare it against the API version the module has been compiled against. If the versions do not match, an exception is thrown. This doesn't fully prevent binary incompatible extensions to be loaded. It merely compares PERL_API_* between compile- and runtime, and does not attempt to solve the problem of identifying binary incompatible perls with the same API version (i.e. the same perl version configured with and without DEBUGGING).
* Add Perl_init_dbargs(), to set up @DB::args without losing SV references.Nicholas Clark2010-07-211-3/+18
|
* Remove -w recommendation in perl -hDavid Golden2010-06-071-1/+1
| | | | | | | | | Abigail already said it best: I do not think 'perl -h' is the place to give recommendations on how code should be written. 'perl -h' gives a list and a brief explanation of the command line switches. IMO, it should do just that, and nothing else.
* When assigning to $^P, don't zero $DB::single, $DB::trace and $DB::signal.Nicholas Clark2010-05-291-3/+6
| | | | | | | Previously, whenever a true value was assigned to $^P, all 3 were set to 0. Now only set them to 0 if they aren't already SvIOK(). Resolves RT #72422.
* Make HvFILL() count the allocated buckets, instead of reading a stored value.Nicholas Clark2010-05-211-1/+0
| | | | | Add a function Perl_hv_fill to perform the count. This will save 1 IV per hash, and on some systems cause struct xpvhv to become cache aligned.
* unwinding target nominated by separate globalZefram2010-04-251-0/+4
| | | | | | | | 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.
* In Perl_get_debug_opts(), restructure the message into fewer string literals.Nicholas Clark2010-04-171-26/+26
| | | | This reduces the object code size slightly.
* In S_usage(), restructure the storage of the help message into fewer literals.Nicholas Clark2010-04-171-36/+36
| | | | This reduces the object code size slightly.
* revert "revert perl -h changes"David Golden2010-04-131-2/+6
| | | | | Reapplies commit 482d21b3db741a7f6b59279ab7ad289307e2186b that was reverted in commit bb87c82accf79d3e15da7fc9b646232a4c2bd47c
* Fix comments about @INC orderingRafael Garcia-Suarez2010-03-081-2/+2
|
* revert perl -h changesDavid Golden2010-02-111-6/+2
|
* keep -h to 80 characters or lessDavid Golden2010-02-101-2/+2
|
* Help new users learn how to get helpDavid Golden2010-02-101-0/+4
|
* Improvements to 31c9a3 - CPAN code did depend on the previous behaviour of ↵Nicholas Clark2010-02-061-0/+24
| | | | | | | | | | | | | | | | | | | blessing filehandles into FileHandle It turns out that it's not quite as simple as blessing into IO::File. If you do (just) that, then it breaks any existing code that does C<require IO::Handle;> to allow it to call methods on file handles, because they're blessed into IO::File, which isn't loaded. (Note this code doesn't assume that methods in IO::Seekable are there to be called) So, it all should work if you also set @IO::File:::ISA correctly? That way, code that assumes that methods from IO::Handle can be called will work. However, gv.c now starts complaining (but not failing) if IO::Handle, IO::Seekable and Exporter aren't present, because it goes looking for methods in them. So the solution seems to be to set @IO::File::ISA *and* create (empty) stashes for the other 3 packages. Patch appended, but not applied.
* Add USE_PERL_ATOF to the list of -V's compile-time options.Nicholas Clark2010-01-211-0/+3
|
* Changed Copyright year as suggested by karl williamson in ↵Abigail2010-01-131-2/+3
| | | | http://nntp.perl.org/group/perl.perl5.porters/155493
* include sv_debug_serial field in debugging outputDavid Mitchell2010-01-081-2/+3
|