Estimated hours taken: 4
Implement `recursive' and `non_recursive' pragma c_code declarations.
This allows the compiler to optimize cases when the C code
is known to not call Mercury code. It's also necessary
to allow C code which modifies the hp register to work
(such code must be declared `non_recursive', otherwise
the registers will be saved and restored over it).
To make things bootstrap OK, the old pragma c_code declarations
default to `non_recursive'.
prog_data.m, hlds_goal.m:
Add new field c_is_recursive to pragma c_code goals.
prog_io.m:
Parse the new `recursive' and `non_recursive' pragma c_code
declarations.
make_hlds.m:
Pass the c_is_recursive field from the parse tree to the HLDS.
live_vars.m:
For non-recursive C code, don't save variables on the stack.
code_gen.pp:
For non-recursive C code, don't save variables on the stack,
don't mark the succip as needing to be saved, and don't
call save_registers() and restore_registers().
*.m:
Change c_code/5 to c_code/6.
Estimated hours taken: 12
Four loosely related changes to improve mode inference.
--------------------
(1) Fix a problem with inference of unique modes.
Previously it was sufficient to just look at the final insts of the
mode and check whether they were `clobbered' or not in order to tell
which arguments will be dead on exit from this procedure. However,
that doesn't work for inferred modes, where the final inst will
initially be `not_reached'. Previously mode inference just assumed that
all arguments to a predicate were live, but that prevents it from being
able to infer `di' modes. So I've added a new field to the proc_info
to record which arguments are required to be dead on exit.
I've also changed mode analysis so that it checks that such
arguments really are dead. This means you can declare both `di' and
`ui' modes of a predicate, and so long as you declare the `di' one
first, mode checking should handle this overloading. It also means
that errors such as passing a variable which is live to a procedure with
a `di' mode argument are caught earlier, with a potentially better
error message; mode checking may also be able to reorder such calls,
so that the `di' mode pred is scheduled last. Mode inference now
notices if an argument is dead, and if so will try infering a `di'
mode.
hlds_pred.m:
Add a new field to the proc_info, the `maybe_arglives', of type
`maybe(list(is_live))'. If set, this records whether or not the
arguments are required to be dead after the procedure or not.
Add an access predicate which checks whether this is set,
and returns either the value set, or if no value special value
is set, looks up a value based on the modes by calling get_arg_lives
from mode_util.m.
make_hlds.m:
Add a MaybeArgLives parameter to add_new_pred.
(Also change the error messages about pragmas to reflect
the new pragma syntax.)
clause_to_proc.m, unify_proc.m:
Pass MaybeArgLives = no to add_new_pred.
modes.m, mode_errors.m:
Use the new arglives field. When mode-checking a call (or
higher-order call), check that all the variables which are
required to be dead really are dead.
unique_modes.m:
Use the new arglives field.
mode_util.m:
Add predicate `get_arg_lives', for use by modes.m and hlds_pred.m.
--------------------
(2) Fix a problem with mode inference looping.
It was checking whether a fixpoint had been reached by comparing the
(un-normalised) inferred final insts with the previously recorded final
insts (which had been normalised). Instead, it has to normalise the
insts before the comparison.
modes.m:
When doing mode analysis of an inferred mode, normalise the insts
before checking whether they've changed, rather than vice versa.
--------------------
(3) Fix a problem with the computation of liveness for mode-analysis
of if-then-elses that was detected when I tried to bootcheck the above
changes.
modes.m, unique_modes.m:
When mode-checking if-then-elses, the variables in the "else"
should not be considered live when checking the condition.
(They're nondet-live, but not live with regard to forward execution.)
--------------------
(4) Reduce the occurrence of mode inference inferring spurious
`in(not_reached)' modes.
modes.m:
If the top-level inst of a variable becomes `not_reached', set
the whole instmap to `unreachable'.
Estimated hours taken: 24
Add preliminary support for mode inference.
hlds_pred.m, hlds_out.m:
Add a new pred marker `infer_modes'.
make_hlds.m:
If there are no declared modes for a predicate,
set the `infer_modes' marker in the pred_info.
modes.m:
Implement mode inference.
When we see a call to a predicate with the `infer_modes' marker
set, then if the call does not match any of the modes we've
already inferred for the predicate, create a new inferred mode;
the initial insts are set to the normalised argument insts, and
the final insts are initially set to not_reached. When
analysing such a predicate, rather than checking whether the
inferred final insts match the declared final insts, just
replace the old final insts with the normalised version of the
newly inferred insts. Change the top-level to repeat mode
analysis until a fixpoint is reached. We need to "normalise"
insts to a bounded approximation avoid non-termination due to
infinite expansion.
Also fix a bug which meant that using `inst constrained == any.'
didn't work - the checks for `any' weren't calling `inst_expand'.
mode_util.m:
Change the predicates `inst_is_ground', `inst_is_unique', etc.
so that they consider `not_reached' insts to satisfy the
condition.
mode_errors.m:
Change the message for predicates with no mode declaration.
Add code for printing out inferred mode declarations.
clause_to_proc.m:
Add a new predicate copy_module_clauses_to_procs
to call copy_clauses_to_procs for a list of pred_ids.
We call this from modes.m at the start of each fixpoint iteration.
Estimated hours taken: 24
Treat higher-order predicate calls as a new sort of goal,
rather than as calls to the special predicate call/N, in order to
remove the fixed limit on the number of arguments and on the modes
for call/N.
Also, remove the restriction on output arguments preceding input arguments
in lambda expressions.
hlds_goal.m:
Add new functor higher_order_call/6 to the hlds__goal type.
*.m:
Handle new functor higher_order_call/6.
arg_info.m:
Abstract things a bit more: the argument passing convention
for a procedure may be affected by that procedure's types,
modes, and code_model, as well as the arg_method.
follow_vars.m:
Pass down the args_method, since it is now needed for figuring
out the arg_info for unifications and higher-order calls.
follow_code.m:
Treat complicated unifications in the same way as calls.
lambda.m:
When creating lambda predicates, permute the arguments so
that all input arguments come before all output arguments.
call_gen.m:
When generating higher-order predicate calls, don't abort
if outputs precede inputs; instead, generate code assuming
that the called predicate's args have been permuted so that
the inputs to come before all the outputs.
Estimated hours taken: 8
options.m:
Rename branch_delay_slot to have_delay_slot.
Set optimize_delay_slot in -O2 only if have_delay_slot was set earlier.
This is possible now because the default optimization level is now
set in mc.
mercury_compile:
Change verbose output a bit to be more consistent.
dead_proc_elim:
Export the predicates that will eventually be needed by inlining.m.
inlining.m:
Use the information about the number of times each procedure is called
to inline local nonrecursive procedures that are called exactly once.
EXCEPT that this is turned off at the moment, since the inlining of
parse_dcg_goal_2 in prog_io, which this change enables, causes the
compiler to emit incorrect code.
prog_io:
Moved the data type definitions to prog_data. (Even though prog_io.m
is ten times the size of prog_data.m, the sizes of the .c files are
not too dissimilar.)
Estimated hours taken: 3
options:
Add a new option, --branch-delay-slot, intended for use by mc on
the basis of the configuattion script. It says whether the machine
architecture has delays slots on branches.
The setting of option should affect whether we set
--optimize-delay-slots at -O2, but this doesn't work yet.
hlds_goal:
Add an extra field to hold follow_vars infromation to disjunctions,
switches and if-then-elses. I intend to use this information to
generate better code.
*.m:
Changes to accommodate the extra field.
Estimated hours taken: 10
hlds, hlds_module, hlds_pred, hlds_goal, hlds_data:
Divided the old hlds.m into four files:
hlds_module.m defines the data structures that deal with issues
that are wider than a single predicate. These data structures are
the module_info structure, dependency_info, the predicate table
and the shape table.
hlds_pred.m defined pred_info and proc_info, pred_id and proc_id.
hlds_goal.m defines hlds__goal, hlds__goal_{expr,info}, and the
other parts of goal structures.
hlsd_data.m defines the HLDS types that deal with issues related
to data and its representation: function symbols, types, insts, modes.
It also defines the types related to determinism.
hlds.m is now an empty module. I have not removed it from CVS
because we may need the name hlds.m again, and CVS does not like
the reuse of a name once removed.
other modules:
Import the necessary part of hlds.
det_analysis:
Define a type that was up to now improperly defined in hlds.m.
prog_io:
Move the definition of type determinism to hlds_data. This decision
may need to be revisited when prog_io is broken up.
dnf, lambda:
Simplify the task of defining predicates.
llds:
Fix some comments.
mercury_compile:
If the option -d all is given, dump all HLDS stages.
shape, unused_args:
Fix formatting.
Estimated hours taken: 12
Fixes for two bugs in mode analysis, and
a first cut at support for `any' insts.
(The support for `any' is very preliminary,
has had only the most minimal of testing, and
doubtless has some bugs.)
inst_match.m mercury_to_mercury.m mode_util.m modes.m undef_modes.m
unique_modes.m prog_io.m:
Add new type of inst `any(uniqueness)' to prog_io.m, and
change inst_match.m, mode_util.m, and other places to handle
handle `any' insts.
inst_match.m:
Fix bug in inst_merge: when merging `unique(f(ground)) and `unique',
the result should be `ground', not `unique', since part of the
data structure may be shared. (This fix required adding several
new predicates: `merge_uniq_bound' etc.)
inst_match.m mercury_to_mercury.m mode_util.m modes.m polymorphism.m
prog_io.m switch_detection.m unique_modes.m:
Fix a design bug: in a `bound' inst, the list of bound_insts
must be sorted on the name+arity, not on the name+arg_insts.
To achieve this, I changed the type of the first argument of
functor/2 in the type bound_inst from `const' (just name) to
`cons_id' (name+arity).
Estimated hours taken: 1.5
Undo dylan's changes in the names of some library entities,
by applying the following sed script
s/term_atom/term__atom/g
s/term_string/term__string/g
s/term_integer/term__integer/g
s/term_float/term__float/g
s/term_context/term__context/g
s/term_functor/term__functor/g
s/term_variable/term__variable/g
s/_term__/_term_/g
s/std_util__bool_/bool__/g
to all the `.m' and `.pp' files in the compiler and library directories.
The reason for undoing these changes was to minimize incompatibilities
with 0.4 (and besides, the changes were not a really good idea in the first
place).
I also moved `bool' to a separate module.
The main reason for that change is to ensure that the `__' prefix is
only used when it genuinely represents a module qualifier.
(That's what dylan's changes were trying to acheive, but `term__'
does genuinely represent a module qualifier.)
compiler/*.m:
Apply sed script above;
where appropriate, add `bool' to the list of imported modules.
Estimated hours taken: 18
---------------------------------------------------------
A large bunch of changes to improve unique mode checking.
---------------------------------------------------------
Unique mode checking is now quite similar to redoing mode checking,
except that as it goes along it changes the insts of variables which
may be used again on backtracking from `unique' to `mostly_unique',
and except that it doesn't do any rescheduling.
(This contrasts with my original very simple approach which just kept track
of which variables were nondet-live - that approach only works
for the top-level of the inst. The new approach handles insts
such a list whose skeleton is unique and whose elements are mostly_unique.)
Another improvement is that we now also detect errors resulting from
shallow (semidet) backtracking in if-then-elses and negations, which
previously we missed.
Also, fix a bug in the handling of `X = f(_)' when X is unique:
it was inferring the delta instmap `X -> unique(f(ground))'
rather than `X -> unique(f(unique))'.
unique_modes.m:
Major rewrite.
inst_match.m:
Add new predicate `make_mostly_uniq_inst' which replaces
every occurence of `unique' in an inst with `mostly_uniq'.
Fix bug in abstractly_unify_inst_functor_3 which caused
above-mentioned problem with `X = f(_)' when X is unique.
hlds.m, prog_io.m, mercury_to_mercury.m, mode_util.m, undef_modes.m:
Add a new inst_name `mostly_unique(inst)'; the inst
`defined_inst(mostly_unique(X))' is identical to the
inst X with every occurrence of `unique' replaced with
`mostly_unique'. This change was required in order to
implement the `make_mostly_uniq_inst' predicate for recursive
insts.
mode_info.m:
Add a new field holding the nondet-live variables,
for use by unique_modes.m.
modes.m:
Export a whole bunch of previously private predicates,
for use by unique_modes.m.
det_analysis.m, det_report.m, make_hlds.m, mercury_compile.pp, prog_io.m,
value_number.m:
Fix unique mode errors resulting from I/O operations (calls
to io__lookup_bool_opt) in the conditions of if-then-elses.
code_exprn.m:
Improve error message for one of the internal errors.
det_analysis.m:
Make sure we don't generated unnecessary nested `some' goals.
prog_io.m, inst_match.m, mode_util.m, mercury_to_mercury.m:
Add new insts `mostly_unique' and `mostly_clobbered', with
semantics similar to `unique' and `clobbered', except that
mostly-unique variables might be needed on backtracking.
unique_modes.m:
A good start on the code to check that `unique' modes
are not used for nondet live variables. Still incomplete,
but just about all the code is there except the code to
actually compute the set of nondet live variables as you
traverse the goal.
Estimated hours taken: _2___
Change names with badly placed double underscores (ie where the part of
a name before a double underscore is not the same as the module name.)
Reflect changes in the library interface.
compiler/*:
Use the newer, more correct form of the term and bool names.
Predicates "bool__" are now "std_util__bool" and labels of
the term ADT are now "term_" instead of "term__".
compiler/vn*.m:
change all names "vn__*" to a correct module prefix. All the
names remain qualified.
compiler/hlds.m:
s/\<is_builtin__/hlds__is_builtin_/g
s/\<dependency_info__/hlds__dependency_info_/g
compiler/unify_proc.m:
s/\<unify_proc_info__/unify_proc__info_/g
compiler/transform.m:
s/\<reschedule__conj/transform__reschedule_conj/g
Estimated hours taken: 4
Fix bug in mode analysis with partially instantiated modes
that caused the compiler to generate incorrect code.
compiler/{modes.m,mode_util.m}:
`categorize_unify_var_functor' was computing the wrong
`list(uni_mode)' in the `unify_info' for `construction'
and `deconstruction' unifications. The modes for the
left-hand-side should have been the modes of the various
fields of the variable on the LHS, assuming that the
variable had the same functor as the functor on RHS.
But instead they were all duplicates of the top-level
mode of the LHS variable. (It worked if the top-level
mode was `in' or `out', since in that case the argument
modes would all have been `in' or `out' respectively too.
But it failed if the top-level mode was a partially
instantiated mode.) This caused `split_complicated_subunifies'
to get very confused and ultimately caused the compiler
to generate incorrect code. I fixed this by changing
modes.m so that it computed the correct information.
This also required changing `mode_util__modes_to_uni_modes'
so that it took a list of modes for the LHS rather than a
single mode.
excess:
A new pass to remove unnecessary assignment unifications.
mercury_compile:
Call the new excess assignment module.
options:
Add a new option, excess_assign, to control the new optimization.
Add another, num-real-regs, to specify how many of r1, r2 etc are
actually real registers. The default is now set to 5 for kryten;
later it should be supplied by the mc script, with a value determined
at configuration time.
tag_switch:
Use num-real-regs to figure out whether it is likely to be worthwhile
to eliminate the common subexpression of taking the primary tag of
a variable. Also fix an old performance bug: the test for when a
jump table is worthwhile was reversed.
value_number, vn_block:
Do value numbering on extended basic blocks, not basic blocks.
vn_debug:
Modify an information message.
labelopt:
Clean up an export an internal predicate for value numbering. Replace
bintree_set with set.
middle_rec:
Prepare for the generalization of middle recursion optimization
to include predicates with an if-then-else structure.
cse_detection:
Fix a bug: when hoisting a common desconstruction X = f(Yi), create
new variables for the Yi. This avoids problems with any of the Yis
appearing in other branches of the code.
goal_util:
Add a new predicate for use by cse_detection.
common:
Fix a bug: recompute instmap deltas, since they may be affected by the
optimization of common structures.
code_info:
Make an error message more explicit.
det_analysis:
Restrict import list to the needed modules.
*.m:
Import assoc_list.
The changes made allow declarations of the form:
:- pragma(c_code, predname(Varname1::mode1, Varname2::mode2, ...),
"Some C code to execute instead of a mercury clause;").
There are still a couple of minor problems to be fixed in the near future:
If there is a regular clause given as well as a pragma(c_code, ...) dec, it
is not handled well, and variables names '_' are not handled well.
prog_io.m:
parse the pragma(c_code, ...) dec.
hlds.m:
define a new hlds__goal_expr 'pragma_c_code'.
make_hlds.m:
insert the pragma(c_code, ...) dec. as a pragma_c_code into the hlds.
det_analysis.m:
infer that pragma_c_code goals are det.
modes.m:
convince the mode checker that the correct pragma variables are bound
etc.
quantification.m:
quantify the variables in the pragma(c_code, ...) dec.
code_gen.pp:
convert pragma_c_code into pragma_c (in the llds).
llds.m:
define a new instr, pragma_c. Output the pragma_c
hlds_out.m:
mercury_to_mercury.m:
mercury_to_goedel.m:
spit out pragma(c_code, ...) decs properly
*.m: handle the new pragma_c_code in the hlds or the new pragma_c in the llds
Previously we didn't check if a unification was unifying with
a clobbered value. With these changes, we now do.
inst_match.m:
Add an extra parameter `unify_is_real' to `abstractly_unify_inst'.
The extra parameter specifies whether this is a "real" or "fake"
unification; if it is fake, unifications with clobbered values
are allowed.
modes.m:
Pass the above-mentioned new parameter to `abstractly_unify_inst'.
prog_io.m, hlds.m:
Store the above-mentioned new parameter in the unify_inst table.
mode_util.m:
Use the above-mentioned new parameter when looking up an inst
in the unify_inst table.
undef_modes.m, mercury_to_mercury.m:
More miscellaneous changes to handle new `unify_is_real' parameter.
modes.m, mode_errors.m, mode_util.m:
Finish implementing mode checking of lambda expressions.
inst_match.m:
Mode checking of higher-order pred modes was slightly
too strict - relax it a little.
modes.m, mode_errors.m, mode_info.m:
For mode errors that occur in predicate calls,
record the argument number that they occurred in,
and print it out in mode error messages.
(This also fixes a bug where some of the determinism
error messages would say "in argument 0 of call to pred ...").
polymorphism.m:
A couple of minor simplifications.
frameopt:
Look inside blocks introduced by value numbering when looking
restorations of succip.
value_number, opt_util:
If we are using conservative garbage collection, disable value
numbering for blocks that allocate more than one cell on the heap.
This allows value numbering of most blocks to work in the absence
of -DALL_INTERIOR_POINTERS.
all other source files:
Clean up "blank" lines that nevertheless contain space or tab
characters.
modes.m, mode_util.m, inst_match.m:
Move the 800 lines of code for inst__merge,
abstractly_unify_inst, and the predicates they
call from modes.m into inst_match.m.
(modes.m was getting too huge.)
This set of changes includes most of the work necessary for
mode and determinism checking of higher-order predicates.
prog_io.m:
Change the syntax for lambda expressions: they need
to have a determinism declaration. Lambda
expressions must now look like this:
lambda([X::in, Y::out] is det, ...goal...).
^^^^^^
Note that both the modes and the determinism are mandatory,
not optional.
hlds.m:
Insert a determinism field in the lambda_goal structure.
hlds_out.m, inlining.m, make_hlds.m, modes.m, polymorphism.m, quantification.m,
switch_detection.m, typecheck.m:
Modified to use lambda_goal/4 rather than lambda_goal/3.
prog_io.m:
Add a new field to the `ground' inst, of type `maybe(pred_inst_info)'.
We use this to store the modes and determinism of higher-order
predicate terms.
code_info.m, inst_match.m, mercury_to_mercury.m, mode_util.m, modes.m,
polymorphism.m, shapes.m, undef_modes.m:
Modified to handle higher-order pred modes:
use ground/2 rather than ground/1.
(Note that modes.m still requires a bit more work on this.)
llds.m:
Add a new field to the call_closure/3 instruction to hold the
caller address for use with profiling, since the C macros
require a caller address.
dup_elim.m, frame_opt.m, garbage_out.m, live_map.m, middle_rec.m, opt_debug.m,
opt_util.m, value_number.m, vn_*.m:
Modified to use call_closure/4 rather than call_closure/3.
mercury_to_mercury.m:
Export mercury_output_det for use by hlds_out.m.
-------------------------------------------------------
Implement unique modes. We do not handle local aliasing yet, so this
is still not very useful, except for io__state. Destructive update is
not yet implemented. Also note that this really only implements
"mostly unique" variables that may be non-unique on backtracking - we
don't check that you don't backtrack over I/O, for example.
prog_io.m, mode_util.m, modes.m, inst_match.m:
Major changes to Handle unique modes.
mercury_to_mercury.m, polymorphism.m, prog_out.m, undef_modes.m:
Use `ground(Uniqueness)' rather than just `ground'.
compiler/*.m:
Fix compile errors now that unique modes are enforced: add a
few calls to copy/2, and comment out lots of unique mode
declarations that caused problems.
typecheck.m, mode_info.m:
Hack around the use of unique modes, which doesn't work
because we don't allow local aliasing yet: make the insts
`uniq_type_info' and `uniq_mode_info' not unique at all,
and add a call to copy/2 when extracting the io_state from
type_info or mode_info.
-------------------------------------------------------
Plus a couple of unrelated changes:
hlds.m:
Change the modes for the special predicates from `ground -> ground'
to `in', so that any error messages that show those modes
come out looking nicer.
Add a new shared_inst_table for shared versions of user-defined
insts.
mercury_to_goedel.m:
Use string__is_alnum_or_underscore.
context of the unification from which call was made. We we use this to generate
significantly better error messages. (There should be no more messages of the
form "call to __Unify__(blah blah blah) can fail".) Most of the files are
changed just to reflect this.
An unrelated change in det_analysis is that we now ensure the absence of
cycles by modifying the new inferred determinism in the light of the old
one, ensuring that any changes are monotonic.
In hlds_out, inhibit the printing of pseudo-imported predicates (unifications)
since nobody cares about them except sometimes Fergus.
mode_util.m:
Fix two bugs. One was very subtle, due to the fact that
after my recent bug fix to merge_instmap, the assumption that
merge_instmap(empty_instmap, X) == X
is no longer true. The other was an obvious stupid cut-and-paste
bug - the recursive call in `recompute_instmap_delta_disj'
called `recompute_instmap_delta_CONJ'.
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!!!)
llds, code_info, opt_*, vn*:
Replaced curredoip with redoip(rval) to make references to other
redoips more efficient. Also, by turning modframe(L) into
redoip(curfr) = const(address_const(L)), value_number can now
optimize hijacking code better.
vn*:
If a disagreement on the desired value of an lvalue prevents value
number, try again after skipping to the first control point, since
this may cure the problem.
peephole, opt_util:
Now looking for successive modframes to optimize out.
disj_gen:
Put deterministic alternatives before others, mainly to make
the back mode of append easier to explain in the paper. :-(
mode_util:
Fixed scope error.
garbage_out:
Fixed some spelling and formatting errors.
mode_util.nl, modes.nl, follow_code.nl:
Implement merge_instmap_delta properly, to fix a bug in
determinism analysis. This required threading the module_info
through various predicates.
Makefile.common:
Add new targets `mercury_compile.sicstus' (the Mercury compiler
compiled with Sicstus) and `mercury_compile.sicstus.debug'
(debugging version of the above).
*.nl:
Use Sicstus-compatible char and string escapes.
Avoid the use of explicit existential quantification.
Various other hacks to get things to parse correctly under Sicstus.
prog_io.nl:
Don't allow (A -> B) in DCGs, since NU-Prolog and Mercury give
it different semantics to Sicstus.
sp_builtin.nl, sp_lib.nl:
Split sp_builtin.nl into sp_builtin.nl and sp_lib.nl.
sp_conv.sed:
Add sed script which converts some character escapes so that
they work with Sicstus.
term_io.nl:
Remove term_io__prefix_op etc. since they aren't used anymore.
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").
*.nl:
Replace all occurrences of `not(Vars, Goal)' with just
plain `not(Goal)'.
type_util.nl, switch_gen.nl:
Higher-order pred types are not user-defined types.
Add a `predtype' type category for them.
call_gen.nl:
Change call_closure/2 to call_closure/3 (with liveinfo).
Plus a little bit of random hacking.
det_analysis.nl:
Fix an old "XXX": implement `no_output_vars' properly.
This required threading InstMaps through everything.
modes.nl, inst_match.nl:
Move some predicates from modes.nl into a new module, inst_match.nl,
so that they can be used by det_analysis.nl.
hlds.nl, mode_util.nl:
Do some more work for propagating type info into modes.
hlds_out.nl:
Some minor cosmetic changes.
hlds.nl, prog_io.nl:
Add a couple of comments.
switch_detection.nl:
Search through nested conjunctions, which can be created as
a result of mode analysis.
typecheck.nl, unify_proc.nl:
Fix some determinism errors.
prog_io.nl:
Remove some stuff put in by squirrell:
don't recognize `=>', `<=', or `<=>' in DCG goals.
They don't make sense in DCG goals.
hlds.nl, modes.nl, mode_util.nl.
Do determinism analysis for complicated unifications.
This is done in mode_util.nl at the same time as it does
the mode analysis for them.
mode_info.nl:
Fix determinism error.
typecheck.nl:
Make it an error, not just a warning, if a predicate doesn't
have any clauses. (The only reason it was a warning was because
originally the `:- external' directive wasn't implemented.)
*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.
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.
io.nu.nl, mercury_compile.nl:
Add a default definition of main_predicate/3 in io.nu.nl,
which just calls the NU-Prolog command loop.
Change the way mercury_compile.nl generates the .dep files
so that io.nu.nl will get linked in before the users files,
so that their main_predicate (if any) will override the
one in io.nu.nl.
Makefile.common:
Add an entry to copy the linked NU-Prolog library, which
now starts up with the NU-Prolog command loop, to the
installation directory for use by the `mnp' script.
code_gen.nl, llds.nl, string.nl:
Add some code to put a description of the stack slot usage
as a comment at the start of each procedure prolog.
library.nl, mode_util.nl:
Add some comments.
disj_gen.nl, code_info.nl, code_gen.nl:
Remove the optimization of mkframe()/modframe() for the
first continuation, since it was broken.
hlds_out.nl:
Write the instmap deltas out on separate lines.
liveness.nl:
Fixed bugs in processing of if_then_elses.
live_vars.nl:
Fixed a bug in the processing of if_then_elses.
mode_util.nl:
Fix the recompute_instmap_delta so that it restricts the
instmap_delta to the non-local variables for the goal.
unify_gen.nl:
Implement string equality tests.
llds.nl:
Remove some unnecessary parentheses in the output.
Handle string equality.
goal_info, by adding a new predicate `recompute_instmap_delta' in
mode_util.nl to recompute this info. A couple of minor fixes to
code_gen.nl. Renamed `detect_liveness_is_atomic' as `goal_is_atomic'
and moved it to hlds.nl.
hlds_out.nl:
Minor improvements to the output.
code_info.nl, type_util.nl:
Change make_type_id to fail rather than call error/1
if the type is not valid.
undef_types.nl:
Report invalid types.
mode_util.nl:
Add a new pred `type_constructors'.
modes.nl:
Detect determinism of deconstruction unifications properly,
using the type information.
code_info.nl:
Tidy up the code for code_info__cons_id_to_tag.
prog_io.nl, mode_util.nl, mercury_to_mercury.nl:
Add new inst `free(Type)' and new inst_names `typed_ground(Type)'
and `typed_inst(Type, Inst)' so that we can propagate type
information through the mode system.
Do some of the work necessary to propagate type info to modes.
type_util.nl:
Add an extra output argument to type_to_type_id so that it can
return the type's arguments; also fix a determinism error in
type_to_type_id.
hlds.nl:
Add a comment.
list.nl:
Fix the determinism annotation for same_length.
map.nl:
Add map__apply_to_list.
mode_info.nl:
Add mode_info__get_types_of_vars.
switch_detection.nl:
Minor efficiency improvement.
call_gen.nl, hlds.nl, make_hlds.nl, modes.nl, det_analysis, followvars,
code_gen.nl:
Add an extra field to record the determinism for
deconstruct(...) and complicated_unify(...) unifications.
modes.nl, mode_util.nl:
Handle free-free unifications as assignments, not as
complicated_unifies.
Add mode_is_unused to mode_util.nl so we can detect them.
call_info.nl:
Fix bug in call_info__cons_id_to_tag.
hlds.nl, hlds_out.nl, det_analysis.nl:
Remove the unused `declared_determinsm' field in the goal_info.
Rename the `inferred_determinism' field as just `determism'.
Add a new field `local_determinism'. In det_analysis.nl,
Plug the contents of the new `local_determinsm' field in the goal_info
into the computation of the determinism for each goal.
det_analysis.nl, fix_errs.sed:
For the cases which we currently don't handle correctly,
generate incorrect code in preference to generating spurious
error messages (we still have to handle these cases sometime,
but this means that we can deal with them one at a time).
arg_info.nl, builtins.nl, code_gen.nl, delay_info.nl, det_analysis.nl,
getopt.nl, globals.nl, make_hlds.nl, modes.nl, mode_util.nl, stack.nl,
string.nl, string.nu.nl, term.nl, undef_modes.nl, varset.nl:
Fix determinism errors uncovered by the changes in the determinism
analysis.
bintree.nl, map.nl, varset.nl:
Remove map__search_insert; it's not needed and it's not
really useful.
bintree.nl:
Fix determinism problem in bintree__from_list_2.
options.nl, det_analysis.nl, make_hlds.nl:
Add options to suppress determinism warnings.
det_analysis.nl, hlds.nl, modes.nl:
Allow the delta-instmap to be `unreachable'.
hlds_out.nl:
Output the delta-instmap.
Output conjunctions differently in verbose mode.
llds.nl:
Fix determinism problem.
Change GOTO(LABEL(...)) into GOTO_LABEL(...) which can be
more efficient.
map.nl:
Add map__overlay/3.
typecheck.nl, modes.nl, mode_errors.nl, options.nl, hlds_out.nl.
Split the old `debug' option into debug-types and debug-modes.
Change the default for the `modecheck' option to `yes'.
Add a new verbose-dump-hlds option, and use that instead
of the very-verbose option in hlds_out.nl.
mode_util.nl:
Export mode_get_insts/4.
Add instmap_lookup_var (moved from modes.nl).
Add apply_instmap_delta.
modes.nl, term.nl, prog_util.nl:
Add determinism annotations.
term.nl, prog_io.nl:
Fix bugs in when declarations.
std_util.nl, prog_io.nl:
Add a maybe(T) type to std_util.nl.
Rename the maybe(T) type in prog_io.nl as maybe1(T).
codegen.nl, codeinfo.nl codeutil.nl unifygen.nl:
Made a start on the generation of unifications.
Fixed bug in the generation of prologues and epilogues:
The code generator now saves the succip if calls were
made in the body of the procedure. Useful. :-)
mode_util.nl modes.nl make_hlds.nl unifygen.nl:
created uni_mode structure and generate it appropriately.