Files
mercury/tests/debugger/lambda_expr.exp
Ian MacLarty f362356b17 Make the user friendly names of predicates introduced by lambda expressions
Estimated hours taken: 4
Branches: main

Make the user friendly names of predicates introduced by lambda expressions
(more) unique.  This is necessary so they can be distinguished from each other
in trace count files.

If two or more lambda expression appear in the same context, then include
their sequence number in that context in the user friendly predicate name.

compiler/hlds_module.m:
	Instead of keeping a counter of how many lambdas appear in a module,
	keep a seperate counter for each context (filename/lineno).  This
	way we only need to include the sequence number in the predicate
	name if there are two or more lambdas in the same context.

compiler/hlds_pred.m:
	Add a new field to the `lambda' functor which records the count of the
	lambda expressin in its context.

compiler/hlds_out.m:
	Unify with lambda/3 instead of lambda/2.

compiler/lambda.m:
	Use the sequence number of the lambda expression in its context
	when creating the predicate origin.

compiler/layout.m:
	Store the origin of a closure predicate in the layout data of the
	closure, so that it's user friendly name can be included in the
	generated C code.

compiler/layout_out.m:
	When generating a user friendly name for lambda expression predicates,
	include the sequence number of the lambda expression if the sequence
	number is greater than one.

compiler/stack_layout.m:
	Pass the closure origin to the closure layout construction predicate.

compiler/unify_gen.m:
	Pass the closure origin when constructing the closure layout.

tests/debugger/Mmakefile:
tests/debugger/lambdatest.exp:
tests/debugger/lambdatest.inp:
tests/debugger/lambdatest.m:
	Test that the predicate names for lambda expressions are unique,
	even if they appear in the same call.

tests/debugger/higher_order.exp:
tests/debugger/lambda_expr.exp:
tests/debugger/declarative/find_origin.exp:
tests/debugger/declarative/find_origin.exp2:
tests/debugger/declarative/higher_order.exp:
tests/debugger/declarative/higher_order.exp2:
tests/debugger/declarative/ho2.exp2:
tests/debugger/declarative/trust.exp:
tests/hard_coded/deconstruct_arg.exp:
	Expect the new (more) unique predicate names.
2005-05-26 00:17:06 +00:00

29 lines
829 B
Plaintext

E1: C1 CALL pred lambda_expr.main/2-0 (det) lambda_expr.m:17
mdb> echo on
Command echo enabled.
mdb> context none
Contexts will not be printed.
mdb> register --quiet
mdb> step
E2: C2 CALL pred lambda_expr.lambda_lambda_expr_m_18/2-0 (det)
mdb> print
lambda_lambda_expr_m_18(1, _)
mdb> up
Ancestor level set to 1:
1 pred lambda_expr.main/2-0 (det)
mdb> print P
P lambda_lambda_expr_m_18
mdb> finish ; print
E3: C2 EXIT pred lambda_expr.lambda_lambda_expr_m_18/2-0 (det)
lambda_lambda_expr_m_18(1, 2)
mdb> retry
E2: C2 CALL pred lambda_expr.lambda_lambda_expr_m_18/2-0 (det)
mdb> print
lambda_lambda_expr_m_18(1, _)
mdb> finish
E3: C2 EXIT pred lambda_expr.lambda_lambda_expr_m_18/2-0 (det)
mdb> print
lambda_lambda_expr_m_18(1, 2)
mdb> continue
2