In perl.git, the branch smoke-me/bulk88/rt125296-wip-COPFILE-threads has been 
created

<http://perl5.git.perl.org/perl.git/commitdiff/7731a87b2840c76ca49ca7c39405a8e1895f2654?hp=0000000000000000000000000000000000000000>

        at  7731a87b2840c76ca49ca7c39405a8e1895f2654 (commit)

- Log -----------------------------------------------------------------
commit 7731a87b2840c76ca49ca7c39405a8e1895f2654
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Fri Feb 26 03:29:54 2016 -0500

    CV's with DYNFILE can optionally store CHEK *s instead of Newx *s
    
    This commit removes duplicate paths caused by const subs. With this commit
    on this branch there are no duplicate file paths in an threaded perl
    process caused by perl core (paths and path fragments in PP pads are
    beyond the control of perl core). Below is example of callstack that
    allocates a Newx buffer for each CvFILE in a const sub. If
    a PP module has alot of const subs, there will be alot of duplicate
    paths in the heap. This callstack's curcop and PL_compiling is line 14 in
    strict.pm, line 14 is the BEGIN token. I suspect const subs are "*all_bits"
    and "*all_explicit_bits" since this breakpoint is hit twice with same
    curcop info.
    
    KernelBase.dll!_DebugBreak@0()      Unknown
    perl523.dll!Perl_mymemcpy(void * d=0x004b5674, const void * s=0x004ad082, 
unsigned int l=0x0000001a) Line 6629      C
    perl523.dll!Perl_savepv(interpreter * my_perl=0x00488ff4, const char * 
pv=0x004ad082) Line 1100     C
    perl523.dll!Perl_newXS_len_flags(interpreter * my_perl=0x00488ff4, const 
char * name=0x00000000, unsigned int len=0x00000000, void (interpreter *, cv *) 
* subaddr=0x77c1f6b0, const char * const filename=0x004ad082, const char * 
const proto=0x77d5f510, sv * * const_svp=0x0030eef0, unsigned long 
flags=0x00000001) Line 8991  C
    perl523.dll!Perl_newCONSTSUB_flags(interpreter * my_perl=0x00488ff4, hv * 
stash=0x004a44b4, const char * name=0x00000000, unsigned int len=0x00000000, 
unsigned long flags=0x00000000, sv * sv=0x004a4804) Line 8883        C
    perl523.dll!Perl_newCONSTSUB(interpreter * my_perl=0x00488ff4, hv * 
stash=0x004a44b4, const char * name=0x00000000, sv * sv=0x004a4804) Line 8820   
C
    perl523.dll!S_cv_clone_pad(interpreter * my_perl=0x00488ff4, cv * 
proto=0x004a4854, cv * cv=0x004a4944, cv * outside=0x004a46b4, hv * 
cloned=0x00000000, char newcv='\x1') Line 2215        C
    perl523.dll!S_cv_clone(interpreter * my_perl=0x00488ff4, cv * 
proto=0x004a4854, cv * cv=0x004a4944, cv * outside=0x00000000, hv * 
cloned=0x00000000) Line 2264      C
    perl523.dll!Perl_cv_clone(interpreter * my_perl=0x00488ff4, cv * 
proto=0x004a4854) Line 2282        C
    perl523.dll!Perl_pp_anoncode(interpreter * my_perl=0x00488ff4) Line 519     
C
    perl523.dll!Perl_runops_standard(interpreter * my_perl=0x00488ff4) Line 41  
C
    perl523.dll!Perl_call_sv(interpreter * my_perl=0x00488ff4, sv * 
sv=0x004a46b4, volatile long flags=0x0000000d) Line 2790    C
    perl523.dll!Perl_call_list(interpreter * my_perl=0x00488ff4, long 
oldscope=0x00000006, av * paramList=0x004a4464) Line 4911 C
    perl523.dll!S_process_special_blocks(interpreter * my_perl=0x00488ff4, long 
floor=0x0000008f, const char * const fullname=0x004b25e4, gv * const 
gv=0x004a48c4, cv * const cv=0x004a46b4) Line 8758 C
    perl523.dll!Perl_newATTRSUB_x(interpreter * my_perl=0x00488ff4, long 
floor=0x0000008f, op * o=0x004b38b4, op * proto=0x00000000, op * 
attrs=0x00000000, op * block=0x004b46a0, char o_is_gv='\0') Line 8688 C
    perl523.dll!Perl_yyparse(interpreter * my_perl=0x00488ff4, int 
gramtype=0x00000102) Line 295        C
    perl523.dll!S_doeval_compile(interpreter * my_perl=0x00488ff4, unsigned 
char gimme='\x2', cv * outside=0x00000000, unsigned long seq=0x00000001, hv * 
hh=0x00000000) Line 3387      C
    perl523.dll!Perl_pp_require(interpreter * my_perl=0x00488ff4) Line 4067     
C
    perl523.dll!Perl_runops_standard(interpreter * my_perl=0x00488ff4) Line 41  
