Files
mercury/tests/debugger/breakpoints.exp
Zoltan Somogyi 9bdc5db590 Try to work around the Snow Leopard linker's performance problem with
Estimated hours taken: 20
Branches: main

Try to work around the Snow Leopard linker's performance problem with
debug grade object files by greatly reducing the number of symbols needed
to represent the debugger's data structures.

Specifically, this diff groups all label layouts in a module, each of which
previously had its own named global variable, into only a few (one to four)
global variables, each of which is an array. References to the old global
variables are replaced by references to slots in these arrays.

This same treatment could also be applied to other layout structures. However,
most layouts are label layouts, so doing just label layouts gets most of the
available benefit.

When the library and compiler are compiled in grade asm_fast.gc.debug,
this diff leads to about a 1.5% increase in the size of their generated C
source files (from 338 to 343 Mb), but a more significant reduction (about 17%)
in the size of the corresponding object files (from 155 to 128 Mb). This leads
to an overall reduction in disk requirements from 493 to 471 Mb (about 4.5%).
Since we generate the same code and data as before, with the data just being
arranged differently, the decrease in object file sizes is coming from the
reduction in relocation information, the information processed by the linker.
This should speed up the linker.

compiler/layout.m:
	Make the change described above. We now define up to four arrays:
	one each for label layouts with and without information about
	variables, one for the layout structures of user events,
	and one for the variable number lists of user events.

compiler/layout_out.m:
	Generate the new arrays that the module being compiled needs.

	Use purpose-specific types instead of booleans.

compiler/trace_gen.m:
	Use a new field in foreign_proc_code instructions to record the
	identity of any labels whose layout structures we want to refer to,
	even though layout structures have not been generated yet. The labels
	will be looked up in a map (generated together with the layout
	structures) by llds_out.m.

compiler/llds.m:
	Add this extra field to foreign_proc_code instructions.

	Add the map (which is actually in two parts) to the c_file type,
	which is the data structure representing the entire LLDS.

	Also add to the c_file type some other data structures that previously
	we used to hand around alongside it. Some of these data structures
	used to conmingle layout structures that we now separate.

compiler/stack_layout.m:
	Generate array slots instead of separate structures for label layouts.
	Return the different arrays separately.

compiler/llds_out.m:
	Order the output of layout structures to require fewer forward
	declarations. The forward declarations of the few arrays holding the
	label layout structures replace a lot of the declarations previously
	needed.

	Include the information needed by layout_out.m in the llds_out_info,
	and conform to the changes above.

	As a side-effect of all these changes, we now generate proc layout
	structures in the same order as the procedures' appearence in the HLDS,
	which is the same as their order in the source code, modulo any
	procedures added by the compiler itself (for lambdas, unification
	predicates, etc).

compiler/code_info.m:
compiler/dupelim.m:
compiler/dup_proc.m:
compiler/exprn_aux.m:
compiler/frameopt.m:
compiler/global_data.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/llds_to_x86_64.m:
compiler/mercury_compile_llds_back_end.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/pragma_c_gen.m:
compiler/proc_gen.m:
compiler/reassign.m:
compiler/use_local_vars.m:
	Conform to the changes above.

runtime/mercury_goto.h:
	Add the macros used by the new code in layout_out.m and llds_out.m.
	We need new macros because the old ones assumed that the
	C preprocessor can construct the address of a label's layout structure
	from the name of the label, which is obviously no longer possible.

	Make even existing families of macros handle in bulk up to 10 labels,
	up from the previous 8.

runtime/mercury_stack_layout.h:
	Add macros for use by the new code in layout.m.

