Estimated hours taken: 8
Branches: main
Add an option `--no-inline-builtins', which causes builtins to
be generated as calls to out-of-line procedures. This is done
by default when debugging, as without this option the execution
of builtins is not traced.
On earth, a compiler built in grade asm_fast.gc.tr.debug
takes 36.8s to run `mmc -C -I ../analysis/ hlds.make_hlds'.
When the compiler is built with `--no-inline-builtins',
this is increased to 38.6s.
The size of the compiler built in grade asm_fast.gc.tr.debug
increases from 45.0MB to 46.6MB.
compiler/options.m:
Add the option.
compiler/code_util.m:
Work out whether builtins should be generated inline.
compiler/handle_options.m:
Disable inlining of builtins when debugging.
compiler/simplify.m:
compiler/higher_order.m:
compiler/modes.m:
code_util__builtin_state now needs to know where the
builtin is being called from to know whether a particular
call should be treated as an inline builtin. The "recursive"
calls from the automatically generated procedures for each
builtin should always be generated inline, or else we would
generate an infinite loop.
NEWS:
doc/user_guide.texi:
compiler/notes/todo.html:
Document the change.
tests/debugger/Mmakefile:
tests/debugger/no_inline_builtins.{m,exp,inp}:
Test case.
tests/debugger/*.{inp,exp,exp2}:
tests/debugger/declarative/*.{inp,exp,exp2}:
Update due to changed event numbers.
tests/debugger/lval_desc_array.inp:
Use a less brittle method for stepping to the point in
the program where the test needs to display variables.
tests/debugger/declarative/library_forwarding.m:
tests/debugger/declarative/*.m:
Add forwarding predicates for some library predicates
and functions so that the declarative debugger doesn't
ask different questions depending on whether or not
the library was compiled with debugging enabled.
Estimated hours taken: 6
Branches: main
Fix a bug that caused a core dump if the debugger attempted to look at stack
frames with more than 64 live variables on the stack.
runtime/mercury_stack_layout.h:
Fix a bug. The array of lval descriptors in a label layout structures
has two components: the long descriptors and the short descriptors.
The bug was that we were using an index with respect to the start
of the first subarray to index into the second subarray. The fix is
to subtract the length of the first subarray from the index first.
(This problem rarely bit before because the first subarray's length
is almost always zero.)
runtime/mercury_layout_util.c:
Improve existing debugging code, but make its compilation conditional.
The difference this makes in runtime is not significant for the
debugger, but would be significant for native gc.
runtime/mercury_conf_param.h:
Document the macro the debugging code is conditional on.
trace/mercury_trace_vars.c:
Set unused fields of Var_Spec structures to explicitly invalid values,
to avoid possible misinterpretation when using gdb.
tests/debugger/lval_desc_array.{m,inp,exp,exp2}:
A regression test to check for the presence of the bug.
tests/debugger/Mmakefile:
Enable the new test case.