mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 11:54:02 +00:00
Estimated hours taken: 10
Fix a bug reported by Warwick, which exposed a design error in failure
handling. We use to assume in several places that either the address
to jump to on failure was unknown (meaning we must generate a redo()),
or that the address was known *and* stored in the redoip slot of the top
nondet stack frame contained this address. This change takes care of the
third possibility: the address is known but the top redoip slot does not
(necessarily) contain that address.
compiler/code_info.m:
Make the above distinction in the failure handling state of the
code generator, and make use of it appropriately.
compiler/disj_gen.m:
When reaching the end of a disjunct in a model_det or model_semi
disjunction, reset this part of the state to what it was on entering
the disjuct. The failure continuation was known, pointing to the
next disjunct, during the generation of code for the disjunct,
but the code after the disjunction as a whole should fail the
same way as the disjunction itself should fail.
In the absence of this reset, the merging of the failure states
of the ends of the different branches may produce incorrect info.
compiler/notes/failure.html:
State that the changed design is not yet documented :-(
tests/hard_coded/redoip_clobber.{m,exp}:
A test case for the bug.
tests/hard_coded/Mmakefile:
Enable the test case.
2 lines
8 B
Plaintext
2 lines
8 B
Plaintext
Failed.
|