[m-rev.] for discussion: undefined behaviours in int.m

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Oct 21 19:33:08 AEDT 2016



On Fri, 21 Oct 2016 17:17:17 +1100, Mark Brown <mark at mercurylang.org> wrote:
> Backend compilers are likely to be able to statically evaluate expressions like
> 
>     (123 * 1000 + 456) * 1000 + 789
> 
> to get the number 123456789. Can we get enough inlining of the library
> functions to generate code like this, or at least something that
> backend compilers can statically evaluate?

You don't need to *inline* a library function if you are willing to make
its semantics static enough, which would be a given if the function is
a part of the definition of a builtin type. That is because in that case,
you can bake the semantics of the library function into the compiler's
builtin_ops.m and const_prop.m modules.

Zoltan.



More information about the reviews mailing list