mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 20
Branches: main
Add a new tabling method, one which specifies how each argument should
be treated, like this:
:- pragma memo(p(in, in, in, out), [value, addr, promise_implied, output]).
doc/reference_manual.texi:
Document the new tabling method.
compiler/prog_data.m:
Add a new tabling method, one which specifies how each argument should
be treated.
compiler/hlds_pred.m:
Provide for the description of untabled input arguments of tabled
procedures.
compiler/prog_io_pragma.m:
Parse the new tabling method.
Fix a bunch of formatting problems.
compiler/add_pragma.m:
When adding a tabling pragma to the HLDS, check that if the pragma
individually specifies the tabling methods of a procedure's arguments,
then those tabling methods agree with the modes of those arguments.
Fix an old bug: check whether a tabled predicate's arguments are
fully input or fully output, and print an error message if not.
We used to check this only in table_gen.m, but there we could only
abort the compiler if the check failed.
Factor out some common code and thereby fix an old bug: check for
conflicting tabling pragmas not just when adding the pragma to all
procedures of a predicate, but also when adding it to only a
specified procedure.
compiler/table_gen.m:
Implement the new tabling method.
compiler/prog_out.m:
compiler/layout_out.m:
Conform to the changes above.
runtime/mercury_stack_layout.h:
Provide for the description of untabled input arguments of tabled
procedures.
trace/mercury_trace.c:
Handle the new tabling method.
trace/mercury_trace_internal.c:
Handle the new tabling method. Delete the defaults from some switches
on enums to allow gcc to recognize missing cases.
Handle the untabled input arguments of tabled procedures: skip over
them when printing procedures' call tables.
Enable better completion for mdb's "table" command.
trace/mercury_trace_tables.[ch]:
Rename the breakpoint completer the proc_spec completer, since it does
completions on procedure specifications.
tests/debugger/print_table.{m,inp,exp}:
Modify this test case to test the ability to print the tables of
predicates with some untabled arguments.
tests/tabling/specified.{m,exp}:
New test case to check the functioning of the new tabling method
by testing whether it is in fact faster to table the address of
an argument instead of its value, or to not table it at all.
Since the gains here are not quite as dramatic as tabled vs untabled,
use a slightly looser criterion for comparing speeds than we use
in the various versions of the fib test case.
tests/tabling/Mmakefile:
tests/tabling/Mercury.options:
Enable the new test case, and set up the option it needs.
tests/invalid/specified.{m,err_exp}:
New test case, a slight variant of tests/tabling/specified.m,
to check the compiler's ability to detect errors in the new form
of tabling pragma.
tests/invalid/Mmakefile:
Enable the new test case.
111 lines
935 B
Plaintext
111 lines
935 B
Plaintext
echo on
|
|
context none
|
|
goal_paths off
|
|
register --quiet
|
|
b p
|
|
c
|
|
f -n
|
|
table p
|
|
table p 5
|
|
table p 5 2
|
|
c
|
|
f -n
|
|
table p
|
|
table p 5
|
|
table p 5 2
|
|
table p 4
|
|
table p 4 2
|
|
c
|
|
f -n
|
|
table p
|
|
table p 5
|
|
table p 5 2
|
|
table p 4
|
|
table p 2 1
|
|
c
|
|
f -n
|
|
table p
|
|
table p 5
|
|
table p 5 2
|
|
table p 4
|
|
table p 2 1
|
|
table p 1 0
|
|
delete 1
|
|
b q
|
|
c
|
|
f -n
|
|
table q
|
|
table q 3
|
|
table q 3 2
|
|
table q 4
|
|
c
|
|
f -n
|
|
table q
|
|
table q 3
|
|
table q 3 2
|
|
table q 3 0
|
|
table q 4 2
|
|
table q 4 1
|
|
table q 4 0
|
|
delete 1
|
|
b r
|
|
c
|
|
table r
|
|
s
|
|
table r
|
|
table r 3
|
|
c
|
|
table r
|
|
f -n
|
|
table r
|
|
f -n 1
|
|
table r
|
|
delete 1
|
|
b s
|
|
c
|
|
table s
|
|
f -n
|
|
table s
|
|
c
|
|
f -n
|
|
table s
|
|
table s 3.5
|
|
table s 3.51
|
|
table s 3.5 1
|
|
table s 3.5 1 abc
|
|
c
|
|
f -n
|
|
c
|
|
f -n
|
|
c
|
|
f -n
|
|
table s
|
|
table s 3.5
|
|
table s 3.51
|
|
table s 3.5 1
|
|
table s 3.5 1 abc
|
|
table s 3.5 2
|
|
table s 3.5 2 abc
|
|
table s 3.5 2 xyz
|
|
table s 9.1 2 abc
|
|
table s 9.2 2 abc
|
|
table s 9.2 2 def
|
|
table s 9.2 2 xyz
|
|
delete 1
|
|
b t
|
|
c
|
|
table t
|
|
s
|
|
table t
|
|
finish
|
|
table t
|
|
delete 1
|
|
b tdone
|
|
c
|
|
table t
|
|
delete 1
|
|
b udone
|
|
c
|
|
table u
|
|
c -S -n
|