Estimated hours taken: 1.5
Split llds into two parts. llds.m defines the data types, while llds_out.m
has the predicates for printing the code.
Removed the call_closure instruction. Instead, we use calls to the
system-defined addresses do_call_{det,semidet,nondet}_closure. This is
how call_closure was implemented already. The advantage of the new
implementation is that it allows jump optimization of what used to be
call_closures, without new code in jumpopt.
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
Implement functional syntax. You can now use `:- func' in a similar manner
to `:- pred'. For example, `:- func foo(int, int) = int.' declares a function,
and `:- mode foo(in, in) = out.' defines a mode for it. You can write clauses
for functions, such as `foo(X, Y) = Z :- Z is 2*X + Y.' Any term in the
head or body of a clause can be a function call, e.g. `bar(X, Y, foo(X, Y))'.
Until we have implemented a proper Mercury debugger, this syntax
should not be used (except that I might reimplement the functions
provided by Prolog's is/2 predicate using this syntax, rather than
the current special-case hack in the parser).
prog_io.m:
Add syntax for declaring and defining functions.
Disallow the use of `=' to define modes, as in `:- mode foo = bar.'
(Instead, you should use `::'. `==' is also allowed.)
Also, use higher-order predicates to simplify some of the rather
repetitious parsing code.
mercury_to_mercury.m, mercury_to_goedel.m, make_hlds.m, modules.m:
Handle new functional syntax.
typecheck.m:
Add support for functions, function types such as `func(int) = int',
and currying. (But there's currently no equivalent to call/N for
functions, so function types and currying aren't very useful yet.)
undef_types.m:
Add support for function types.
modes.m:
Convert function calls into predicate calls.
(This must be done after typechecking is complete,
so I put it in mode analysis.)
hlds.m:
Add new field `pred_or_func' to the pred_info.
hlds_out.m:
Print out the `pred_or_func' field.
higher_order.m, unused_args.m, lambda.m, dnf.m:
Pass extra pred_or_func argument to pred_info_init to specify that
the thing being created is a predicate, not a function.
constraint.m, dependency_graph.m, hlds_out.m:
`mercury_output_mode_subdecl' has been renamed
`mercury_output_pred_mode_subdecl'.
prog_util.m:
Add new predicate split_type_and_mode/3.
llds.m:
Print out
/* code for predicate '*'/3 in mode 0 */
rather than
/* code for predicate */3 in mode 0 */
to avoid a syntax error in the generated C code.
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.
mercury_compile.pp:
Invoke the unique_modes.m pass after determinism analysis.
getopt.m, options.m:
Change getopt.m to use higher-order predicates, so that
it doesn't depend on option.m, and move it from the compiler
directory to the library directory.
mercury_compile.pp, hlds_out.m, mercury_to_c.m:
Minor changes to work with the new getopt.
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: 8
More work on the --high-level-C option.
It now successfully compiles some toy modules.
mercury_to_c.m:
Significant improvements.
mercury_compile.pp:
Invoke the excess-assign pass before generating high-level C code.
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