C
    perl523.dll!Perl_call_sv(interpreter * my_perl=0x00488ff4, sv * 
sv=0x0048d90c, volatile long flags=0x0000000d) Line 2790    C
    perl523.dll!Perl_call_list(interpreter * my_perl=0x00488ff4, long 
oldscope=0x00000002, av * paramList=0x004a43c4) Line 4911 C
    perl523.dll!S_process_special_blocks(interpreter * my_perl=0x00488ff4, long 
floor=0x00000027, const char * const fullname=0x004ac690, gv * const 
gv=0x004a43d4, cv * const cv=0x0048d90c) Line 8758 C
    perl523.dll!Perl_newATTRSUB_x(interpreter * my_perl=0x00488ff4, long 
floor=0x00000027, op * o=0x004ac53c, op * proto=0x00000000, op * 
attrs=0x00000000, op * block=0x004ac51c, char o_is_gv='\0') Line 8688 C
    perl523.dll!Perl_utilize(interpreter * my_perl=0x00488ff4, int 
aver=0x00000001, long floor=0x00000027, op * version=0x00000000, op * 
idop=0x004ac160, op * arg=0x00000000) Line 6068        C
    perl523.dll!Perl_yyparse(interpreter * my_perl=0x00488ff4, int 
gramtype=0x00000102) Line 351        C
    perl523.dll!S_parse_body(interpreter * my_perl=0x00488ff4, char * * 
env=0x004885a8, void (interpreter *) * xsinit=0x77d496e0) Line 2314     C
    perl523.dll!perl_parse(interpreter * my_perl=0x00488ff4, void (interpreter 
*) * xsinit=0x77d496e0, int argc=0x00000004, char * * argv=0x00488550, char * * 
env=0x004885a8) Line 1636        C
    perl523.dll!RunPerl(int argc=0x00000004, char * * argv=0x00488550, char * * 
env=0x004885a8) Line 245        C++
    perl.exe!main(int argc=0x00000004, char * * argv=0x00488550, char * * 
env=0x00488940) Line 39       C
    perl.exe!__tmainCRTStartup() Line 626       C
    kernel32.dll!@BaseThreadInitThunk@12()      Unknown
    ntdll.dll!___RtlUserThreadStart@8() Unknown
    ntdll.dll!__RtlUserThreadStart@8()  Unknown

M       cv.h
M       op.c
M       pad.c
M       sv.c
M       universal.c

commit 08d359e58b462bd916770a2c3672cffe4cc00033
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Wed Feb 24 11:13:18 2016 -0500

    WIP Store CHEKs as COW SVs with offset
    
    -in hv.c prevent HEK_HASH from being used when the SV key has an offseted
     CHEK in it, HEK_HASH is for the full "_<" prefixed string to look up
     debugging globs faster on ithreads from COPs when debugging perl code
     with perl5db, there is no hash number acceleration for offseted buffer
     HEKs since it is a subset of a bigger buffer
    -in hv.c, SvSHARED_HASH contains a SvPVX, while in some funcs,
     str = SvPV(sv); already ran earlier, so to avoid the extra mem deref,
     just use var str or its analog instead of looking into the SV head again
     this could be a separate commit
    -in pp_ctl.c to speed up caller, a kindda high use part of perl,
     instead of Newx-ing a copy of cop_file, COW it, since
     it really is a [C]HEK under the hood, but it needs the "_<" chars
     stripped off. By knowing shared HEKs and CHEKs are both malloced, and
     therefore will always be aligned to at least 4 bytes, because of 4 byte
     pointers, a very tiny "OOK" trick can be done that cuts upto 3 chars off
     the start of the HEK. Cutting off "_<" is only 2 chars. Reversing the
     HEK OOK to get the original HEK *, is a cheap "ptr &= ~0x3" CPU
     instruction. Carrying over the offset when copying a SV HEK COW to
     another SV as a HEK COW is more complicated. I've thought about whether
     HEK OOK should be implemented on N0_ITHREADS too, since CopFILE on
     NO_ITHREADS is
     #define CopFILE(c) (CopFILEGV(c) ? GvNAME(CopFILEGV(c))+2 : NULL)
     and has that "+2", and caller on NO_ITHREADS would get the same COW
     improvement as on USE_ITHREADS with HEK OOK. Note, the SV OOK code would
     corrupt the HEK's string portion and therefore HEK's hash number so the
     SV OOK code can't be used as is on HEKs. Perhaps with more special casing
     the SV OOK flag could mean something else that doesn't corrupt the HEK
     buffer for SvLEN=0 and SVf_IsCOW but I can't think of an implementation.
    -in pp_ctl.c pp_require now stores a CHEK as the value in %INC, this saves
     another Newx buffer of memory
    -in sv.c allow CHEKs and offseted [C]HEKs to propagate through ithreads,
     psuedoforks, and sv_setsv'es
    -in toke.c all the SV's created by __FILE__ token previously had unique
     Newxed PV buffers, they should be shared, CHEK allows them to be shared
     now, this saves memory, no real CPU saved since compile time happens once
    -This commit has no API and leaks implementation everywhere. HALP!!!!
    -Most of the diff lines in B.xs will disappear if this is squashed since
     they were created 1 commit ago
    -XXX create newSVhek_flags or keep the low 2 bits of ptr are "flags"
     thing? SVs_TEMP will also have to be added to newSVhek_flags if
     newSVhek_flags is ever created, like newSVpvn_flags has SVs_TEMP.

