Files
mercury/tests/misc_tests/mdemangle_test.exp
Simon Taylor 75354e38bb Deforestation.
Estimated hours taken: 400

Deforestation.

This increases the code size of the compiler by ~80k when compiling
with --intermodule-optimization --deforestation.

The improvement from deforestation is not measurable for mmc -C make_hlds.m.
Compile time for make_hlds.m increased from 50.7 seconds to 52.2 seconds
when running deforestation.

compiler/simplify.m
compiler/common.m
	Provide a nicer interface for simplifying a goal,
	not an entire procedure.
	Rework the interface to avoid manipulating lots of booleans.
	Return an estimate of the improvement in cost from simplification.
	Remove failing cases and disjuncts.
	Add an option to optimize common structures even across calls.
	Remove code to merge branched goals, since that is now
	done by deforestation.

	Fix a bug: the code to collect instmap_deltas for cases was not
	including the switched-on variable in the instmap_delta,
	which caused an abort in merge_instmap_delta if the switched
	on variable was further instantiated in the switch.
	This came up while compiling the compiler with --deforestation.

compiler/det_report.
	Output duplicate call warnings even if --warn-simple-code is not set.
	XXX fix the same problem with `:- pragma obsolete'.

compiler/code_aux.m
	Update code_aux__cannot_loop to use termination information.

compiler/hlds_pred.m
compiler/dnf.m
	Pass the type_info_varmap and typeclass_info_varmap
	into hlds_pred__define_new_pred.
	Restrict the variables of the new procedure onto the variables
	of the goal.
	Make sure all relevant type_infos are passed into the new
	procedure if --typeinfo-liveness is set.

compiler/modes.m
compiler/unique_modes.m
compiler/mode_info.m
compiler/modecheck_unify.m
	Put `how_to_check_goal' into the mode_info, rather
	than passing it around.
	Add a field to the `check_unique_modes' case which
	controls whether unique modes is allowed to choose
	a different procedure. For deforestation, this is
	not allowed, since it could result in choosing a less
	efficient procedure after generalisation.

compiler/options.m
	New options:
	--deforestation
	--deforestation-depth-limit
		Safety net for termination of the algorithm.
	--deforestation-cost-factor
		Fudge factor for working out whether deforestation
		was worthwhile.
	--deforestation-vars-threshold
		Like --inline-vars-threshold.
	Enable deforestation at -O3.

	Removed an unnecessary mode for option_defaults_2, since it
	resulted in a warning about disjuncts which cannot succeed.

compiler/handle_options.m
	--no-reorder-conj implies --no-deforestation.

compiler/inlining.m
	Separate code to rename goals into inlining__do_inline_call.

compiler/hlds_goal.m
	Added predicates goal_list_nonlocals, goal_list_instmap_delta
	and goal_list_determinism to approximate information about
	conjunctions.

compiler/hlds_module.m
	Added module_info_set_pred_proc_info to put an updated
	pred_info and proc_info back into the module_info.

compiler/hlds_out.m
	Exported hlds_out__write_instmap for debugging of deforestation.
	Bracket module names on constructors where necessary.

compiler/mercury_compile.m
	Call deforestation.
	Use the new interface to simplify.m.

compiler/intermod.m
	Put recursive predicates with a top-level branched goal
	into `.opt' files.

goal_util.m
	Added goal_calls_pred_id to work out if a predicate is
	recursive before mode analysis.
	Export goal_util__goals_goal_vars for use by deforestation.
	Give a better message for a missing variable in a substitution.

compiler/instmap.m
	Give a better message for inst_merge failing.

compiler/notes/compiler_design.m
	Document the new modules.

library/varset.m
	Add varset__select to project a varset's names and values
	onto a set of variables.

doc/user_guide.texi
	Document deforestation.
	Remove a reference to a non-existent option, --no-specialize.

util/mdemangle.c
profiler/demangle.m
tests/misc_tests/mdemangle_test.{exp,inp}
	Handle the `DeforestationIn__' predicate names introduced by
	deforestation, similar to the `IntroducedFrom__' for lambda goals.

New files:

deforest.m	Deforestation.
pd_cost.m	Cost estimation.
pd_debug.m	Debugging output.
pd_info.m	State type and version control.
pd_term.m	Termination checking.
pd_util.m	Utility predicates
1998-04-27 04:05:12 +00:00

133 lines
4.7 KiB
Plaintext

