Estimated hours taken: 5
bytecode*.m:
These now compile without errors. No other promises are made :-)
options:
Adda new option, --generate-bytecode.
mercury_compile:
Generate bytecode if the option is set.
goal_util:
Add a predicate to find all the variables in a goal, even the ones
that have been quantified. Used by the bytecode generator.
call_gen:
Add a predicate and export another for use by the bytecode generator.
hlds_module:
Add a predicate to look up full naming details on a PredId.
Used by the bytecode generator.
hlds_pred:
Remove the follow_vars field from proc_infos, since it is not needed
any more.
hlds_goal:
Remove the store_map field from goal_infos, since it is not needed
any more.
code_gen, code_info, follow_vars, goal_util, hlds_out, middle_rec, store_alloc:
Accommodate the changes in hlds_goal and hlds_pred
vn_block:
Fix an oversight in my previous change.
Estimated hours taken: 3
Fix a bug to do with nondet live variables.
compiler/code_gen.pp:
explicitly kill off variables that became nondet-live in a
context from which they cannot escape (ie some somes, and nots)
compiler/liveness.m:
improve a couple of comments.
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: 6
compiler/{code_gen.pp,code_info.m,code_exprn.m}:
When generating semidet pragma c_codes, make sure to shuffle r1
out of the way in case its value is needed after the pragma.
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: 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: 5.0
Added a new kind of switch generation which generates array lookups
for dense switches that output constants.
compiler/code_gen.pp:
The interface to switch_gen__generate_switch changed - we now pass
the goal-info which gets used in lookup_switch.
compiler/dense_switch.m:
export dense_switch__calc_density/3 and dense_switch__type_range/5
which get used by lookup_switch.
compiler/options.m:
Added a new option "lookup-switch-size" which is the minimum number
of cases that should be in a switch before we turn it into a lookup
table. Currently, it defaults to 4 which is the same value as used
for the "dense-switch-size" option. Some experimentation may show
a better value.
Also fixed the option names for "dense-switch-size" and
"string-switch-size" which were "...switch_size".
compiler/switch_gen.m:
switch_gen__generate_switch/Lots now take the hlds__goal_info as
one of its arguments, because the goal-info is needed by lookup-
switches.
Also, in switch_gen__generate_switch/Lots, check to see if a switch
can be turned into a dense lookup table, and turn it into one if it
can.
compiler/lookup_switch.m:
A new module that turns switches into lookup tables if the outputs
of the switch are all constants. It does this by generating code
for each of the cases and checking that no code actually got generated
and that all the outputs were constants. The result is that for many
predicates like char_to_int/2, etc instead of a computed goto with
lots and lots of silly trivial cases, we get a simple lookup. This
is good.
There is a case where it may not be a win - if the cost of the range
check and the bitvector lookup outweighs the cost of the jumps that
would otherwise take place.
Estimated hours taken: 1
Fix a bug in code generation for semidet pragma c_codes.
code_gen.pp:
For semidet pragma c_codes, make sure that we lock register r1
before allocating registers to the output variables, so that
we don't clobber r1 before the test to see if it succeeded.
code_info.m:
Add predicates code_info__lock_reg and code_info__unlock_reg which
forward to code_exprn__lock_reg and code_exprn__unlock_reg, for
use in the above change to code_gen.pp.
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: 3
Fix some bugs in which the failure continuation was not being set to
`unknown' after a model_nondet goal. We did it for model_nondet
disjunctions and calls, but not for the other branched goals, namely
switches and if-then-elses. In those cases, it is still necessary to
unset the failure continuation, because if one or more of the branches is
model_nondet but the last branch is model_det or model_semidet, we
don't want to leave the failure continuation as it was before the
branched goal.
code_gen.pp:
After generating a nondet goal, call code_info__unset_failure_cont.
disj_gen.m, call_gen.m:
Remove calls to code_info__unset_failure_cont, since that is
now done in code_gen.pp.
ite_gen.m:
Before entering the condition, it pushes a new failure cont
(pointing to the `else' case), and then after the condition, it
pops this failure cont off again. But if the condition is
nondet, we need to make sure we set the top-level failure
continuation to `unknown' before we generate the condition.
Generating the condition will have done that, but it will
have done it to the failure cont that we just popped!
I've added a call to code_info__unset_failure_cont to do this
to the newly exposed top of the failure cont stack.
Estimated hours taken: 3
Fix an omission in determinism analysis: make sure that a goal
with no output variables is considered to be in a single-solution context.
Also, implement pruning of multidet goals in det contexts.
(This fixes the long-standing problem with a
"Sorry, unimplemented: nondet goal in det context" error in code generation.)
compiler/det_analysis.m:
Make sure that a goal with no output variables is considered to
be in a single-solution context.
compiler/code_gen.pp:
Handle model_nondet goals in det contexts by wrapping them
inside a `generate_det_(pre_)commit' pair.
compiler/code_info.m:
Rename `generate_(pre_)commit' as `generate_semi_(pre_)commit',
and add a new pair of predicates `generate_det_(pre_)commit'.
Also fix restore_failure_cont so that it doesn't abort if
a multidet goal is called from within a det 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: 1
Succip wasn't being marked as live after call_closure.
compiler/code_gen.pp:
Modified code_gen__add_saved_succip to add a live succip in the
liveness information for call_closures.
Added documentation on what this predicate does.
Improved variable naming to conform with coding standard.
Estimated hours taken: 3
Fix bug in C interface: if there was a pragma(c_code, ...) declaration
for a polymorphicly typed predicate, the compiler would get an internal
error, because the number of arguments in the pragma_c_code goal
would not match the number of arguments in the proc_info for that
predicate, so the call to assoc_list__from_corresponding_lists in
compiler/polymorphism.pp:
Add extra type_info arguments to pragma_c_code goals.
compiler/code_gen.pp:
If a variable in a pragma_c_code goal does not occur in the
arg_info map (e.g. it is a type_info argument introduced
by polymorphism.m), just ignore it.
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
instructions, and the last argument from local labels. All these were
placeholders for info put in there by prof.m and used when emitting C
code.
The set of labels that serve as return points are now calculated in llds.m
just before each procedure has its C code generated. This set is passed to
output_instruction along with the label at the start of the procedure.
options, code_gen:
Add an option, --no-simple-neg, to disable the generation of
simplified code for simple negations, since sometimes the more
complex code is better (e.g. for queens) due to branch frequencies.
peephole, jumpopt:
Move the detection of tailcalls from peephole to jumpopt. This
allows us to avoid building some maps in peephole. The code in
jumpopt is also somewhat more general, but this is unlikely
to lead to better code.
opt_util:
Some changes to support the previous modifications. We also
allow framevars in code that looks for stackvars, since the
two kinds of variables can both occur in code that does commits.
optimize:
The main predicate of peephole has a new name, call it by that name.
Also remove Tom's comment asking for my inspection of his change.
value_number:
The main predicate of peephole has a new name, call it by that name.
Also loosen a too-tight sanity check.
code_gen.pp:
Fix a comment about an unimplemented thing.
code_info.m, code_gen.pp:
For the special case of a negated simple test
(ie X \= Y) generate better code. This only works
for the global success or failure of a predicate.
The next version of this fix will work for ->;
as well.
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.
code_gen:
Fixed a cut-and-paste bug in an error message (spotted by Fergus).
common:
Adopted the code to our usual naming convention, and distributed
the declarations of local predicates out of the block at the start.
Fixed one bug. One more bug and the addition of a missing feature
remain.
det_analysis:
Threaded a new switch context field through the diagnosis routines
to improve error messages affecting nested switches. Modified the
code for adding existential quantification to desist if the goal
under consideration is already a quantification. Removed an unused
predicate and updated several comments.
hlds:
Removed the notion of "internal determinism"; commits are now indicated
through "some" goals. Renamed the predicate module_info_shapes to
module_info_get_shapes. Will later change other predicates also to
get consistent naming.
hlds_out:
Removed printing of internal determinisms.
det_analysis:
Changes to accommodate the new way of signalling commits. The comments
on optimizations have been modified to reflect the need for information
about whether goals can raise exceptions. Exported two predicates for
use by follow_code.
live_vars:
Changes to accommodate the new way of signalling commits.
code_gen:
Shift the handling of commits to "some" goals. Some predicates
had three versions, one for each code model; these have been
simplified significantly. The sequence of predicates has also
been rationalised a bit. There is still room for improvement
on both fronts.
disj_gen, ite_gen, middle_rec:
Changed calls to modified predicates in code_gen.
common:
When this pass changes A == f(B, C), D := f(B, C) into A == f(B, C),
D := A, it can change the scopes of A, B and C. The pass did not
take this into account; now it does. The pass is still disabled
until it has been more adequately tested.
mercury_compile:
Moved followcode into the back end. We now thread ModuleInfo through
the backend instead of Shapes, since follow_code modifies other parts
of ModuleInfo as well. Rationalised the stage numbers, WHICH MEANS
-d NUMBERS HAVE CHANGED.
follow_code:
Follow_code is now after determinism analysis, so that we can check
that it does not change the determinism of the branched structure
we are pushing code into. We now push not just builtins but also the
first call after the branched structure into the branched structure,
since this will reduce register shuffling. Made a start on pushing code
into the fronts of branched structures, when some code before the branch
point is useful only in one branch.
options:
Added an option prev_code for the (incomplete) functionality in
follow_code.
vn_flush:
Moved a comment about future functionality to where it now belongs.
cse_detection:
Removed obsolete debugging predicate.
code_gen.pp:
Change code_gen__generate_det_goal so that it aborts if you
try call multi-det code with no output vars. It used to just
silently generate incorrect code....
unifications. See the comments at the top of unify_proc.m for
details of how it's done.
hlds.m:
Add new export statuses `pseudo_imported' and `pseudo_exported'
to handle unification predicates, which can now have complicated
modes.
code_gen.pp, code_info.m, common.m, constraint.m, cse_detection.m,
follow_code.m, follow_vars.m, hlds_out.m, inlining.m, live_vars,
make_hlds.m, mercury_compile.pp, modes.m, store_alloc.m,
switch_detection.m:
Handle pseudo_imported predicates.
modes.m, constraint.m:
Change modecheck to return an updated module_info, since
modechecking may insert new entries into the unify_requests
queue in the module_info. Make sure that modechecking
never inserts requests into the unify_requests queue
for code that has mode errors (or needs rescheduling).
call_gen.m, polymorphism.m:
Move duplicated code into unify_proc.m.
clause_to_proc.m:
Add new predicate clauses_to_proc for use by unify_proc.m.
unify_proc.m:
Implement complicated unifications with complicated modes.
call_gen.m code_gen.pp code_info.m garbage_out.m hlds.m llds.m
mercury_compile.pp shapes.m:
Output .garb files (with --gc accurate). This option overrides
information gleaned from the grades about GC.
Remove some of the magic numbers that were being used for
shape numbers.
hlds.m and lots of other files:
Change the type of the first two arguments of unify/5 in
hlds__goal_expr from `term, term' to `var, unify_rhs'
where unify_rhs is given by
:- type unify_rhs
---> var(var)
; functor(const, list(var))
; lambda_goal(list(var), hlds__goal).
This change was for two reasons: firstly, it simplifies the
code in a lot of places, and secondly, it is a step towards
implementing lambda closures and higher-order predicates
properly.
code*.m & *gen.m:
Implement an improved method of handling negated contexts.
The new method avoids saving things onto the stack before
an if-then-else or negation if it can.
Also, fix the implementation of nondet if-then-else so that
it does the soft cut properly.
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)'.
switch_detection:
Detect partial switches, i.e. disjunctions in which not all
disjuncts form part of the switch. We give preference to full
switches, and failing that, to partial switches with the most arms.
peephole, opt_util:
Fixed the code for the introduction of succeed_discard.
code_gen:
Fixed spelling error in error message.
code_info:
Made error message somewhat more informative.
cse_detection:
Removed debugging code; we now always repeat cse detection after
finding some cses.
det_analysis:
Added some comments.
value_number, vn_debug, vn_flush:
Changes to make debugging easier.
options.m call_gen.m code_gen.pp code_info.m code_util.m llds.m unify_gen.m:
A bunch of changes to implement the procs-per-c-function option.
This default is now `--procs-per-c-function 1', for reasonable
efficiency of compilation, but for efficiency of generated code
(e.g. when compiling benchmarks!)
use `--procs-per-c-function 0' (0 really means infinity).
I haven't tested this in any mode except asm_fast, so it's possible
that this change might break the other modes. If that turns out
to be the case, let me know. The symptom will be an error from
the C compiler or linker.
prog_io, hlds: Added the functor "multidet" to the type determinism.
Added types and predicates to relate determinism to its
two components, can_fail and soln_count.
Removed the functor "unspecified" from the type determinism,
substituting maybe(determinism) for determinism in proc_info.
Replaced the type category with the type code_model,
and added predicates to compute it from determinism.
det_analysis: Redone the analyses to work with determinism, not category
(or code_model). This should enable programmers to write
their own erroneous (and failure) predicates.
other files: Use the new and renamed types and access predicates.
frameopt:
fix the problem with destroying stack frames and creating
them again later, accessing detstackvars that were earlier
nominally destroyed.
vn_livemap:
renamed it to livemap since frameopt now uses it also.
value_number, vn_*:
Fixed some bugs. Reorganized the handling of blocks: they are now
put in at the last minute before llds writes out the code.
Made a start towards exploiting info about cheaper copies of
values.
optimize, options:
Made value_numbering an iterated optimization. Added a new
option to control how many times it is iterated together
with other the jumpopt, peephole and labelopt.
llds, call_gen, code_gen, code_info, middle_rec, opt_debug:
changed type of the argument of livevals to plain set.
Warning: in more than a week I haven't been able to fully test this change,
dur to kryten's flakiness and bugs upstream of the optimizer.
code_gen.pp:
Oops, back out previous change, since it didn't quite work
properly (need to change things so that it doesn't do a
localcall to procedures that are not in the same C function).
exprn_aux.nl:
a new module for manipulating rvals and lvals.
code_exprn.nl:
the new bottom level of the new code generator. This replaces
a large chunk of code_info.
*code* & *gen*:
various small changes to use the new bottom level of the
code generator.
io.nl:
Introduced a new predicate which ignore's any whitespace in the input.
Needs to have all the whitespace character's added to it.
*.nl and *.pp:
Changed the implementation of time profiling. Now during a compile,
the compiler identifies all the internal labels which can be accessed
externally, and marks them. At the moment, these are the continuation
labels of calls and the next disjunct in nondet disjunctions. Then
at the .mod output, it places a macro 'update_prof_current_proc' to
restore the profiling counter.
unify_gen:
Whenever we do a test of a variable against a non-constant functor,
we now try to turn it into a negated test on a constant functor.
This is possible if these two functors are the only ones.
code_aux:
Added an extra predicate to look up type definitions to make the
previous change easier.
llds, code_gen, opt_util, opt_debug, frameopt, jumpopt, peephole:
Added a boolean argument to do_succeed to say whether the nondet
frame should be discarded on success or not. The default is no,
but peephole has an optimization that tries to turn on this flag.
optimize, value_number, vn*:
Restructured the top level of value numbering as part of an effort
to identify blocks that could be optimized further given our knowledge
that the contents of e.g. stackvars is also in registers when we
jump to those blocks. Redone the interface between value_number and
frameopt to allow value_number to be iterated, which is necessary
to take advantage of the previously mentioned capability. Threated
the I/O state through the relevant predicates; value numbering doesn't
use non-logical I/O any more.
llds.nl:
Introduced an extra argument to the LLDS goto. It is the label
address of the Caller and is used for the profiling of tailcall's.
*.nl and *.pp:
Propagated the extra argument to all the appropiate files.
Makefile.*:
Added a target to make the library as a shared library, not just as
an archive.
code_gen, options:
Introduced a new option to disable middle recursion optimization.
This is needed to generate the right example code for section 3 of
the JLP paper.
jumpopt:
Factored some code.
frameopt:
Put back a most of an optimization lost by a previous change.
vn_order:
Changed the computation of desired dependencies; the new method should
lead to improvements more frequently.
code_gen.{nl,pp}:
Fix a long-known undocumented bug in which preds for which
the main conj has inst 'unreachable' aborted.
Before generating a negated goal, save live variables onto
the stack so we can find them again later.
ite_gen.nl:
Before generating the condition of an if-then-else, save the
live variables onto the stack so that we can find them in the
else clause.
live_vars.nl:
Add interference for the cases where live vars are saved before
negations and ite conditions.