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.
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.
Estimated hours taken: 0.2
Branches: main
Fix the failure of debugger/uci in .decldebug grades.
tests/debugger/Mmakefile:
tests/debugger/uci.exp:
Use standardized event numbering for this test case to avoid
differences between shallow and deep tracing.
Estimated hours taken: 0.2
Branches: main
tests/debugger/uci.exp:
Update the expected output of this test case to account for the recent
change to make avoid pointer equality tests in builtin.{unify,compare}:
we now get calls to and thus call and exit events from the
type-construct-specific unify and compare predicates for du types
(other than enums) even when the two input arguments are pointer-equal.
Estimated hours taken: 4
Branches: main
Trace builtin and private_builtin (with the exception of external predicates
and those that are polymorhphic, but have no extra type_info arguments).
This allows subterms to be traced through calls to predicates in builtin
and private_builtin and fixes an assertion failure in the declarative debugger
that was triggered when an untraced builtin called a traced predicate
(the debugger would then think the events from the traced predicate were
child events of the parent of the untraced predicate, which would cause the
assertion failure).
compiler/code_gen.m:
compiler/hlds_pred.m:
compiler/mercury_compile.m:
compiler/ml_code_util.m:
compiler/polymorphism.m:
compiler/stack_layout.m:
compiler/term_constr_initial.m:
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
Move no_type_info_builtin from compiler/hlds_pred.m to
mdbcomp/program_representation.m, so that the debugger can call it
to see what builtin polymorphic predicates do not have extra type_info
arguments.
Define pred_is_external to be true for predicates defined with
:- external. The debugger needs to know not to expect any events for
such predicates.
Trace the builtin and private_builtin modules.
tests/debugger/loopcheck.exp3:
tests/debugger/uci.exp2:
tests/debugger/uci_index.exp:
Changes to expected output due to the fact that builtins are now
traced.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/typed_unify.exp:
tests/debugger/declarative/typed_unify.inp:
tests/debugger/declarative/typed_unify.m:
Test tracking of a subterm through a builtin.
Estimated hours taken: 4
Branches: main
Reduce the sizes of .c and .o files in debug grades by 8%.
Add to mdb the capability of putting breakpoints on unify, compare and index
predicates.
compiler/code_gen.m:
Since compiler-generated unify, index and compare pred can be presumed
to be correct, compile them with shallow tracing instead of deep
tracing even if the user asks for deep tracing of the rest of the
module. This saves disk space, compile time and run time.
Move the code for setting the trace level to generate_proc_code,
where it is executed whether we generate code by predicates or by
phases.
compiler/trace_params.m:
Provide a function for use by code_gen.m.
Consider unify and compare predicates to behave as if their address
were taken, since they may be called from builtin.unify or
builtin.compare.
compiler/jumpopt.m:
Do not replace jumps with the block being jumped to if the block
contains an instruction that represents a call to the debugger.
In such cases, the jump is a minor cost in runtime compared to the
call, and the locality benefit from not increasing the code size is
quite likely to exceed that cost.
compiler/llds.m:
Add field names to pragma_c instructions to make the change to jumpopt
easier.
tests/debugger/uci.{inp,exp}:
Update this test case. An update is required since we now generate
fewer events from unify and compare preds due to their now being
shallow traced.
To make this the update easier, use the new capability of putting
breakpoints on unify and compare predicates.
trace/mercury_trace_tables.[ch]:
Expand procedure specifications to allow the specification of unify,
compare and index predicates, and expand the function that checks for
matches between a procedure layout and a procedure specification
accordingly.
Fix two instances of a bug: if a procedure specification has no name,
represent it as NULL, not as a non-NULL pointer to a null character,
since the match function expects only the former.
doc/user_guide.texi:
Document the new definition of procedure specifications.
NEWS:
Mention the new definition of procedure specifications, and expand
on some previous additions to the debugger.
runtime/mercury_stack_trace.c:
Allow mdb breakpoint specifications on uci predicates to be saved.
Factor out some common data structure accesses.
runtime/mercury_proc_id.h:
Change the name of a macro from MR_PROC_ID_COMPILER_GENERATED to
MR_PROC_ID_IS_UCI, for consistency with other names dealing with
unify, compare and index predicates.
runtime/*.[ch]:
trace/*.[ch]:
Conform to the change in mercury_proc_id.h.
Estimated hours taken: 6
Branches: main
Fix two bugs in the printing of goals where the predicate concerned is an
compiler-generated unify, compare or index predicate. Improve the mechanisms
for debugging bugs like this.
runtime/mercury_layout_util.[ch]:
Fix bug one: do not return the arity of a type constructor as
the arity of the unify, compare or index predicate of that
type constructor; return the actual arity. When the falsely
returned arity was greater than the actual arity, we could get
core dumps; when it was smaller, the mdb command "print goal"
printed wrong output.
Provide a mechanism for fixing bug two: add a utility function
for computing *correctly* a procedure's original arity and the number
of type_info and/or typeclass_info arguments added by the compiler.
(For convenience, it also returns a predicate/function indication.)
runtime/mercury_stack_layout.h:
Rename the MR_comp_arity field of MR_Compiler_Proc_Id to
MR_comp_type_arity, to make clear that it gives the arity of the type
constructor, not the arity of the predicate, and thus avoid bugs such
as those above.
runtime/mercury_stack_trace.c:
Use the new name of the MR_comp_type_arity field.
trace/mercury_trace_declarative.c:
trace/mercury_trace_vars.c:
Call the new, correct utility function in runtime/mercury_layout_util
to compute how many typeinfo and/or typeclassinfo arguments are added
by the compiler to a unify, compare, or index procedure's arguments,
instead of the different, but logically equivalent and equally wrong
pieces of code here.
trace/mercury_trace_external.c:
Use the new name of the MR_comp_type_arity field. Leave an XXX, since
I am not sure whether Morphine interprets the arity as the arity of the
type constructor or as the arity of the predicate.
runtime/mercury_engine.[ch]:
runtime/mercury_layout_util.c:
Make the printing of locations obtained from RTTI data structures
switchable from mdb, to make problems like this easier to debug.
tests/debugger/uci.{m,inp,exp}:
A new test case to test the proper handling of unify, compare and index
predicates.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
Enable the new test case.