summaryrefslogtreecommitdiff
path: root/embed.h
Commit message (Collapse)AuthorAgeFilesLines
* regcomp.c: Fix memory leak regressionNicholas Clark2011-05-261-1/+0
| | | | | | | | There was a remaining memory leak in the new inversion lists data structure under threading. This solves it by changing the implementation to use a SVpPV instead of doing our own memory management. Then the already existing code for handling SVs returns the memory when done.
* add hfree_next_entry(), hv_free_ent_ret()David Mitchell2011-05-191-0/+1
| | | | | | | | | | | | | Move body of hfreeentries()' central loop into a new function, hfree_next_entry(); leaving hfreeentries() as a simple loop that calls hfree_next_entry() until there are no entries left. This will in future allow sv_clear() to free a hash iteratively rather than recursively. Similarly, turn hv_free_ent() into a thin wrapper around a new function, hv_free_ent_ret(), which doesn't free HeVAL(), but rather just returns the SV instead.
* utf8.c: Add _flags version of to_utf8_fold()Karl Williamson2011-05-031-2/+2
| | | | | | | | | | And also to_uni_fold(). The flag allows retrieving either simple or full folds. The interface is subject to change, so these are marked experimental and their names begin with underscore. The old versions are turned into macros calling the new versions with the correct extra parameter.
* Make push/shift $scalar accept only unblessed aryrefsFather Chrysostomos2011-04-181-1/+0
| | | | See ticket #80626.
* Add depth parameter to reg_namedseqKarl Williamson2011-03-201-1/+1
|
* regcomp.c: Merge identical functionsKarl Williamson2011-03-081-1/+0
| | | | | These two functions now have identical code, so merge them, but use a macro in case they ever need to diverge again.
* Avoid miniperl SEGVing when processing -I on the #! lineNicholas Clark2011-03-051-1/+5
| | | | | | | | | | | | | | | | | | 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.
* regcomp.c: Add parameters to fcnsKarl Williamson2011-02-271-2/+2
| | | | | | A pointer to the list of multi-char folds in an ANYOF node is now passed to the routines that set the bit map. This is in preparation for those routines to add to the list
* regcomp.c: Add fcn add_cp_to_invlist()Karl Williamson2011-02-271-0/+1
| | | | | This is just an inline shorthand when a single code point is all that is needed. A macro could have been used instead, but this just seemed nicer.
* regcomp.c: Factor code into a function.Karl Williamson2011-02-271-0/+1
| | | | A future commit uses this same code, so put it into a common place.
* handy.h: isIDFIRST_utf8() changed to use XIDStartKarl Williamson2011-02-171-0/+2
| | | | | | | | | | Previously this used a home-grown definition of an identifier start, stemming from a bug in some early Unicode versions. This led to some problems, fixed by #74022. But the home-grown solution did not track Unicode, and allowed for characters, like marks, to begin words when they shouldn't. This change brings this macro into compliance with Unicode going-forward.
* foldEQ_utf8: Add version with flags parameterKarl Williamson2011-02-141-1/+1
| | | | | The parameter doesn't do anything yet. The old version becomes a macro calling the new version with 0 as the flags.
* regcomp.c: Put two static functions in embed.fncKarl Williamson2011-02-141-0/+2
|
* Fix up \cX for 5.14Karl Williamson2011-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Throughout 5.13 there was temporary code to deprecate and forbid certain values of X following a \c in qq strings. This patch fixes this to the final 5.14 semantics. These are: 1) a utf8 non-ASCII character will croak. This is the same behavior as pre-5.13, but it gives a correct error message, rather than the malformed utf8 message previously. 2) \c{ and \cX where X is above ASCII will generate a deprecated message. The intent is to remove these capabilities in 5.16. The original agreement was to croak on above ASCII, but that does violate our stability policy, so I'm deprecating it instead. 3) A non-deprecated warning is generated for all other \cX; this is the same as throughout the 5.13 series. I did not have the tuits to use \c{} as I had planned in 5.14, but \N{} can be used instead.
* Move grok_bslash_c to dquote.c and make staticKarl Williamson2011-02-091-1/+1
| | | | No other changes were made
* Move grok_blsash_o and make staticKarl Williamson2011-02-091-1/+1
| | | | | | This function is only used in the same places as dquote_static.c is used, so move it there, and we won't have to worry about changing its API will break something. No other changes made
* Add initial inversion list objectKarl Williamson2011-02-021-0/+15
| | | | | | | | | | | | | | | Going forward the intent is to convert from swashes to the better-suited inversion list data structure. This adds rudimentary inversion lists that have only the functionality needed for 5.14. As a result, they are as much as possible static to one file. What's necessary for 5.14 is enough to allow folding of ANYOF nodes to be moved from regexec to regcomp. Why they are needed for that is to generate as compact as possible class definitions; otherwise, very long linear lists might be generated. (They still may be, but that's inherent in the problem domain; this generates as compact as possible, combining overlapping ranges, etc.) The only two non-trivial methods in this object are from published algorithms.
* embed.fnc: Add E flag to regcurly entryKarl Williamson2011-01-291-3/+3
| | | | On C++ builds, it wasn't getting seen in extensions.
* Use embed.pl inline capabilities for regcurlyKarl Williamson2011-01-291-0/+3
| | | | Change the regcurly definition to use the new inline abilities.
* Break out the generated function Perl_keywords() into keywords.c, a new file.Nicholas Clark2011-01-241-1/+0
| | | | | | | | As it and Perl_yylex() both need FEATURE_IS_ENABLED, feature_is_enabled() is no longer static, and the two macro definitions move from toke.c to perl.h Previously, one had to cut and paste the output of perl_keywords.pl into the middle of toke.c, and it was not clear that it was generated code.
* Move all the generated file header printing into read_only_top()Nicholas Clark2011-01-231-4/+4
| | | | | | | | | Previously all the scripts in regen/ had code to generate header comments (buffer-read-only, "do not edit this file", and optionally regeneration script, regeneration data, copyright years and filename). This change results in some minor reformatting of header blocks, and standardises the copyright line as "Larry Wall and others".
* Add check_utf8_print()Karl Williamson2011-01-091-0/+1
| | | | | | | This new function looks for problematic code points on output, and warns if any are found, returning FALSE as well. What it warns about may change, so is marked as experimental.
* regen/opcode.pl should only generate prototypes for pp_* functions that exist.Nicholas Clark2011-01-091-1/+0
| | | | | | | It now generates prototypes for all functions that implement OPs. Hence Perl_unimplemented_op no longer needs a special-case prototype. As it is now generating a prototype for Perl_do_kv, no need for regen/embed.pl to duplicate this. Convert the last two users of the macro do_kv() to Perl_do_kv(aTHX).
* Generate pp_* prototypes in pp_proto.h, and remove pp.symNicholas Clark2011-01-091-366/+1
| | | | | | | | | | | 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)
* Rename tied_handle_method() to tied_method(), and make it non-static.Nicholas Clark2011-01-051-0/+3
| | | | It can be used for (at least) the call to "SPLICE" from pp_splice.
* [perl #36347] Object destruction incompleteFather Chrysostomos2011-01-021-0/+1
| | | | | | | | | | | | | | | | | | | do_clean_objs only looks for objects referenced by RVs, so blessed array references and lexical variables (and probably other SVs, too) are not DESTROYed. This commit adds a new visit() call to sv_clean_objs, which curses (DESTROYs and un-blesses, leaving the reference count as it is) any objects that are still left after do_clean_named_io_objs. The new do_curse routine (a pointer to which is passeds to visit()) follows do_clean_named_io_objs’ example and explicitly skips the STDOUT and STDERR handles, in case destructors need to use them. The cursing code, which is now called from two places, is moved out of sv_clear and put in its own routine. The check that the reference count is zero does not apply when called from sv_clean_objs, so the new S_curse routine takes a boolean argument that determines whether that check should take place.
* Argument op to report_evil_fh() is always PL_op->op_type, so need not be passedNicholas Clark2010-12-281-1/+1
|
* The io argument to report_evil_fh() is always GvIO(gv), so need not be passed.Nicholas Clark2010-12-281-1/+1
|
* Extract the OP_phoney_* code from report_evil_fh() into report_wrongway_fh()Nicholas Clark2010-12-281-0/+1
| | | | | Previously Perl_report_evil_fh()'s body was just an if/else at the top level - a good sign that it is actually implementing two disjoint functions.
* Move do_chomp() from pp.c to doop.c, and make it static.Nicholas Clark2010-12-271-1/+1
| | | | It was never part of the public API, and only ever used by pp_{s,}cho{,m}p.
* Merge Perl_do_chop() and Perl_do_chomp().Nicholas Clark2010-12-271-2/+1
| | | | | | They share code for dealing with PVAVs, PVHVs, read only values and handling PL_encoding. They are not part of the public API, and Google codesearch shows no users outside the core.
* Convert Perl_do_chomp() to the same prototype as Perl_do_chop().Nicholas Clark2010-12-271-1/+1
| | | | Pass in an SV to hold the count, rather than returning the count.
* recursive-descent expression parsingZefram2010-12-111-0/+4
| | | | | | New API functions parse_fullexpr(), parse_listexpr(), parse_termexpr(), and parse_arithexpr(), to parse an expression at various precedence levels.
* Add mg_findextFlorian Ragwitz2010-11-301-0/+1
|
* Add sv_unmagicextFlorian Ragwitz2010-11-301-0/+1
|
* Add Perl_foldEQ_latin1()Karl Williamson2010-11-281-0/+1
| | | | | | | | | | This function compares two non-utf8 strings to see if they are equivalent without regards to case differences. It does not work nor check for three problematic code points that require special handling: MICRO_SIGN, LATIN_SMALL_LETTER_SHARP_S, and LATIN_SMALL_LETTER_Y_WITH_DIAERESIS. make regen required
* [perl #78908] Reinstate mod for one more stable releaseFather Chrysostomos2010-11-261-0/+1
|
* mro_package_moved must act on all effective namesFather Chrysostomos2010-11-221-1/+1
| | | | | | | | | | | | See the test case in the commit. It passes in 5.8.x and blead (as of this commit), but not 5.10-5.13.7. In every case the name to be passed to mro_gather_and_rename is cre- ated using an SV, so we might as well pass that instead of extracting the char array and length from it. That allows us to pass an AV instead, if there are multiple names to take into account.
* Add flags param to hv_ename_*Father Chrysostomos2010-11-201-2/+2
| | | | | We will need this for making the API UTF8-aware in 5.16 or whenever.
* Eliminate the newname param from mro_package_movedFather Chrysostomos2010-11-201-1/+1
| | | | Nothing is using this any more, as of the previous commit.
* hv_undef .= _flagsFather Chrysostomos2010-11-201-1/+0
| | | | | | | Add flags param to hv_undef. There is no mathom, as the changes that this will support are by no means suitable for maint.
* Convert newSUB() to a macro wrapping Perl_newATTRSUB()Nicholas Clark2010-11-171-1/+0
| | | | | Provide a Perl_newSUB() function in mathoms.c for anyone referencing it by its full name.
* Inline Perl_pad_undef() into its only caller, Perl_cv_undef().Nicholas Clark2010-11-161-1/+0
| | | | | Perl_pad_undef was never in the API, and has no users (elsewhere in core, on CPAN, or anywhere else visible to Google codesearch).
* mro_isa_changed_in3 is no longer necessaryFather Chrysostomos2010-11-111-1/+1
| | | | | | | | as of 80ebaca. It was nice while it lasted. This reverts 6f86b615fa.
* Fix package assignment with nested aliased packagesFather Chrysostomos2010-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | This commit fixes package assignments like *foo:: = *bar:: when both foo and bar contain nested stashes that are aliases of each other. mro_package_moved (actually, its auxiliary routine) need to keep a list of stashes that have been seen as a separate list from those that are going to have mro_isa_changed_in called on them. Otherwise, some stashes will simply not be iterated through. See the test that this adds and its comments. @ISA = @ISA should never have any effect visible to Perl (with a capital), but it does in that test case, prior to this commit. This also fixes another bug that the test case triggered: riter was not being reset before the second iteration in mro_gather_and_rename. Also, the stashes HV (aka the ‘big list’) now holds refcounts on its elements, as that makes the code simpler as a result of the changes.
* Add Perl_bytes_cmp_utf8() to compare character sequences in different encodingsNicholas Clark2010-11-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Convert sv_eq_flags() and sv_cmp_flags() to use it. Previously, to compare two strings of characters, where was was in UTF-8, and one was not, you had to either: 1: Upgrade the second to UTF-8 2: Compare the resulting octet sequence 3: Free the temporary UTF-8 string or: 1: Attempt to downgrade the first to bytes. If it can't be, they aren't equal 2: Else compare the resulting octet sequence 3: Free the temporary byte string Which for the general case involves a malloc()/free() and at least two O(n) scans per comparison. Whereas this approach has no allocation, a single O(n) scan, which terminates as early as the best case for the second approach.
* Inline sv_cmp() and sv_cmp_locale() as macros wrapping their flags variants.Nicholas Clark2010-11-111-2/+0
| | | | | | We can't move Perl_sv_cmp() and Perl_sv_cmp_locale() to mathoms.c, as they are referenced by function pointer in pp_sort.c - pointers which require the specific current calling signature.
* Change S_doopen_pm() and S_check_type_and_open() to take an SV parameter.Nicholas Clark2010-11-091-1/+1
| | | | | Previously S_doopen_pm() took a char */STRLEN pair, but it happened that the pointer was always from an SV. So pass the SV directly.
* [perl #75176] Symbol::delete_package does not free certain memory associated ↵Father Chrysostomos2010-11-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with package::ISA This commit makes @ISA changes and package aliasing update PL_isarev properly, removing old, unnecessary entries in addition to adding new entries. So now it is capable of shrinking, not just growing. ------------ Gory Details ------------ There is a chicken-and-egg problem when it comes to calling mro_isa_changed_in on the affected classes: When an isa linearisation is recalculated, it uses the existing linearisations of the super- classes (if any) (or at least the DFS implementation does). Since an assigned package (e.g., the *b:: in *a:: = *b::) can contain nested packages that inherit from each other in any order (b::c isa b::c::d or b::c::e isa b::c), this means that mro_isa_changed_in *must not* be called on any stash while another stash contains stale data. So mro_package_moved has been restructured. It is no longer recurs- ive. The recursive code for iterating through nested stashes has been moved into a separate, static routine: mro_gather_and_rename. Instead of calling mro_isa_changed_in during the iteration, it adds all the classes to ‘the big hash’, which mro_package_moved holds a pointer to. When mro_gather_and_rename returns, mro_package_moved iterates through the big hash twice: the first time to wipe caches; the second to call mro_isa_changed_in on all the stashes. This ‘big hash’ is now used in place of the seen_stashes that mro_package_moved used before. Both mro_package_moved and mro_isa_changed_in now use the existing mrometa->isa hash to determine which classes used to be superclasses of the stash in question. A separate routine, S_mro_clean_isarev, deletes entries mention in isa, except for those that still exist in the new isa hash. mro_isa_changed_in now does two iterations through isarev, just like mro_package_moved. It has to call get_linear_isa on the subclasses so that it can see what is in the new meta->isa hash created thereby. Consequently, it has to make sure that all the subclasses have their caches deleted before it can update anything. It makes the same changes to isarev for each subclass that are made further down on the class for which mro_isa_changed_in was called. Yes, it is repetitive. But calling mro_isa_changed_in recursively has more overhead and would do more unnecessary work. (Maybe we could make some macros for this repetitive code.) The loop through the superclasses near the end of mro_isa_changed_in no longer adds the subclasses to all the superclasses’ isarev hashes, because that is taken care of further up. ------------ Side Effects ------------ One result of this change is that mro::is_universal no longer returns true for classes that are no longer universal. I consider that a bug fix. ------------- Miscellaneous ------------- This also removes obsolete comments in mro_isa_changed_in, concerning fake and universal flags on stashes, that have been invalid since dd69841bebe.
* utf8.c: Add function to create inversion of swashKarl Williamson2010-11-071-0/+1
| | | | | | | | | | | | This adds _swash_inversion_hash() which takes a mapping swash and returns a hash that is the inverse relation. That is, given a code point, it allows quick lookup of all code points that map to it. The function is not for public use, as it will likely be revised, so is not in the public API, and it's name begins with underscore. It does not deal with multi-char mappings at this time, nor other swash complications.