Estimated hours taken: 20
vn_block:
Fix a typo which reflected a fundamental design error. When finding
cheaper copies of live lvals, for use in creating specialized copies
(parallels) of blocks jumped to from the current location, we used
to use the map reflecting the contents of lvals at the start of the
block, not at the point of the jump.
--pred-value-number, which uses the information computed by the
buggy predicate, actually bootstrapped some time ago despite
this fundamental bug!
value_number:
Fix a bug in the creation of parallel code sequences for computed
gotos. Add some more opprtunities for printing diagnostics.
Move code concerning final verification to vn_verify.
vn_verify:
Move the remaining code concerned with final verification from
value_number to vn_verify.
peephole:
Add a new pattern, which transforms the sequence
incr_sp N; goto L2; L1; incr_sp N; L2
into just
L1; incr_sp N; L2
The pattern is of course more broadly applicable, but I have seen
it only when it involves a single incr_sp between the two labels.
(The longer pattern can be introduced by frameopt.)
opt_util:
Look inside blocks when checking whether an instruction can fall
through. This improves the performance of labelopt.
vn_table:
Make the type vn_table abstract; add, export and use access functions.
vn_util:
Remove a noop predicate, since now it won't ever be made to do
anything.
vn_cost:
Refine debugging output.
vn_debug:
Add some more debugging routines.
opt_debug:
Add some more debugging routines.
det_analysis:
Remove an unused argument.
labelopt:
Formatting change.
Estimated hours taken: 0.25
compiler/make_hlds.m:
Fix a bug reported by Zoltan: it was printing out a misleading error
message, since I had `function' and `predicate' switched.
Estimated hours taken: 0.25
compiler/options.m:
Re-enable excess_assign by default. The problem with it (it
broke the C interface) was fixed a long time ago.
Estimated hours taken: 2
compiler/lambda.m:
Re-enable the optimization of not introducing separate
predicates for lambda expressions when not necessary,
after fixing it so that it doesn't attempt to curry output
arguments in cases such as
lambda([Y::out] is det, q(_, Y))
where q/2 is declared as
:- pred q(int::out, int::out) is det.
Estimated hours taken: 0.1
compiler/unify_proc.m:
In the code generated for compare/3 predicates, call
builtin_int_lt and builtin_int_gt rather than < and >.
This is because < and > are going to be moved from mercury_builtin.m
to int.m.
Estimated hours taken: 0.1
compiler/code_util.m:
Add mercury_builtin:builtin_int_{lt,gt} to the list of builtin
operators, as synonyms for "<" and ">" on ints.
These two predicates don't exist yet, but this change is
the first step towards moving the definitions of < and >
on ints from mercury_builtin.m back into int.m.
(The other parts of this change can't be committed yet
due to bootstrapping problems.)
Estimated hours taken: 0.25
compiler/prog_io.m:
Remove most of the old hack which expanded calls to is/2 in the
parser, since we now use functions instead.
Estimated hours taken: 4
compiler/notes/COMPILER_DESIGN:
Document the changes in the design of type-checking that were
needed to implement overload resolution for predicates with the
same name and arity that occur in different modules.
Estimated hours taken: 4
compiler/{typecheck.m, modes.m}:
Implement overload resolution for predicates with the same name
and arity that occur in different modules.
Amough other things, this change makes it practical to define
pred '<'(int, int) in int.m and pred '<'(float, float) in float.m,
without having to module-qualify uses of `<'.
Estimated hours taken: 0.25
My last change to llds.m broke my second-last change to it.
compiler/llds.m:
As of my previous change, float_consts are now emitted as
static ground terms, so we need to include float_consts in the
set of things which we test for when deciding whether to emit
`const Word mercury_const_n[] = { ... }' or
`const Word * mercury_const_n[] = { ... }', so that gcc gets
position-independent code right.
Estimated hours taken: 2
Do some more work on improving floating-point performance:
emit boxed floating point constants as static ground terms.
options.m:
Add new option --unboxed-float.
exprn_aux.m
Add --unboxed-float to the `exprn_opts' that affect whether
or not things can be static constants. If --unboxed-float
is not set, and --static-ground-terms is, then consider
float_consts to be constant.
code_exprn.m, lookup_switch.m:
Trivial changes to handle new arity of exprn_opts type.
llds.m:
If --unboxed-float is not set, and --static-ground-terms is, then
output `static const Float mercury_float_const_...' declarations
for float_consts.
Estimated hours taken: 1
(plus lots of time debugging the problem via email)
Fix a second occurrence of the problem with casts in the initializers
of static constants causing gcc to generate non-position-independent code.
This prevented the use of gcc on AIX RS/6000 systems, and was also
preventing us from creating genuinely shared shared libraries on Solaris.
compiler/llds.m:
Emit static constants as `const Word * mercury_const_n [] = { ... }'
rather than `const Word mercury_const_n [] = { ... }' not just
in the case when the constant contains code addresses, but also
when it contains data addresses, including addresses of other
static constants and/or string literals.
exprn_aux.m:
Add nondet (in, out) modes to the ..._contain_rval predicates,
which nondeterministically generate all the contained rvals,
and export args_contain_rval. For use by llds.m as required
by the above change.
Estimated hours taken: 1
When emitting the boxing/unboxing macros for floating point
arithmetic, avoid unnecessary boxing and unboxing of constants
and intermediate results.
compiler/llds.m:
Add a new predicate output_rval_as_float that prints the C code
for an rval as an unboxed float, and change the places which
ouput code for floating point operations to call it.
This change means we generate better code for code such as `X
is Y + Z + 1'. Previously we would unbox Y, unbox Z, add them,
box the result, unbox it, box the constant 1, unbox it, add
them, and box the final result. Now we just unbox Y, unbox Z,
add them, add the constant 1, and then box the final result.
Estimated hours taken: 0.1
compiler/hlds_out.m:
Export hlds_out__write_modes for use by mode_errors.m.
(Oops, forgot to include this with my previous change.)
Estimated hours taken: 3
A bunch of cleanups: improve error messages, tidy up the code.
Also, do some work towards supporting higher-order functions.
type_util.m:
Add new predicate type_is_higher_order/3 for checking
whether a type is a higher-order type. This recognizes
both higher-order predicate types and also higher-order
function types.
code_info.m, modes.m, polymorphism.m, shapes.m:
Use type_is_higher_order/3.
make_hlds.m:
Fix another error message to do the right thing when
reporting errors for functions.
mercury_to_mercury:
List `func' in the table of operators, so that it gets
parenthesized correctly.
modes.m, mode_errors.m:
Improve the error message for attempted higher-order unifications:
spit out some context, and if verbose_errors is enabled, spit
out a long description.
Estimated hours taken: 1
compiler/{typecheck.m,clause_to_proc.m}:
If there are no declared modes for a function, give it a default
mode of `:- func foo(in, in, ..., in) = out is det.'.
Estimated hours taken: 1
code_exprn:
Avoid creating unecessary shuffling operations. Specifically,
if a register (say r1) is live, and if you want to put a value
into it, we used to generate a sequence such as:
r2 = r1;
r1 = <some rval>;
Very often the original value of r1 is needed *only* in <some rval>.
We now generate this bad code as before, but then check whether
there are any live variables whose values *require* r2 (as opposed
to having one of their several copies accessible via r2). If not,
we remove the register copy.
Most of the work is done by the auxiliary predicates introduced
in the previous checkin.
This change reduces the size of the compiler by 65 Kb, almost 3%.
This is with standard optimization. Since this optimization removes
code that is also removed by value numbering, any gain in the
size of fully optimized code will be minimal.
Estimated hours taken: 4
code_exprn:
Made a start towards getting better code generated for nested creates
and towards getting rid of useless "shuffle lval" instructions.
Also, some minor cleanup.
exprn_aux:
Add some auxiliary predicates for the new code_exprn.
delay_info:
Remove a useless import of hlds, which is now empty.
Estimated hours taken: 0.1
compiler/notes/RELEASE_CHECKLIST:
When building a release on a 64 bit machine, you must remember
to compile with `--num-tag-bits 2', so that the resulting C code
is portable to 32 bit machines.
Estimated hours taken: 0.5
make_hlds.m, typecheck.m, modes.m, unique_modes.m, hlds_out.m:
Change the progress messages and error messages to print out
"function `mod:foo/2'" instead of the old message "pred
mod:foo/3" (make_hlds.m) or "predicate foo/3" (typecheck.m,
modes.m, unique_modes.m).
Estimated hours taken: 1
Fix the handling of builtins so that it takes module qualifiers into account.
compiler/{call_gen.m, code_util.m}:
Use module-qualifiers when recognizing builtins, so that
int:+/3 and float:+/3 can be recognized as different.
unify_proc.m:
Use a `mercury_builtin:' module-qualifier when constructing
calls to builtins in compiler-generated predicates, so that
user predicates with the same name don't interfere.
Estimated hours taken: 6
NEWS:
Documented the changed interfaces to list, std_util and graph.
configure.in:
Added the number of bytes per word (calculated as sizeof(void *))
as a configuration variable.
compiler/goal_util.m:
Add an optional sanity check for ensuring that all variables in a goal
get renamed in goal_util__rename_vars_in_goal[s].
Also fixed a bug in goal_util__create_variables which was giving
wrong names to some variables (which lead to very confusing hlds dumps).
compiler/excess.m:
in the calls to goal_util__rename_vars_in_goals add the bool which
indicates that we do not want to do the sanity checking operation of
making sure that *all* variables get renamed.
compiler/inlining.m:
in the calls to goal_util__rename_vars_in_goals add the bool which
indicates that we do want to do the sanity checking operation of
making sure that *all* variables get renamed.
Also fixed up calls to goal_util__create_variables for the bug fix
described above.
compiler/quantification.m:
in the calls to goal_util__rename_vars_in_goals add the bool which
indicates that we do not want to do the sanity checking operation of
making sure that *all* variables get renamed.
Also fixed up calls to goal_util__create_variables for the bug fix
described above.
compiler/lookup_switch.m:
changed lookup_switch to use a configuration option "word_size" to
find out the number of bytes (and hence the number of bits) per
word, rather than having a magic number.
compiler/options.m:
added "word_size" for the number of bytes per word. Defaults to 4,
but my next checkin will add a configuration parameter to mc.in.
Don't port to any 16 bit machines in the next couple of days. ;-)
also changed req_density to dense_switch_req_density and added
lookup_switch_req_density for the minimum density of lookup switches.
compiler/switch_gen.m:
changed req_density to dense_switch_req_density and
lookup_switch_req_density appropriately.
library/graph.m:
Add lots of comments.
Fix the interface to make it more consistent.
Fixed some bugs.
library/list.m:
Added some HO stuff from philip:
list__filter/3, list__filter/4
list__filter_map, list_sort/3 (takes a cmp predicate).
Moved the HO interface stuff into the interface at the
top of the file.
Removed list__map_maybe/3.
library/std_util.m:
added a pair/3 predicate from philip for avoiding type ambiguities
when using -/2.
added maybe_pred/3.
doc/user_guide.texi:
added documentation for the changes to the command line options.
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: 1
compiler/modes.m:
Fix a bug in the implementation of functions: the check for
type subsumption (used as part of the process of figuring out
if something is a function or a data constructor) was buggy.
Estimated hours taken: 0.25
mercury/make_hlds.m:
Fix variable numbering bug in the printing out of the arity
of a function: it was printing out the adjusted (N+1) arity,
rather than the original arity.
Estimated hours taken: 0.5
compiler/llds.m:
Emit new call_localret macro, for the case when the
continuation label is a local label (this is like the inverse
of the localcall macro), because on the alpha a call_localret
is two instructions cheaper than the equivalent call would be.
Estimated hours taken: 0.5
Fix a bug with the no_tag optimization.
compiler/{make_tags.m,shapes.m}:
Don't apply the no_tag optimization to type_info/1.
(A cleaner fix would be to change type_info/1 to type_info/2 or /4,
but that would cause some trouble with bootstrapping.)
Estimated hours taken: 0.1
compiler/make_hlds.m:
Fix non-contiguous clauses problem (Zoltan inserted a new predicate
add_pred_marker in the middle of the clauses for another predicate,
and NU-Prolog doesn't like that).
Estimated hours taken: 3
Optimize the represention of types which have only one functor, whose arity
is one, such as
:- type bar ---> foo(baz).
For these types, the functor `foo' serves as an explicit type
conversion, but does not need to be physically represented -- there is
no need to box and unbox the `baz' value when converting to and from
type `bar'. So I've introduced a new tag category `no_tag' for these
sort of functors.
hlds.m:
Add new tag category `no_tag'.
make_tags.m:
For types with only one functor, if the arity of that functor is one,
assign it a `no_tag' tag.
unify_gen.m:
Handle construction, deconstruction, and tag tests for `no_tag' tags.
shapes.m:
For types with only one functor, if the arity of that functor is one,
the tag will be a `no_tag' tag, so the shape of that object is
determined by the shape of the argument.
switch_gen.m:
Handle `no_tag' tags in switch_gen__priority.
(There shouldn't be any `no_tag' switches, since such switches
could only ever have one case -- this change is just necessary
to avoid a determinism error.)
A Constraint Solver Interface For Mercury
<thunderous applause>
Estimated hours taken: 1 summer studentship
This is the implementation of a fairly general constraint solver interface. If
using a library grade *.cnstr, we emit C instructions to keep track of the
solver's implicit state. This is done by storing and restoring 'tickets' -
abstract handles on the solver's state.
We emit a store_ticket() macro:
-when entering the first disjunct of a disjunction
-when entering the condition of an if-then-else
We emit a restore_ticket() macro:
-when entering a disjunct other than the first of a disjunction
-when entering the else part of an if-then-else
We emit a discard_ticket() macro:
-after the restore_ticket() in the final disjunct of a disjunction
-at the start of the 'then' part of an if-then-else
The rules for emitting the macros is slightly more complicated than that shown
above for if-then-elses (determinism of the parts must be taken into account).
compiler/code_info.m:
Get an llds store_ticket/restore_ticket etc. instruction
compiler/disj_gen.m:
Emit ticket macros in the appropriate places in a disjunction.
compiler/dupelim.m:
Handle the new llds instruction.
compiler/frameopt.m:
Handle the new llds instruction.
compiler/handle_options.m:
If the grade is *.cnstr, set the constraints option on.
compiler/ite_gen.m:
Emit ticket macros in the appopriate places in an if-then-else.
compiler/livemap.m:
Handle the new llds instruction.
compiler/llds.m:
Output the ticket macros.
compiler/make_hlds.m:
An irrelevant tidy-up.
compiler/mercury_compile.pp:
If the grade is *.cnstr, pass -DCONSTRAINTS to mgnuc
compiler/middle_rec.m:
Handle the new llds instruction.
compiler/opt_*.m:
Handle the new llds instruction.
compiler/options.m:
Introduce a new boolean option 'constraints'.
compiler/shapes.m:
Output a new shape - 'ticket'.
compiler/unify_proc.m:
Handle the new llds instruction.
compiler/v*.m:
Handle the new llds instruction.
Estimated hours taken: 0.25
compiler/modes.m:
Fix misleading context on the error message for a call which
doesn't match any of the modes of a predicate.
It used to say "in argument N", but the error message relates
to all the arguments, not just the last one.