mercury_compile.pp:
Change the output to the `.dep' file so that `foo_init.c' does
not depend on anything and so that the arguments passed to $(C2INIT)
are `foo.m bar.m' rather than `foo.c bar.c'.
Note: this will only work with the new version of mkinit.
code_gen.pp:
Put the comment about the contents of stack slots before the initial
label, since this way it will be preserved by optimizations.
cse_detection.m:
Extended the search to look for cses in if-then-elses and switches
as well as disjunctions. Removed InstmapDelta from preds in which it
was not being used.
det_analysis.m:
Make the diagnosis routines more robust. The changes here avoid the
Philip's problems with lexical.m.
jumpopt.m:
Minor formatting changes.
livemap.m:
Avoid duplicating livevals instructions when optimizations are
repeated, since this can confuse some optimizations.
llds.m:
Minor documentation change.
make_hlds.m:
Minor formatting change.
mercury_compile.pp:
Do not map arguments to registers if any semantic errors have been
found.
middle_rec.m and code_aux.m:
Apply middle recursion only if tail recursion is not possible,
since tail recursion yields more efficient code.
opt_util.m:
Added a predicate to recognize constant conditions in if_vals.
Modified a predicate to make it better suited for frameopt.
optimize.pp:
Changed the way optimizations were repeated to allow better control.
Repeat peephole once more after frameopt, since the new frameopt
can benefit from this.
options.m:
Removed the --compile-to-c option, which was obsolete. Added an
option for predicate-wide value numbering, which is off by default.
Changed some of the default values of optimization flags to reduce
compilation time while holding the loss of speed of generated code
to a minimum.
peephole.m:
Look for if_vals whose conditions are constants, and eliminate the
if_val or turn it into a goto depending on the value of the constant.
Generalized the condition for optimizing incr_sp/decr_sp pairs.
value_number.m:
Added a prepass to separate primary tag tests in if-then-elses from
the test of the secondary tag, which requires dereferencing the
pointer.
Added sanity check routines to test two aspects of the generated code.
First, whether it produces the same values for the live variables as
the original code, and second, whether it has moved any dereferences
of a pointer before a test of the tag of that pointer. If either test
fails, we use the old instruction sequence.
vn_debug.m:
New messages to announce the failure of the sanity checks. They are
enabled by default, but of course can only appear if value numbering
is turned on (it is still off by default).
vn_flush.m:
Threaded a list of forbidden lvals (lvals that may not be assigned to)
through the flushing routines. When saving the old value of an lval
that is being assigned to, we use this list to avoid modifying any of
the values used on the right hand side of the assignment, even if the
saving of an old value results in assignment that requires another
save, and so on recursively.
When the flushing of a node_lval referred to a shared vn, the uses of
the access vns of the node_lvals were not being adjusted properly.
Now they are.
vn_order.m:
The ctrl_vn phase of the ordering was designed to ensure that all
nodes that need not come before a control node come after it. However,
nodes were created after this phase operated, causing leakage of some
value nodes in front of control nodes. Some of these led to pointer
dereferences before tag tests, causing bus errors. The ctrl_vn phase
is now last to avoid this problem.
vn_table.m:
Added an extra interface predicate to support the sanity checks in
value_number.
vn_util.m:
The transformation of c1-e2 into (0-e2)+c1 during vnrval simplification
could lead to an infinite loop in the compiler if c1 was zero. A test
for this case now prevents the loop.
compiler/Mmake:
Include the library .m files in the tags file.
hlds.m and lots of other places:
Change the type of the argument list of a HLDS `call' from
`list(term)' to `list(var)'.
code_info.m:
Bug fix: change generate_pre_commit and generate_commit so that
the values which need to be saved and restored are always pushed
onto the det stack, even in nondet predicates. The reason is
that if the committed goal fails, curfr is not valid, so we
can't restore the fields from the nondet stack.
(This way may well be more efficient anyway.)
disj_gen.m, ite_gen.m:
Handle the case when the current failure continuation is unknown
on entry to the disjunction or nondet if-then-else by creating
a new frame on the nondet stack. (Originally we just aborted
in this case; recently we "fixed" this, but it turned out that
the fix was not correct, for the same reason as the above-mentioned
bug in pre_commit/commit.
llds.m:
Add succfr/1 and prevfr/1 to the rval type in llds.m,
since they were needed by the above bug fixes.
(This caused dozens of changes elsewhere to handle the
new types.)
Also fix a trivial bug that I recently introduced which
prevented --mod-comments from working.
live_vars.m:
Fix bug in allocation of stack slots for nondet code.
(This is the one that caused the bug that ksiew and I found
when writing a calculator program.)
peephole.m:
Disable the succeed_discard() optimization, since it
causes incorrect code to be generated. It was replacing
modframe(do_fail) ... succeed() with
modframe(do_fail) ... succeed_discard() even when there were
instructions such as mkframe() in between.
modes.m, hlds.m:
When modechecking switches, record the binding of the switch variable
as we enter each case, so that we get the determinism analysis
right.
mercury_compile.pp:
Make sure that we set the exit status to be non-zero if we
find any errors.
typecheck.m, modes.m, undef_types.m, undef_modes.m:
Don't invoke type-checking if there are undefined types.
Don't invoke mode-checking if there are undefined modes.
This avoids the problem of the compiler aborting with an
internal error if there are undefined types/modes.
mercury_compile:
Perform arg_info only if we are generating code.
llds:
Handle redo and fail by outputing a branch to their labels in the
runtime, since this is smaller than the code for the macro itself.
dupelim, options:
Added an extra optimization pass to eliminate duplicate blocks of
code. Reduces compiler size by half a percent.
compiler/*:
Add copyright messages.
Change all occurences of *.nl in comments to *.m.
compiler/mercury_compile.pp:
Change the output to the .dep files to use *.m rather than *.nl.
(NOTE: this means that `mmake' will not work any more if you
call your files *.nl!!!)
code_exprn.m
code_info.m:
Fix an overly conservative sanity check.
mercury_compile.pp
typecheck.m:
Fix type errors due to the changed implementation of map.
Possibly these bits of code should be removed or something
so that map is properly abstract.
prog_io.m:
Associate a term__context with every goal:
rename the type `goal' as `goal_expr' and add
`:- type goal == pair(goal_expr, term__context)'.
make_hlds.m, negation.m, mercury_to_mercury.m, mercury_to_goedel.m:
Change to handle new representation of goals.
modes.m, typecheck.m:
Use the term__context from the goals, since the above changes
make it meaningful now.
implication.m, make_hlds.m, mercury_compile.pp:
Fold the implication transformation into the make_hlds pass.
Net result: better error messages, but compilation time is worse.
mercury_compile.pp:
Handle `.m' files as well as `.nl'.
Add rules for Sicstus Prolog in the automatically generated `.dep'
files.
Don't output the `.d' files for library modules when generating
the `.dep' files.
Fix bug: missing space after the -DTAGBITS=n option.
Makefile.common:
Use mkdir -p.
Add mmake.sh.
Change the tags rule so that it gets the .pp files first.
Change the name of the compiler target from comp to mercury_compile.
Remove the rules for test.exe since they duplicate the auto-generated
ones in test.dep (which call the target `test' not `test.exe').
Remove the `code_gen' target. (Tom, if you need it, put it in
Makefile.params.)
Hack around with the installation rules (still in a state of flux).
options.nl:
Disable the --mod-comments option by default.
llds.nl:
Only output the gc livevals comment if --mod-comments is enabled.
mercury_compile.nl, prog_io.nl:
Handle `file not found' errors more cleanly.
When making the dependencies, assume that any files not found
are library files, so don't put them in the dependencies.
modes.nl:
Resolve type ambiguity introduced by change to prog_io.nl.
Mmake.rules Mmake.vars:
Split Makefile.mercury into two halves for use by mmake.
NOTE: I haven't removed Makefile.mercury yet, so any changes
need to be made in both places!
Makefile.mercury:
Change the default grade from `fast' to `asm_fast.gc'.
Makefile.common, mercury_compile.pp:
Change the rules in the generated .dep makefiles so that
the NU-Prolog executable is called `<module>.nu', not `<module>'.
Add new rules for creating `<module>' and `<module>_init.c'
using mc and mod2init.
mercury_compile.pp:
Fix a couple of bugs in the option handling: firstly `--gc
conservative' should imply `--tags none', and secondly the
CONSERVATIVE_GC, TAGBITS, and HIGHTAGS #defines were not
being passed to gcc.
io.nl, io.nu.nl:
Add io__{get,set}_exit_status.
Change documentation to refer to main/2 rather than main_predicate/3.
mercury_compile.pp:
Implement the --link option.
Improve error reporting, and try to return a non-zero exit
status if something goes wrong.
hlds_out.nl:
Print out the variable number for each variable.
Makefile.common:
Change the default grade to asm_fast.gc.
Enable followcode, followvars, and optimization.
Change the name of the library to `libmercury.{a,so}'.
Makefile.mercury:
Define MCG in terms of MC.
mercury_compile.pp:
Fix bug with hlds-dumping: stage 6 got dumped twice, and stage 10
didn't get dumped at all.
Fix old bug where compiling files in directories other than
the current directory would give you a `warning: incorrect module
name' message.
Makefile, Makefile.mercury:
Add rules for making .mod into .h. Define MOD2H and MOD2H flags,
(mod2h not included yet).
code_gen.nl, code_info.nl, garbage_out.nl, hlds.nl, io.nl, llds.nl,
make_hlds.nl, mercury_compile.nl, mercury_compile.pp shapes.nl:
Various changes to facilitate shape information gathering, and
garbage information output.
elimination was leaving eliminated variables in the hlds__goal_info
structure. The call to common.nl has been moved back again so that it
comes after switch detection. Maybe it will settle down there for a
while!
garbage_out.*:
A new module to handle the output of the garbage collection
information, presently it generates and puts the continuation
table into a .garb file.
Makefile, Makefile.mercury:
Rule for creating .garb files, and new dependencies for
targets.
io.nl, io.nu.nl:
Added io__read_anything/3 and io__read_anything/4.
mercury_compile.pp, options.nl:
Added option support for garbage collection, `--gc accurate'
switches on .garb file output, but code-generation must
also be on.
shapes.nl:
Cosmetic changes.
optimisation. It doesn't appear to be doing that yet but nor does
it appear to be doing any harm :-)
It can be switched out in any case with the --no-common-subexpression option
graph.nl:
Added more stuff needed for the call_graph.
mercury_to_mercury.nl:
added a version of the predicate for outputing
mode declarations that leaves off the ':-' and '\n'
options.nl:
added the option -C for generating a call graph in the
file <module>.call_graph
char.nl:
Add char__is_{hex,octal,binary}_digit.
string.nl:
Add declaration and stub implementation for
string__base_string_to_int.
io.nl, io.nu.nl:
Implement io__putback_char (not very efficiently).
mercury_builtin.nl:
Add a declaration for cut.
mercury_compile.pp:
Suppress singleton variable warning.
prog_io.nl:
In DCG expansion, when appending unifications to disjunctions
propagate them into each disjunct, so that we don't stuff up
switch detection.
shapes:
New module to handle shape information collection.
call_gen, code_gen, code_info, hlds, mercury_compile:
Modifications to call the shapes module, and keep a shape
table in the module_info structure.
mercury_compile:
Added back an old garbage collection point.
optimize:
Added some new garbage collection points, and made the file into .pp.
value_number, vn_util, opt_debug:
Changed the way access vns are counted. Pushed noop vnlvals towards
the front of the flush order; this can improve the speed of the
generated code.
middle_rec:
Clarified a bit of code.
value_number, vn_util:
Value numbering should now work with code that allocates memory.
frameopt:
Create a stack frame before an if_val if both continuations need one.
optimize, mercury_compile:
-V now prints a message for each optimization pass for each proc.
llds, call_gen, code_gen, middle_rec etc:
Change livevals/2 back into livevals1.
jumpopt:
Rename instmap to instrmap at fjh's request.
polymorphism.nl:
Fix some bugs:
- I had forgotten to update the argmodes of the modified
procedures
- I was updating the argtypes and attempting to use there
old value. I fixed this by splitting the algorithm
into two passes.
- to compute the types of the arguments to a call,
apply the type mapping from the _caller_ not the callee.
Also improve efficiency in a couple of places.
hlds.nl:
Add some new access predicates required by polymorphism.nl.
list.nl:
Add a new predicate list__duplicate, which is used by polymorphism.nl.
typecheck.nl, type_util.nl:
Move the type_unify routines from typecheck.nl into type_util.nl,
since they're also needed by polymorphism.nl.
term.nl:
Export term__apply_rec_substitution_to_list, since it's needed
by polymorphism.nl.
- - - - - - - - - - - - - - - - - - - - - - - - -
mode_util.nl, type_util.nl:
Move some routines from mode_util.nl to type_util.nl, where they
really belong.
- - - - - - - - - - - - - - - - - - - - - - - - -
make_hlds.nl, code_util.nl, typecheck.nl:
Mark builtin predicates as "external" in make_hlds.nl,
rather than checking for them as a special case in typecheck.nl.
- - - - - - - - - - - - - - - - - - - - - - - - -
prog_io.nl, hlds.nl, typecheck.nl:
For documentation purposes, define equivalent types `tvar',
`tvarset', `tsubst' for type variables, type varsets, and
type substitutions.
- - - - - - - - - - - - - - - - - - - - - - - - -
mercury_compile.pp, options.nl:
Change the handling of the --dump-hlds option so that you can
now dump the HLDS after any of the 12 HLDS transformation passes.
- - - - - - - - - - - - - - - - - - - - - - - - -
make_hlds.nl:
Report an error if there are clauses for an imported predicate.
- - - - - - - - - - - - - - - - - - - - - - - - -
io.nu.nl:
Add a new predicate r/1 which is like run/1 except that
you pass it a string rather than a list of atoms.
So now you can do
$ mercury_compile.debug
Mercury Interpreter 0.1
NU-Prolog 1.6.4
1?- r("mc -options blah blah blah").
llds.nl:
changed call/2 to call/3 to include gc information about
what registers and stack locations are live, and what their
`shape numbers' are. Currently all the shape numbers are -1
because the shape table stuff hasn't been implemented.
* The changes made are only cosmetic as far as everything else
* is concerned.
*.nl, etc:
changes related to the above.