Implement static allocation of grounds terms for the

Estimated hours taken: 20

Implement static allocation of grounds terms for the
MLDS back-end.

compiler/hlds_goal.m:
	Change the `maybe(cell_to_reuse)' field of `construct'
	unifications from a `maybe(cell_to_reuse)' into a
	`how_to_construct' type with three alternatives,
	`reuse_cell(cell_to_reuse)', `construct_dynamically',
	and the new alternative `construct_statically(static_cons)'.
	`static_cons' is a new type that provides information on
	how to construct a static ground term.

compiler/goal_util.m:
compiler/lambda.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/modecheck_unify.m:
compiler/polymorphism.m:
compiler/quantification.m:
	Trivial changes to handle the change to the `maybe(cell_to_reuse)'
	field of `construct' unifications.

compiler/mark_static_terms.m:
	New module.  This traverses the HLDS and marks terms which can
	be construction unifications which can be allocated statically
	with the `construct_statically' flag.

compiler/mercury_compile.m:
	For the MLDS back-end, if the static_ground_terms option is set,
	invoke the mark_static_terms pass.

compiler/ml_unify_gen.m:
	When generating code for construction unifications, pass down
	the `how_to_reuse' field.  If this is `construct_statically',
	then generate a local initialized static constant, rather than
	using `new_object' to allocate the memory dynamically.
	(This required some fairly substantial reorganization.
	I changed ml_gen_construct so that no_tag types and compound
	terms, including closures, are handled separately from
	constants.  I moved some of the code from ml_gen_construct_rep
	into ml_gen_construct, and the remainder, which deals with
	constants, was simplified and renamed ml_get_constant.  The
	code for constructing closures was moved into a separate
	predicate ml_gen_closure, and was simplified by elimination of
	some code duplication.  I also added a bunch of new procedures
	for generating static constants.)

compiler/mlds.m:
	Add a new alternative `mlds__array_type' to the mlds__type type.
	This is needed by ml_unify_gen.m for static constants.

compiler/mlds_to_c.m:
	Handle `mlds__array_type'.  This required splitting
	mlds_output_type into mlds_output_type_prefix and
	mlds_output_type_suffix.

compiler/ml_code_util.m:
	Reorder the code slightly, to improve readability.
This commit is contained in:
Fergus Henderson
2000-05-22 18:00:52 +00:00
parent f6c9d93c5b
commit 082b084ac7
14 changed files with 856 additions and 300 deletions

View File

@@ -549,10 +549,9 @@ lambda__process_lambda(PredOrFunc, EvalMethod, Vars, Modes, Detism,
Functor = functor(cons(PredName, NumArgVars), ArgVars),
ConsId = pred_const(PredId, ProcId, EvalMethod),
VarToReuse = no,
RLExprnId = no,
Unification = construct(Var, ConsId, ArgVars, UniModes,
VarToReuse, cell_is_unique, RLExprnId),
construct_dynamically, cell_is_unique, RLExprnId),
LambdaInfo = lambda_info(VarSet, VarTypes, Constraints, TVarSet,
TVarMap, TCVarMap, Markers, POF, OrigPredName, Owner,
ModuleInfo, MustRecomputeNonLocals).