M       embed.fnc
M       ext/B/B.xs
M       hv.c
M       pp_ctl.c
M       proto.h
M       sv.c
M       sv.h
M       toke.c

commit 9add7ea8cb2c8cea38d085cbea40f7aefdeb001c
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Fri Feb 26 04:00:18 2016 -0500

    WIP GvFILE is now a CHEK on ithreads
    
    -newGP now doesn't execute PERL_HASH which coverts CopFILE to a hash
     number, then PL_strtab lookup each time when it is making a GP/GV, now
     it is just upping refcount on the CHEK, a cheaper operation
    -GvFILE_HEK is removed from public API since with threads it would return
     "_<" prefixed HEK *s which breaks back compat, but GvFILE keeps back
     compat.
    -GvFILELEN added since we know this info under the hood
    -GvFILEGV (basically unused, only use in CORE is by B::, 1 use on CPAN,
     embperl) is now faster since "_<" adding doesn't need to happen with
     temp buffers and calling PERL_HASH which is what the older gv_fetchfile
     func does
    -a CHEK that goes through hek_dup just has its refcount increased, not a
     new pointer created
    -teach S_unshare_hek_or_pvn how to free a HEK* that is really a CHEK*

M       ext/B/B.pm
M       ext/B/B.xs
M       gv.c
M       gv.h
M       hv.c

commit 2664dcb82d023d82519f825c0bb0060fe5331134
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Mon Feb 22 22:32:08 2016 -0500

    WIP add API for refcounting CopFILE names with threads
    
    This has large memory savings, test prog,
    perl -MTest::More -e"system 'pause'"
    before 2196KB Private Bytes Win 7 32 bit to after 2092KB.
    
    -On a CHEK the refcount is a U32 for memory savings on 64 bit CPUs while
     SHEKs are Size_t for refcount because of HE struct, on 32 bit Size_t and
     U32 happen to be the same thing, if there is future integration the
     refcount members will have to be the same type, then duping a SHEK or
     a CHEK is the same code, except that HVhek_COMPILING controls whether to
     aquire OP_REFCNT_LOCK before touching the ref count, in the future with
     atomic operations, the refcount can be manipulated with atomic operations
     regardless if it is a SHEK or CHEK since OP_REFCNT_LOCK lines were removed
    -TODO figure out how to do static const CHEKs, hash member must be 0
     since its process specific randomized (rurban's B stores HEKs in RW static
     memory and fixes up the hash #s at runtime), add test and branch
     so that refcount isn't read and written or passed to PerlMemShared_free
     if static flag is on inidicating static const CHEK
    -TODO optimize the former alloca to smallbuf or Safefree or savestack
     newx free

M       cop.h
M       cv.h
M       embed.fnc
M       embed.h
M       ext/Devel-Peek/t/Peek.t
M       gv.c
M       hv.c
M       hv.h
M       makedef.pl
M       op.c
M       pp_ctl.c
M       proto.h
M       scope.h
M       sv.c
M       sv.h

commit cb470760b25c04a07c1c530e664f204b3f0a88ff
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Thu Feb 25 04:12:13 2016 -0500

    Perl_newCONSTSUB_flags: dont alloc a buffer for empty string literal
    
    Saves a heap block (usually minimum 16 bytes on 32 bit OSes) if file arg
    was NULL.

M       op.c

commit c5b67e77949ee8478c38afbf8f2640ddaf40235c
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Wed Feb 17 02:09:29 2016 -0500

    remove usage of obsolete OutCopFILE macro
    
    OutCopFILE was added in commit 248c2a4db2 in 5.7.2, and became obsolete in
    commit e37778c28b in 5.11.0. To allow future commits to use more varieties
    of CopFILE* macros around core, remove core usage of OutCopFILE. OutCopFILE
    can't be outright removed as CPAN grep shows some usage without a
    #ifndef OutCopFILE fallback.

M       cop.h
M       deb.c
M       pp_ctl.c
M       toke.c
M       util.c

commit 21e4a4d775aab833bc793004fb2cdf9071cd56f8
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Thu Feb 11 15:21:55 2016 -0500

    remove unused arg in gv_fetchfile_flags
    
    Since gv_fetchfile_flags was created in commit d9095cec1b in 5.9.5 in 2007
    the flags argument has been unused and undefined as to its meaning.
    Remove the cpu instruction overhead of pushing the flags arg in the
    callers of gv_fetchfile_flags by changing it to a macro that drops out
    the flags argument. Only known callers are NYTProf and core's gv_fetchfile
    according to cpan grep. This commits sets up future refactoring of
    gv_fetchfile*.

M       embed.fnc
M       embed.h
M       gv.c
M       gv.h
M       proto.h
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to