summaryrefslogtreecommitdiff
path: root/dump.c
Commit message (Collapse)AuthorAgeFilesLines
* [perl #85026] Iterate hashes by hand during do_sv_dumpTon Hospel2011-06-111-12/+24
| | | | | | | | | A further note: while debugging this issue it was annoying that Devel::Peek::Dump doesb't actually dump the HASH elements when an iterator is active. Also added is a patch that does the iteration to dump the HASH contents by iterating over it by hand (not disturbing any active iterator). With that it also doesn't activate hash magic during iteration, which I think is a feature
* Revert "Perl_do_sv_dump: alert when skipping elements"Father Chrysostomos2011-06-111-27/+22
| | | | | | | This reverts commit 002beaef76a1595af2e39ffd4cd55c595bd6c271. I am about to apply the manual-iteration patch from ticket #85026. It conflicts with 002beaef, but it also renders 002beaef unnecessary.
* Generate magic_names in dump.c using mg_vtable.pl.Nicholas Clark2011-06-111-43/+1
|
* Provide the names of the magic vtables in PL_magic_vtable_names[].Nicholas Clark2011-06-111-33/+5
| | | | | | As it's a 1 to 1 mapping with the vtables in PL_magic_vtables[], refactor Perl_do_magic_dump() to index into it directly to find the name for an arbitrary mg_virtual, avoiding a long switch statement.
* Replace references to PL_vtbl_{bm,fm} in the code with PL_vtbl_regexp.Nicholas Clark2011-06-111-2/+0
| | | | | Also, in Perl_sv_magic() merge the case for PERL_MAGIC_dbfile with the others that return a NULL vtable.
* Abolish PL_vtbl_sig. It's been all 0s since it was added in 5.0 alpha 2.Nicholas Clark2011-06-111-1/+0
| | | | | Magic with a NULL vtable is equivalent to magic with a vtable of all 0s. On CPAN, only Apache::Peek's code for 5.005 is referencing it.
* Don't even declare PL_vtbl_sigelem under -DPERL_MICRONicholas Clark2011-06-111-0/+2
| | | | This turns out to be a simpler solution than 9ba75e3cf905a6e6.
* Store FBMs in PVMGs, instead of GVs.Nicholas Clark2011-06-111-7/+8
| | | | | | | | This should reduce the complexity of code dealing with GVs, as they no longer try to play several different incompatible roles. (As suggested by Ben Morrow. However, it didn't turn out to be as straightforward as one might have hoped).
* Use SvTAIL() instead of BmFLAGS(). The core no longer uses BmFLAGS().Nicholas Clark2011-06-111-1/+0
|
* Test that SvFLAGS() & SVpad_NAME is SVpad_NAME, not just non-zero.Nicholas Clark2011-06-111-3/+5
| | | | | In Perl_find_rundefsv() and PAD_COMPNAME_FLAGS_isOUR(), replace longhand flags test with SvPAD_OUR().
* Perl_do_sv_dump() shouldn't show "IV" for a FBM, as it's not valid.Nicholas Clark2011-06-111-2/+2
| | | | | | | The memory is used for part of the FBM state. Tidy the order of conditions in the if() determining whether the IV/UV should be shown.
* In Perl_pv_escape(), avoid reading 1 byte beyond the end of the buffer.Nicholas Clark2011-05-241-1/+1
| | | | | | | | The check for whether to use 3 digits of octal was not correct, and was capable of reading the byte beyond the passed in buffer. Except for the small possibility that that byte was not mapped memory, it wouldn't change the semantic correctness of the escaped output, but it would lead to non-deterministic choice of which format to use.
* Clean: Actually use HvUSEDKEYS() instead of HvKEYS()Michael Witten2011-05-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This: commit 8aacddc1ea3837f8f1a911d90c644451fc7cfc86 Author: Nick Ing-Simmons <nik@tiuk.ti.com> Date: Tue Dec 18 15:55:22 2001 +0000 Tidied version of Jeffrey Friedl's <jfriedl@yahoo.com> restricted hashes - added delete of READONLY value inhibit & test for same - re-tabbed p4raw-id: //depot/perlio@13760 essentially deprecated HvKEYS() in favor of HvUSEDKEYS(); this is explained in line 144 (now 313) of file `hv.h': /* * HvKEYS gets the number of keys that actually exist(), and is provided * for backwards compatibility with old XS code. The core uses HvUSEDKEYS * (keys, excluding placeholdes) and HvTOTALKEYS (including placeholders) */ This commit simply puts that into practice, and is equivalent to running the following (at least with a35ef416833511da752c4b5b836b7a8915712aab checked out): git grep -l HvKEYS | sed /hv.h/d | xargs sed -i s/HvKEYS/HvUSEDKEYS/ Notice that HvKEYS is currently just an alias for HvUSEDKEYS: $ git show a35ef416833511da752c4b5b836b7a8915712aab:hv.h | sed -n 318p #define HvKEYS(hv) HvUSEDKEYS(hv) According to `make tests': All tests successful.
* Store the compiled format in mg_ptr instead of after SvCUR() - fixes RT #89218Nicholas Clark2011-05-181-1/+0
| | | | | | | | | | | | | | | | | | | | | Formats are compiled down to a sequence of U32 opcodes in doparseform(). Previously the block of opcodes was stored in the buffer of SvPVX() after the raw string by extending the buffer, and calculating the first U32 aligned address after SvCUR(). A flag bit on the scalar was set to signal this hackery, tested with SvCOMPILED() The flag bit used happened to be the same as one of the two used by to signal Boyer-Moore compiled scalars. The assumption was that no scalar can be used for both. Unfortunately, this isn't quite true. Given that the scalar is alway upgraded to PVMG to add PERL_MAGIC_fm magic, to clear the cached compiled version, there's no extra memory cost in using mg_ptr in the MAGIC struct to point directly to the block of U32 opcodes. The test for "is there a compiled version" can switch to mg_find(..., PERL_MAGIC_fm) returning a pointer, and the use of a flag bit abolished. Retain SvCOMPILED() and SvCOMPILED_{on,off}() as compatibility for XS code on CPAN - the first is always 0, the other two now no-ops.
* Fix excess whitespace in pod.Michael Stevens2011-02-041-3/+3
|
* Perl_do_sv_dump: dump REGEXP bodyDavid Mitchell2011-01-301-4/+85
| | | | | Now that a regexp is a first-class SV, dump all the fields of the 'struct regexp': it's just another SV body type
* Perl_do_sv_dump: move stub REGEXP codeDavid Mitchell2011-01-301-7/+6
| | | | | SVt_REGEXP was in the 'general SV fields' section; move it to the 'type-specific SV fields' section. Not that it does anything yet.
* Perl_do_sv_dump: add some blank lines and headersDavid Mitchell2011-01-301-0/+23
| | | | | | Make this long function easier on the eye by separating "paragraphs" with a blank lines, and with a comment at the start of each major section.
* Remove vestigial ORANGE referencesDavid Mitchell2011-01-301-1/+1
| | | | | This was a temporary type used while regexes were in the process of being promoted to first-class SVs
* clear up unused var warning in prev patchChip Salzenberg2011-01-211-1/+3
|
* Since xmldump_packsubs does not actually output XML, don't call it from ↵Chip Salzenberg2011-01-211-1/+0
| | | | xmldump_all.
* pv_escape: Add option to dump all non-ascii as hexKarl Williamson2010-12-191-5/+9
| | | | | | | This patch adds an option to pv_escape() to dump all characters above ASCII in hex. Before, you could get all chars as hex or the Latin1 non-ASCII as octal, whereas the typical values for these that people think in are given in hex.
* dump.c: correct pod statementKarl Williamson2010-12-191-5/+4
|
* Refactor ENAME dumping in Perl_do_sv_dump() to simplify the code slightly.Nicholas Clark2010-11-251-19/+16
| | | | | Simpler code avoids the need for a comment explaining how the complex code was working. Also use newSVpvs_flags() in place of sv_newmortal() and sv_setpv().
* Convert xhv_name in struct xpvhv_aux to be a union of HEK* and HEK**Nicholas Clark2010-11-241-2/+2
| | | | | This avoids a lot of casting. Nothing outside the perl core code is accessing that member directly.
* Clarify the hekp assignment in dump.cFather Chrysostomos2010-11-221-0/+7
|
* Fix NAMECOUNT output format in dump.cFather Chrysostomos2010-10-291-2/+2
| | | | Remove quotation marks and, as a bonus, eliminate a compiler warning.
* Teach dump.c about all magic flagsFlorian Ragwitz2010-10-291-5/+11
| | | | | Also rearrange the flags according to their value and trim some trailing whitespace in that area.
* Teach dump.c about ENAMEsFather Chrysostomos2010-10-281-0/+31
|
* plugin mechanism to rewrite calls to a subroutineZefram2010-10-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | New magic type PERL_MAGIC_checkcall attaches a function to a CV, which will be called as the second half of the op checker for an entersub op calling that CV. Default state, in the absence of this magic, is to process the CV's prototype if it has one, or apply list context to all the arguments if not. New API functions cv_get_call_checker() and cv_set_call_checker() provide a clean interface to this facility, hiding the internal use of magic. Expose in the API the new functions rv2cv_op_cv(), ck_entersub_args_list(), ck_entersub_args_proto(), and ck_entersub_args_proto_or_list(), which are meaningful segments of standard entersub op checking and are likely to be useful in plugged-in call checker functions. Expose new API function op_contextualize(), which is a public interface to the internal scalar()/list()/scalarvoid() functions. This API is likely to be required in most plugged-in call checker functions. Incidentally add new function mg_free_type(), in the API, which will remove magic of one type from an SV. (mg_free() removes all magic, and there isn't anything else more selective.)
* Remove MEMBER_TO_FPTR.Ben Morrow2010-10-061-2/+2
| | | | This is left over from PERL_OBJECT (see beeff2, 16c915, and so on).
* systematically provide pv/pvn/pvs/sv quartetsZefram2010-09-281-0/+7
| | | | | Anywhere an API function takes a string in pvn form, ensure that there are corresponding pv, pvs, and sv APIs.
* prevent Devel::Peek::Dump from lieing to us about evil class namesYves Orton2010-08-251-1/+8
| | | | | While one certainly can argue the merits of using a class name like "\0", it is legal so lets avoid it confusing our primary debugging tool.
* 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.
* DEBUG_LEAKING_SCALARS: add sv_debug_parentDavid Mitchell2010-08-011-2/+2
| | | | | Rather than just recording whether an SV was cloned (sv->sv_debug_cloned), record the address of the SV we were cloned from.
* Dump didn't display CVf_ISXSUB flagDavid Mitchell2010-07-291-1/+2
|
* Perl_do_sv_dump didn't increase nesting for magicDavid Mitchell2010-07-291-1/+1
|
* Perl_do_sv_dump: alert when skipping elementsDavid Mitchell2010-07-291-22/+27
| | | | | | When dumping an HV, we skip dumping the elements if the iterator is already in use. Explain this in the dump output so people like me aren't left wondering why the elements have vanished.
* add CVf_CVGV_RC flagDavid Mitchell2010-07-181-1/+2
| | | | | | | | | | | | | after the recent commit 803f274831f937654d48f8cf0468521cbf8f5dff, the CvGV field is sometimes reference counted. Since it was intended that the reference counting would happen only for anonymous CVs, the CVf_ANON flag was co-opted to indicate whether RC was being used. This is not entirely robust; for example, sub __ANON__ {} is a non-anon sub which points to the same GV used by anon subs, which while itself doesn't directly break things, shows that the potential for breakage is there. So add a separate flag just to indicate the reference count status of the CvGV field.
* Sort and complete the op flags lists for op_dump()Vincent Pit2010-07-111-11/+20
|
* Remove extraneous semicolon from OP_PRIVATE_ONCE.Craig A. Berry2010-06-031-1/+1
| | | | | | | | | Thus silencing compiler noise like: OP_PRIVATE_ONCE(op_aassign, OPpASSIGN_COMMON, ",COMMON"); ........................................................^ %CC-I-EXTRASEMI, Extraneous semicolon. at line number 846 in file D0:[craig.blead]dump.c;1
* Migrate most other op_private to name conversion into S_op_private_to_names().Nicholas Clark2010-05-281-57/+38
|
* In Perl_do_op_dump(), move calls to append_flags() into S_op_private_to_names()Nicholas Clark2010-05-281-12/+34
|
* Add C_ARRAY_END(), returning a pointer to after the last element of an array.Nicholas Clark2010-05-281-1/+1
| | | | Refactor the macro append_flags() in dump.c to use it.
* In Perl_do_op_dump(), reorder the ops within the if (o->op_private) clause.Nicholas Clark2010-05-281-29/+29
|
* In Perl_do_sv_dump(), use append_flags() for PVCV, PVFM and PVGP flags.Nicholas Clark2010-05-281-22/+38
|
* In Perl_do_sv_dump(), for PVCV and PVFM, test for SvCOMPILED(sv) last.Nicholas Clark2010-05-281-1/+1
|
* In Perl_do_op_dump(), move runs of op_private name tests to S_append_flags().Nicholas Clark2010-05-281-47/+44
|
* Create S_append_flags() from a common code pattern in dump.c.Nicholas Clark2010-05-281-44/+64
| | | | | | | | Convert repetitive sequences of "if this bit is set, append that string" into structures and a function call. Use a custom macro append_flags() to make calling it easer. This makes the object code slightly smaller.
* add OPpDEREFed flag to avoid double mg_get()David Mitchell2010-05-251-0/+5
| | | | | | | | | | | | | The previous commit made various ops such as rv2av unconditionally do an SvGETMAGIC(). Under some circumstances this could cause a double mg_get() (and hence double FETCH etc). In particular, when the proceeding op was something like aelem with OPpDEREF, the aelem would call vivify_ref(), which would call magic. So in peep(), mark OP_RV2[SAH]V ops with the new OPpDEREFed flag if the preceding op was OPpDEREF. Then use this flag to avoid a second dose of magic. Note that RV2GV probably needs this flag too, but there weren't any spare private flag bits left for that op (I think).