New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examine codebase for subs that can be is pured
#1992
Comments
|
FYI: http://colabti.org/irclogger/irclogger_log/perl6?date=2018-06-29#l748 That problem was worked around with this piece of code in the optimizer: rakudo/src/Perl6/Optimizer.nqp Lines 1636 to 1647 in 84f60ad
So possibly stuff that works with strings would either need to remain unpure or would require similar treatments (if they're worth it). This also makes me think this work, if available by then, should not go into 2018.07 Rakudo Star. |
|
Spotted one op that currently isn't constant folded, but probably should be: $ perl6 --target=optimize -e 'say ’a‘ <=> ’b‘'
[...]
- QAST::Op(callstatic &say) <sunk> :statement_id<1> say ’a‘ <=> ’b‘
- QAST::Op(callstatic &infix:«<=>») <wanted> <=>
- QAST::Want <wanted> a
- QAST::WVal(Str)
- Ss
- QAST::SVal(a)
- QAST::Want <wanted> b
- QAST::WVal(Str)
- Ss
- QAST::SVal(b) |
Otherwise constant folding will blow up the test file, once R#1992 rakudo/rakudo#1992 is fixed Orig: bb4d3ebff
Otherwise constant folding will blow up the test file, once R#1992 rakudo/rakudo#1992 is fixed Orig: bb4d3ebff
Note: routines that appear too early in the setting are affected by R#1566. If resolving this Issue before that one, ensure what you purify still
~~ Callable.We probably have a bunch of stuff that is currently missing
is puretrait.My understanding is
is pure"means that the result is only dependent on the parameters and nothing else. It doesn't have to memoize or anything like that, but it wouldn't be wrong for it to". In other words, if all the args are known at compile time, the routine can be executed right there and then and its result used in the place of the call.Note that currently static optimizer expects the
is pureto be applied to the proto of multi subs and will not see it if you add it only to some candidates.The text was updated successfully, but these errors were encountered: