mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-27 07:14:20 +00:00
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.
108 lines
4.3 KiB
Plaintext
108 lines
4.3 KiB
Plaintext
1: 1 1 CALL pred completion.main/2-0 (det) completion.m:13
|
|
mdb> echo on
|
|
Command echo enabled.
|
|
mdb> register --quiet
|
|
mdb>
|
|
! fail procedures
|
|
? fail_trace_counts push_list_dir
|
|
P finish query
|
|
alias flag quit
|
|
all_class_decls format r
|
|
all_procedures format_param register
|
|
all_regs forward retry
|
|
all_type_ctors g return
|
|
ambiguity gen_stack s
|
|
b goal_paths save
|
|
break goto scope
|
|
break_print grep scroll
|
|
browse h shell
|
|
c held_vars source
|
|
cc_query help stack
|
|
class_decl histogram_all stack_default_limit
|
|
clear_histogram histogram_exp stack_regs
|
|
condition hold stats
|
|
consumer ignore step
|
|
context io_query subgoal
|
|
continue level table
|
|
current list table_io
|
|
cut_stack list_context_lines term_size
|
|
d list_path track
|
|
dd max_io_actions trail_details
|
|
debug_vars maxdepth trust
|
|
delete mindepth trusted
|
|
dice mm_stacks type_ctor
|
|
diff mmc_options unalias
|
|
disable modules unhide_events
|
|
document next untrust
|
|
document_category nondet_stack up
|
|
down open user
|
|
dump p user_event_context
|
|
e pass_trace_counts v
|
|
echo pneg_stack var_details
|
|
enable pop_list_dir vars
|
|
exception print view
|
|
excp print_optionals xml_browser_cmd
|
|
f printlevel xml_tmp_filename
|
|
h help histogram_exp
|
|
held_vars histogram_all hold
|
|
var_details vars view
|
|
var_details vars
|
|
help vars
|
|
vars
|
|
Prints the names of all the known variables in the current
|
|
environment, together with an ordinal number for each variable.
|
|
mdb>
|
|
* --pretty -f -v goal
|
|
--flat --verbose -p exception
|
|
p --flat D
|
|
mdb: there is no such variable.
|
|
mdb>
|
|
stack stack_default_limit stack_regs
|
|
stack --detailed
|
|
0 1 1 1 pred completion.main/2-0 (det) (completion.m:13) (empty)
|
|
mdb>
|
|
completion completion.sub2
|
|
completion.sub1 completion.sub2.sub3
|
|
completion.sub1 completion.sub2 completion.sub2.sub3
|
|
procedures completion.sub1
|
|
List of procedures in module `completion.sub1'
|
|
func completion.sub1.z1/0-0 (det)
|
|
pred completion.sub1.zp/1-0 (det)
|
|
mdb>
|
|
format format_param
|
|
format_param --flat lines 10
|
|
mdb> unalias excp
|
|
Alias `excp' removed.
|
|
mdb> b zabc3
|
|
0: + stop interface func completion.sub2.sub3.zabc3/0-0 (det)
|
|
mdb>
|
|
func*completion. func*completion.sub2.
|
|
func*completion.sub1. func*completion.sub2.sub3.
|
|
func*completion.z func*completion.zz
|
|
b func*completion.z
|
|
1: + stop interface func completion.z/0-0 (det)
|
|
mdb>
|
|
completion. completion.sub2.
|
|
completion.sub1. completion.sub2.sub3.
|
|
completion.sub1. completion.sub2. completion.sub2.sub3.
|
|
completion.sub1.z1 completion.sub1.zp
|
|
b completion.sub1.z1
|
|
2: + stop interface func completion.sub1.z1/0-0 (det)
|
|
mdb>
|
|
completion. completion.sub2.
|
|
completion.sub1. completion.sub2.sub3.
|
|
completion.sub1. completion.sub2. completion.sub2.sub3.
|
|
completion.sub2. completion.sub2.sub3.
|
|
b completion.sub2.sub3.zabc3
|
|
3: + stop interface func completion.sub2.sub3.zabc3/0-0 (det)
|
|
mdb>
|
|
2d 2dice 2document_category
|
|
2dd 2diff 2down
|
|
2debug_vars 2disable 2dump
|
|
2delete 2document
|
|
2debug_vars 2delete
|
|
2delete
|
|
2: E stop interface func completion.sub1.z1/0-0 (det)
|
|
mdb> c
|
|
ok
|