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
Avoid checking twice if divisor is zero #702
Avoid checking twice if divisor is zero #702
Conversation
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.
46f2450
to
2391b4e
Compare
Also contains a fix for http://caml.inria.fr/mantis/view.php?id=7328 The justification for adding the fix here rather than in a separate patch is that it share a lot of this patch. @damiendoligez would you still accept such a patch for 4.04 ? |
I think we should merge this for 4.04 given half of it was actually a merge mistake in 4.03, IIUC. |
according to the docs:
div by zero should always raise. |
Well the doc was missing something then. It should probably be fixed. |
here |
@bobzhang I tried and it don't look too heavy, so here it is. |
@chambart OK for 4.04 but what does this have to do with the If you think the doc is missing something, you need to update it in this PR... |
This looks correct to me. @damiendoligez It doesn't have anything to do with the |
@lpw25 Thanks for the clarification. I see the doc change is not so urgent and it belongs in another PR anyway. This one seems ready to merge. Any objections? |
Now this has been read we should be good to go. |
@damiendoligez I cannot find a trace of this in 4.04, did we forget to cherry-pick it? |
* 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
cherry-picked to 4.04 (commit 0ea09d2) |
* 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
otherlibs: add PR10478 fix back to systhreads
Add low/high PC ranges to CU DIEs
Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
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.