{"push_id":1257327065,"size":18,"distinct_size":15,"ref":"refs/heads/feature/gh14-native-types","head":"7d734cb42f28d40f17ed800f35b856ed19d9f956","before":"75c7ab93f68eeba9f38874187c8375d8c9964c21","commits":[{"sha":"e36cf22465deb98352d49050f789cadb2a4dfc68","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"hash: extract hv_common_magical() helper\n\nextract uncommon magical code in hot code to an extra\nstatic function to help keep the icache smaller.\nonly in rare cases this branch is taken. (i.e filling ENV at startup)\n\nMeasured 2-15% faster with normal scripts, not using tied hashes.\n\nSpecial-case the return values for ENV_IS_CASELESS (Windows)\nDo not use a keysv as this will be mixed up with valid keysv cases.\nrather check for HVhek_FREEKEY and set the key to caseless again\nwith ENV_IS_CASELESS.\nalso optimize the mixed case: only do this when a windows env key is\nreally mixed. do nothing with all uppercase keys.\n\nput a strupr() debugging helper into perl.h for Windows/Netware debugging\neven when not on these platforms, to get coverage on other platforms\nfor those crazy code paths. actually developed and debugged on darwin.","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/e36cf22465deb98352d49050f789cadb2a4dfc68"},{"sha":"c7b87bb147bb63cb25833da996beadd6a5619066","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"hash: refactor hv_common_magical, fix windows\n\nThe Windows fix was keysv = NULL.\n\nAdd a &return_action arg, with some post-actions in hv_common().\nOnly 2-3 are used: RETURNS, IGNORE and ENV_IS_CASELESS (Windows only).\n\nMove the getenv debugging helpers for ENV_IS_CASELESS into\niperlsys.h/util.c\n\nAdd some more -DH debugging diagnostics, esp. for magical HVs.\n\nNote: With ENV_IS_CASELESS we still avoid the faster keysv ptr\ncomparison and always check by string. But not with hv_delete().","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/c7b87bb147bb63cb25833da996beadd6a5619066"},{"sha":"593394b80bd8a73c2621e4de286f6761e2686fd0","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":".git-rr-cache hv_common_magical","distinct":false,"url":"https://api.github.com/repos/perl11/cperl/commits/593394b80bd8a73c2621e4de286f6761e2686fd0"},{"sha":"5ab811b11750f0b72ef983b7177b17d924a9e9a6","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"Revert \"native opcodes: undef PERL_NATIVE_TYPES, disabled\"\n\nThis reverts commit 7becbb36b1109f29ecd168df490f3c1695ab99a5.","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/5ab811b11750f0b72ef983b7177b17d924a9e9a6"},{"sha":"83ce728cb6381a599240387d33d14674b2e23fe1","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: up- and downgrade native types in op chains\n\nthis optimizes, checks and partially infers types involving all unboxed\nnative types: :int, :uint, :str, :num.\n\nwe bite the bullet and create a const native already in the parser if\npossible, esp. :int. This saves creating a newSV upfront in the parser,\nesp.  when it's later used in native context.  If not it will be\ndowngraded to a boxed const.\n\ncheck every native chain in rpeep for followers if possible to upgrade\nto native.  and if only one either downgrade it, or add a box op to end\nthe chain.\n\nThrow bad_type_declared errors when upgrading to a type fails.\n  Type violation on scalar %s declared as :%s\nBut note that some of these types are implicit, such as numeric\nand string constants.\n\nadd op_pad2const helper.\na padsv cannot be replaced by a const in-place, as there is\nno room for the op_sv.\nthus we need the prev. sibling, which we best do in constant folding.\nwe also need to upgrade to native, because a const cannot carry the\ntype, other than implicit. native const is better later in the peep\nnative chain checker.\n\nneed now the SVf_NATIVE flag for pad data, which we took from SVf_PROTECT.\npad have multiple ops pointing to the curpad[].\nwe can only upgrade them to native as we see them.\n\nIdeas:\n* we could use a PadnameNATIVE flags instead.\n* when walk all padop's upgrade them on-the-fly.\n  problem: fold_constants sees a non-native pad op,\n  which points to a native pad.\n  we should not mark uninitialized lexical pads with SvNATIVE,\n  when the flags are still 0.\n\nProblems:\nwithin pushmark we omit all optimizations, as we do not carry the\nstack depth with us. i.e. -e'my int $a=1; print $b=$a+42+$a'\nall the arguments of print cannot be optimized yet.\nwith the stackdepth for print (which is 1 here) we could downgrade\nonly the result of $b=.\n\nThe optimizer can now up- and downgrade the native ops:\n\n./miniperl -Ilib -Dktv -e'my int $a=1; $b=$a+42+$a'\n\n(-e:1)\tmatch: padsv ():Scalar + :int <=> int_padsv ():int\n(-e:1)\tmatch: sassign (:Scalar,:Scalar):Scalar + :int <=> int_sassign (:int,:int):int\n(-e:1)\tnative: can upgrade sassign => int_sassign\n(-e:1)\tnative chain: int_const .. 2x .. nextstate\n(-e:1)\tmatch: padsv ():Scalar + :int <=> int_padsv ():int\n(-e:1)\tnative: upgrade padsv => int_padsv at [1]\n(-e:1)\tmatch: sassign (:Scalar,:Scalar):Scalar + :int <=> int_sassign (:int,:int):int\n(-e:1)\tnative: upgrade sassign => int_sassign\n(-e:1)\tnative: int_sassign -> nextstate needs no box\n(-e:1)\trpeep lastnative_op == o int_padsv continue\n(-e:1)\trpeep lastnative_op == o int_sassign continue\n(-e:1)\tmatch: padsv ():Scalar + :int <=> int_padsv ():int\n(-e:1)\tnative chain: int_padsv .. 4x .. gv\n(-e:1)\tmatch: padsv ():Scalar + :int <=> int_padsv ():int\n(-e:1)\tnative: upgrade padsv => int_padsv at [1]\n(-e:1)\trpeep lastnative_op == o int_const continue\n(-e:1)\trpeep lastnative_op == o int_add continue\n(-e:1)\trpeep lastnative_op == o int_padsv continue\n(-e:1)\trpeep lastnative_op == o int_add continue\n\nEXECUTING...\n\n(-e:0)\tenter\n(-e:0)\tnextstate\n(-e:1)\tint_const(1:int)\n(-e:1)\tint_padsv($a)\n(-e:1)\tint_sassign\n(-e:1)\tnextstate\n(-e:1)\tint_padsv($a)\n(-e:1)\tint_const(42:int)\n(-e:1)\ti_add\n(-e:1)\tint_add\n(-e:1)\tint_padsv($a)\n(-e:1)\tint_add (BOX)\n(-e:1)\tgvsv(main::b)\n(-e:1)\tsassign\n(-e:1)\tleave\n\non the end of statements we do not care boxing\n*SP, the last result. keep it native\ni.e. in\n\tint_sassign (BOX)\n\tnextstate\nBOX is not needed. nextstate resets the stack.\n\nsince a padsv with SvNATIVE IS_NATIVE_OP\nit needs special treatments to be upgraded.\npadav (native arrays) not yet.\n\nnative padsv needs to set the curpad[], as well as putting\nthe native val onto the stack.\n\ndeb_stack printing needs a looks_like_sv(), which checks the SV\narenas or the curpad pointers, if this is a SV or native value.\n\nmake sure we do not visit the native chain all over again\nfor every next element, by using a state lastnative_op.\nwe cannot use op_opt=1 as this is only for nullifying ops.\nrpeep is just a glorified nullifier framework, and hard to convince to\ndo normal optimizations.\n\nharmonize rpeep upgrader with ck_type rules: i_divide, i_modulo.\nTODO: we really should use one function for this, not two.\ncheck modulo for 2 const args where one is negative.\n  but if one is a typed int lexical, we'll use the libc (use integer)\n  fast i_modulo then.\n    my int $i = -3; $i % 2 => -1, not 1.\n  This is the same special case, which was removed with e7311069\n\n  See in http://www.nntp.perl.org/group/perl.perl5.porters/2001/10/msg45590.html\n  p5p arguing that it is using the mathematical \"correct\" semantics,\n  vs the C standards committee:\n  http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf\n\n  \"When integers are divided, the result of the / operator is the\n  algebraic quotient with any fractional part discarded. If the\n  quotient a/b is representable, the expression\n  (a/b)*b + a%b shall equal a.\" Perl does not obey this, only with use integer.\n  'use integer; my ($a,$b)=(13,-4); print int(($a/$b)*$b) + $a % $b' => 13\n  'my ($a,$b)=(13,-4); print int(($a/$b)*$b) + $a % $b' => 10\n\nbox int_padsv when used before assign.\nA lhs padsv (i.e used as a container for the result) needs to\nput the SvNATIVE onto the stack, not just the value as in rhs.\nDetect it for now simply by checking op_next for sassign or aassign.\nSuch a padsv really should have a OPf_MOD lhs context flag. But we\ncannot handle native arrays (padav) yet.\n\nextend op_native_variant to check its args\nso far op_native_variant never checked the typed of it's args, as ck_type\ndid.\ndo now for UNOP and BINOP, but do not match int with Int or uint yet.\nThis fixes cases like 'my int $a=0; $b+$a+1' where gvsv *b prevents\nadd => int_add\nWe really should write a better matcher, as we only do simple single- and\ndouble-dispatch yet.  esp.  check not only both args, but pass the result\ntype to the next op, with possible casts.  For user-dispatch we need to come\nup with a better dispatcher which needs to be fast at run-time, i.e.  using\nmore memory.\n\ninitialize with newSV the IVX slot with 0.\nwe dont want to see uninitialized native values with -Ds\n\nadd op_insert_box, 2 ops needed for BINOP.\nwhen a chain ends with an BINOP, we need the 2 last ops being\nboxed. which is getting unfortunate.\nWith higher ops, we need to skip it alltogether.\n\nadd is_native_string\nto get more OP_STR_CONST, saving initial SVs.\nBut the parser does not give as that many.\nis_native_string checks if the pv can be stored as native ASCIIZ\nstring: no utf8, no embedded NULs, must have ending NUL.\n\nbail-out conditions are one typed op only,\nending BINOP,LOGOP with only one arg,\nor any LOOPOP,LISTOP.\nThe chain ends typically with a nextstate for good.\n\nnon downgradable ops need to be boxed.\nfor a *PADSV turn on BOXRET and return true.\nNote that in reality most native UN- and BINOPs\nneed not to be downgraded, only CONST and PADSV, as they start\na native chain.\n\non forbidden ops (pushmark..listop) downgrade the whole list.\ndo not break the loop, continue with next optim.\nadd more -Dkv on rpeep exit logic.\n\ndowngrade typed variants\ne.g. within pushmarks. also all binops and unops.\nS_op_downgrade_native got a bool with_box argument.","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/83ce728cb6381a599240387d33d14674b2e23fe1"},{"sha":"c1af9bfe1fbaf392084cf20843302c87d0070dbf","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"loop: fix loop optimizer, no o clobber\n\ndo not clobber o with the loop body. use o2 instead.","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/c1af9bfe1fbaf392084cf20843302c87d0070dbf"},{"sha":"23ee6921253cb06214ef69c705e6585792be7eca","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: fix the last make miniperl errors\n\nfixup missing targ in downgraded op, use S_const_iv.\nfix documentation of is_native_string and op_native_peek","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/23ee6921253cb06214ef69c705e6585792be7eca"},{"sha":"1c99166aeee6b8840dbe125cc1ea0ee4a5d38276","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"add t/opbasic/native.t","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/1c99166aeee6b8840dbe125cc1ea0ee4a5d38276"},{"sha":"dec374195799465fa827dd19f1f2d5b835bcc779","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: add can_const_iv for more stability\n\ndo not rely on const_iv returning IV_MAX","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/dec374195799465fa827dd19f1f2d5b835bcc779"},{"sha":"e154adc072924b79e2cc5479331a8aa16e39893e","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: fix op_downgrade_oplist, more\n\ndo not end the op_downgrade_oplist chain in the next non-native op.\nwe need to downgrade all.\n\ntestcase: my int $r=1; sub t{$a} t($T++, $r, 2)\n\nadd IS_PADSV_OP including native *_PADSV, use it\nin check_hash_fields_and_hekify et al.\n\nset type flags in downgradeded native pads, to be able to restore them\nin entersub calls, and display the values on the curpad for debugging.\n\nop_pretty and scalarvoid support now also OP_STR_CONST","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/e154adc072924b79e2cc5479331a8aa16e39893e"},{"sha":"30902bff43c6a32ff58066614c7ba61e0d7653ef","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: downgrade *_padsv also\n\nfor entersub calls (pushmark deoptim).\nthose ops cannot handle native (bodyless) pads yet.\n\nallow the 2nd BINOP arg to be NULL, ie. for {and,or,xor}assign as UNOP","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/30902bff43c6a32ff58066614c7ba61e0d7653ef"},{"sha":"9701bfb72f54eeba1bdd514d4acbadb03e06ccb7","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: fix padsv downgrade, op_typed, ...\n\nS_op_typed can now handle !0 and OP_NULL (advancing to the next non-null\nop)\ndowngrading a PADSV needs to work on the PAD_SV, not on the not-existing\ncSVOPo (data corruption). upgrade this curpad entry on place.\nImprove -Dkv diagnostics in the type matcher.\nRemove some duplicate code in the constant body folding","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/9701bfb72f54eeba1bdd514d4acbadb03e06ccb7"},{"sha":"5016ab16213d7b8c23774d5cc5fd94dc3fa1c6a5","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: upgrade padsv at run-time\n\nUpgrade a OP_PADSV op to its native variant, and mark it as BOXRET,\npushing a boxed SV onto the stack.\nThis is needed because different padsv ops can point to the same\nnative curpad entry, which could have been upgraded, but the ops not.\n\nDo this on the fly in pp_padsv, so that the next call will use the faster\nvariant. This indirectly promotes the lexical variable to a native type,\nbut uses the non-native context, because of the BOXRET flag.\n\nProvide SvNATIVE backcompat for non-usecperl.","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/5016ab16213d7b8c23774d5cc5fd94dc3fa1c6a5"},{"sha":"053449b7dd9b959e4a7d163c1d60c19ee88eae4e","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: downgrade padsv at run-time, type earlier\n\ntype and upgrade a PADSV earlier in a my_attrs declaration already.\nAdd missing native padsv cases to op_lvalue_flags to avoid lvalue croaks.\n\nDo not touch the PAD_SV, rather box the OP.\nChange helper to op_native_padsv_off and op_native_padsv_on (only off is\nused).\n\nAvoid inserting a box directly before a nextstate. The stack result is\nignored there.","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/053449b7dd9b959e4a7d163c1d60c19ee88eae4e"},{"sha":"549761c159e457c3cc35625ad5ce65aff1d70e2b","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: cast native CONST values\n\nwhen we need a different from a CONST, do not type violate,\nrather cast the value via sv_2?v_flags to the wanted type.\n  my num $f = (1 * 2.0);\nbut now we broke constant folding along the way.","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/549761c159e457c3cc35625ad5ce65aff1d70e2b"},{"sha":"80e5f8f2d9b5c3251c9375f449886e69d9f15530","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"dump: support SvNATIVE in sv_peek","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/80e5f8f2d9b5c3251c9375f449886e69d9f15530"},{"sha":"d8b6fa5e9dff65911fa697e5ec603974c2900e9a","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: maybe cast one arg for upgraded op\n\nfor binop's when the two args have different types, and\nit would be cheap to cast one arg to a matching op,\nprepare 2*7 variants of possible casts. like int=>uint\nint=>num, int=>Int, ...","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/d8b6fa5e9dff65911fa697e5ec603974c2900e9a"},{"sha":"7d734cb42f28d40f17ed800f35b856ed19d9f956","author":{"name":"Reini Urban","email":"124d4de0b2391c49441429d4e282b8f880187ae3@cpanel.net"},"message":"native: typestash names can now be without main::","distinct":true,"url":"https://api.github.com/repos/perl11/cperl/commits/7d734cb42f28d40f17ed800f35b856ed19d9f956"}]}
{"actor":{"display_login":"rurban"}}