for review: Aditi back end

Simon Taylor stayl at cs.mu.OZ.AU
Sun Aug 30 17:08:39 AEST 1998


Hi,

Could someone (Tom, Fergus?) please take a look over the Aditi back end
stuff before I commit. To save a few MB of mail spool space I won't post
the files, they're in /home/mercury1/stayl/mercury/review and
/home/mercury1/stayl/mercury/extras/aditi.

Thanks,
Simon.

Here's a small addition to the diff:

Mmakefile:
bindist/Mmakefile:
	Don't distribute extras/aditi yet.

Index: Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/mercury/Mmakefile,v
retrieving revision 1.23
diff -u -t -u -r1.23 Mmakefile
--- Mmakefile	1998/06/01 01:28:14	1.23
+++ Mmakefile	1998/08/30 06:41:10
@@ -204,10 +204,12 @@
                 tar -cf - mercury-$(VERSION) |                          \
                         gzip -9 > mercury-$(VERSION).tar.gz;            \
                 mv stuff-to-exclude/* mercury-$(VERSION);               \
-                rmdir stuff-to-exclude;                                 \
                 mv mercury-$(VERSION)-extras mercury-$(VERSION)/extras; \
+                mv mercury-$(VERSION)/extras/aditi stuff-to-exclude;    \
                 tar -cf - mercury-$(VERSION)/extras |                   \
                         gzip -9 > mercury-$(VERSION)-extras.tar.gz;     \
+                mv stuff-to-exclude/* mercury-$(VERSION)/extras;        \
+                rmdir stuff-to-exclude;                                 \
                 mv mercury-$(VERSION)/tests tests;                      \
                 mv mercury-$(VERSION) mercury                           \
         )

Index: bindist/Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/mercury/bindist/Mmakefile,v
retrieving revision 1.11
diff -u -t -u -r1.11 Mmakefile
--- Mmakefile	1998/04/08 11:06:42	1.11
+++ Mmakefile	1998/08/30 07:02:57
@@ -85,6 +85,8 @@
         -cd ../tests; mmake realclean
         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
         cp -r ../tests $(MERCURY_VERSION)/tests
         for file in $(MISC_FILES); do \
                 sed     -e 's/<VERSION>/$(VERSION)/g' \

Estimated hours taken: 1000

Aditi compilation.

compiler/options.m:
	These are 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,
	--detect-rl-streams:
		Options to control RL optimization passes which are not
		implemented or are not ready to commit yet.
	--aditi-user:
		Default owner of any Aditi procedures, defaults to $USER.
	--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:
	Set --aditi-user to $USER if it is not already set.

compiler/globals.m:
	Add a field to record whether there are any local Aditi procedures
	in the current module.

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' and `owner'.

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:
	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:
	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 some low-level annotation passes on Aditi procedures.

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.
	
WORK_IN_PROGRESS:
	Say something about Aditi.

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:
compiler/rl_block.m:
compiler/rl_analyse.m:
compiler/rl_liveness.m:
	Make sure all relations are initialised before used, clear
	references to relations that are no longer required.

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.




More information about the developers mailing list