In perl.git, the branch davem/shpv_poc has been created
<http://perl5.git.perl.org/perl.git/commitdiff/ef06c870d4160393a9c572e2e8dd4869ab42f098?hp=0000000000000000000000000000000000000000>
at ef06c870d4160393a9c572e2e8dd4869ab42f098 (commit)
- Log -----------------------------------------------------------------
commit ef06c870d4160393a9c572e2e8dd4869ab42f098
Author: David Mitchell <[email protected]>
Date: Wed Mar 22 14:48:01 2017 +0000
implement SVt_SHPVs
Proof-of-concept:
Use the sv_any and sv_u fields of an SV head to directly store
a short (<=14 chars + '\0' on 64-bit system) string, dispensing with
the need for an SV body or mallocing a PVX buffer.
The current status is that miniperl compiles and can handle simple
programs containing simple strings, but asserts/crashes on anything complex.
Currently it only works on 64-bit platforms, due to the buffer size in
SvSHPV_size being hard-coded.
The next major thing to do would be to replace all the direct PVX
allocation code in the core, i.e. uses of SvPV_free() and SvPV_set().
But code like
sv = (... an SVt_SHPV SV...);
s = SvPV(sv,len);
SvUPGRADE(sv, SVt_PVMG); /* or SVt_PVIV etc */
/* s is now invalid */
is possibly too widespread to make this a viable scheme.
M dump.c
M sv.c
M sv.h
commit e7ce568758a237c4f26814fe0a61e59dbc971352
Author: David Mitchell <[email protected]>
Date: Tue Mar 21 15:46:02 2017 +0000
make SvCUR() etc handle SVt_SHPV
Rather than SvCUR() just accessing the xpv_cur field, make what it does
conditional on whether the SV's type is SVt_SHPV.
Note that nothing yet creates SVt_SHPV SVs. This is rough proof of concept
code which at this stage is intended to benchmark what performance penalty
is incurred by adding a condition to each of SvCUR(), SvLEN, SvPVX, SvEND.
The SvTYPE(sv) == SVt_SHPV being true branch may not even be correct yet,
as its not exercised.
This commit point-patches various cpan/ modules to avoid using SvCUR() etc
in lvalue context.
[SVt_SHPV SVs are intended for short strings (< 16 chars on 64-bit
systems) where the string is stored in the head of the SV field
(using the sv_any and sv_u fields as a buffer) and has no body, with SvLEN
being always 15 and SvCUR stored in the last bytes of string buffer.]
M cpan/Encode/Byte/Makefile.PL
M cpan/Encode/CN/Makefile.PL
M cpan/Encode/EBCDIC/Makefile.PL
M cpan/Encode/Encode.xs
M cpan/Encode/Encode/Makefile_PL.e2x
M cpan/Encode/JP/Makefile.PL
M cpan/Encode/KR/Makefile.PL
M cpan/Encode/Symbol/Makefile.PL
M cpan/Encode/TW/Makefile.PL
M cpan/Encode/bin/enc2xs
M doop.c
M ext/XS-APItest/APItest.xs
M gv.c
M sv.h
M toke.c
M universal.c
M vutil.c
commit c9ac72150863674f7dfca1522dcc6056bb5d1667
Author: David Mitchell <[email protected]>
Date: Thu Mar 23 10:12:43 2017 +0000
fixup Perl_fbm_compile
M util.c
commit f46ed0bf9857a6f807b72d1203f08bb27d6a3c4e
Author: David Mitchell <[email protected]>
Date: Thu Mar 23 09:34:00 2017 +0000
PERL_DEBUG_PAD_ZERO(): use SvCUR_set()
M perl.h
commit 603aacca711bb924a2afab13b1574b7e7ab35610
Author: David Mitchell <[email protected]>
Date: Tue Mar 21 13:59:20 2017 +0000
add SVt_SHPV type
(It doesn't do anything yet)
This is rough Proof-of-Concept code
M dump.c
M ext/B/B.pm
M ext/B/B.xs
M perl.h
M sv.c
M sv.h
commit 000c7495aa2efe410fd8c5b3c310a49d0be5bf47
Author: David Mitchell <[email protected]>
Date: Wed Mar 22 21:13:42 2017 +0000
fixup Perl_do_vop()
The memzero() has over the years inadvertently become nearly a noop,
zeroing only the single btye at the end; remove it for now.
Move the SvCUR_set() till after the SvGROW() is any, otherwise you have
cur temporarily pointing beyond the end of the buffer.
Not sure if these changes are 100% correct, bu they pass all tests
M doop.c
-----------------------------------------------------------------------
--
Perl5 Master Repository