3 ms·
Maybe, but LLVM has the disadvantage that speculating “this won’t overflow” and creating a fast path with that information is not something that can be fixed if
by saagarjha 6y ago
Maybe, but LLVM has the disadvantage that speculating “this won’t overflow” and creating a fast path with that information is not something that can be fixed if more profiling data comes in at runtime saying it was a poor choice.
- im3w1l 6y agoThe C/C++ standards allow compilers to do whatever they want as long as it does not cause observable output changes. So LLVM could do runtime profiling if it wanted. But I suspect that in the majority of the cases the cost of the profiling would be worse than the potential gains.
- pizlonator 6y agoThose aren’t the optimizations I’m talking about. That’s not even how JSC optimizes overflow checks. I’m talking about: - abstract interpretation using a streamlined version of the octagon domain. - instruction selection and register allocation hacks to emit the best possible code for checked math. I don’t think llvm has parity with B3 here, particularly in cases where inputs to the math are live on the failing case. - probably other stuff. IRs that start out with checked math tend to include checked math reasoning in more optimizations.
- frankpf 6y ago> - abstract interpretation using a streamlined version of the octagon domain. Do you have any links/source code where I can read up about this (possibly in the context of compilers)? I've never heard of the term octagon domain before.
- tom_mellior 6y agoIf you know about abstract interpretation, here are the relevant papers: https://www.cs.utexas.edu/~tdillig/cs395/octagon.pdf https://www.cs.utexas.edu/~tdillig/cs395/octagon.pdf https://www-apr.lip6.fr/~mine/publi/article-mine-HOSC06.pdf https://www-apr.lip6.fr/~mine/publi/article-mine-HOSC06.pdf If you don't know about abstract interpretation, start at https://en.wikipedia.org/wiki/Data-flow_analysis https://en.wikipedia.org/wiki/Data-flow_analysis and https://en.wikipedia.org/wiki/Abstract_interpretation https://en.wikipedia.org/wiki/Abstract_interpretation
- tom_mellior 6y agoHaving said the above, I can't find any other information on JavaScriptCore using octagons. Searching https://trac.webkit.org/browser/trunk/Source/JavaScriptCore https://trac.webkit.org/browser/trunk/Source/JavaScriptCore for "octagon" yields nothing.