5 Commits

Author SHA1 Message Date
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
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
Zoltan Somogyi
9521818650 Get the purity check pass to not issue warnings about unnecessary purity
Estimated hours taken: 16
Branches: main

Get the purity check pass to not issue warnings about unnecessary purity
annotations on compiler-generated predicates. The problem I am addressing
is that when an optimization such as type specialization creates a clone of
a predicate, that predicate gets all the original predicate's annotations.
During the creation of a .opt file, purity checking sees the clauses of the
original predicate and knows that the annotation is not redundant, but doesn't
know that about the copy, since it has no definition at all (it doesn't need
one).

The fix is to put into each pred_info an indication of where the predicate
came from, and to never warn about unnecessary purity annotations of predicates
that the programmer didn't write.

This diff also uses the origin indication to record human-usable names of
compiler-generated or compiler-transformed predicates in RTTI for use by the
debugger.

compiler/hlds_pred.m:
	Replace two fields in pred_infos, that say (a) whether the predicate
	is a special (unify/compare/index/init) predicate and (b) whether
	it is a type class method implementation, with an origin field saying
	where the predicate came from. This field has several alternatives,
	special preds and type class method implementation being only two.

	Make the predicates that create pred_infos take an argument specifing
	where the predicate comes from.

	Replace a copy of one of the old fields in rtti_proc_labels with
	the new one.

	Make the name of the existing function more descriptive.

compiler/purity.m:
	Use the origin field to suppress unnecessary annotation warnings for
	compiler-generated predicates.

compiler/layout_out.m:
	Use the origin field to generate more human-friendly names for
	predicates, instead of the existing linker-friendly names. The
	debugger doesn't insist on predicate names being unique, even
	within a module.

compiler/*.m:
	Conform to the changed interface of hlds_pred.m. The most significant
	changes were for recording the origin of new predicates. In one case
	(dnf.m) it also involved passing the required information down to the
	place where the new predicates were created through the dnf_info tuple
	instead of separate arguments, and switching to state variable
	notation.

tests/debugger/*.exp*:
tests/debugger/declarative/*.exp*:
tests/hard_coded/*.exp*:
	Update the expected outputs to expect human-friendly predicate names.
2005-01-21 06:21:00 +00:00
Ian MacLarty
cab3c62fe7 Remove call depth numbers from standardized event printing.
Estimated hours taken: 2
Branches: main

Remove call depth numbers from standardized event printing.  This will make
maintaining the debugger test cases easier since a lot of the expected outputs
differ only in the call depth of their events, because of deep tracing of the
standard library in the decldebug grade.

Not all the debugger tests are run with standardized event printing, so
printing of call depths will still be exercised.

tests/debugger/breakpoints.exp
tests/debugger/breakpoints.exp2
tests/debugger/browser_test.exp
tests/debugger/exception_cmd.exp
tests/debugger/exception_cmd.exp2
tests/debugger/exception_cmd.exp3
tests/debugger/exception_value.exp
tests/debugger/exception_value.exp2
tests/debugger/exception_vars.exp
tests/debugger/existential_type_classes.exp
tests/debugger/existential_type_classes.exp2
tests/debugger/exported_eqv_type.exp
tests/debugger/higher_order.exp
tests/debugger/interpreter.exp2
tests/debugger/lambda_expr.exp
tests/debugger/loopcheck.exp3
tests/debugger/loopcheck.inp2
tests/debugger/nondet_stack.exp
tests/debugger/nondet_stack.exp2
tests/debugger/polymorphic_output.exp
tests/debugger/polymorphic_output.exp2
tests/debugger/polymorphic_output.exp3
tests/debugger/print_goal.exp
tests/debugger/print_table.exp
tests/debugger/queens.exp
tests/debugger/queens.exp2
tests/debugger/resume_typeinfos.exp
tests/debugger/retry.exp
tests/debugger/retry.exp2
tests/debugger/tabled_read.exp
tests/debugger/tabled_read_decl.exp
tests/debugger/tabled_read_unitize.exp
tests/debugger/type_desc_test.exp
tests/debugger/declarative/aadebug.exp
tests/debugger/declarative/app.exp
tests/debugger/declarative/args.exp
tests/debugger/declarative/big.exp
tests/debugger/declarative/filter.exp
tests/debugger/declarative/if_then_else.exp
tests/debugger/declarative/input_term_dep.exp
tests/debugger/declarative/io_stream_test.exp
tests/debugger/declarative/io_stream_test.exp2
tests/debugger/declarative/output_term_dep.exp
tests/debugger/declarative/propositional.exp
tests/debugger/declarative/remember_modes.exp
tests/debugger/declarative/special_term_dep.exp
tests/debugger/declarative/tabled_read_decl.exp
tests/debugger/declarative/trust.exp
	Remove call depth numbers from output run with standardized event
	printing.

trace/mercury_trace_internal.c
	Remove call depth from standardized event printing.
2004-11-16 00:16:44 +00:00
Zoltan Somogyi
f76c4823e5 Fix a problem reported by Ian: the debugger ignored information about the head
Estimated hours taken: 2
Branches: main

Fix a problem reported by Ian: the debugger ignored information about the head
variables of the predicates generated by the compiler from lambda expressions
because they didn't have names.

compiler/hlds_pred.m:
	Add a predicate to ensure that all headvars have names.

compiler/lambda.m:
	Call that predicate to give names to the predicates created from lambda
	expressions.

compiler/code_gen.m:
	Call that predicate to give names to the predicates created from lambda
	expressions, in case other transformations also create predicates
	with unnamed head variables.

doc/user_guide.texi:
	Add a new mdb command, var_details, and a new method of invocation of
	an existing mdb command, flag. I used them to track down this bug.

trace/mercury_trace_internal.c:
	Implement the var_details mdb command, and the new method of invocation
	of the flag command.

trace/mercury_trace_vars.[ch]:
	Add a function to print variable details.

tests/debugger/mdb_command_test.inp:
	Test the documentation of the new command.

tests/debugger/completion.exp:
	Expect the new command.

tests/debugger/lambda_expr.{m,inp,exp}:
	Add the new test case to test for the bug.

tests/debugger/Mmakefile:
	Enable the new test case.
2004-07-19 03:37:55 +00:00