lots of files:
Make a start at implementing code generation for complicated
unifications. In the HLDS, change complicated_unify/4 to
complicated_unify/2 since we didn't need the extra two args
after all.
peephole.nl:
A couple of minor efficiency improvements.
queue.nl:
Add queue__queue_to_list/2.
*Makefile*:
Ensure that Makefile.mercury can be used as a generic
Makefile for Mercury programs. It now gets included by the
Makefiles in the tests/ directory.
(It's highly likely that these changes have broken something.)
code_util.nl, peephole.nl, code_info.nl:
Move peephole__neg_rval to code_util.nl, so that it can
also be used by code_info.nl. Improve it a bit.
disj_gen.nl:
Minor stylistic changes.
peephole.nl:
Use bintree_set(label) rather than map(label, bool).
ite_gen.nl:
Implement non-deterministic if-then-elses.
mercury_compile.nl:
Change the action in the automatically generated .dep makefile
to use `$(MNL)' rather than `$(NC)' to link the `.no' files
together.
mode_util.nl, mode_info.nl:
Fix some (recently detected) determinism errors.
options.nl:
Rearrange the options into a vaguely meaninful order and
add a couple of comments.
Makefile:
Install ml.sh.
*_gen.nl, code_info.nl:
Reorganize the handling of failure continuations and mixing
det/semidet/nondet code in the one procedure.
It should now work! ;-)
The category_context field has gone away.
The fall_though field is now a stack(maybe(label)) rather
than a stack(label). If Cont = yes(label), then we
fail by jumping to that label. If Cont = no, then we
fail by executing a redo(). Whenever we create a semidet
choice point, we just push a failure continuation label.
Whenever we create a nondet choice point, we do two things:
(1) generate code which does a `modframe()'
(2) push a failure continuation label
The failure continuation records what value is currently in the
redoip. This allows us to short-circuit redo() instructions
into direct jumps. Whenever we get to a nondet goal, we change
the current failure continuation to `no', since the nondet goal
might have left some choice points behind.
(TODO: The same sort of mechanism would allow us to optimize `redo()'
to `fail()' but we don't do that yet; also currently we generate
quite a few unnecessary modframe() instructions.)
`generate_[i]cond_branch' has gone away.
Instead, push a failure continuation and then call
generate_test_and_fail.
code_util.nl, llds.nl:
Fix newly discovered determinism errors.
code_info.nl, live_vars.nl:
framevars start at 0, not at 1!!!
backtracked over contains a construction unification or a
non-builtin call. Add code to save/restore the heap pointer
in one or two places where this was missing, e.g. semidet disjunctions.
Change switch/2 into switch/3 so that we can store the `local
determinism' of the switch there, rather than in the goal_info.
Fix code generation for semidet/nondet switches, so that
we omit the test for the last case if the switch is locally
det.
call_gen.nl code_info.nl unify_gen.nl:
Fix the handling of assignments to dead variables,
Fix several problems where live registers got clobbered.
llds.nl:
Fix the output for nonlocal calls.
code_util.nl:
Fix the interface dependencies so that they are not circular.
group.nl:
Fix a determinism error.
switch_gen.nl unify_gen.nl:
Bug fixes - survive a whole lot more test cases.
make_hlds.nl:
Output introduced unifications in the correct order:
they should be generated top-down, not bottom up.
hlds_out.nl:
Don't output lines which don't contain any information.
modes.nl:
Avoid spurious determinism warnings for complicated
unifies.
code_util.nl:
Fix a couple of bugs.
llds.nl:
Added mkbody and body rvals which expand to macros.
*_gen.nl code_info.nl:
Fixed tag stuff. String things call error/1 but the
rest is approximately right. Still wants for testing.
mercury_builtin.nl:
Use det_pred(...), semidet_pred(...), nondet_pred(...)
rather than call_pred(...) for the higher-order predicate modes.
prog_io.nl, io.nl, varset.nl, etc.
Add determinism annotations.
hlds.nl, make_hlds.nl, LOTS of other files:
Reorganize the way the predicate table works.
Make hlds.nl a bit more modular.
Change call/4 to call/5.
Remove all/2 from the hlds.
Changed pred_id to an integer.
Added pred_call_id which is similar to the old pred_id.
Makefile:
Add a rule for creating *.hlds_dump.
array.nl:
Fix determinism error.
det_analysis.nl:
Fix a bug in printing determinism warnings.
fix_errors.sed:
Modify this so it allows all the `inferred nondet' determinism
errors but none of the `inferred semidet' ones.
llds.nl:
Rename llds__pred_mode_id as llds__proc_id.
mode_errors.nl:
Finally got around to implementing Zoltan's suggestions
about the error messages from the mode analysis.
If an error occurs in a conjunction, only one error message
is printed out - the first error which doesn't relate to
a head unification.
modes.nl:
Handle X = f(X) properly. NB: determinism analysis and code
generation still get it wrong!
undef_modes, undef_insts:
I've broken the error message code, since it's not easy
to print pred_ids. I just changed it so that it didn't
print the pred_ids out. Should fix this properly at some stage...