tests/debugger/*.{inp,exp}:
tests/debugger/declarative/*.{inp,exp}:
	Update these test cases to account for the new (and better) order
	of proc layout structures. Where inputs changed, this was to ensure
	that we still select the same procedures from lists of procedures,
	e.g. to put a breakpoint on.
2009-10-21 06:36:37 +00:00

258 lines
11 KiB
Plaintext

E1: C1 CALL pred breakpoints.main/2-0 (cc_multi) breakpoints.m:24
mdb> echo on
Command echo enabled.
mdb> register --quiet
mdb> break data
Ambiguous procedure specification. The matches are:
0: func breakpoints.data/0-0 (det)
1: pred breakpoints.data/1-0 (det)
Which do you want to put a breakpoint on (0-1 or *)? *
0: + stop interface func breakpoints.data/0-0 (det)
1: + stop interface pred breakpoints.data/1-0 (det)
mdb> delete 1
1: E stop interface pred breakpoints.data/1-0 (det)
mdb> delete 0
0: E stop interface func breakpoints.data/0-0 (det)
mdb> break data
Ambiguous procedure specification. The matches are:
0: func breakpoints.data/0-0 (det)
1: pred breakpoints.data/1-0 (det)
Which do you want to put a breakpoint on (0-1 or *)? 1
0: + stop interface pred breakpoints.data/1-0 (det)
mdb> continue
E2: C2 CALL pred breakpoints.data/1-0 (det) breakpoints.m:58 (breakpoints.m:56)
mdb> disable 0
0: - stop interface pred breakpoints.data/1-0 (det)
mdb> break info
0: - stop interface pred breakpoints.data/1-0 (det)
mdb> break qperm
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> break safe
2: + stop interface pred breakpoints.safe/1-0 (semidet)
mdb> break -e qperm
3: + stop entry pred breakpoints.qperm/2-0 (nondet)
mdb> break -a qperm
4: + stop all pred breakpoints.qperm/2-0 (nondet)
mdb> break /
Ambiguous procedure specification. The matches are:
0: func breakpoints.//2-0 (det)
1: func breakpoints.print_list.//2-0 (det)
Which do you want to put a breakpoint on (0-1 or *)? 0
5: + stop interface func breakpoints.//2-0 (det)
mdb> break //2
Ambiguous procedure specification. The matches are:
0: func breakpoints.//2-0 (det)
1: func breakpoints.print_list.//2-0 (det)
Which do you want to put a breakpoint on (0-1 or *)? 0
6: + stop interface func breakpoints.//2-0 (det)
mdb> break breakpoints.print_list.-/2
7: + stop interface func breakpoints.print_list.-/2-0 (det)
mdb> break breakpoints.print_list.--0
8: + stop interface func breakpoints.print_list.-/2-0 (det)
mdb> break breakpoints__print_list__/-0
9: + stop interface func breakpoints.print_list.//2-0 (det)
mdb> break breakpoints__print_list__print_list
10: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> break breakpoints.print_list.print_list/3
11: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> break info
0: - stop interface pred breakpoints.data/1-0 (det)
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
2: + stop interface pred breakpoints.safe/1-0 (semidet)
3: + stop entry pred breakpoints.qperm/2-0 (nondet)
4: + stop all pred breakpoints.qperm/2-0 (nondet)
5: + stop interface func breakpoints.//2-0 (det)
6: + stop interface func breakpoints.//2-0 (det)
7: + stop interface func breakpoints.print_list.-/2-0 (det)
8: + stop interface func breakpoints.print_list.-/2-0 (det)
9: + stop interface func breakpoints.print_list.//2-0 (det)
10: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
11: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> delete 0
0: D stop interface pred breakpoints.data/1-0 (det)
mdb> break info
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
2: + stop interface pred breakpoints.safe/1-0 (semidet)
3: + stop entry pred breakpoints.qperm/2-0 (nondet)
4: + stop all pred breakpoints.qperm/2-0 (nondet)
5: + stop interface func breakpoints.//2-0 (det)
6: + stop interface func breakpoints.//2-0 (det)
7: + stop interface func breakpoints.print_list.-/2-0 (det)
8: + stop interface func breakpoints.print_list.-/2-0 (det)
9: + stop interface func breakpoints.print_list.//2-0 (det)
10: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
11: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> disable 3
3: - stop entry pred breakpoints.qperm/2-0 (nondet)
mdb> break nodiag
0: + stop interface pred breakpoints.nodiag/3-0 (semidet)
mdb> break_print -v -n -b1 HeadVar__1 HeadVar__2
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (verbose, nowarn), HeadVar__2 (verbose, nowarn)
mdb> continue
E3: C3 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:61)
HeadVar__1
[|]
1-1
2-[|]
1-2
2-[|]
1-3
2-[|]/2
mdb> break_print -b1 none
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> format_param -p depth 10
mdb> format_param -p size 20
mdb> break_print -p -n -b1 HeadVar__1 HeadVar__2
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (pretty, nowarn), HeadVar__2 (pretty, nowarn)
mdb> continue
E4: C3 SWTC pred breakpoints.qperm/2-0 (nondet) s2-2; breakpoints.m:65
mdb> finish -N
E5: C4 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
HeadVar__1
[2, 3, 4, 5]
mdb> finish -n
E6: C4 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
HeadVar__1
[2, 3, 4, 5]
HeadVar__2
[2, 3, 4, 5]
mdb> break_print -b1 none
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> break_print -f -n -b1 HeadVar__1
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (flat, nowarn)
mdb> break_print -f -e -n -b1 HeadVar__2
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (flat, nowarn), HeadVar__2 (flat, nowarn)
mdb> continue
E7: C3 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:61)
HeadVar__1 [1, 2, 3, 4, 5]
HeadVar__2 [1, 2, 3, 4, 5]
mdb> continue
E8: C5 CALL pred breakpoints.safe/1-0 (semidet) breakpoints.m:74 (breakpoints.m:62)
mdb> finish
E9: C6 CALL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:79 (breakpoints.m:76)
E10: C6 FAIL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:79 (breakpoints.m:76)
E11: C5 FAIL pred breakpoints.safe/1-0 (semidet) breakpoints.m:74 (breakpoints.m:62)
mdb> delete *
0: E stop interface pred breakpoints.nodiag/3-0 (semidet)
1: E stop interface pred breakpoints.qperm/2-0 (nondet)
2: E stop interface pred breakpoints.safe/1-0 (semidet)
3: D stop entry pred breakpoints.qperm/2-0 (nondet)
4: E stop all pred breakpoints.qperm/2-0 (nondet)
5: E stop interface func breakpoints.//2-0 (det)
6: E stop interface func breakpoints.//2-0 (det)
7: E stop interface func breakpoints.print_list.-/2-0 (det)
8: E stop interface func breakpoints.print_list.-/2-0 (det)
9: E stop interface func breakpoints.print_list.//2-0 (det)
10: E stop interface pred breakpoints.print_list.print_list/3-0 (det)
11: E stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> break info
There are no break points.
mdb> delete *
There are no break points.
mdb> break -i -I3 qperm
0: + stop interface pred breakpoints.qperm/2-0 (nondet)
(ignore next 3 interface events)
mdb> continue
E12: C7 REDO pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> print *
HeadVar__1 [4, 5]
mdb> ignore -E4 0
0: + stop interface pred breakpoints.qperm/2-0 (nondet)
(ignore next 4 call events)
mdb> continue
E13: C8 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> print *
HeadVar__1 []
mdb> delete *
0: E stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> break -O test_in_both
Ambiguous procedure specification. The matches are:
0: pred breakpoints.test_in_both/2-0 (det)
1: pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> break breakpoints.test_in_both
0: + stop interface pred breakpoints.test_in_both/2-0 (det)
mdb> break breakpoints.print_list.test_in_both
1: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> delete *
0: E stop interface pred breakpoints.test_in_both/2-0 (det)
1: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> break print_list.test_in_both
0: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> break print_list.test_only_in_printlist
1: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> delete *
0: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
1: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> break test_only_in_printlist
0: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> delete *
0: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> procedures testmod
Module name `testmod' is ambiguous.
The matches are:
breakpoints.a.testmod
breakpoints.b.testmod
mdb> procedures a
List of procedures in module `a'
func breakpoints.a.afunc/0-0 (det)
mdb> procedures a.testmod
List of procedures in module `a.testmod'
func breakpoints.a.testmod.test_in_a/0-0 (det)
func breakpoints.a.testmod.test_in_ab/0-0 (det)
mdb> break -O test_in_ab
Ambiguous procedure specification. The matches are:
0: func breakpoints.a.testmod.test_in_ab/0-0 (det)
1: func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> break -O testmod.test_in_ab
Ambiguous procedure specification. The matches are:
0: func breakpoints.a.testmod.test_in_ab/0-0 (det)
1: func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> break -O a.testmod.test_in_ab
0: + stop interface func breakpoints.a.testmod.test_in_ab/0-0 (det)
mdb> break -O b.testmod.test_in_ab
1: + stop interface func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> delete *
0: E stop interface func breakpoints.a.testmod.test_in_ab/0-0 (det)
1: E stop interface func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> break -O -p goal test_in_a
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
goal (flat)
mdb> break -O -P -p HeadVar__1 test_in_b
1: + print interface func breakpoints.b.testmod.test_in_b/0-0 (det)
HeadVar__1 (flat)
mdb> break info
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
goal (flat)
1: + print interface func breakpoints.b.testmod.test_in_b/0-0 (det)
HeadVar__1 (flat)
mdb> continue
[1, 3, 5, 2, 4]
E14: C9 CALL func breakpoints.a.testmod.test_in_a/0-0 (det) breakpoints.a.testmod.m:10 (breakpoints.m:27)
test_in_a = '_'
mdb> break_print -b0 none
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
mdb> break_print -b0 *
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
all (flat)
mdb> continue
E15: C9 EXIT func breakpoints.a.testmod.test_in_a/0-0 (det) breakpoints.a.testmod.m:10 (breakpoints.m:27)
HeadVar__1 "a"
mdb> continue
"a"
E16: C10 CALL func breakpoints.b.testmod.test_in_b/0-0 (det) breakpoints.b.testmod.m:10 (breakpoints.m:29)
mdb: there is no variable named HeadVar__1.
E17: C10 EXIT func breakpoints.b.testmod.test_in_b/0-0 (det) breakpoints.b.testmod.m:10 (breakpoints.m:29)
HeadVar__1 "b"
"b"