A collection of symbols for use in testing mdemangle.
Each symbol is followed by the correct decoding.
a common block
<shared constant number 21 for module mercury_builtin>
<shared constant number 21 for module mercury_builtin>
a base type info
<base type_info for type 'mercury_builtin:list'/1>
<base type_info for type 'mercury_builtin:list'/1>
a base type layout
<type layout for type 'mercury_builtin:term__context'/0>
<type layout for type 'mercury_builtin:term__context'/0>
a base type functors
<type functors for type 'eliza:message'/0>
<type functors for type 'eliza:message'/0>
an unqualified base type info
<base type_info for type 'int'/0>
<base type_info for type 'int'/0>
an unqualified base type layout
<type layout for type 'float'/0>
<type layout for type 'float'/0>
a mangled name
<predicate '!'/0 mode 0>
<predicate '!'/0 mode 0>
a compare predicate
<compare/3 predicate for type 'mercury_builtin:comparison_result'/0>
<compare/3 predicate for type 'mercury_builtin:comparison_result'/0>
an index predicate
<index/2 predicate for type 'mercury_builtin:list'/1>
<index/2 predicate for type 'mercury_builtin:list'/1>
a unify predicate
<unification predicate for type 'mercury_builtin:term'/0 mode 0>
<unification predicate for type 'mercury_builtin:term'/0 mode 0>
a normal predicate
<predicate 'copy'/2 mode 1>
<predicate 'copy'/2 mode 1>
a function
<function 'copy'/2 mode 1>
<function 'copy'/2 mode 1>
an internal label
<predicate 'copy'/2 mode 1 label 5>
<predicate 'copy'/2 mode 1 label 5>
unused args
<predicate 'copy'/2 mode 1 (minus unused args)>
<predicate 'copy'/2 mode 1 (minus unused args)>
unused args
<predicate 'copy'/2 mode 1 (minus unused args)>
<predicate 'copy'/2 mode 1 (minus unused args)>
higher order specialization
<predicate 'copy'/2 mode 1 (specialized)>
<predicate 'copy'/2 mode 1 (specialized)>
higher order specialization (regression test for 1 char pred names)
<predicate 'c'/2 mode 1 (specialized)>
<predicate 'c'/2 mode 1 (specialized)>
higher order specialization and unused args
<predicate 'copy'/2 mode 1 (specialized) (minus unused args)>
<predicate 'copy'/2 mode 1 (specialized) (minus unused args)>
mangled name with unused args
<predicate '!'/2 mode 0 (minus unused args)>
<predicate '!'/2 mode 0 (minus unused args)>
some tests of symbols that should not be demangled
(this is a regression test: previous versions of mdemangle
seg faulted for this case)
mercury_data_foo
mercury_data_foo
some lambda goals
<pred goal (#9) from 'simplex' in module 'lp' line 262 label 5>
<pred goal (#9) from 'simplex' in module 'lp' line 262 label 5>
<func goal (#4) from 'collect_vars' in module 'lp' line 153>
<func goal (#4) from 'collect_vars' in module 'lp' line 153>
procedures introduced by deforestation
<deforestation procedure (#9) from 'simplex' in module 'lp' line 262 label 5>
<deforestation procedure (#9) from 'simplex' in module 'lp' line 262 label 5>
<deforestation procedure (#4) from 'collect_vars' in module 'lp' line 153>
<deforestation procedure (#4) from 'collect_vars' in module 'lp' line 153>
A realistic test
ml -s asm_fast.gc.tr --no-demangle -o interpreter interpreter_init.o \
interpreter.o -lcfloat_lib
Undefined first referenced
symbol in file
<predicate 'tr_store:get_mutvar'/4 mode 0> interpreter.o
<index/2 predicate for type 'store:mutvar'/2> interpreter.o
<compare/3 predicate for type 'store:mutvar'/2> interpreter.o
<predicate 'std_util:unsorted_aggregate'/4 mode 5> interpreter.o
<base type_info for type 'store:some_store_type'/0> interpreter.o
<unification predicate for type 'store:mutvar'/2 mode 0> interpreter.o
<predicate 'tr_store:new_mutvar'/4 mode 0> interpreter.o
<predicate 'tr_store:set_mutvar'/4 mode 0> interpreter.o
<base type_info for type 'store:mutvar'/2> interpreter.o
ld: fatal: Symbol referencing errors. No output written to interpreter
gmake: *** [interpreter] Error 1
A realistic test
ml -s asm_fast.gc.tr --no-demangle -o interpreter interpreter_init.o \
interpreter.o -lcfloat_lib
Undefined first referenced
symbol in file
<predicate 'tr_store:get_mutvar'/4 mode 0> interpreter.o
<index/2 predicate for type 'store:mutvar'/2> interpreter.o
<compare/3 predicate for type 'store:mutvar'/2> interpreter.o
<predicate 'std_util:unsorted_aggregate'/4 mode 5> interpreter.o
<base type_info for type 'store:some_store_type'/0> interpreter.o
<unification predicate for type 'store:mutvar'/2 mode 0> interpreter.o
<predicate 'tr_store:new_mutvar'/4 mode 0> interpreter.o
<predicate 'tr_store:set_mutvar'/4 mode 0> interpreter.o
<base type_info for type 'store:mutvar'/2> interpreter.o
ld: fatal: Symbol referencing errors. No output written to interpreter
gmake: *** [interpreter] Error 1