Files
mercury/tests/debugger/shallow.inp
Zoltan Somogyi ed83fe4623 Optimize shallow traced modules by not adding calls to MR_trace to shallow
Estimated hours taken: 12
Branches: main

Optimize shallow traced modules by not adding calls to MR_trace to shallow
traced procedures which cannot be called from a deep traced environment.
A shallow traced procedure can be optimized in this way if it is neither
exported from its defining module nor has its address taken.

The main purpose of this optimization is not the avoidance of the cost of the
MR_trace calls as much as it is the restoration of tail recursion optimization.
Previously, compiling a program in a debug grade would disable all tail
recursion in the program (since debug grades require at least shallow tracing
every module). This was a problem because it limited the sizes of the inputs
the debugged program could process before running out of memory. As long as
the procedures that recurse on the input are in the implementation section
of a shallow traced module, this should no longer happen.

compiler/trace_params.m:
	Introduce the concept of a procedure's effective trace level. This is
	identical to the global trace level, except if the procedure is not
	exported and doesn't have its address taken, and the global trace level
	is shallow. In that case, we say that the procedure's effective trace
	level is none.

	Computing a procedure's effective trace level requires its proc_info
	and its parent pred_info, so require callers to supply these as
	parameters.

compiler/code_info.m:
	Store the current pred_info as well as the current proc_info, for
	trace parameter lookups.

compiler/continuation_info.m:
compiler/code_gen.m:
	Record the required trace parameters of a procedure in its layout
	structure, since it can no longer be computed from the global trace
	level.

compiler/stack_layout.m:
	Use the trace parameters in procedures' layout structures, instead of
	trying to compute them from the global trace level.

compiler/inlining.m:
compiler/liveness.m:
compiler/stack_alloc.m:
compiler/store_alloc.m:
compiler/trace.m:
	Use procedures' effective trace level instead of the global trace level
	where relevant.

compiler/llds.m:
	Record the required trace parameter of a procedure in its c_procedure
	representation, since it can no longer be computed from the global
	trace level.

	Delete an obsolete field.

compiler/optimize.m:
compiler/jumpopt.m:
	Use a required trace parameter of a procedure in its c_procedure
	representation, since it can no longer be computed from the global
	trace level.

compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
	Trivial changes to conform to updated interfaces.

compiler/stack_opt.m:
	Use the option opt_no_return_calls, instead of approximating it
	with the trace level. (The old code was a holdover from before the
	creation of the option.)

tests/debugger/shallow.m:
tests/debugger/shallow2.m:
tests/debugger/shallow.{inp,exp*}:
	Divide the old test case in shallow.m in two. The top level predicates
	stay in shallow.m and continue to be shallow traced. The two bottom
	predicates move to shallow2.m and are now deep traced.

	The new test input checks whether the debugger can walk across the
	stack frames of procedures in shallow traced modules whose effective
	trace level is "none" (such as queen/2).
2002-07-30 08:25:20 +00:00

8 lines
55 B
Plaintext

echo on
context before
context
step
print *
stack
c -S