{"push_id":1052239902,"size":14,"distinct_size":0,"ref":"refs/heads/feature/CM-712-cperl-types-proto","head":"8fffb7ed4dd6257f36ee83aefaf91b49820d26ff","before":"29a3de60152026a3adca0613526bafc329c61c8b","commits":[{"sha":"9439deaa6535f3e193f5b4e24cf64cdb66bc0792","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"re-implement OPpASSIGN_COMMON mechanism\n\nThis commit almost completely replaces the current mechanism\nfor detecting and handing common vars in list assignment, e.g.\n\n    ($a,$b) = ($b,$a);\n\nIn general outline: it creates more false positives at compile-time\nthan before, but also no longer misses some false negatives. In\ncompensation, it considerably reduces the run-time cost of handling\npotential and real commonality.\n\nIt does this firstly by splitting the OPpASSIGN_COMMON flag into 3\nseparate flags:\n\n    OPpASSIGN_COMMON_AGG\n    OPpASSIGN_COMMON_RC1\n    OPpASSIGN_COMMON_SCALAR\n\nwhich indicate different classes of commonality that can be handled\nin different ways at runtime.\n\nMost importantly, it distinguishes between two basic cases. Firstly,\ncommon scalars (OPpASSIGN_COMMON_SCALAR), e.g.\n\n    ($x,....) = (....,$x,...)\n\nwhere $x is modified and then sometime later its value is used again,\nbut that value has changed in the meantime. In this case, we need\nreplace such vars on the RHS with mortal copies before processing the\nassign.\n\nThe second case is an aggregate on the LHS (OPpASSIGN_COMMON_AGG), e.g.\n\n    (...,@a) = (...., $a[0],...)\n\nIn this case, the issue is instead that when @a is cleared, it may free\nitems on the RHS (due to the stack not being ref counted).  What is\nrequired here is that rather than making of a copy of each RHS element and\nstoring it in the array as we progress, we make *all* the copies *before*\nclearing the array, but mortalise them in case we die in the meantime.\n\nWe can further distinguish two scalar cases; sometimes it's possible\nto confirm non-commonality at run-time merely by checking that all\nthe LHS scalars have a reference count of 1. If this is possible,\nwe set the OPpASSIGN_COMMON_RC1 flag rather than the\nOPpASSIGN_COMMON_SCALAR flag.\n\nThe major improvement in the run-time performance in the\nOPpASSIGN_COMMON_SCALAR case (or OPpASSIGN_COMMON_RC1 if rc>1 scalars are\ndetected), is to use a mark-and-sweep scan of the two lists using the\nSVf_BREAK flag, to determine which elements are common, and only make\nmortal copies of those elements.  This has a very big effect on run-time\nperformance; for example in the classic\n\n    ($a,$b) = ($b,$a);\n\nit would formerly make temp copies of both $a and $b; now it only\ncopies $a.\n\nIn more detail, the mark and sweep mechanism in pp_aassign works by\nlooping through each LHS and RHS SV pair in parallel. It temporarily marks\neach LHS SV with the SVf_BREAK flag, then makes a copy of each RHS element\nonly if it has the SVf_BREAK flag set. When the scan is finished, the flag\nis unset on all LHS elements.\n\nOne major change in compile-time flagging is that package scalar vars are\nnow treated as if they could always be aliased. So we don't bother any\nmore to do the compile-time PL_generation checking on package vars (we\nstill do it on lexical vars). We also no longer make use of the run-time\nPL_sawalias mechanism for detecting aliased package vars (and indeed the\nnext commit but one will remove that mechanism). This means that more list\nassignment expressions which feature package vars will now need to\ndo a runtime mark-and-sweep (or where appropriate, RC1) test. In\ncompensation, we no longer need to test for aliasing and set PL_sawalias\nin pp_gvsv and pp_gv, nor reset PL_sawalias in every pp_nextstate.\n\nPart of the reasoning behind this is that it's nearly impossible to detect\nall possible package var aliasing; for example PL_sawalias would fail to\ndetect XS code doing GvSV(gv) = sv.\n\nNote that we now scan the two children of the OP_AASSIGN separately,\nand in particular we mark lexicals with PL_generation only on the\nLHS and test only on the RHS. So something like\n\n    ($x,$y) = ($default, $default)\n\nwill no longer be regarded as having common vars.\n\nIn terms of performance, running Porting/perlbench.pl on the new\nexpr::aassign:: tests in t/perf/benchmarks show that the biggest slowdown\nis around 13% more instruction reads and 20% more conditional branches in\nthis:\n        setup   => 'my ($v1,$v2,$v3) = 1..3; ($x,$y,$z) = 1..3;',\n        code    => '($x,$y,$z) = ($v1,$v2,$v3)',\n\nwhere this is now a false positive due to the presence of package\nvariables.\n\nThe biggest speedup is 50% less instruction reads and conditional branches\nin this:\n\n        setup   => '@_ = 1..3; my ($x,$y,$z)',\n        code    => '($x,$y,$z) = @_',\n\nbecause formerly the presence of @_ pessimised things if the LHS wasn't\na my declaration (it's still pessimised, but the runtime's faster now).\n\nConversely, we pessimise the 'my' variant too now:\n\n        setup   => '@_ = 1..3;',\n        code    => 'my ($x,$y,$z) = @_',\n\nthis gives 5% more instruction reads and 11% more conditional branches now.\nBut see the next commit, which will cheat for that particular construct.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/9439deaa6535f3e193f5b4e24cf64cdb66bc0792"},{"sha":"2d16ffc4217f939f76fc40dc3c65826a6f5d411b","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"make my (...) = @_ non-OPpASSIGN_COMMON_RC1\n\nTechnically in\n\n    my ($scalar,...) = @_\n\ndue to closure/goto tricks, its possible for $scalar to appear on both\nthe LHS and RHS, so we currently set the OPpASSIGN_COMMON_RC1 flag.\n\nHowever, this imposes extra overhead; for example 5% extra instruction\nreads and 11% extra conditional branches for\n\n    my ($x,$y,$z) = @_;\n\nGiven what an important construct this is, disable this flag in the\nspecific case of of only my's on the LHS and only @_ on the RHS.\nIt's technically incorrect, but its the same behaviour we've always had\n(it was only the previous commit which made it safe but slower).\n\nWe still set the OPpASSIGN_COMMON_AGG flag for\n\n    my ($...,@a) = @_\n\nsince in the normal case this only adds the small additional runtime\noverhead of checking that @a is already empty.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/2d16ffc4217f939f76fc40dc3c65826a6f5d411b"},{"sha":"0d3f7574256993b31a3d700d69edd895dfb0e925","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"Eliminate PL_sawalias, GPf_ALIASED_SV\n\nThese two commits:\n\n    v5.21.3-759-gff2a62e \"Skip no-common-vars optimisation for aliases\"\n    v5.21.4-210-gc997e36 \"Make list assignment respect foreach aliasing\"\n\nadded a run-time mechanism to detect aliased package variables,\nby either \"*pkg = ...,\" or \"for $pkg (...)\", and used that information\nto enable the OPpASSIGN_COMMON mechanism at runtime for detecting common\nelements in a list assign, e.g.\n\n    for $alias ($a, ...) {\n        ($a,$b) = (1,$alias);\n    }\n\nThe previous commit but one changed the OPpASSIGN_COMMON mechanism such\nthat it no longer uses PL_sawalias. So this var and the mechanism for\nsetting it can now be removed.\n\nThis commit removes:\n\n    * the PL_sawalias variable\n    * the GPf_ALIASED_SV GP flag\n    * the SAVEt_GP_ALIASED_SV and save_aliased_sv() save type.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/0d3f7574256993b31a3d700d69edd895dfb0e925"},{"sha":"b93a0b528abb82ec6575e86071f6258626659353","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"Optimise 1 arg in list assign\n\nAvoid setting common scalar flags in these cases:\n\n($x) = (...);\n(...) = ($x);\n\nSigned-off-by: Reini Urban <rurban@cpanel.net>\nWith the last 4 commits the perlbench -t array is 19% faster,\nranging from 10-40% in some tests.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/b93a0b528abb82ec6575e86071f6258626659353"},{"sha":"2b41f0720fee0b310e1521939c64392396081a81","author":{"email":"b3538261d0c0bffcce3d04dcc48be08a7393a14f@cpanel.net","name":"Reini Urban"},"message":"aassign: fix TARGLEX check, use our OP_HAS_TARGLEX\n\nfixing the typical blead TARGLEX_MY bug, crashed in various tests.\n\nalso remove the wrong S args from the ops: const gvsv gv","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/2b41f0720fee0b310e1521939c64392396081a81"},{"sha":"c5ef5967a4d76dc66c60cf85c2389743b714a2ef","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"Eliminate GvASSIGN_GENERATION and _set macros\n\nSince we no longer scan package vars with PL_generation for\nOPpASSIGN_COMMON* purposes, eliminate the macros used for that purpose.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/c5ef5967a4d76dc66c60cf85c2389743b714a2ef"},{"sha":"9eb2280312c5a980247a1e79031be85f89b241f6","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"document what PL_generation is for","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/9eb2280312c5a980247a1e79031be85f89b241f6"},{"sha":"cc75accc63b908e11ee71e4299ed10dcefcbacd9","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"fix PAD_COMPNAME_GEN documentation\n\nThe generation number is no longer stored in the SvUVX() field","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/cc75accc63b908e11ee71e4299ed10dcefcbacd9"},{"sha":"44053e8212b8879392b16f311760cdf8c8a47edd","author":{"email":"fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@iabyn.com","name":"David Mitchell"},"message":"fix a SV_NOSTEAL issue in pp_aassign\n\nin something like (...) = (f())[0,0]\n\nA mortal SV can appear multiple times on the RHS without being reference\ncounted. If it's a string, the temptation is to steal its string buffer\nduring the first copy; but this would make the second usage undef.\n\npp_aassign() already takes account of this and uses the SV_NOSTEAL\nflag when copying - except that one common code path didn't.\n\nThis commit fixes that, adds more tests, and adds more code comments\nto explain the issue.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/44053e8212b8879392b16f311760cdf8c8a47edd"},{"sha":"12536eec91b80034cf7c1ab8f0486552b2722df6","author":{"email":"c0fd74ce2882be55e9bf92d69673cd6e9a6dc720@gmail.com","name":"Matthew Horsfall"},"message":"[perl #120826] - Fix documentation nit (thanks Eric Brine.)","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/12536eec91b80034cf7c1ab8f0486552b2722df6"},{"sha":"303e3915622b8f45fd7e95c6ef4d4cc0706b0eb7","author":{"email":"b3538261d0c0bffcce3d04dcc48be08a7393a14f@cpanel.net","name":"Reini Urban"},"message":"B-C: unTODO passing tests","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/303e3915622b8f45fd7e95c6ef4d4cc0706b0eb7"},{"sha":"47fe5191303b4d93cb26b92bdaa1b83b574996d6","author":{"email":"b3538261d0c0bffcce3d04dcc48be08a7393a14f@cpanel.net","name":"Reini Urban"},"message":"hv_rand_set: silence UNUSED_ARG warning\n\nPERL_HASH_RANDOMIZE_KEYS is not default anymore","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/47fe5191303b4d93cb26b92bdaa1b83b574996d6"},{"sha":"e92714e21575ca6c10f32d1cc4561b3a7747c0ea","author":{"email":"b3538261d0c0bffcce3d04dcc48be08a7393a14f@cpanel.net","name":"Reini Urban"},"message":"cperl dev. only: cp-rb cp-lb cp-rh cp-mt scripts\n\nskip them porting/manifest.t\ndescribe our branches in cp-rb\n\nautomate the ./cp-rb rebase --skip steps with an optional argument\n\nimport issues from private stash to github (stash is way better btw)\n\nadd a new branch-point from which the branches branch off\nto keep master clean.\n\nrenamed all the branches to the github issue id\n\ncp-*: updated after 1st release","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/e92714e21575ca6c10f32d1cc4561b3a7747c0ea"},{"sha":"8fffb7ed4dd6257f36ee83aefaf91b49820d26ff","author":{"email":"b3538261d0c0bffcce3d04dcc48be08a7393a14f@cpanel.net","name":"Reini Urban"},"message":".git-rr-cache fixups [EOF master]","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/8fffb7ed4dd6257f36ee83aefaf91b49820d26ff"}]}