Files
mercury/tests/hard_coded/checked_nondet_tailcall.exp
Zoltan Somogyi 0b35ee3f56 Add a new option, --checked-nondet-tailcalls, that enables the use of
Estimated hours taken: 8

Add a new option, --checked-nondet-tailcalls, that enables the use of
Prolog style nondet tail calls (which check whether the current frame is
on top of the nondet stack and only do a tail call if it is).

This option is not likely to help Mercury code, since most of the time
the test will fail, which means we incurred its cost and did not gain
the benefit of the tailcall. However, HAL often has predicates that are
declared nondet but are det or semidet most of the time, and these can
benefit.

compiler/options.m:
doc/user_guide.texi:
	Add the new option, which is not on by default and is not turned on
	at any optimization level; you have to give it explicitly.

compiler/llds.m:
	Modify the call_model type to distinguish the new style nondet tail
	call from the old (which does not do a runtime test).

compiler/code_info.m:
	Check the fail state whether it is suitable for new style nondet
	tail calls.

compiler/call_gen.m:
	Put the result from code_info.m into the generated LLDS.

compiler/jumpopt.m:
	Use the new status field in the LLDS to perform the optimization,
	if the option is given.

	Document the main predicate and its new argument.

compiler/optimize.m:
	Pass the value of the new option to jumpopt.

tests/hard_coded/checked_nondet_tailcall.{m,exp}:
	A new test case to check that the code we generate with the new
	option works correctly. (Checking whether it actually reduces
	nondet stack usage would be harder.)
1999-09-30 08:55:51 +00:00

6 lines
23 B
Plaintext