for review: Aditi
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Dec 3 19:17:21 AEDT 1998
Hi Fergus,
Here's a diff of the files which have changed since the last review.
I've tried to snip out the parts of the diff which haven't changed.
If you want a proper relative diff just ask, but I don't think it
will tell you much given how much has changed.
The main change was the addition of a pragma to give information
about indexing and an option to control whether the compiler uses
that information in optimization.
Also, I don't think committing the new files in stages will be of
much benefit, so I've updated the log message and
compiler/notes/compiler_design.html to take that into account.
Thanks,
Simon.
New log message:
Estimated hours taken: 1200
Aditi compilation.
compiler/options.m:
The documentation for these is commented out because the Aditi
system is not currently useful to the general public.
--aditi: enable Aditi compilation.
--dump-rl: write the intermediate RL to `<module>.rl_dump'.
--dump-rl-bytecode: write a text version of the bytecodes
to `<module>.rla'
--aditi-only: don't produce a `.c' file.
--filenames-from-stdin: accept a list of filenames to compile
from stdin. This is used by the query shell.
--optimize-rl, --optimize-rl-cse, --optimize-rl-invariants,
--optimize-rl-index, --detect-rl-streams:
Options to control RL optimization passes.
--aditi-user:
Default owner of any Aditi procedures,
defaults to $USER or "guest".
--generate-schemas:
write schemas for base relations to `<module>'.base_schema
and schemas for derived relations to `<module>'.derived_schema.
This is used by the query shell.
compiler/handle_options.m:
Handle the default for --aditi-user.
compiler/hlds_pred.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/make_hlds.m:
Add some Aditi pragma declarations - `aditi', `supp_magic', `context',
`naive', `psn' (predicate semi-naive), `aditi_memo', `aditi_no_memo',
`base_relation', `owner' and `index'.
Separate out code to parse a predicate name and arity.
compiler/hlds_pred.m:
Add predicates to identify Aditi procedures.
Added markers `generate_inline' and `aditi_interface', which
are used internally for Aditi code generation.
Add an `owner' field to pred_infos, which is used for database
security checks.
compiler/make_hlds.m:
Some pragmas must be exported if the corresponding predicates
are exported, check this.
Make sure stratification of Aditi procedures is checked.
Set the `do_aditi_compilation' field of the module_info if there
are any local Aditi procedures or base relations.
Check that `--aditi' is set if Aditi compilation is required.
compiler/post_typecheck.m:
Check that every Aditi predicate has an `aditi__state' argument,
which is used to ensure sequencing of updates and that Aditi
procedures are only called within transactions.
compiler/dnf.m:
Changed the definition of disjunctive normal form slightly
so that a call followed by some atomic goals not including
any database calls is considered atomic. magic.m can handle
this kind of goal, and it results in more efficient RL code.
compiler/hlds_module.m:
compiler/dependency_graph.m:
Added dependency_graph__get_scc_entry_points which finds
the procedures in an SCC which could be called from outside.
Added a new field to the dependency_info, the
aditi_dependency_ordering. This contains all Aditi SCCs of
the original program, with multiple SCCs merged where
possible to improve the effectiveness of differential evaluation
and the low level RL optimizations.
compiler/hlds_module.m:
Add a field to record whether there are any local Aditi procedures
in the current module.
Added versions of module_info_pred_proc_info and
module_info_set_pred_proc_info which take a pred_proc_id,
not a separate pred_id and proc_id.
compiler/polymorphism.m:
compiler/lambda.m:
Make sure that predicates created for closures in Aditi procedures
have the correct markers.
compiler/goal_util.m:
Added goal_util__switch_to_disjunction,
goal_util__case_to_disjunct (factored out from simplify.m)
and goal_util__if_then_else_to_disjunction. These are
require because supplementary magic sets can't handle
if-then-elses or switches.
compiler/type_util.m:
Added type_is_aditi_state/1.
compiler/mode_util.m:
Added partition_args/5 which partitions a list of arguments
into inputs and others.
compiler/inlining.m:
Don't inline memoed procedures.
Don't inline Aditi procedures into non-Aditi procedures.
compiler/intermod.m:
Handle Aditi markers.
Clean up handling of markers which should not appear in `.opt' files.
compiler/simplify.m:
Export a slightly different interface for use by magic.m.
Remove explicit quantifications where possible.
Merge multiple nested quantifications.
Don't report infinite recursion warnings for Aditi procedures.
compiler/prog_out.m:
Generalised the code to output a module list to write any list.
compiler/code_gen.m:
compiler/arg_info.m:
Don't process Aditi procedures.
compiler/mercury_compile.m:
Call magic.m and rl_gen.m.
Don't perform the low-level annotation passes on Aditi procedures.
Remove calls to constraint.m - sometime soon a rewritten version
will be called directly from deforestation.
compiler/passes_aux.m:
Add predicates to process only non-Aditi procedures.
compiler/llds.m:
compiler/llds_out.m:
Added new `code_addr' enum members, do_{det,semidet,nondet}_aditi_call,
which are defined in extras/aditi/aditi.m.
compiler/call_gen.m:
Handle generation of do_*_aditi_call.
compiler/llds_out.m:
Write the RL code for the module as a constant char array
in the `.c' file.
compiler/term_errors.m:
compiler/error_util.m:
Move code to describe predicates into error_util.m
Allow the caller to explicitly add line breaks.
Added error_util:list_to_pieces to format a list of
strings.
Reordered some arguments for currying.
compiler/hlds_out.m:
Don't try to print clauses if there are none.
runtime/mercury_init.h:
util/mkinit.c:
scripts/c2init.in:
Added a function `mercury__load_aditi_rl_code()' to the generated
`<module>_init.c' file which throws all the RL code for the program
at the database. This should be called at connection time by
`aditi__connect'.
Added an option `--aditi' which controls the output
`mercury__load_aditi_rl_code()'.
compiler/notes/compiler_design.html:
Document the new files.
Mmakefile:
bindist/Mmakefile:
Don't distribute extras/aditi yet.
New files:
compiler/magic.m:
compiler/magic_util.m:
Supplementary magic sets transformation. Report errors
for constructs that Aditi can't handle.
compiler/context.m:
Supplementary context transformation.
compiler/rl_gen.m:
compiler/rl_relops.m:
Aditi code generation.
compiler/rl_info.m: Code generator state.
compiler/rl.m:Intermediate RL representation.
compiler/rl_util: Predicates to collect information about RL instructions.
compiler/rl_dump.m: Print out the representation in rl.m.
compiler/rl_opt.m: Control low-level RL optimizations.
compiler/rl_block.m: Break a procedure into basic blocks.
compiler/rl_analyse.m: Generic dataflow analysis for RL procedures.
compiler/rl_liveness.m:
Make sure all relations are initialised before used, clear
references to relations that are no longer required.
compiler/rl_loop.m: Loop invariant removal.
compiler/rl_block_opt.m: CSE and instruction merging on basic blocks.
compiler/rl_key.m: Detect upper/lower bounds for which a goal could succeed.
compiler/rl_sort.m:
Use indexing for joins and projections.
Optimize away unnecessary sorting and indexing.
compiler/rl_stream.m: Detect relations don't need to be materialised.
compiler/rl_code.m:
RL bytecode definitions. Automatically generated from the Aditi
header files.
compiler/rl_out.m:
compiler/rl_file.m:
Output the RL bytecodes in binary to <module>.rlo (for use by Aditi)
and in text to <module>.rla (for use by the RL interpreter).
Also output the schema information if --generate-schemas is set.
compiler/rl_exprn.m:
Generate bytecodes for join conditions.
extras/aditi/Mmakefile:
extras/aditi/aditi.m:
Definitions of some Aditi library predicates and the
interfacing and transaction processing code.
Index: Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/mercury/Mmakefile,v
retrieving revision 1.29
diff -u -t -u -r1.29 Mmakefile
--- Mmakefile 1998/11/13 08:04:17 1.29
+++ Mmakefile 1998/11/24 04:25:30
@@ -237,6 +237,7 @@
mv mercury/trial stuff-to-exclude; \
mv mercury/bytecode stuff-to-exclude; \
mv mercury/lp_solve stuff-to-exclude; \
+ mv mercury/extras/aditi stuff-to-exclude; \
mv mercury/extras mercury-extras-$(VERSION); \
mv mercury mercury-compiler-$(VERSION); \
mv tests mercury-tests-$(VERSION); \
@@ -249,6 +250,7 @@
mv mercury-compiler-$(VERSION) mercury; \
mv mercury-extras-$(VERSION) mercury/extras; \
mv mercury-tests-$(VERSION) tests; \
+ mv stuff-to-exclude/aditi mercury/extras/aditi; \
mv stuff-to-exclude/* mercury; \
rmdir stuff-to-exclude; \
)
Index: bindist/Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/mercury/bindist/Mmakefile,v
retrieving revision 1.13
diff -u -t -u -r1.13 Mmakefile
--- Mmakefile 1998/11/24 00:26:06 1.13
+++ Mmakefile 1998/11/24 04:39:16
@@ -90,6 +90,8 @@
fi
cp -r ../samples $(MERCURY_VERSION)/samples
cp -r ../extras $(MERCURY_VERSION)/extras
+ # Aditi isn't ready for distribution yet.
+ rm -rf $(MERCURY_VERSION)/extras/aditi
if [ -d ../tests ]; then \
cp -r ../tests $(MERCURY_VERSION)/tests; \
else \
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_module.m,v
retrieving revision 1.38
diff -u -t -u -r1.38 hlds_module.m
--- hlds_module.m 1998/11/24 03:57:04 1.38
+++ hlds_module.m 1998/11/24 04:26:43
<< In definition of type do_aditi_compilation,
s/no_do_aditi_compilation/no_aditi_compilation >>
<< Lots of mindless changes because someone else
added a field to the module_info >>
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_out.m,v
retrieving revision 1.211
diff -u -t -u -r1.211 hlds_out.m
--- hlds_out.m 1998/11/24 03:57:06 1.211
+++ hlds_out.m 1998/11/24 04:48:53
<< snip >>
@@ -505,6 +512,7 @@
{ pred_info_get_constraint_proofs(PredInfo, Proofs) },
{ pred_info_get_purity(PredInfo, Purity) },
{ pred_info_get_head_type_params(PredInfo, HeadTypeParams) },
+ { pred_info_get_indexes(PredInfo, Indexes) },
globals__io_lookup_string_option(dump_hlds_options, Verbose),
( { string__contains_char(Verbose, 'C') } ->
% Information about predicates is dumped if 'C'
@@ -530,7 +538,7 @@
( { MarkerList = [] } ->
[]
;
- io__write_string("% markers:"),
+ io__write_string("% markers: "),
hlds_out__write_marker_list(MarkerList),
io__write_string("\n")
),
@@ -540,6 +548,14 @@
hlds_out__write_constraint_proofs(Indent, TVarSet,
Proofs),
io__write_string("\n")
+ ),
+ ( { Indexes = [] } ->
+ []
+ ;
+ io__write_string("% indexes: "),
+ io__write_list(Indexes, ", ",
+ mercury_output_index_spec),
+ io__nl
)
;
[]
@@ -550,7 +566,8 @@
<< snip >>
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_pred.m,v
retrieving revision 1.56
diff -u -t -u -r1.56 hlds_pred.m
--- hlds_pred.m 1998/11/20 04:07:50 1.56
+++ hlds_pred.m 1998/12/02 04:24:53
@@ -14,7 +14,7 @@
:- interface.
:- import_module hlds_data, hlds_goal, hlds_module, llds, prog_data, instmap.
-:- import_module purity, globals, term_util.
+:- import_module purity, rl, globals, term_util.
:- import_module bool, list, set, map, std_util, term, varset.
:- implementation.
@@ -116,8 +116,8 @@
; clauses
; none.
- % The evaluation method that should be used for a pred
-
+ % The evaluation method that should be used for a pred.
+ % Ignored for Aditi procedures.
:- type eval_method ---> eval_normal % normal mercury
% evaluation
; eval_loop_check % loop check only
@@ -230,12 +230,54 @@
<< snip >>
+ ; aditi_memo % Requests that this Aditi predicate be
+ % evaluated using memoing. This has no
+ % relation to eval_method field of the
+ % pred_info, which is ignored for Aditi
+ % predicates.
<< snip >>
@@ -274,6 +316,10 @@
% then it must give an error message.
.
+ % Aditi predicates are identified by their owner as well as
+ % module, name and arity.
+:- type aditi_owner == string.
+
:- type type_info_locn
---> type_info(prog_var)
% It is a normal type_info, i.e. the type
<< snip >>
@@ -478,6 +524,18 @@
map(class_constraint, constraint_proof), pred_info).
:- mode pred_info_set_constraint_proofs(in, in, out) is det.
+:- pred pred_info_get_aditi_owner(pred_info, string).
+:- mode pred_info_get_aditi_owner(in, out) is det.
+
+:- pred pred_info_set_aditi_owner(pred_info, string, pred_info).
+:- mode pred_info_set_aditi_owner(in, in, out) is det.
+
+:- pred pred_info_get_indexes(pred_info, list(index_spec)).
+:- mode pred_info_get_indexes(in, out) is det.
+
+:- pred pred_info_set_indexes(pred_info, list(index_spec), pred_info).
+:- mode pred_info_set_indexes(in, in, out) is det.
+
:- pred pred_info_get_purity(pred_info, purity).
:- mode pred_info_get_purity(in, out) is det.
<< snip >>
:- implementation.
@@ -622,30 +687,42 @@
% (the type_infos are returned from
% the called preds).
% Computed during type checking.
- list(class_constraint)
- % unproven class constraints on type variables
- % in the predicate's body, if any
- % (if this remains non-empty after type
- % checking has finished, post_typecheck.m
- % will report a type error).
+ list(class_constraint),
+ % unproven class constraints on type
+ % variables in the predicate's body,
+ % if any (if this remains non-empty
+ % after type checking has finished,
+ % post_typecheck.m will report a type
+ % error).
+ aditi_owner,
+ % The owner of this predicate if
+ % it is an Aditi predicate. Set to
+ % the value of --aditi-user if no
+ % `:- pragma owner' declaration exists.
+ list(index_spec)
+ % Indexes if this predicate is
+ % an Aditi base relation, ignored
+ % otherwise.
).
pred_info_init(ModuleName, SymName, Arity, TypeVarSet, ExistQVars, Types,
Cond, Context, ClausesInfo, Status, Markers, GoalType,
- PredOrFunc, ClassContext, ClassProofs, PredInfo) :-
+ PredOrFunc, ClassContext, ClassProofs, User, PredInfo) :-
map__init(Procs),
unqualify_name(SymName, PredName),
sym_name_get_module_name(SymName, ModuleName, PredModuleName),
term__vars_list(Types, TVars),
list__delete_elems(TVars, ExistQVars, HeadTypeParams),
UnprovenBodyConstraints = [],
+ Indexes = [],
PredInfo = predicate(TypeVarSet, Types, Cond, ClausesInfo, Procs,
Context, PredModuleName, PredName, Arity, Status, TypeVarSet,
GoalType, Markers, PredOrFunc, ClassContext, ClassProofs,
- ExistQVars, HeadTypeParams, UnprovenBodyConstraints).
+ ExistQVars, HeadTypeParams, UnprovenBodyConstraints, User,
+ Indexes).
pred_info_create(ModuleName, SymName, TypeVarSet, ExistQVars, Types, Cond,
- Context, Status, Markers, PredOrFunc, ClassContext,
+ Context, Status, Markers, PredOrFunc, ClassContext, User,
ProcInfo, ProcId, PredInfo) :-
map__init(Procs0),
proc_info_declared_determinism(ProcInfo, MaybeDetism),
@@ -662,14 +739,16 @@
term__vars_list(Types, TVars),
list__delete_elems(TVars, ExistQVars, HeadTypeParams),
UnprovenBodyConstraints = [],
+ Indexes = [],
PredInfo = predicate(TypeVarSet, Types, Cond, ClausesInfo, Procs,
Context, ModuleName, PredName, Arity, Status, TypeVarSet,
clauses, Markers, PredOrFunc, ClassContext, ClassProofs,
- ExistQVars, HeadTypeParams, UnprovenBodyConstraints).
+ ExistQVars, HeadTypeParams, UnprovenBodyConstraints, User,
+ Indexes).
pred_info_procids(PredInfo, ProcIds) :-
PredInfo = predicate(_, _, _, _, Procs, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _),
+ _, _, _, _, _, _, _, _, _),
map__keys(Procs, ProcIds).
pred_info_non_imported_procids(PredInfo, ProcIds) :-
@@ -702,57 +781,57 @@
pred_info_clauses_info(PredInfo, Clauses) :-
PredInfo = predicate(_, _, _, Clauses, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _).
pred_info_set_clauses_info(PredInfo0, Clauses, PredInfo) :-
PredInfo0 = predicate(A, B, C, _, E, F, G, H, I, J, K, L, M, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, Clauses, E, F, G, H, I, J, K,
- L, M, N, O, P, Q, R, S).
+ L, M, N, O, P, Q, R, S, T, U).
pred_info_arg_types(PredInfo, ArgTypes) :-
pred_info_arg_types(PredInfo, _TypeVars, _ExistQVars, ArgTypes).
pred_info_arg_types(PredInfo, TypeVars, ExistQVars, ArgTypes) :-
- PredInfo = predicate(TypeVars, ArgTypes,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, ExistQVars, _, _).
+ PredInfo = predicate(TypeVars, ArgTypes, _, _, _, _, _, _, _, _, _,
+ _, _, _, _, _, ExistQVars, _, _, _, _).
pred_info_set_arg_types(PredInfo0, TypeVarSet, ExistQVars, ArgTypes,
PredInfo) :-
PredInfo0 = predicate(_, _, C, D, E, F, G, H, I, J, K, L, M, N, O, P,
- _, R, S),
- PredInfo = predicate(TypeVarSet, ArgTypes,
- C, D, E, F, G, H, I, J, K, L, M, N, O, P, ExistQVars, R, S).
+ _, R, S, T, U),
+ PredInfo = predicate(TypeVarSet, ArgTypes, C, D, E, F, G, H, I, J, K,
+ L, M, N, O, P, ExistQVars, R, S, T, U).
pred_info_procedures(PredInfo, Procs) :-
PredInfo = predicate(_, _, _, _, Procs, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _).
pred_info_set_procedures(PredInfo0, Procedures, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, _, F, G, H, I, J, K, L, M, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, Procedures, F, G, H, I, J, K, L, M,
- N, O, P, Q, R, S).
+ N, O, P, Q, R, S, T, U).
pred_info_context(PredInfo, Context) :-
PredInfo = predicate(_, _, _, _, _, Context, _, _, _,
- _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _).
pred_info_module(PredInfo, Module) :-
PredInfo = predicate(_, _, _, _, _, _, Module, _, _, _, _,
- _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _).
pred_info_name(PredInfo, PredName) :-
PredInfo = predicate(_, _, _, _, _, _, _, PredName, _, _, _,
- _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _).
pred_info_arity(PredInfo, Arity) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, Arity, _, _,
- _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _).
pred_info_import_status(PredInfo, ImportStatus) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, ImportStatus, _, _, _,
- _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _).
pred_info_is_imported(PredInfo) :-
pred_info_import_status(PredInfo, imported).
@@ -785,35 +864,35 @@
pred_info_mark_as_external(PredInfo0, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, _, K, L, M, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, imported, K, L, M,
- N, O, P, Q, R, S).
+ N, O, P, Q, R, S, T, U).
pred_info_set_import_status(PredInfo0, Status, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, _, K, L, M, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, Status, K,
- L, M, N, O, P, Q, R, S).
+ L, M, N, O, P, Q, R, S, T, U).
pred_info_typevarset(PredInfo, TypeVarSet) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, TypeVarSet, _, _,
- _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _).
pred_info_set_typevarset(PredInfo0, TypeVarSet, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, _, L, M, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, TypeVarSet, L, M,
- N, O, P, Q, R, S).
+ N, O, P, Q, R, S, T, U).
pred_info_get_goal_type(PredInfo, GoalType) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, GoalType, _,
- _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _).
pred_info_set_goal_type(PredInfo0, GoalType, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, _, M, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, GoalType, M,
- N, O, P, Q, R, S).
+ N, O, P, Q, R, S, T, U).
pred_info_requested_inlining(PredInfo0) :-
pred_info_get_markers(PredInfo0, Markers),
@@ -847,41 +926,41 @@
pred_info_get_markers(PredInfo, Markers) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, Markers,
- _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _).
pred_info_set_markers(PredInfo0, Markers, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, _, N, O, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, Markers,
- N, O, P, Q, R, S).
+ N, O, P, Q, R, S, T, U).
pred_info_get_is_pred_or_func(PredInfo, IsPredOrFunc) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _,
- IsPredOrFunc, _, _, _, _, _).
+ IsPredOrFunc, _, _, _, _, _, _, _).
pred_info_set_class_context(PredInfo0, ClassContext, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N, _, P,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
- ClassContext, P, Q, R, S).
+ ClassContext, P, Q, R, S, T, U).
pred_info_get_class_context(PredInfo, ClassContext) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _,
- ClassContext, _, _, _, _).
+ ClassContext, _, _, _, _, _, _).
pred_info_set_constraint_proofs(PredInfo0, Proofs, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, _,
- Q, R, S),
+ Q, R, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
- O, Proofs, Q, R, S).
+ O, Proofs, Q, R, S, T, U).
pred_info_get_constraint_proofs(PredInfo, ConstraintProofs) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- ConstraintProofs, _, _, _).
+ ConstraintProofs, _, _, _, _, _).
pred_info_get_exist_quant_tvars(PredInfo, ExistQVars) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, ExistQVars, _, _).
+ _, ExistQVars, _, _, _, _).
pred_info_get_univ_quant_tvars(PredInfo, UnivQVars) :-
pred_info_arg_types(PredInfo, ArgTypes),
@@ -892,24 +971,45 @@
pred_info_get_head_type_params(PredInfo, HeadTypeParams) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, HeadTypeParams, _).
+ _, _, HeadTypeParams, _, _, _).
pred_info_set_head_type_params(PredInfo0, HeadTypeParams, PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P,
- Q, _, S),
+ Q, _, S, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P,
- Q, HeadTypeParams, S).
+ Q, HeadTypeParams, S, T, U).
pred_info_get_unproven_body_constraints(PredInfo, UnprovenBodyConstraints) :-
PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, UnprovenBodyConstraints).
+ _, _, UnprovenBodyConstraints, _, _).
pred_info_set_unproven_body_constraints(PredInfo0, UnprovenBodyConstraints,
PredInfo) :-
PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P,
- Q, R, _),
+ Q, R, _, T, U),
PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P,
- Q, R, UnprovenBodyConstraints).
+ Q, R, UnprovenBodyConstraints, T, U).
+
+
+pred_info_get_aditi_owner(PredInfo, Owner) :-
+ PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
+ _, _, _, _, Owner, _).
+
+pred_info_set_aditi_owner(PredInfo0, Owner, PredInfo) :-
+ PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
+ O, P, Q, R, S, _, U),
+ PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
+ O, P, Q, R, S, Owner, U).
+
+pred_info_get_indexes(PredInfo, Indexes) :-
+ PredInfo = predicate(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
+ _, _, _, _, _, Indexes).
+
+pred_info_set_indexes(PredInfo0, Indexes, PredInfo) :-
+ PredInfo0 = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
+ O, P, Q, R, S, T, _),
+ PredInfo = predicate(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
+ O, P, Q, R, S, T, Indexes).
%-----------------------------------------------------------------------------%
<< snip >>
Index: compiler/inlining.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/inlining.m,v
retrieving revision 1.80
diff -u -t -u -r1.80 inlining.m
--- inlining.m 1998/11/20 04:07:53 1.80
+++ inlining.m 1998/11/25 05:31:53
@@ -81,6 +81,7 @@
%-----------------------------------------------------------------------------%
:- interface.
+
:- import_module hlds_goal, hlds_module, hlds_pred, prog_data.
:- import_module io, list, map.
@@ -117,6 +118,17 @@
head_type_params, list(tvar), map(tvar, type)).
:- mode inlining__get_type_substitution(in, in, in, in, out) is det.
+ % inlining__rename_goal(CalledProcHeadVars, CallArgs,
+ % CallerVarSet0, CalleeVarSet, CallerVarSet,
+ % CallerVarTypes0, CalleeVarTypes, CallerVarTypes,
+ % VarRenaming, CalledGoal, RenamedGoal).
+:- pred inlining__rename_goal(list(prog_var), list(prog_var), prog_varset,
+ prog_varset, prog_varset, map(prog_var, type),
+ map(prog_var, type), map(prog_var, type),
+ map(prog_var, prog_var), hlds_goal, hlds_goal).
+:- mode inlining__rename_goal(in, in, in, in, out,
+ in, in, out, out, in, out) is det.
+
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
<< snip >>
@@ -583,12 +602,9 @@
),
% Now rename apart the variables in the called goal.
-
- map__from_corresponding_lists(HeadVars, ArgVars, Subn0),
- goal_util__create_variables(CalleeListOfVars, VarSet0,
- VarTypes1, Subn0, CalleeVarTypes, CalleeVarSet,
- VarSet, VarTypes, Subn),
- goal_util__must_rename_vars_in_goal(CalledGoal, Subn, Goal),
+ inlining__rename_goal(HeadVars, ArgVars, VarSet0, CalleeVarSet,
+ VarSet, VarTypes1, CalleeVarTypes, VarTypes, Subn,
+ CalledGoal, Goal),
apply_substitutions_to_var_map(CalleeTypeInfoVarMap0,
TypeRenaming, TypeSubn, Subn, CalleeTypeInfoVarMap1),
@@ -629,6 +645,16 @@
)
).
+inlining__rename_goal(HeadVars, ArgVars, VarSet0, CalleeVarSet,
+ VarSet, VarTypes1, CalleeVarTypes, VarTypes, Subn,
+ CalledGoal, Goal) :-
+ map__from_corresponding_lists(HeadVars, ArgVars, Subn0),
+ varset__vars(CalleeVarSet, CalleeListOfVars),
+ goal_util__create_variables(CalleeListOfVars, VarSet0,
+ VarTypes1, Subn0, CalleeVarTypes, CalleeVarSet,
+ VarSet, VarTypes, Subn),
+ goal_util__must_rename_vars_in_goal(CalledGoal, Subn, Goal).
+
%-----------------------------------------------------------------------------%
% inlining__inlining_in_disj is used for both disjunctions and
<< snip >>
Index: compiler/llds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_out.m,v
retrieving revision 1.99
diff -u -t -u -r1.99 llds_out.m
--- llds_out.m 1998/11/24 03:57:09 1.99
+++ llds_out.m 1998/11/26 00:19:35
@@ -17,16 +17,18 @@
:- interface.
-:- import_module llds, prog_data, hlds_data.
-:- import_module set_bbbtree, bool, io.
+:- import_module llds, prog_data, hlds_data, rl_file.
+:- import_module set_bbbtree, bool, io, std_util.
% Given a 'c_file' structure, output the LLDS code inside it
% into one or more .c files, depending on the setting of the
% --split-c-files option. The second argument gives the set of
- % labels that have layout structures.
+ % labels that have layout structures. The third gives the Aditi-RL
+ % code for the module.
-:- pred output_llds(c_file, set_bbbtree(label), io__state, io__state).
-:- mode output_llds(in, in, di, uo) is det.
+:- pred output_llds(c_file, set_bbbtree(label), maybe(rl_file),
+ io__state, io__state).
+:- mode output_llds(in, in, in, di, uo) is det.
% Convert an lval to a string description of that lval.
@@ -121,6 +123,12 @@
:- pred llds_out__make_init_name(module_name, string).
:- mode llds_out__make_init_name(in, out) is det.
+ % Returns the name of the Aditi-RL code constant
+ % for a given module.
+
+:- pred llds_out__make_rl_data_name(module_name, string).
+:- mode llds_out__make_rl_data_name(in, out) is det.
+
%-----------------------------------------------------------------------------%
:- implementation.
@@ -164,7 +172,7 @@
%-----------------------------------------------------------------------------%
-output_llds(C_File, StackLayoutLabels) -->
+output_llds(C_File, StackLayoutLabels, MaybeRLFile) -->
globals__io_lookup_bool_option(split_c_files, SplitFiles),
( { SplitFiles = yes } ->
{ C_File = c_file(ModuleName, C_HeaderInfo,
@@ -172,7 +180,7 @@
module_name_to_file_name(ModuleName, ".dir", yes, ObjDirName),
make_directory(ObjDirName),
output_split_c_file_init(ModuleName, Modules, Datas,
- StackLayoutLabels),
+ StackLayoutLabels, MaybeRLFile),
output_split_user_c_codes(UserCCodes, ModuleName,
C_HeaderInfo, StackLayoutLabels, 1, Num1),
output_split_c_exports(Exports, ModuleName,
@@ -184,7 +192,8 @@
output_split_comp_gen_c_modules(Modules, ModuleName,
C_HeaderInfo, StackLayoutLabels, Num4, _Num)
;
- output_single_c_file(C_File, no, StackLayoutLabels)
+ output_single_c_file(C_File, no,
+ StackLayoutLabels, MaybeRLFile)
).
:- pred output_split_user_c_codes(list(user_c_code)::in,
@@ -196,7 +205,7 @@
StackLayoutLabels, Num0, Num) -->
{ CFile = c_file(ModuleName, C_HeaderLines,
[UserCCode], [], [], [], []) },
- output_single_c_file(CFile, yes(Num0), StackLayoutLabels),
+ output_single_c_file(CFile, yes(Num0), StackLayoutLabels, no),
{ Num1 is Num0 + 1 },
output_split_user_c_codes(UserCCodes, ModuleName, C_HeaderLines,
StackLayoutLabels, Num1, Num).
@@ -210,7 +219,7 @@
StackLayoutLabels, Num0, Num) -->
{ CFile = c_file(ModuleName, C_HeaderLines,
[], [Export], [], [], []) },
- output_single_c_file(CFile, yes(Num0), StackLayoutLabels),
+ output_single_c_file(CFile, yes(Num0), StackLayoutLabels, no),
{ Num1 is Num0 + 1 },
output_split_c_exports(Exports, ModuleName, C_HeaderLines,
StackLayoutLabels, Num1, Num).
@@ -223,7 +232,7 @@
output_split_comp_gen_c_vars([Var | Vars], ModuleName, C_HeaderLines,
StackLayoutLabels, Num0, Num) -->
{ CFile = c_file(ModuleName, C_HeaderLines, [], [], [Var], [], []) },
- output_single_c_file(CFile, yes(Num0), StackLayoutLabels),
+ output_single_c_file(CFile, yes(Num0), StackLayoutLabels, no),
{ Num1 is Num0 + 1 },
output_split_comp_gen_c_vars(Vars, ModuleName, C_HeaderLines,
StackLayoutLabels, Num1, Num).
@@ -236,7 +245,7 @@
output_split_comp_gen_c_datas([Data | Datas], ModuleName, C_HeaderLines,
StackLayoutLabels, Num0, Num) -->
{ CFile = c_file(ModuleName, C_HeaderLines, [], [], [], [Data], []) },
- output_single_c_file(CFile, yes(Num0), StackLayoutLabels),
+ output_single_c_file(CFile, yes(Num0), StackLayoutLabels, no),
{ Num1 is Num0 + 1 },
output_split_comp_gen_c_datas(Datas, ModuleName, C_HeaderLines,
StackLayoutLabels, Num1, Num).
@@ -250,16 +259,18 @@
StackLayoutLabels, Num0, Num) -->
{ CFile = c_file(ModuleName, C_HeaderLines,
[], [], [], [], [Module]) },
- output_single_c_file(CFile, yes(Num0), StackLayoutLabels),
+ output_single_c_file(CFile, yes(Num0), StackLayoutLabels, no),
{ Num1 is Num0 + 1 },
output_split_comp_gen_c_modules(Modules, ModuleName, C_HeaderLines,
StackLayoutLabels, Num1, Num).
:- pred output_split_c_file_init(module_name, list(comp_gen_c_module),
- list(comp_gen_c_data), set_bbbtree(label), io__state, io__state).
-:- mode output_split_c_file_init(in, in, in, in, di, uo) is det.
+ list(comp_gen_c_data), set_bbbtree(label), maybe(rl_file),
+ io__state, io__state).
+:- mode output_split_c_file_init(in, in, in, in, in, di, uo) is det.
-output_split_c_file_init(ModuleName, Modules, Datas, StackLayoutLabels) -->
+output_split_c_file_init(ModuleName, Modules, Datas,
+ StackLayoutLabels, MaybeRLFile) -->
module_name_to_file_name(ModuleName, ".m", no, SourceFileName),
module_name_to_split_c_file_name(ModuleName, 0, ".c", FileName),
@@ -275,16 +286,13 @@
"** version ", Version, ".\n",
"** Do not edit.\n",
"*/\n"]),
- io__write_string("/*\n"),
- io__write_string("INIT "),
- output_init_name(ModuleName),
- io__write_string("\n"),
- io__write_string("ENDINIT\n"),
- io__write_string("*/\n\n"),
+
+ output_init_comment(ModuleName),
output_c_file_mercury_headers,
io__write_string("\n"),
output_c_module_init_list(ModuleName, Modules, Datas,
StackLayoutLabels),
+ output_rl_file(ModuleName, MaybeRLFile),
io__told
;
io__progname_base("llds.m", ProgName),
@@ -309,10 +317,10 @@
).
:- pred output_single_c_file(c_file, maybe(int), set_bbbtree(label),
- io__state, io__state).
-:- mode output_single_c_file(in, in, in, di, uo) is det.
+ maybe(rl_file), io__state, io__state).
+:- mode output_single_c_file(in, in, in, in, di, uo) is det.
-output_single_c_file(CFile, SplitFiles, StackLayoutLabels) -->
+output_single_c_file(CFile, SplitFiles, StackLayoutLabels, MaybeRLFile) -->
{ CFile = c_file(ModuleName, C_HeaderLines,
UserCCode, Exports, Vars, Datas, Modules) },
( { SplitFiles = yes(Num) } ->
@@ -337,12 +345,7 @@
( { SplitFiles = yes(_) } ->
[]
;
- io__write_string("/*\n"),
- io__write_string("INIT "),
- output_init_name(ModuleName),
- io__write_string("\n"),
- io__write_string("ENDINIT\n"),
- io__write_string("*/\n\n")
+ output_init_comment(ModuleName)
),
output_c_file_mercury_headers,
@@ -367,6 +370,7 @@
output_c_module_init_list(ModuleName, Modules, Datas,
StackLayoutLabels)
),
+ output_rl_file(ModuleName, MaybeRLFile),
io__told
;
io__progname_base("llds.m", ProgName),
<< snip >>
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/make_hlds.m,v
retrieving revision 1.278
diff -u -t -u -r1.278 make_hlds.m
--- make_hlds.m 1998/11/20 04:08:15 1.278
+++ make_hlds.m 1998/12/02 01:08:43
@@ -61,7 +61,7 @@
:- import_module make_tags, quantification, (inst), term, varset.
:- import_module code_util, unify_proc, special_pred, type_util, mode_util.
:- import_module mercury_to_mercury, passes_aux, clause_to_proc, inst_match.
-:- import_module fact_table, purity, goal_util, term_util, export, llds.
+:- import_module fact_table, purity, goal_util, term_util, export, llds, rl.
:- import_module string, char, int, set, bintree, map, multi_map, require.
:- import_module getopt, assoc_list, term_io.
<< snip >>
@@ -382,9 +384,61 @@
<< snip >>
+ { Pragma = aditi_index(PredName, Arity, Index) },
+ add_base_relation_index(Module0, PredName, Arity, Index,
+ ImportStatus, Context, Module)
<< snip >>
+:- pred set_pred_owner(module_info, sym_name, arity, string, import_status,
+ prog_context, module_info, io__state, io__state).
+:- mode set_pred_owner(in, in, in, in, in, in, out, di, uo) is det.
+
+set_pred_owner(Module0, Name, Arity, Owner, Status, Context, Module) -->
+ { SetOwner =
+ lambda([PredInfo0::in, PredInfo::out] is det, (
+ pred_info_set_aditi_owner(PredInfo0, Owner, PredInfo)
+ )) },
+ { MarkerMustBeExported = yes },
+ do_add_pred_marker(Module0, "owner", Name, Arity, Status,
+ MarkerMustBeExported, Context, SetOwner, Module, _).
+
+:- pred add_base_relation_index(module_info, sym_name, arity, index_spec,
+ import_status, prog_context, module_info, io__state, io__state).
+:- mode add_base_relation_index(in, in, in, in, in, in, out, di, uo) is det.
+
+add_base_relation_index(Module0, Name, Arity, Index, Status,
+ Context, Module) -->
+ { AddIndex =
+ lambda([PredInfo0::in, PredInfo::out] is det, (
+ pred_info_get_indexes(PredInfo0, Indexes0),
+ Indexes = [Index | Indexes0],
+ pred_info_set_indexes(PredInfo0, Indexes, PredInfo)
+ )) },
+ { MarkerMustBeExported = yes },
+ do_add_pred_marker(Module0, "aditi_index", Name, Arity, Status,
+ MarkerMustBeExported, Context, AddIndex, Module, PredIds),
+ { Index = index_spec(_, Attrs) },
+ list__foldl(check_index_attribute(Name, Arity, Context), Attrs),
+ list__foldl(check_index_attribute_pred(Module, Name,
+ Arity, Context, Attrs), PredIds).
+
+ % Check that the index attributes are legal for the predicate's arity.
+:- pred check_index_attribute(sym_name, arity, term__context, int,
+ io__state, io__state).
+:- mode check_index_attribute(in, in, in, in, di, uo) is det.
+
+check_index_attribute(Name, Arity, Context, Attr) -->
+ ( { Attr > 0, Attr =< Arity } ->
+ []
+ ;
+ prog_out__write_context(Context),
+ io__write_string(
+ "In `:- pragma aditi_index(...)' declaration for `"),
+ hlds_out__write_pred_call_id(Name/Arity),
+ io__write_string("':\n"),
+ prog_out__write_context(Context),
+ io__write_string(" attribute "),
+ io__write_int(Attr),
+ io__write_string(" is out of range.\n"),
+ io__set_exit_status(1)
+ ).
+
+ % Check that a relation with an index specified is a base relation
+ % and that the indexed attributes do not include aditi__states.
+:- pred check_index_attribute_pred(module_info, sym_name, arity, term__context,
+ list(int), pred_id, io__state, io__state).
+:- mode check_index_attribute_pred(in, in, in, in, in, in, di, uo) is det.
+
+check_index_attribute_pred(ModuleInfo, Name, Arity, Context, Attrs, PredId) -->
+ { module_info_pred_info(ModuleInfo, PredId, PredInfo) },
+ { pred_info_get_markers(PredInfo, Markers) },
+ { pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
+ ( { check_marker(Markers, base_relation) } ->
+ []
+ ;
+ prog_out__write_context(Context),
+ io__write_string(
+ "Error: `:- pragma aditi_index(...)' declaration"),
+ io__nl,
+ prog_out__write_context(Context),
+ io__write_string(" for "),
+ hlds_out__write_call_id(PredOrFunc, Name/Arity),
+ io__write_string(" without preceding\n"),
+ prog_out__write_context(Context),
+ io__write_string(
+ " `:- pragma base_relation(...)' declaration.\n"),
+ io__set_exit_status(1)
+ ),
+
+ { pred_info_arg_types(PredInfo, ArgTypes) },
+ { AttrIsAditiState =
+ lambda([Attr::in] is semidet, (
+ list__index0(ArgTypes, Attr, ArgType),
+ type_is_aditi_state(ArgType)
+ )) },
+ { list__filter(AttrIsAditiState, Attrs, AditiStateAttrs) },
+
+ ( { AditiStateAttrs = [AditiStateAttr | _] } ->
+ % Indexing on aditi__state attributes is pretty silly,
+ % since they're removed by magic.m.
+ prog_out__write_context(Context),
+ io__write_string(
+ "In `:- pragma aditi_index(...)' declaration for "),
+ hlds_out__write_call_id(PredOrFunc, Name/Arity),
+ io__write_string(":\n"),
+ prog_out__write_context(Context),
+ io__write_string(" attribute "),
+ io__write_int(AditiStateAttr),
+ io__write_string(" is an aditi__state.\n"),
+ io__set_exit_status(1)
+ ;
+ []
+ ).
+
<< snip >>
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_compile.m,v
retrieving revision 1.116
diff -u -t -u -r1.116 mercury_compile.m
--- mercury_compile.m 1998/11/24 03:57:11 1.116
+++ mercury_compile.m 1998/12/03 06:13:44
@@ -26,7 +26,7 @@
% library modules
:- import_module int, list, map, set, std_util, dir, require, string, bool.
-:- import_module library, getopt, set_bbbtree.
+:- import_module library, getopt, set_bbbtree, term, varset.
% the main compiler passes (mostly in order of execution)
:- import_module handle_options, prog_io, prog_out, modules, module_qual.
@@ -36,17 +36,18 @@
:- import_module table_gen.
:- import_module bytecode_gen, bytecode.
:- import_module (lambda), polymorphism, termination, higher_order, inlining.
-:- import_module deforest, dnf, constraint, unused_args, dead_proc_elim.
-:- import_module lco, saved_vars, liveness, term, varset.
+:- import_module deforest, dnf, unused_args, magic, dead_proc_elim.
+:- import_module lco, saved_vars, liveness.
:- import_module follow_code, live_vars, arg_info, store_alloc, goal_path.
:- import_module code_gen, optimize, export, base_type_info, base_type_layout.
+:- import_module rl_gen, rl_opt, rl_out.
:- import_module llds_common, transform_llds, llds_out.
:- import_module continuation_info, stack_layout.
% miscellaneous compiler modules
-:- import_module prog_data, hlds_module, hlds_pred, hlds_out, llds.
+:- import_module prog_data, hlds_module, hlds_pred, hlds_out, llds, rl.
:- import_module mercury_to_c, mercury_to_mercury, mercury_to_goedel.
-:- import_module dependency_graph, prog_util.
+:- import_module dependency_graph, prog_util, rl_dump, rl_file.
:- import_module options, globals, passes_aux.
%-----------------------------------------------------------------------------%
<< snip >>
@@ -951,27 +1000,25 @@
Verbose, Stats, HLDS36), !,
mercury_compile__maybe_dump_hlds(HLDS36, "36", "deforestation"), !,
- % dnf transformations should be after inlining
- % magic sets transformations should be before constraints
- mercury_compile__maybe_transform_dnf(HLDS36, Verbose, Stats, HLDS38), !,
- mercury_compile__maybe_dump_hlds(HLDS38, "38", "dnf"), !,
-
- mercury_compile__maybe_constraints(HLDS38, Verbose, Stats, HLDS40), !,
- mercury_compile__maybe_dump_hlds(HLDS40, "40", "constraint"), !,
+ mercury_compile__maybe_lco(HLDS36, Verbose, Stats, HLDS40), !,
+ mercury_compile__maybe_dump_hlds(HLDS40, "40", "lco"), !,
- mercury_compile__maybe_unused_args(HLDS40, Verbose, Stats, HLDS43), !,
- mercury_compile__maybe_dump_hlds(HLDS43, "43", "unused_args"), !,
+ % DNF transformations should be after inlining.
+ mercury_compile__maybe_transform_dnf(HLDS40, Verbose, Stats, HLDS44), !,
+ mercury_compile__maybe_dump_hlds(HLDS44, "44", "dnf"), !,
+
+ % Magic sets should be the last thing done to Aditi procedures
+ % before RL code generation, and must come immediately after DNF.
+ mercury_compile__maybe_magic(HLDS44, Verbose, Stats, HLDS46), !,
+ mercury_compile__maybe_dump_hlds(HLDS46, "46", "magic"), !,
- mercury_compile__maybe_dead_procs(HLDS43, Verbose, Stats, HLDS46), !,
- mercury_compile__maybe_dump_hlds(HLDS46, "46", "dead_procs"), !,
-
- mercury_compile__maybe_lco(HLDS46, Verbose, Stats, HLDS47), !,
- mercury_compile__maybe_dump_hlds(HLDS47, "47", "lco"), !,
+ mercury_compile__maybe_dead_procs(HLDS46, Verbose, Stats, HLDS48), !,
+ mercury_compile__maybe_dump_hlds(HLDS48, "48", "dead_procs"), !,
% map_args_to_regs affects the interface to a predicate,
% so it must be done in one phase immediately before code generation
- mercury_compile__map_args_to_regs(HLDS47, Verbose, Stats, HLDS49), !,
+ mercury_compile__map_args_to_regs(HLDS48, Verbose, Stats, HLDS49), !,
mercury_compile__maybe_dump_hlds(HLDS49, "49", "args_to_regs"), !,
{ HLDS50 = HLDS49 },
<< snip >>
-
-:- pred mercury_compile__maybe_constraints(module_info, bool, bool,
- module_info, io__state, io__state).
-:- mode mercury_compile__maybe_constraints(in, in, in, out, di, uo)
- is det.
-
-mercury_compile__maybe_constraints(HLDS0, Verbose, Stats, HLDS) -->
- globals__io_lookup_bool_option(constraint_propagation, ConstraintProp),
- ( { ConstraintProp = yes } ->
- maybe_write_string(Verbose, "% Propagating constraints..."),
- maybe_flush_output(Verbose),
- constraint_propagation(HLDS0, HLDS),
- maybe_write_string(Verbose, " done.\n"),
- maybe_report_stats(Stats)
<< snip >>
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.151
diff -u -t -u -r1.151 mercury_to_mercury.m
--- mercury_to_mercury.m 1998/11/24 03:57:12 1.151
+++ mercury_to_mercury.m 1998/11/26 00:31:15
@@ -24,8 +24,8 @@
; not_next_to_graphic_token. % doesn't need quotes
:- import_module hlds_goal, hlds_data, hlds_pred, prog_data, (inst), purity.
-:- import_module varset, term.
-:- import_module bool, std_util, list, io.
+:- import_module rl.
+:- import_module bool, std_util, list, io, varset, term.
% convert_to_mercury(ModuleName, OutputFileName, Items)
:- pred convert_to_mercury(module_name, string, list(item_and_context),
@@ -78,6 +78,10 @@
int, proc_id, list(int), io__state, io__state) is det.
:- mode mercury_output_pragma_unused_args(in, in, in, in, in, di, uo) is det.
+ % Write an Aditi index specifier.
+:- pred mercury_output_index_spec(index_spec, io__state, io__state).
+:- mode mercury_output_index_spec(in, di, uo) is det.
+
% Output the given c_header_code declaration
:- pred mercury_output_pragma_c_header(string, io__state, io__state).
:- mode mercury_output_pragma_c_header(in, di, uo) is det.
@@ -357,6 +361,41 @@
<< snip >>
+ { Pragma = aditi_index(Pred, Arity, Index) },
+ mercury_output_pragma_index(Pred, Arity, Index)
<< snip >>
+:- pred mercury_output_pragma_index(sym_name, arity, index_spec,
+ io__state, io__state).
+:- mode mercury_output_pragma_index(in, in, in, di, uo) is det.
+
+mercury_output_pragma_index(PredName, Arity, IndexSpec) -->
+ io__write_string(":- pragma aditi_index("),
+ mercury_output_bracketed_sym_name(PredName, next_to_graphic_token),
+ io__write_string("/"),
+ io__write_int(Arity),
+ io__write_string(", "),
+ mercury_output_index_spec(IndexSpec),
+ io__write_string(").\n").
+
+mercury_output_index_spec(IndexSpec) -->
+ { IndexSpec = index_spec(IndexType, Attrs) },
+ io__write(IndexType),
+ io__write_string(", ["),
+ mercury_output_int_list(Attrs),
+ io__write_string("]").
%-----------------------------------------------------------------------------%
Index: compiler/module_qual.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/module_qual.m,v
retrieving revision 1.41
diff -u -t -u -r1.41 module_qual.m
--- module_qual.m 1998/11/20 04:08:35 1.41
+++ module_qual.m 1998/11/24 04:26:59
@@ -686,7 +686,26 @@
<< snip >>
+qualify_pragma(aditi_index(SymName, Arity, Index),
+ aditi_index(SymName, Arity, Index), Info, Info) --> [].
<< snip >>
Index: compiler/modules.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modules.m,v
retrieving revision 1.92
diff -u -t -u -r1.92 modules.m
--- modules.m 1998/11/20 04:08:37 1.92
+++ modules.m 1998/12/02 01:26:42
<< snip >>
@@ -829,8 +831,8 @@
).
% pragma `obsolete', `terminates', `does_not_terminate'
-% `termination_info' and `check_termination' declarations
-% are supposed to go in the interface,
+% `termination_info', `check_termination', `aditi', `base_relation'
+% and `owner' pragma declarations are supposed to go in the interface,
% but all other pragma declarations are implementation
% details only, and should go in the implementation.
@@ -856,6 +858,18 @@
pragma_allowed_in_interface(terminates(_, _), yes).
pragma_allowed_in_interface(does_not_terminate(_, _), yes).
pragma_allowed_in_interface(check_termination(_, _), yes).
+ % `aditi', `base_relation', `index' and `owner' pragmas must be in the
+ % interface for exported preds. This is checked in make_hlds.m.
+pragma_allowed_in_interface(aditi(_, _), yes).
+pragma_allowed_in_interface(base_relation(_, _), yes).
+pragma_allowed_in_interface(aditi_index(_, _, _), yes).
+pragma_allowed_in_interface(supp_magic(_, _), no).
+pragma_allowed_in_interface(context(_, _), no).
+pragma_allowed_in_interface(aditi_memo(_, _), no).
+pragma_allowed_in_interface(aditi_no_memo(_, _), no).
+pragma_allowed_in_interface(naive(_, _), no).
+pragma_allowed_in_interface(psn(_, _), no).
+pragma_allowed_in_interface(owner(_, _, _), yes).
check_for_no_exports(Items, ModuleName) -->
globals__io_lookup_bool_option(warn_nothing_exported, ExportWarning),
<< snip >>
Index: compiler/options.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/options.m,v
retrieving revision 1.251
diff -u -t -u -r1.251 options.m
--- options.m 1998/11/18 08:11:16 1.251
+++ options.m 1998/12/03 05:38:48
<< snip >>
@@ -276,6 +282,12 @@
; optimize_vnrepeat
; pred_value_number
; vn_fudge
+ % - RL
+ ; optimize_rl
+ ; optimize_rl_cse
+ ; optimize_rl_invariants
+ ; optimize_rl_index
+ ; detect_rl_streams
% - C
; use_macro_for_redo_fail
; emit_c_loops
<< snip >>
@@ -602,7 +623,13 @@
procs_per_c_function - int(1),
everything_in_one_c_function - special,
c_optimize - bool(no),
- inline_alloc - bool(no)
+ inline_alloc - bool(no),
+% RL
+ optimize_rl - bool(no),
+ optimize_rl_cse - bool(no),
+ optimize_rl_invariants - bool(no),
+ optimize_rl_index - bool(no),
+ detect_rl_streams - bool(no)
]).
option_defaults_2(link_option, [
% Link Options
<< snip >>
@@ -938,6 +975,13 @@
long_option("pred-value-number", pred_value_number).
long_option("vn-fudge", vn_fudge).
+% RL optimizations
+long_option("optimize-rl", optimize_rl).
+long_option("optimize-rl-cse", optimize_rl_cse).
+long_option("optimize-rl-invariants", optimize_rl_invariants).
+long_option("optimize-rl-index", optimize_rl_index).
+long_option("detect-rl-streams", detect_rl_streams).
+
% LLDS->C optimizations
long_option("use-macro-for-redo-fail", use_macro_for_redo_fail).
long_option("emit-c-loops", emit_c_loops).
<< snip >>
@@ -1971,6 +2046,29 @@
"\tExtend value numbering to entire predicates."
]).
+:- pred options_help_rl_rl_optimization(io__state::di, io__state::uo) is det.
+
+options_help_rl_rl_optimization -->
+ [].
+/***** ADITI is not yet useful
+ io__write_string("\n Aditi-RL optimizations:\n"),
+ write_tabbed_lines([
+ "--optimize-rl",
+ "\tEnable the optimizations of Aditi-RL procedures",
+ "\tdescribed below.",
+ "--optimize-rl-cse",
+ "\tOptimize common subexpressions in Aditi-RL procedures.",
+ "\t--optimize-rl-invariants",
+ "\tOptimize loop invariants in Aditi-RL procedures.",
+ "\t--optimize-rl-index",
+ "\tUse indexing to optimize access to relations in Aditi-RL".
+ "\tprocedures.",
+ "\t--detect-rl-streams",
+ "\tDetect cases where intermediate results in Aditi-RL",
+ "\tprocedures do not need to be materialised."
+ ]).
+*****/
+
:- pred options_help_output_optimization(io__state::di, io__state::uo) is det.
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/post_typecheck.m,v
retrieving revision 1.4
diff -u -t -u -r1.4 post_typecheck.m
--- post_typecheck.m 1998/11/20 04:08:50 1.4
+++ post_typecheck.m 1998/12/03 06:44:02
@@ -61,6 +61,8 @@
% Do the stuff needed to initialize the proc_infos so that
% a pred is ready for mode checking (copy clauses from the
% clause_info to the proc_info, etc.)
+ % Also check that all predicates with an `aditi' marker have
+ % an `aditi:state' argument.
%
:- pred post_typecheck__finish_pred(module_info, pred_id, pred_info, pred_info,
io__state, io__state).
@@ -78,10 +80,10 @@
:- implementation.
:- import_module typecheck, clause_to_proc, mode_util, inst_match.
-:- import_module mercury_to_mercury, prog_out, hlds_out, term.
+:- import_module mercury_to_mercury, prog_out, hlds_out, type_util.
:- import_module globals, options.
-:- import_module map, set, assoc_list, bool, std_util.
+:- import_module map, set, assoc_list, bool, std_util, term.
%-----------------------------------------------------------------------------%
% Check for unbound type variables
@@ -114,13 +116,13 @@
[], Errs, Set0, Set),
( Errs = [] ->
PredInfo = PredInfo0,
- IOState = IOState1
+ IOState2 = IOState1
;
%
% report the warning
%
report_unresolved_type_warning(Errs, PredId, PredInfo0,
- ModuleInfo, VarSet, IOState1, IOState),
+ ModuleInfo, VarSet, IOState1, IOState2),
%
% bind all the type variables in `Set' to `void' ...
@@ -129,6 +131,27 @@
bind_type_vars_to_void(Set, Context, VarTypesMap0, VarTypesMap),
ClausesInfo = clauses_info(VarSet, B, VarTypesMap, HeadVars, E),
pred_info_set_clauses_info(PredInfo0, ClausesInfo, PredInfo)
+ ),
+
+ %
+ % Check that all Aditi predicates have an `aditi__state' argument.
+ % This must be done after typechecking because of type inference --
+ % the types of some Aditi predicates may not be known before.
+ %
+ pred_info_get_markers(PredInfo, Markers),
+ pred_info_arg_types(PredInfo, ArgTypes),
+ ( check_marker(Markers, aditi) ->
+ list__filter(type_is_aditi_state, ArgTypes, AditiStateTypes),
+ ( AditiStateTypes = [] ->
+ report_no_aditi_state(PredInfo, IOState2, IOState)
+ ; AditiStateTypes = [_, _ | _] ->
+ report_multiple_aditi_states(PredInfo,
+ IOState2, IOState)
+ ;
+ IOState = IOState2
+ )
+ ;
+ IOState = IOState2
).
:- pred check_type_bindings_2(assoc_list(prog_var, (type)), list(tvar),
@@ -342,6 +365,7 @@
{ pred_info_arg_types(PredInfo0, ArgTypes) },
{ pred_info_procedures(PredInfo0, Procs0) },
{ pred_info_procids(PredInfo0, ProcIds) },
+
propagate_types_into_proc_modes(ModuleInfo, PredId, ProcIds, ArgTypes,
Procs0, Procs),
{ pred_info_set_procedures(PredInfo0, Procs, PredInfo) }.
@@ -393,5 +417,43 @@
io__write_string(" error: unbound inst variable(s).\n"),
prog_out__write_context(Context),
io__write_string(" (Sorry, polymorphic modes are not supported.)\n").
+
+%-----------------------------------------------------------------------------%
+
+:- pred report_no_aditi_state(pred_info, io__state, io__state).
+:- mode report_no_aditi_state(in, di, uo) is det.
+
+report_no_aditi_state(PredInfo) -->
+ io__set_exit_status(1),
+ { pred_info_context(PredInfo, Context) },
+ prog_out__write_context(Context),
+ { pred_info_module(PredInfo, Module) },
+ { pred_info_name(PredInfo, Name) },
+ { pred_info_arity(PredInfo, Arity) },
+ { pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
+ io__write_string("Error: `:- pragma aditi' declaration for "),
+ hlds_out__write_pred_or_func(PredOrFunc),
+ io__write_string(" "),
+ hlds_out__write_pred_call_id(qualified(Module, Name)/Arity),
+ io__write_string(" without an `aditi:state' argument.\n").
+
+:- pred report_multiple_aditi_states(pred_info, io__state, io__state).
+:- mode report_multiple_aditi_states(in, di, uo) is det.
+
+report_multiple_aditi_states(PredInfo) -->
+ io__set_exit_status(1),
+ { pred_info_context(PredInfo, Context) },
+ prog_out__write_context(Context),
+ { pred_info_module(PredInfo, Module) },
+ { pred_info_name(PredInfo, Name) },
+ { pred_info_arity(PredInfo, Arity) },
+ { pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
+ io__write_string("Error: `:- pragma aditi' declaration for "),
+ hlds_out__write_pred_or_func(PredOrFunc),
+ io__write_string(" "),
+ hlds_out__write_pred_call_id(qualified(Module, Name)/Arity),
+ io__nl,
+ prog_out__write_context(Context),
+ io__write_string(" with multiple `aditi:state' arguments.\n").
%-----------------------------------------------------------------------------%
Index: compiler/prog_data.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_data.m,v
retrieving revision 1.42
diff -u -t -u -r1.42 prog_data.m
--- prog_data.m 1998/11/20 04:08:54 1.42
+++ prog_data.m 1998/11/24 05:32:15
@@ -18,9 +18,8 @@
:- interface.
-:- import_module hlds_data, hlds_pred, (inst), purity, term_util.
-:- import_module varset, term.
-:- import_module list, map, term, std_util.
+:- import_module hlds_data, hlds_pred, (inst), purity, rl, term_util.
+:- import_module list, map, varset, term, std_util.
%-----------------------------------------------------------------------------%
@@ -146,6 +145,45 @@
<< snip >>
+
+ ; aditi_index(sym_name, arity, index_spec)
+ % PredName, Arity, IndexType, Attributes
+ %
+ % Specify an index on a base relation.
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.17
diff -u -t -u -r1.17 prog_io_pragma.m
--- prog_io_pragma.m 1998/11/20 04:09:00 1.17
+++ prog_io_pragma.m 1998/11/24 05:35:50
@@ -22,7 +22,7 @@
:- implementation.
-:- import_module prog_io, prog_io_goal, hlds_pred, term_util, term_errors.
+:- import_module prog_io, prog_io_goal, hlds_pred, term_util, term_errors, rl.
:- import_module int, map, string, std_util, bool, require.
parse_pragma(ModuleName, VarSet, PragmaTerms, Result) :-
@@ -494,36 +494,21 @@
(
PragmaTerms = [PredAndArityTerm, FileNameTerm]
->
+ parse_pred_name_and_arity(ModuleName, "fact_table",
+ PredAndArityTerm, ErrorTerm, NameArityResult),
(
- PredAndArityTerm = term__functor(term__atom("/"),
- [PredNameTerm, ArityTerm], _)
- ->
- (
- parse_implicitly_qualified_term(ModuleName,
- PredNameTerm, PredAndArityTerm,
- "pragma fact_table declaration", ok(PredName, [])),
- ArityTerm = term__functor(term__integer(Arity), [], _)
+ NameArityResult = ok(PredName, Arity),
+ (
+ FileNameTerm = term__functor(term__string(FileName), [], _)
->
- (
- FileNameTerm =
- term__functor(term__string(FileName), [], _)
- ->
- Result = ok(pragma(fact_table(PredName, Arity,
- FileName)))
- ;
- Result = error(
- "expected string for fact table filename",
- FileNameTerm)
- )
+ Result = ok(pragma(fact_table(PredName, Arity, FileName)))
;
- Result = error(
- "expected predname/arity for `pragma fact_table(..., ...)'",
- PredAndArityTerm)
+ Result = error("expected string for fact table filename",
+ FileNameTerm)
)
;
- Result = error(
- "expected predname/arity for `pragma fact_table(..., ...)'",
- PredAndArityTerm)
+ NameArityResult = error(ErrorMsg, _),
+ Result = error(ErrorMsg, PredAndArityTerm)
)
;
Result =
@@ -532,6 +517,122 @@
ErrorTerm)
).
<< snip >>
+parse_pragma_type(ModuleName, "aditi_index", PragmaTerms,
+ ErrorTerm, _, Result) :-
+ ( PragmaTerms = [PredNameArityTerm, IndexTypeTerm, AttributesTerm] ->
+ parse_pred_name_and_arity(ModuleName, "aditi_index",
+ PredNameArityTerm, ErrorTerm, NameArityResult),
+ (
+ NameArityResult = ok(PredName, PredArity),
+ (
+ IndexTypeTerm = term__functor(term__atom(IndexTypeStr),
+ [], _),
+ (
+ IndexTypeStr = "unique_B_tree",
+ IndexType = unique_B_tree
+ ;
+ IndexTypeStr = "non_unique_B_tree",
+ IndexType = non_unique_B_tree
+ )
+ ->
+ convert_int_list(AttributesTerm, AttributeResult),
+ (
+ AttributeResult = ok(Attributes),
+ Result = ok(pragma(aditi_index(PredName, PredArity,
+ index_spec(IndexType, Attributes))))
+ ;
+ AttributeResult = error(_, AttrErrorTerm),
+ Result = error(
+ "expected attribute list for `:- pragma aditi_index(...)' declaration",
+ AttrErrorTerm)
+ )
+ ;
+ Result = error(
+ "expected index type for `:- pragma aditi_index(...)' declaration",
+ IndexTypeTerm)
+ )
+ ;
+ NameArityResult = error(NameErrorMsg, NameErrorTerm),
+ Result = error(NameErrorMsg, NameErrorTerm)
+ )
+ ;
+ Result = error(
+"wrong number of arguments in pragma aditi_index(..., ..., ...) declaration",
+ ErrorTerm)
+ ).
+
@@ -645,29 +746,15 @@
parse_simple_pragma(ModuleName, PragmaType, MakePragma,
PragmaTerms, ErrorTerm, Result) :-
- (
- PragmaTerms = [PredAndArityTerm]
- ->
- (
- PredAndArityTerm = term__functor(term__atom("/"),
- [PredNameTerm, ArityTerm], _)
- ->
- (
- parse_implicitly_qualified_term(ModuleName,
- PredNameTerm, ErrorTerm, "", ok(PredName, [])),
- ArityTerm = term__functor(term__integer(Arity), [], _)
- ->
- call(MakePragma, PredName, Arity, Pragma),
- Result = ok(pragma(Pragma))
- ;
- string__append_list(
- ["expected predname/arity for `pragma ",
- PragmaType, "(...)' declaration"], ErrorMsg),
- Result = error(ErrorMsg, PredAndArityTerm)
- )
+ ( PragmaTerms = [PredAndArityTerm] ->
+ parse_pred_name_and_arity(ModuleName, PragmaType,
+ PredAndArityTerm, ErrorTerm, NameArityResult),
+ (
+ NameArityResult = ok(PredName, Arity),
+ call(MakePragma, PredName, Arity, Pragma),
+ Result = ok(pragma(Pragma))
;
- string__append_list(["expected predname/arity for `pragma ",
- PragmaType, "(...)' declaration"], ErrorMsg),
+ NameArityResult = error(ErrorMsg, _),
Result = error(ErrorMsg, PredAndArityTerm)
)
;
@@ -675,6 +762,34 @@
PragmaType, "(...)' declaration"], ErrorMsg),
Result = error(ErrorMsg, ErrorTerm)
).
+
+:- pred parse_pred_name_and_arity(module_name, string, term, term,
+ maybe2(sym_name, arity)).
+:- mode parse_pred_name_and_arity(in, in, in, in, out) is det.
+
+parse_pred_name_and_arity(ModuleName, PragmaType, PredAndArityTerm,
+ ErrorTerm, Result) :-
+ (
+ PredAndArityTerm = term__functor(term__atom("/"),
+ [PredNameTerm, ArityTerm], _)
+ ->
+ (
+ parse_implicitly_qualified_term(ModuleName,
+ PredNameTerm, ErrorTerm, "", ok(PredName, [])),
+ ArityTerm = term__functor(term__integer(Arity), [], _)
+ ->
+ Result = ok(PredName, Arity)
+ ;
+ string__append_list(
+ ["expected predname/arity for `pragma ",
+ PragmaType, "(...)' declaration"], ErrorMsg),
+ Result = error(ErrorMsg, PredAndArityTerm)
+ )
+ ;
+ string__append_list(["expected predname/arity for `pragma ",
+ PragmaType, "(...)' declaration"], ErrorMsg),
+ Result = error(ErrorMsg, PredAndArityTerm)
+ ).
%-----------------------------------------------------------------------------%
Index: compiler/notes/compiler_design.html
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/notes/compiler_design.html,v
retrieving revision 1.21
diff -u -t -u -r1.21 compiler_design.html
--- compiler_design.html 1998/09/10 06:52:46 1.21
+++ compiler_design.html 1998/12/02 05:53:54
@@ -35,9 +35,9 @@
<li> parsing (source files -> HLDS)
<li> semantic analysis and error checking (HLDS -> annotated HLDS)
<li> high-level transformations (annotated HLDS -> annotated HLDS)
-<li> code generation (annotated HLDS -> LLDS)
-<li> low-level optimizations (LLDS -> LLDS)
-<li> output C code (LLDS -> C)
+<li> code generation (annotated HLDS -> LLDS or RL)
+<li> low-level optimizations (LLDS -> LLDS or RL -> RL)
+<li> output code (LLDS -> C or RL -> bytecode)
</ol>
<p>
<< snip >>
+<h3> 8. Aditi-RL optimization </h3>
+
+<ul>
+<li> rl_block.m converts an RL procedure into basic blocks, and performs
+ other tasks such as detecting the loops in those basic blocks.
+
+<li> rl_analyse.m contains a generic data-flow analysis procedure for
+ RL procedures.
+
+<li> rl_liveness.m uses rl_analyse.m to insert code to initialise relations
+ and clear references to them when they are no longer needed.
+
+<li> rl_loop.m moves invariants out of loops.
+
+<li> rl_block_opt.m performs common subexpression elimination and instruction
+ merging on basic blocks.
+
+<li> rl_key.m computes upper and lower bounds on the non-locals of a goal
+ for which the goal could succeed, which is useful for determining when
+ an index could be used for a relational operation.
+
+<li> rl_sort.m introduces sort-merge and indexed versions of relational
+ operations where possible, and optimizes away unnecessary sorting and
+ indexing.
+
+<li> rl_stream.m detects relations which do not need to be materialised.
+
+</ul>
+
<hr>
<!-------------------------->
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/reference_manual.texi,v
retrieving revision 1.114
diff -u -t -u -r1.114 reference_manual.texi
--- reference_manual.texi 1998/11/09 03:52:28 1.114
+++ reference_manual.texi 1998/12/02 06:22:16
<< snip >>
+ at c `pragma aditi_index' is intended to be used only in files automatically
+ at c generated by the Aditi system, so this documentation should disappear
+ at c eventually.
+ at example
+:- pragma aditi_index(@var{Name}/@var{Arity},
+ @var{IndexType}, @var{Attributes}).
+ at end example
+
+The base relation has the given B-tree index. B-tree indexes allow efficient
+retrieval of a tuple or range of tuples from a base relation.
+ at var{IndexType} must be one of @samp{unique_B_tree} or
+ at samp{non_unique_B_tree}. @var{Attributes} is a list of argument
+numbers (argument numbers are counted from one).
Index: doc/user_guide.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/user_guide.texi,v
retrieving revision 1.153
diff -u -t -u -r1.153 user_guide.texi
--- user_guide.texi 1998/11/18 08:11:56 1.153
+++ user_guide.texi 1998/12/03 05:38:41
<< snip >>
+ at sp 1
+ at item --optimize-rl-index
+Use indexing to optimize access to relations in Aditi-RL procedures.
<< snip >>
More information about the developers
mailing list