Commit Graph

2 Commits

Author SHA1 Message Date
Zoltan Somogyi
642c902c90 Reduce the sizes of .c and .o files in debug grades by 8%.
Estimated hours taken: 4
Branches: main

Reduce the sizes of .c and .o files in debug grades by 8%.

Add to mdb the capability of putting breakpoints on unify, compare and index
predicates.

compiler/code_gen.m:
	Since compiler-generated unify, index and compare pred can be presumed
	to be correct, compile them with shallow tracing instead of deep
	tracing even if the user asks for deep tracing of the rest of the
	module. This saves disk space, compile time and run time.

	Move the code for setting the trace level to generate_proc_code,
	where it is executed whether we generate code by predicates or by
	phases.

compiler/trace_params.m:
	Provide a function for use by code_gen.m.

	Consider unify and compare predicates to behave as if their address
	were taken, since they may be called from builtin.unify or
	builtin.compare.

compiler/jumpopt.m:
	Do not replace jumps with the block being jumped to if the block
	contains an instruction that represents a call to the debugger.
	In such cases, the jump is a minor cost in runtime compared to the
	call, and the locality benefit from not increasing the code size is
	quite likely to exceed that cost.

compiler/llds.m:
	Add field names to pragma_c instructions to make the change to jumpopt
	easier.

tests/debugger/uci.{inp,exp}:
	Update this test case. An update is required since we now generate
	fewer events from unify and compare preds due to their now being
	shallow traced.

	To make this the update easier, use the new capability of putting
	breakpoints on unify and compare predicates.

trace/mercury_trace_tables.[ch]:
	Expand procedure specifications to allow the specification of unify,
	compare and index predicates, and expand the function that checks for
	matches between a procedure layout and a procedure specification
	accordingly.

	Fix two instances of a bug: if a procedure specification has no name,
	represent it as NULL, not as a non-NULL pointer to a null character,
	since the match function expects only the former.

doc/user_guide.texi:
	Document the new definition of procedure specifications.

NEWS:
	Mention the new definition of procedure specifications, and expand
	on some previous additions to the debugger.

runtime/mercury_stack_trace.c:
	Allow mdb breakpoint specifications on uci predicates to be saved.

	Factor out some common data structure accesses.

runtime/mercury_proc_id.h:
	Change the name of a macro from MR_PROC_ID_COMPILER_GENERATED to
	MR_PROC_ID_IS_UCI, for consistency with other names dealing with
	unify, compare and index predicates.

runtime/*.[ch]:
trace/*.[ch]:
	Conform to the change in mercury_proc_id.h.
2004-05-23 22:16:57 +00:00
Zoltan Somogyi
ab5a7c7acf Fix two bugs in the printing of goals where the predicate concerned is an
Estimated hours taken: 6
Branches: main

Fix two bugs in the printing of goals where the predicate concerned is an
compiler-generated unify, compare or index predicate. Improve the mechanisms
for debugging bugs like this.

runtime/mercury_layout_util.[ch]:
	Fix bug one: do not return the arity of a type constructor as
	the arity of the unify, compare or index predicate of that
	type constructor; return the actual arity. When the falsely
	returned arity was greater than the actual arity, we could get
	core dumps; when it was smaller, the mdb command "print goal"
	printed wrong output.

	Provide a mechanism for fixing bug two: add a utility function
	for computing *correctly* a procedure's original arity and the number
	of type_info and/or typeclass_info arguments added by the compiler.
	(For convenience, it also returns a predicate/function indication.)

runtime/mercury_stack_layout.h:
	Rename the MR_comp_arity field of MR_Compiler_Proc_Id to
	MR_comp_type_arity, to make clear that it gives the arity of the type
	constructor, not the arity of the predicate, and thus avoid bugs such
	as those above.

runtime/mercury_stack_trace.c:
	Use the new name of the MR_comp_type_arity field.

trace/mercury_trace_declarative.c:
trace/mercury_trace_vars.c:
	Call the new, correct utility function in runtime/mercury_layout_util
	to compute how many typeinfo and/or typeclassinfo arguments are added
	by the compiler to a unify, compare, or index procedure's arguments,
	instead of the different, but logically equivalent and equally wrong
	pieces of code here.

trace/mercury_trace_external.c:
	Use the new name of the MR_comp_type_arity field. Leave an XXX, since
	I am not sure whether Morphine interprets the arity as the arity of the
	type constructor or as the arity of the predicate.

runtime/mercury_engine.[ch]:
runtime/mercury_layout_util.c:
	Make the printing of locations obtained from RTTI data structures
	switchable from mdb, to make problems like this easier to debug.

tests/debugger/uci.{m,inp,exp}:
	A new test case to test the proper handling of unify, compare and index
	predicates.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
	Enable the new test case.
2003-04-02 23:01:45 +00:00