* Avoid checking twice if divisor is zero
The flambda branch before merging assumed that Pdivint and Pmodint where
already checked when entering Cmmgen. This was not the case anymore
after merging and this change was lost. This fix this overlook by adding
an annotation to the Pdivint and Pmodint primitive telling whether the
division by zero was already checked.
The reason to move the test generation to Closure_conversion in the
flambda branch was to allow the division primitive to be considered as
pure without needing to check for the effective value of the
divisor. This simplified Semantics_of_primitives a lot.
* Bigarray div and mod also carry safety information
* Handle bigint div and mod like int div and mod in closure_conversion
* Update Changes
* Test for divisions by zero
* Turn Pdivbint and Pmodbint argument into an inline record
since the semantic changed. There is no need to check Clflags.debug
anymore Raise_withtrace, means that traces must be computed (if the
runtime boolean is true).
Previously, a let-binding such as:
let x =
if ... then 0. else ...
in
...
would keep x in unboxed form, which is mostly useless (it can avoid
multiple memory loads but no allocation) and possibly harmful (it
can result in more allocations on use sites).
Commit 39760599e5 introduced some bogus logic.
Emitting structured constants can register more closures to be emitted. But either
the name of these closures is "unique enough", in which case we don't need the already_translated
argument in transl_all_functions_and_emit_all_constants (and transl_all_functions does not need
to return the set of already emitted functions). Or this is not the case, and the previous code
was wrong since it forgot to remember the set returned by transl_all_functions.
I've fixed the code assuming the latter in order to be on the safe side, but we would probably have
noticed if the former assumption did not hold. I've added a note to the commit mentioned above
so that @chambart can have a look at it.