mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-06 16:08:32 +00:00
master_GIT
569 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f309588509 |
Fix a warning from the C compiler.
Estimated hours taken: 0.1 Branches: main trace/mercury_trace_cmd_browsing.c: Fix a warning from the C compiler. |
||
|
|
c733b0359b |
Give the Mercury debugger the ability to detect cliques of mutually recursive
Estimated hours taken: 30
Branches: main
Give the Mercury debugger the ability to detect cliques of mutually recursive
predicates on the stack. Exploit this ability to enhance the debugger's
level, retry, finish and stack commands.
runtime/mercury_stack_trace.[ch]:
Add a function, MR_find_clique_entry, that detects the clique
that contains the top stack frame. This is used to implement the new
arguments "clentry" and "clparent" (short for clique entry and parent)
options of the level, retry and finish commands. "clique" is a synonym
for "clentry" in these commands.
Add a function, MR_dump_stack_layout_clique, that implements the
new capabilities of the stack command. It can detect more than one
clique, anywhere on the stack.
To make this possible, modify the existing functions for printing
the lines of stack traces. These used to keep some information around
between calls in global variables. Now that information is stored in
two structures that the caller passes them. One contains the parameters
that govern what is to be printed, the other contains information about
what has been buffered up to be printed, but has not been flushed yet.
(The old code was confused in its handling of parameters. Some parts
of it looked up the global variables storing them, while other parts
were given the parameter values by their callers, values that could
have been -but weren't- inconsistent.)
Change the buffer flushing code to be idempotent, since in the new
code, sometimes it is hard to avoid flushing the buffer more than once,
and we want only the first to print its contents.
Make some type names conform to our standard style.
runtime/mercury_stack_layout.h:
Add a new flag in MR_ProcLayouts: a flag that indicates that the
procedure has one or more higher order arguments. The new code in
mercury_stack_trace.c handles procedures with this flag specially:
it does not consider two non-consecutive occurrences of such procedures
on the stack to be necessarily part of the same clique. This is to
avoid having two calls to e.g. list.map in different part of the
program pulling all the procedures between those parts on the stack
into a single clique. (The deep profiler has a very similar tweak.)
Add a pointer to the corresponding part of the compiler.
compiler/hlds_pred.m:
Add a predicate to test whether a predicate has any higher order args.
compiler/stack_layout.m:
When computing the flag in proc layouts, call the new procedure in
hlds_pred.m to help figure it out.
trace/mercury_trace_cmd_backward.c:
Implement the new options of the "retry" command.
trace/mercury_trace_cmd_forward.c:
Implement the new options of the "finish" command.
trace/mercury_trace_cmd_browsing.c:
Implement the "new options of the "level" command.
Implement the new functionality of the "stack" command.
trace/mercury_trace_util.[ch]:
Add some code common to the implementations of the level, retry and
finish commands.
trace/mercury_trace_external.c:
Conform to the changes to the runtime.
doc/user_guide.texi:
Document the debugger's new capabilities.
NEWS:
Announce the debugger's new capabilities.
tests/debugger/mutrec.{m,inp,exp}:
A new test case to test the handling of the stack command
in the presence of cliques.
tests/debugger/mutrec_higher_order.{m,inp,exp}:
A new test case to test the handling of the stack command
in the presence of cliques and higher order predicates.
tests/debugger/Mmakefile:
Enable both new test cases.
|
||
|
|
e60372dfd2 |
Bump the year in the copyright messages.
Branches: main, 11.07
.README.in:
bindist/bindist.README:
compiler/handle_options.m:
doc/*.texi:
profiler/mercury_profile.m:
trace/mercury_trace_internal.c:
Bump the year in the copyright messages.
|
||
|
|
b00bae41bc |
Fix a spot where uninitialized local variables were being used.
Branches: main, 11.07 trace/mercury_trace_tables.c: Fix a spot where uninitialized local variables were being used. |
||
|
|
2ccac171dd |
Add float registers to the Mercury abstract machine, implemented as an
Branches: main Add float registers to the Mercury abstract machine, implemented as an array of MR_Float in the Mercury engine structure. Float registers are only useful if a Mercury `float' is wider than a word (i.e. when using double precision floats on 32-bit platforms) so we let them exist only then. In other cases floats may simply be passed via the regular registers, as before. Currently, higher order calls still require the use of the regular registers for all arguments. As all exported procedures are potentially the target of higher order calls, exported procedures must use only the regular registers for argument passing. This can lead to more (un)boxing than if floats were simply always boxed. Until this is solved, float registers must be enabled explicitly with the developer only option `--use-float-registers'. The other aspect of this change is using two consecutive stack slots to hold a single double variable. Without that, the benefit of passing unboxed floats via dedicated float registers would be largely eroded. compiler/options.m: Add developer option `--use-float-registers'. compiler/handle_options.m: Disable `--use-float-registers' if floats are not wider than words. compiler/make_hlds_passes.m: If `--use-float-registers' is in effect, enable a previous change that allows float constructor arguments to be stored unboxed in structures. compiler/hlds_llds.m: Move `reg_type' here from llds.m and `reg_f' option. Add stack slot width to `stack_slot' type. Add register type and stack slot width to `abs_locn' type. Remember next available float register in `abs_follow_vars'. compiler/hlds_pred.m: Add register type to `arg_loc' type. compiler/llds.m: Add a new kind of lval: double-width stack slots. These are used to hold double-precision floating point values only. Record setting of `--use-float-registers' in exprn_opts. Conform to addition of float registers and double stack slots. compiler/code_info.m: Make predicates take the register type as an argument, where it can no longer be assumed. Remember whether float registers are being used. Remember max float register for calls to MR_trace. Count double width stack slots as two slots. compiler/arg_info.m: Allocate float registers for procedure arguments when appropriate. Delete unused predicates. compiler/var_locn.m: Make predicates working with registers either take the register type as an argument, or handle both register types at once. Select float registers for variables when appropriate. compiler/call_gen.m: Explicitly use regular registers for all higher-order calls, which was implicit before. compiler/pragma_c_gen.m: Use float registers, when available, at the interface between Mercury code and C foreign_procs. compiler/export.m: Whether a float rval needs to be boxed/unboxed when assigned to/from a register depends on the register type. compiler/fact_table.m: Use float registers for arguments to predicates defined by fact tables. compiler/stack_alloc.m: Allocate two consecutive stack slots for float variables when appropriate. compiler/stack_layout.m: Represent double-width stack slots in procedure layout structures. Conform to changes. compiler/store_alloc.m: Allocate float registers (if they exist) for float variables. compiler/use_local_vars.m: Substitute float abstract machine registers with MR_Float local variables. compiler/llds_out_data.m: compiler/llds_out_instr.m: Output float registers and double stack slots. compiler/code_util.m: compiler/follow_vars.m: Count float registers separately from regular registers. compiler/layout.m: compiler/layout_out.m: compiler/trace_gen.m: Remember the max used float register for calls to MR_trace(). compiler/builtin_lib_types.m: Fix incorrect definition of float_type_ctor. compiler/bytecode_gen.m: compiler/continuation_info.m: compiler/disj_gen.m: compiler/dupelim.m: compiler/exprn_aux.m: compiler/global_data.m: compiler/hlds_out_goal.m: compiler/jumpopt.m: compiler/llds_to_x86_64.m: compiler/lookup_switch.m: compiler/opt_debug.m: compiler/opt_util.m: compiler/par_conj_gen.m: compiler/proc_gen.m: compiler/string_switch.m: compiler/tag_switch.m: compiler/tupling.m: compiler/x86_64_regs.m: Conform to changes. runtime/mercury_engine.h: Add an array of fake float "registers" to the Mercury engine structure, when MR_Float is wider than MR_Word. runtime/mercury_regs.h: Document float registers in the Mercury abstract machine. Add macros to access float registers in the Mercury engine. runtime/mercury_stack_layout.h: Add new MR_LongLval cases to represent double-width stack slots. MR_LONG_LVAL_TAGBITS had to be increased to accomodate the new cases, which increases the number of integers in [0, 2^MR_LONG_LVAL_TAGBITS) equal to 0 modulo 4. These are the new MR_LONG_LVAL_TYPE_CONS_n cases. Add max float register field to MR_ExecTrace. runtime/mercury_layout_util.c: runtime/mercury_layout_util.h: Extend MR_copy_regs_to_saved_regs and MR_copy_saved_regs_to_regs for float registers. Understand how to look up new kinds of MR_LongLval: MR_LONG_LVAL_TYPE_F (previously unused), MR_LONG_LVAL_TYPE_DOUBLE_STACKVAR, MR_LONG_LVAL_TYPE_DOUBLE_FRAMEVAR. Conform to the new MR_LONG_LVAL_TYPE_CONS_n cases. runtime/mercury_float.h: Delete redundant #ifdef. runtime/mercury_accurate_gc.c: runtime/mercury_agc_debug.c: Conform to changes (untested). trace/mercury_trace.c: trace/mercury_trace.h: trace/mercury_trace_declarative.c: trace/mercury_trace_external.c: trace/mercury_trace_internal.c: trace/mercury_trace_spy.c: trace/mercury_trace_vars.c: trace/mercury_trace_vars.h: Handle float registers in the trace subsystem. This is mostly a matter of saving/restoring them as with regular registers. |
||
|
|
eccc863e7d |
Add comments about my recent design decision about the representation
Estimated hours taken: 0.1 Branches: main runtime/mercury_stack_layout.h: trace/mercury_trace_declararative.c: Add comments about my recent design decision about the representation of goal paths. |
||
|
|
3ff2d44656 |
Print some more statistics about label layouts.
Estimated hours taken: 0.2 Branches: main trace/mercury_trace_tables.c: Print some more statistics about label layouts. |
||
|
|
a83aad6681 |
Remove references to nondet foreign_proc from the definition of the data
Estimated hours taken: 2 Branches: main Remove references to nondet foreign_proc from the definition of the data structures that define stack layouts. runtime/mercury_stack_layout.h: Remove the trace ports that could occur in nondet foreign_procs from the definition of the trace port type used in C code. mdbcomp/prim_data.m: Remove the trace ports that could occur in nondet foreign_procs from the definition of the trace port type used in Mercury code. compiler/layout_out.m: compiler/stack_layout.m: compiler/trace_params.m: mdbcomp/trace_counts.m: runtime/mercury_trace_base.h: trace/mercury_trace_declarative.h: Delete references to those ports. runtime/mercury_stack_layout.h: Update the binary compatibility version number for debuggable executables, since the port number of user events has changed. |
||
|
|
8e3ead5903 |
Reduce the size of the string tables in debuggable executables by encoding
Estimated hours taken: 6 Branches: main Reduce the size of the string tables in debuggable executables by encoding variable names that fit a few standard templates, the most important of which is STATE_VARIABLE_name_number. The effect on the compiler is to reduce the string table size from about 3.1Mb to about 2.1Mb, which is about a 30% reduction. compiler/stack_layout.m: Look for the names fitting the patterns in variable names, and encode them. runtime/mercury_stack_layout.[ch]: Add a function for looking up variable names, decoding them if needed. Since goal paths cannot fit any of the patterns, access them without using that function. mdbcomp/rtti_access.m: Use the new function to retrieve variable names. runtime/mercury_grade.h: Increment the debugging compatibility version number, since debuggable executables in which some modules were produced by a compiler without this diff and some were produced by a compiler with this diff won't work together. |
||
|
|
d27185c6d2 |
Fix a minor bug: don't go on to try to print statistics if users invoke
Estimated hours taken: 1 Branches: main trace/mercury_trace_cmd_developer.c: Fix a minor bug: don't go on to try to print statistics if users invoke the "stats" command without saying *which* statistics they want, since it just leads to the printing of the same error message. trace/mercury_trace_cmd_developer.c: Fix a core-dump level bug: since the pointer to the table of variable names in a procedure may be NULL if the procedure has no named Mercury variables (which can happen for procedures defined in foreign languages), test it for NULL before deferencing it. |
||
|
|
5b1105b6a3 |
Avoid failures in the namespace cleanliness check in .par grade on MinGW.
Branches: main, 11.07 Avoid failures in the namespace cleanliness check in .par grade on MinGW. */RESERVED_MACRO_NAMES: Add some macros automatically defined by GCC on MinGW. |
||
|
|
257efbd678 |
Store double-precision `float' constructor arguments in unboxed form,
Branches: main Store double-precision `float' constructor arguments in unboxed form, in high-level C grades on 32-bit platforms, i.e. `float' (and equivalent) arguments may occupy two machine words. As the C code generated by the MLDS back-end makes use of MR_Float variables and parameters, float (un)boxing may be reduced substantially in many programs. compiler/prog_data.m: Add `double_word' as a new option for constructor argument widths, only used for float arguments as yet. compiler/make_hlds_passes.m: Set constructor arguments to have `double_word' width if required, and possible. compiler/type_util.m: Add helper predicate. compiler/builtin_ops.m: compiler/c_util.m: compiler/llds.m: Add two new binary operators used by the MLDS back-end. compiler/arg_pack.m: Handle `double_word' arguments. compiler/ml_code_util.m: Deciding whether or not a float constructor argument requires boxing now depends on the width of the field. compiler/ml_global_data.m: When a float constant appears as an initialiser of a generic array element, it is now always unboxed, irrespective of --unboxed-float. compiler/ml_type_gen.m: Take double-word arguments into account when generating structure fields. compiler/ml_unify_gen.m: Handle double-word float constructor arguments in (de)constructions. In some cases we break a float argument into its two words, so generating two assignments statements or two separate rvals. Take double-word arguments into account when calculating field offsets. compiler/mlds_to_c.m: The new binary operators require no changes here. As a special case, write `MR_float_from_dword_ptr(&X)' instead of `MR_float_from_dword(X, Y)' when X, Y are consecutive words within a field. The definition of `MR_float_from_dword_ptr' is more straightforward, and gcc produces better code than if we use the more general `MR_float_from_dword'. compiler/rtti_out.m: For double-word arguments, generate MR_DuArgLocn structures with MR_arg_bits set to -1. compiler/rtti_to_mlds.m: Handle double-word arguments in field offset calculation. compiler/unify_gen.m: Partially handle double_word arguments in LLDS back-end. compiler/handle_options.m: Set --unboxed-float when targetting Java, C# and Erlang. compiler/structure_reuse.direct.choose_reuse.m: Rename a predicate. compiler/bytecode.m: compiler/equiv_type.m: compiler/equiv_type_hlds.m: compiler/llds_to_x86_64.m: compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: compiler/opt_debug.m: Conform to changes. library/construct.m: library/store.m: Handle double-word constructor arguments. runtime/mercury_conf.h.in: Clarify what `MR_BOXED_FLOAT' now means. runtime/mercury_float.h: Add helper macros for converting between doubles and word/dwords. runtime/mercury_deconstruct.c: runtime/mercury_deconstruct.h: Add a macro `MR_arg_value' and a helper function to extract a constructor argument value. This replaces `MR_unpack_arg'. runtime/mercury_type_info.h: Remove `MR_unpack_arg'. Document that MR_DuArgLocn.MR_arg_bits may be -1. runtime/mercury_deconstruct_macros.h: runtime/mercury_deep_copy_body.h: runtime/mercury_ml_arg_body.h: runtime/mercury_table_type_body.h: runtime/mercury_tabling.c: runtime/mercury_type_info.c: Handle double-word constructor arguments. tests/hard_coded/Mercury.options: tests/hard_coded/Mmakefile: tests/hard_coded/lco_double.exp: tests/hard_coded/lco_double.m: tests/hard_coded/pack_args_float.exp: tests/hard_coded/pack_args_float.m: Add test cases. trace/mercury_trace_vars.c: Conform to changes. |
||
|
|
0ae65de577 |
Pack consecutive enumeration arguments in discriminated union types into a
Branches: main Pack consecutive enumeration arguments in discriminated union types into a single word to reduce cell sizes. Argument packing is only enabled on C back-ends with low-level data, and reordering arguments to improve opportunities for packing is not yet attempted. The RTTI implementations for other back-ends will need to be updated, but that is best left until after any argument reordering change. Modules which import abstract enumeration types are notified so by writing declarations of the form: :- type foo where type_is_abstract_enum(NumBits). into the interface file for the module which defines the type. compiler/prog_data.m: Add an `arg_width' argument to constructor arguments. Replace `is_solver_type' by `abstract_type_details', with an extra option for abstract exported enumeration types. compiler/handle_options.m: compiler/options.m: Add an internal option `--allow-argument-packing'. compiler/make_hlds_passes.m: Determine whether and how to pack enumeration arguments, updating the `arg_width' fields of constructor arguments before constructors are added to the HLDS. compiler/mercury_to_mercury.m: compiler/modules.m: Write `where type_is_abstract_enum(NumBits)' to interface files for abstract exported enumeration types. compiler/prog_io_type_defn.m: Parse `where type_is_abstract_enum(NumBits)' attributes on type definitions. compiler/arg_pack.m: compiler/backend_libs.m: Add a new module. This mainly contains a predicate which packs rvals according to arg_widths, which is used by both LLDS and MLDS back-ends. compiler/ml_unify_gen.m: compiler/unify_gen.m: Take argument packing into account when generating code for constructions and deconstructions. Only a relatively small part of the compiler actually needs to understand argument packing. The rest works at the HLDS level with constructor arguments and variables, or at the LLDS and MLDS levels with structure fields. compiler/code_info.m: compiler/var_locn.m: Add assign_field_lval_expr_to_var and var_locn_assign_field_lval_expr_to_var. Allow more kinds of rvals in assign_cell_arg. I do not know why it was previously restricted, except that the other kinds of rvals were not encountered as cell arguments before. compiler/mlds.m: We can now rely on the compiler to pack arguments in the mlds_decl_flags type instead of doing it manually. A slight downside is that though the type is packed down to a single word cell, it will still incur a memory allocation per cell. However, I did not notice any difference in compiler speed. compiler/rtti.m: compiler/rtti_out.m: Add and output a new field for MR_DuFunctorDesc instances, which, if any arguments are packed, points to an array of MR_DuArgLocn. Each array element describes the offset in the cell at which the argument's value is held, and which bits of the word it occupies. In the more common case where no arguments are packed, the new field is simply null. compiler/rtti_to_mlds.m: Generate the new field to MR_DuFunctorDesc. compiler/structure_reuse.direct.choose_reuse.m: For now, prevent structure reuse reusing a dead cell which has a different constructor to the new cell. The code to determine whether a dead cell will hold the arguments of a new cell with a different constructor will need to be updated to account for argument packing. compiler/type_ctor_info.m: Bump RTTI version number. Conform to changes. compiler/add_type.m: compiler/check_typeclass.m: compiler/equiv_type.m: compiler/equiv_type_hlds.m: compiler/erl_rtti.m: compiler/hlds_data.m: compiler/hlds_out_module.m: compiler/intermod.m: compiler/make_tags.m: compiler/mlds_to_gcc.m: compiler/opt_debug.m: compiler/prog_type.m: compiler/recompilation.check.m: compiler/recompilation.version.m: compiler/special_pred.m: compiler/type_constraints.m: compiler/type_util.m: compiler/unify_proc.m: compiler/xml_documentation.m: Conform to changes. Reduce code duplication in classify_type_defn. compiler/hlds_goal.m: Clarify a comment. library/construct.m: Make `construct' pack arguments when necessary. Remove an old RTTI version number check as recommended in mercury_grade.h. library/store.m: Deal with packed arguments in this module. runtime/mercury_grade.h: Bump binary compatibility version number. runtime/mercury_type_info.c: runtime/mercury_type_info.h: Bump RTTI version number. Add MR_DuArgLocn structure definition. Add a macro to unpack an argument as described by MR_DuArgLocn. Add a function to determine a cell's size, since the number of arguments is no longer correct. runtime/mercury_deconstruct.c: runtime/mercury_deconstruct.h: runtime/mercury_deconstruct_macros.h: runtime/mercury_ml_arg_body.h: runtime/mercury_ml_expand_body.h: Deal with packed arguments when deconstructing. Remove an old RTTI version number check as recommended in mercury_grade.h. runtime/mercury_deep_copy_body.h: Deal with packed arguments when copying. runtime/mercury_table_type_body.h: Deal with packed arguments in tabling. runtime/mercury_dotnet.cs.in: Add DuArgLocn field to DuFunctorDesc. Argument packing is not enabled for the C# back-end yet so this is unused. trace/mercury_trace_vars.c: Deal with packed arguments in MR_select_specified_subterm, use for the `hold' command. java/runtime/DuArgLocn.java: java/runtime/DuFunctorDesc.java: Add DuArgLocn field to DuFunctorDesc. Argument packing is not enabled for the Java back-end yet so this is unused. extras/trailed_update/tr_store.m: Deal with packed arguments in this module (untested). extras/trailed_update/samples/interpreter.m: extras/trailed_update/tr_array.m: Conform to argument reordering in the array, map and other modules in previous changes. tests/hard_coded/Mercury.options: tests/hard_coded/Mmakefile: tests/hard_coded/lco_pack_args.exp: tests/hard_coded/lco_pack_args.m: tests/hard_coded/pack_args.exp: tests/hard_coded/pack_args.m: tests/hard_coded/pack_args_copy.exp: tests/hard_coded/pack_args_copy.m: tests/hard_coded/pack_args_intermod1.exp: tests/hard_coded/pack_args_intermod1.m: tests/hard_coded/pack_args_intermod2.m: tests/hard_coded/pack_args_reuse.exp: tests/hard_coded/pack_args_reuse.m: tests/hard_coded/store_ref.exp: tests/hard_coded/store_ref.m: tests/invalid/Mmakefile: tests/invalid/where_abstract_enum.err_exp: tests/invalid/where_abstract_enum.m: tests/tabling/Mmakefile: tests/tabling/pack_args_memo.exp: tests/tabling/pack_args_memo.m: Add new test cases. tests/hard_coded/deconstruct_arg.exp: tests/hard_coded/deconstruct_arg.exp2: tests/hard_coded/deconstruct_arg.m: Add constructors with packed arguments to these cases. tests/invalid/where_direct_arg.err_exp: Update expected output. |
||
|
|
7e26b55e74 |
Implement a new form of memory profiling, which tells the user what memory
Branches: main
Implement a new form of memory profiling, which tells the user what memory
is being retained during a program run. This is done by allocating an extra
word before each cell, which is used to "attribute" the cell to an
allocation site. The attribution, or "allocation id", is an address to an
MR_AllocSiteInfo structure generated by the Mercury compiler, giving the
procedure, filename and line number of the allocation, and the type
constructor and arity of the cell that it allocates.
The user must manually instrument the program with calls to
`benchmarking.report_memory_attribution', which forces a GC and summarises
the live objects on the heap using the attributions. The mprof tool is
extended with a new mode to parse and present that data.
Objects which are unattributed (e.g. by hand-written C code which hasn't
been updated) are still accounted for, but show up in profiles as "unknown".
Currently this profiling mode only works in conjunction with the Boehm
garbage collector, though in principle it can work with any memory allocator
for which we can access a list of the live objects. Since term size
profiling relies on the same technique of using an extra word per memory
cell, the two profiling modes are incompatible.
The output from `mprof -s' looks like this:
------ [1] some label ------
cells words cumul procedure / type (location)
14150 38872 total
* 1949/ 13.8% 4872/ 12.5% 12.5% <predicate `parser.parse_rest/7' mode 0>
975/ 6.9% 1950/ 5.0% list.list/1 (parser.m:502)
487/ 3.4% 1948/ 5.0% term.term/1 (parser.m:501)
487/ 3.4% 974/ 2.5% term.const/0 (parser.m:501)
* 1424/ 10.1% 4272/ 11.0% 23.5% <predicate `parser.parse_simple_term_2/6' mode 0>
708/ 5.0% 2832/ 7.3% term.term/1 (parser.m:643)
708/ 5.0% 1416/ 3.6% term.const/0 (parser.m:643)
...
boehm_gc/alloc.c:
boehm_gc/include/gc.h:
boehm_gc/misc.c:
boehm_gc/reclaim.c:
Add a callback function to be called for every live object after a GC.
Add a function to write out the GC_size_map array.
compiler/layout.m:
Define the alloc_site_info type which is equivalent to the
MR_AllocSiteInfo C structure.
Add alloc_site_array as a kind of "layout" array.
compiler/llds.m:
Add allocation sites to `cfile' structure.
Replace TypeMsg argument (which was also for profiling) on `incr_hp'
instructions by an allocation site identifier.
Add a new foreign_proc_component for allocation site ids.
compiler/code_info.m:
compiler/global_data.m:
compiler/proc_gen.m:
Keep the set of allocation sites in the code_info and global_data
structures.
compiler/unify_gen.m:
Add allocation sites to LLDS allocation instructions.
compiler/layout_out.m:
compiler/llds_out_file.m:
compiler/llds_out_instr.m:
Output MR_AllocSiteInfo arrays in generated C files.
Output code to register the MR_AllocSiteInfo array with the Mercury
runtime.
Output allocation site ids for memory allocation instructions.
compiler/llds_out_util.m:
Add allocation sites to llds_out_info.
compiler/pragma_c_gen.m:
compiler/ml_foreign_proc_gen.m:
Generate a macro MR_ALLOC_ID which resolves to an allocation site
structure, for every foreign_proc whose C code contains the string
"MR_ALLOC_ID". This is to be used by hand-written C code which
allocates memory.
MR_PROC_LABELs are retained for backwards compatibility. Though
they were introduced for profiling, they seem to have been co-opted
for printf-debugging since then.
compiler/ml_global_data.m:
Add allocation site structures to the MLDS global data.
compiler/mlds.m:
compiler/ml_unify_gen.m:
Add allocation site id to `new_object' instruction.
compiler/mlds_to_c.m:
Output allocation site arrays and allocation ids in high-level C code.
Output a call to register the allocation site array with the Mercury
runtime.
Delete an unused predicate.
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/mercury_compile_llds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_util.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/use_local_vars.m:
compiler/var_locn.m:
Conform to changes.
compiler/pickle.m:
compiler/prog_event.m:
compiler/timestamp.m:
Conform to changes in memory allocation macros.
library/benchmarking.m:
Add the `report_memory_attribution' instrumentation predicates.
Conform to changes to MR_memprof_record.
library/array.m:
library/bit_buffer.m:
library/bitmap.m:
library/construct.m:
library/deconstruct.m:
library/dir.m:
library/io.m:
library/mutvar.m:
library/store.m:
library/string.m:
library/thread.semaphore.m:
library/version_array.m:
Use attributed memory allocation throughout the standard library so
that objects don't show up in the memory profile as "unknown".
Replace MR_PROC_LABEL by MR_ALLOC_ID.
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
Replace MR_PROC_LABEL by MR_ALLOC_ID.
profiler/Mercury.options:
profiler/globals.m:
profiler/mercury_profile.m:
profiler/options.m:
profiler/output.m:
profiler/snapshots.m:
Add a new mode to `mprof' to parse and present the data from
`Prof.Snapshots' files.
Add options for the new profiling mode.
profiler/process_file.m:
Fix a typo.
runtime/mercury_conf_param.h:
#define MR_MPROF_PROFILE_MEMORY_ATTRIBUTION if memory profiling
is enabled and we are using Boehm GC.
runtime/mercury.h:
Make MR_new_object take an allocation id argument.
Conform to changes in memory allocation macros.
runtime/mercury_memory.c:
runtime/mercury_memory.h:
runtime/mercury_types.h:
Define MR_AllocSiteInfo.
Add memory allocation functions and macros which take into the
account the additional word necessary for the new profiling mode.
These should be used in preferences to the raw memory allocation
functions wherever possible so that objects do not show up in the
profile as "unknown".
Add analogues of realloc/free which take into account the offset
introduced by the attribution word.
Add function versions of the MR_new_object macros, which can't be
written in standard C. They are only used when necessary.
Add built-in allocation site ids, to be used in the runtime and
other hand-written code when context-specific ids are unavailable.
runtime/mercury_heap.h:
Make MR_tag_offset_incr_hp_msg and MR_tag_offset_incr_hp_atomic_msg
allocate an extra word when memory attribution is desired, and store
the allocation id there.
Similarly for MR_create{1,2,3}_msg.
Replace proclabel arguments in allocation macros by alloc_id
arguments.
Replace MR_hp_alloc_atomic by MR_hp_alloc_atomic_msg. It was only
used for boxing floats.
Conform to change to MR_new_object macro.
runtime/mercury_bootstrap.h:
Delete obsolete macro hp_alloc_atomic.
runtime/mercury_heap_profile.c:
runtime/mercury_heap_profile.h:
Add the code to summarise the live objects on the Boehm GC heap and
writes out the data to `Prof.Snapshots', for display by mprof.
Don't store the procedure name in MR_memprof_record: the procedure
address is enough and faster to compare.
runtime/mercury_prof.c:
Finish and close the `Prof.Snapshots' file when the program
terminates.
Conform to changes in MR_memprof_record.
runtime/mercury_misc.h:
Add a macro to expand to the name of the allocation sites array
in LLDS grades.
runtime/mercury_bitmap.c:
runtime/mercury_bitmap.h:
Pass allocation id through bitmap allocation functions.
Delete unused function MR_string_to_bitmap.
runtime/mercury_string.h:
Add MR_make_aligned_string_copy_msg.
Make string allocation macros take allocation id arguments.
runtime/mercury.c:
runtime/mercury_array_macros.h:
runtime/mercury_context.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_dlist.c:
runtime/mercury_engine.c:
runtime/mercury_float.h:
runtime/mercury_hash_table.c:
runtime/mercury_ho_call.c:
runtime/mercury_label.c:
runtime/mercury_prof_mem.c:
runtime/mercury_stacks.c:
runtime/mercury_stm.c:
runtime/mercury_string.c:
runtime/mercury_thread.c:
runtime/mercury_trace_base.c:
runtime/mercury_trail.c:
runtime/mercury_type_desc.c:
runtime/mercury_type_info.c:
runtime/mercury_wsdeque.c:
Use attributed memory allocation throughout the runtime so that
objects don't show up in the profile as "unknown".
runtime/mercury_memory_zones.c:
Attribute memory zones to the Mercury runtime.
runtime/mercury_tabling.c:
runtime/mercury_tabling.h:
Use attributed memory allocation macros for tabling structures.
Delete unused MR_table_realloc_* and MR_table_copy_bytes macros.
runtime/mercury_deep_copy_body.h:
Try to retain the original attribution word when copying values.
runtime/mercury_ml_expand_body.h:
Conform to changes in memory allocation macros.
runtime/mercury_tags.h:
Replace proclabel arguments by alloc_id arguments in allocation macros.
runtime/mercury_wrapper.c:
If memory attribution is enabled, tell Boehm GC that pointers may be
displaced by an extra word.
trace/mercury_trace.c:
trace/mercury_trace_tables.c:
Conform to changes in memory allocation macros.
extras/net/tcp.m:
extras/solver_types/library/any_array.m:
extras/trailed_update/tr_array.m:
Conform to changes in memory allocation macros.
doc/user_guide.texi:
Document the new profiling mode.
doc/reference_manual.texi:
Update a commented out example.
|
||
|
|
27385ab8d1 |
Fix incorrect conversion specifiers on 32-bit
Branches: main, 11.01 runtime/mercury_wrapper.c: Fix incorrect conversion specifiers on 32-bit machines. MR_LL_PARALLEL_CONJ implies MR_THREAD_SAFE so there is no need to specify both. trace/mercury_event_parser.y: Avoid a C compiler warning on Cygwin. |
||
|
|
88b0057d9d |
Bump the year in the usage messages.
Branches: main, 11.01 .README.in: bindist/bindist.README: compiler/handle_options.m: doc/*.texi: profiler/mercury_profile.m: trace/mercury_trace_internal.c: Bump the year in the usage messages. |
||
|
|
fd76da59ff |
Add support for the csharp' grade to mmc --make', and make it possible to
Branches: main
Add support for the `csharp' grade to `mmc --make', and make it possible to
install the `csharp' grade with `mmake install'.
Also some miscellaneous fixes.
configure.in:
Require a recent enough bootstrap compiler that recognises C# as a
language for `pragma foreign_type'.
Mmakefile:
Use `mmc --make' to install the standard library in csharp grade.
aclocal.m4:
Search for the Mono C# compiler `gmcs', which is required for generics
at this time. Prefer it over the DotGNU C# compiler, which I have not
tested.
Search for `mono'. If found, it will be used in shell scripts to
launch executables generated via the csharp backend.
Remove "MS_" prefixes on the variables MS_CSC and MS_ILASM, which are
not Microsoft-specific. More importantly, it should be less likely to
make the mistake of adding an extra underscore to CSCFLAGS and
ILASMFLAGS.
README.DotNet:
Conform to variable renamings.
compiler/compile_target_code.m:
Add new linked target types `csharp_executable', `java_launcher' and
`erlang_launcher', instead of overloading `executable'.
Link with `mer_std.dll' and other libraries when generating C#
executables. There is no `mer_rt.dll'.
Pass "/debug" to the C# compiler if `--target-debug' is set.
Create a shell script to launch the executable if necessary.
Delete an unused predicate `standard_library_directory_option'.
compiler/file_names.m:
`.cs' and `.cs_date' are grade-dependent.
compiler/handle_options.m:
Force `.exe' as the executable file extension in csharp grades.
Make the `erlang' grade component imply the same options as MLDS
grades.
compiler/make.m:
Classify executable target types based on the compilation target.
compiler/make.module_target.m:
Handle `mmc --grade csharp --make <target>.dll'.
compiler/make.program_target.m:
Install library DLLs in csharp grades.
Make clean targets remove files for csharp grades.
Conform to changes.
compiler/make.util.m:
Add a stub foreign type.
Conform to changes.
compiler/module_cmds.m:
Factor out code to generate the shell scripts which launch programs
compiled in Java, Erlang and C# grades.
compiler/options.m:
Add `cli_interpreter' option to remember the name of the program which
should be used to run CLI (.NET) programs.
Add C#-related options to the help message.
compiler/options_file.m:
Remove "MS_" prefixes on MS_ILASM_FLAGS and MS_CSC_FLAGS, and remove
the extra underscore before "FLAGS". In all uses of the variables,
they were spelt without the extra underscore.
doc/user_guide.texi:
Document options and file types related to the C# grade.
library/Mmakefile:
Pass `mercury_dotnet.cs' to the C# compiler when building the standard
library. Suppress some warnings.
Allow stubs in this directory for csharp grade.
Conform to variable renamings.
library/builtin.m:
Uncomment foreign language pragmas for C#.
Handle null values in C# implementation of `deep_copy'.
library/private_builtin.m:
library/string.m:
Compare strings by ordinals in C#, instead of culture-specific rules.
Although the latter is allowed according to the documentation, it is
likely to slower, and cause confusion when porting between backends.
Handle negative index in string.set_char.
library/rtti_implementation.m:
Uncomment foreign language pragmas for C#.
`System.Type.GetType' only searches the current executing assembly or
in mscorlib for a type. As we have to be able to find types in other
assemblies (e.g. mer_std.dll or user DLLs), explicitly search through
a list of assemblies.
library/thread.semaphore.m:
Uncomment foreign language pragmas for C#.
Fix missing class qualification.
library/array.m:
library/bitmap.m:
library/bool.m:
library/dir.m:
library/exception.m:
library/io.m:
library/mutvar.m:
library/par_builtin.m:
library/region_builtin.m:
library/store.m:
library/thread.m:
library/time.m:
library/univ.m:
library/version_array.m:
Uncomment foreign language pragmas for C#.
mdbcomp/rtti_access.m:
Add type and procedure stubs.
runtime/mercury_dotnet.cs.in:
Override `Equals(object)' methods in `TypeCtorInfo_Struct' and
`TypeInfo_Struct' classes. This requires we override `GetHashCode' as
well.
Handle nulls arguments to `Equals' methods as is the expected behaviour.
Override `ToString' in `TypeCtorInfo_Struct' to produce more useful
output during debugging.
scripts/Mercury.config.in:
Record the configured CLI_INTERPRETER and pass that to the compiler as
a flag.
Conform to variable renamings.
scripts/Mmake.vars.in:
Pass value of CSCFLAGS from Mmake through to `mmc --make'.
Conform to variable renamings.
scripts/Mercury.config.bootstrap.in:
scripts/Mmake.rules:
Conform to variable renaming.
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Canonicalise high-level code, high-level-data, C# target code to the
`csharp' grade.
Handle erlang grades like other grades.
scripts/prepare_install_dir.in:
Copy `.cs' files from the runtime directory when preparing an install
directory.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
trace/Mmakefile:
Do as other non-C grades in this directory.
Conform to variable renamings.
tests/hard_coded/foreign_enum_dummy.m:
tests/hard_coded/sub-modules/non_word_mutable.m:
tests/hard_coded/sub-modules/sm_exp_bug.m:
Make these tests work in C#.
tests/mmc_make/Mmakefile:
Update a regular expression to account for `mmc --make' writing
"Making rebuild.exe" on platforms where the .exe suffix is not normally
used.
tests/mmc_make/complex_test.exp2:
Add alternative output (minor difference in floating point precision).
tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
tests/general/structure_reuse/Mmakefile:
tests/hard_coded/Mmakefile:
tests/hard_coded/sub-modules/Mmakefile:
tests/par_conj/Mmakefile:
tests/stm/Mmakefile:
Disable some tests in the csharp grade.
tests/invalid/Mmakefile:
Disable some tests in the csharp grade.
Enable a test which should work in java grades.
tests/valid/Mmakefile:
Do as other non-C grades in this directory.
When testing the csharp grade in this directory, produce only the C#
target files for now.
tests/run_one_test:
Don't compress a failing test case executable when the executable is
actually only a shell script.
|
||
|
|
62dda38678 |
Make the mdb command "dump" give you a message confirming what it did.
Estimated hours taken: 2
Branches: main
Make the mdb command "dump" give you a message confirming what it did.
trace/mercur_trace_cmd_browsing.c:
Make the mdb command "dump" give you a message confirming what it did,
unless the user gives the new -q or --quiet option.
doc/user_guide.texi:
Document the new option.
scripts/mdb_grep:
scripts/mdb_open:
Specify -q to keep old behavior.
tests/debugger/browser_test.{inp,exp,exp3}:
Update this test case to test the dump command both with and
without -q.
|
||
|
|
75eda06081 |
ssdebug enhancements.
Branches: main, 10.04
ssdebug enhancements.
ssdb/ssdb.m:
Make `print' (no arguments) print the goal, like mdb, instead of
printing all variables.
Make `print *' print all variables. Add `P' as an alias.
Use browser to print terms.
Add `format' and `format_param' commands to set browser parameters.
Support browsing the goal term with `browse' (no argument).
Add `return', `level' and `current' commands.
Support an optional line limit for the `stack' command.
Support compressing duplicate stack frames in stack traces.
Support an integer argument to `step' command.
Treat a bare integer as a `step N' command.
Support `quit -y' option.
browser/browse.m:
browser/util.m:
trace/mercury_trace_vars.c:
Move definition of type `unbound' to a public module.
README.ssdebug:
Note down two more limitations.
|
||
|
|
2ddbac45bc |
When the declarative debugger is about to search in the
supertree of the starting node and there has been no interaction with the user yet show a warning and ask the user if the search should continue in ancestor calls (bug #20). This could happen when the user issues the dd command at a node whose descendents are all trusted. In this case the declarative debugger will begin searching in the ancestors of the node where the dd command was issued, which can seem unintuitive. The warning message should help the user understand what is going on. browser/declarative_debugger.m: Add a warn_if_searching_supertree flag to the declarative debugger state. This flag is initially set to yes and is changed to no after a user interaction. Print a warning if a supertree is requested and there has been no interaction with the user yet. Ask the user if the search should continue in the supertree. Add a predicate to perform per-session initialization. This currently resets the warn_if_searching_supertree flag. browser/declarative_oracle.m: browser/declarative_user.m: Add get_user_input_stream functions. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/all_trusted.exp: tests/debugger/declarative/all_trusted.exp2: tests/debugger/declarative/all_trusted.inp: Include the warning message in the expected output. tests/debugger/declarative/supertree_warning.exp: tests/debugger/declarative/supertree_warning.inp: tests/debugger/declarative/supertree_warning.m: New test case. trace/mercury_trace_cmd_dd.c: Do per-session initialization. trace/mercury_trace_declarative.c: trace/mercury_trace_declarative.h: Add a wrapper function to call the new session initialization predicate. |
||
|
|
327035a48a |
Bump the year in the copyright message.
.README.in: bindist/bindist.README: compiler/handle_options.m: doc/*.texi: profiler/mercury_profile.m: trace/mercury_trace_internal.c: Bump the year in the copyright message. |
||
|
|
d4bbcda309 |
Move all the frequently occurring layout structures and components of layout
Estimated hours taken: 40 Branches: main Move all the frequently occurring layout structures and components of layout structures into arrays where possible. By replacing N global variables holding individual layout structures or layout structure components with one global variable holding an array of them, we reduce the sizes of the symbol tables stored in object files, which should speed up both the C compiler and the linker. Measured on the modules of the library, mdbcomp and compiler directories compiled in grade asm_fast.gc.debug, this diff reduces the size of the generated C source files by 7.8%, the size of the generated object files by 10.4%, and the number of symbols in the symbol tables of those object files by a whopping 42.8%. (These improvements include, and are not on top of, the improvements in my previous similar diff.) runtime/mercury_stack_layout.h: Each label layout structure has information about the type and location of every variable that is live at that label. We store this information in three arrays: an array of pseudo-typeinfos giving the types of all these variables, and two arrays MR_ShortLvals and MR_LongLvals respectively giving their locations. (Most of the time, the location's encoded form fits into one byte (the MR_ShortLval) but sometimes it needs more bits (this is when we use MR_LongLval)). We used to store these three arrays, whose elements are different types, in a single occurrence-specific common structure, one after the other, with a cumbersome mechanism being required to access them. We now store them as segments of three separate arrays, of pseudo-typeinfos, MR_ShortLvals and MR_LongLvals respectively. This makes access simpler and faster (which will matter more to any accurate garbage collector than it does to the debugger). It also allows more scope for compression, since reusing an existing segment of one of the three arrays is easier than reusing an entire common structure, which would require the equivalent of exact matches on all three arrays. Since most label layout structures that have information about variables can encode the variables' locations using only MR_ShortLvals, create a version of the label layout structure type that omits the field used to record the whereabouts of the long location descriptors. Add macros now generated by the compiler to initialize layout structures. Simplify a one-field struct. runtime/mercury_grade.h: Increment the binary compatibility version number for debuggable executables, since .c and .o files from before and after the change to label layout structures are NOT compatible. runtime/mercury_type_info.h: Fix some binary-compatibility-related bit rot. runtime/mercury_misc.h: Move here the existing macros used by the compiler when generating references to layout arrays, and add new ones. runtime/mercury_goto.h: Delete the macros moved to mercury_misc.h. Conform to the changes in mercury_stack_layout.h. runtime/Mmakefile: Prevent the unnecessary rebuilding of mercury_conf.h. runtime/mercury_accurate_gc.c: runtime/mercury_agc_debug.c: runtime/mercury_layout_util.c: runtime/mercury_stack_trace.c: runtime/mercury_types.h: trace/mercury_trace.c: trace/mercury_trace_vars.c: Conform to the changes in mercury_stack_layout.h. runtime/mercury_wrapper.c: Improve the debug support a bit. runtime/mercury_engine.h: Fix style. compiler/layout.m: Make the change described at the top. Almost all layout structures are now in arrays. The only exceptions are those that occur rarely, and proc layouts, whose names need to be derivable from the name of the procedure itself. Instead of having a single type "layout_data" that can represent different kinds of single global variables (not array slots), have different kinds for different purposes. This makes the code clearer and allows traversals that do not have to skip over inapplicable kinds of layout structures. compiler/layout_out.m: Output the new arrays. compiler/stack_layout.m: Generate the new arrays. Previously, an individual term generated by stack_layout.m could represent several components of a layout structure, with the components separated by layout_out.m. We now do the separation in stack_layout.m itself, adding each component to the array to which it belongs. Instead of passing around a single stack_layout_info structure, pass around several smaller one. This is preferable, since I found out the hard way that including everything in one structure would give the structure 51 fields. Most parts of the module work with only one or two of these structures, which makes their role clearer. Cluster related predicates together. compiler/options.m: doc/user_guide.texi: Add an option that control whether stack_layout.m will attempt to compress the layout arrays that can meaningfully be comressed. compiler/llds.m: Remove the old distinction between a data_addr and a data_name, replacing both types with a single new one: data_id. Since different kinds of data_names were treated differently in many places, the distinction in types (which was intended to allow us to process data_addrs that wrapped data_names differently from other kinds of data_addrs) wasn't buying us anything anymore. The new data_id type allows for the possibility that the code generator wants to generate a reference to an address it does not know yet, because it is a slot in a layout array, and the slot has not been allocated yet. Add the information from which the new layout array structures will be generated to the LLDS. compiler/llds_out.m: Call layout_out.m to output the new layout arrays. Adapt the decl_id type to the replacement of data_addrs by data_ids. Don't both keeping track of the have-vs-have-not-declared status of structures that are always declared at the start. When writing out a data_addr, for some kinds of data_addr, llds_out.m would write out the name of the relevant variable, while for some other kinds, it would write out its address. This diff separates out those those things into separate predicates, each of which behaves consistently. compiler/mercury_compile_llds_back_end.m: Convey the intended contents of the new layout arrays from stack_layout.m to llds_out.m. compiler/continuation_info.m: Add a type required by the way we now generate proc_static structures for deep profiling. compiler/hlds_rtti.m: Add distinguishing prefixes to the field names of the rtti_proc_label type. compiler/code_info.m: compiler/code_util.m: compiler/erl_rtti.m: compiler/exprn_aux.m: compiler/global_data.m: compiler/ll_pseudo_type_info.m: compiler/ml_code_util.m: compiler/opt_debug.m: compiler/proc_gen.m: compiler/prog_rep.m: compiler/rtti_out.m: compiler/unify_gen.m: Conform to the changes above. tests/debugger/declarative/track_through_catch.exp: Expect procedures to be listed in the proper order. tests/EXPECT_FAIL_TESTS.asm_fast.gc.debug: tests/EXPECT_FAIL_TESTS.asm_fast.gc.profdeep: Add these files to ignore expected failues in these grades. |
||
|
|
2e859b4208 |
Get Mercury compiling on Mac OS X 10.6 (Darwin 10).
Mmake.common.in:
Add ENABLE_BOEHM_XOPEN_SOURCE.
README.MacOS:
Document that Mercury works on Mac OS X 10.5 and 10.6.
Also document that it hasn't been tested on 10.3 for
some time.
configure.in:
Pass -m32 to gcc on Darwin 9 and 10, because our current version of boehm
doesn't work on 64 bit Darwin.
Define _XOPEN_SOURCE on Darwin 10 when compiling boehm to
avoid errors about the functions in ucontext.h being deprecated.
Don't pass -s to the linker on Darwin 9 and 10.
boehm_gc/Makefile:
Include BOEHM_CFLAGS (generated by the Mercury configure script)
in SPECIALCFLAGS which is used when compiling mach_dep.c so that
_XOPEN_SOURCE is defined in mach_dep.c.
trace/mercury_event_scanner.l:
Remove declaration of mercury_event_get_leng, because flex generates a
different return value type depending on the platform (on Mac OS X 10.6 it
returns yy_size_t while on Linux it returns int).
|
||
|
|
99b9d15442 |
Fix a warning from the C compiler.
Estimated hours taken: 0.1 Branches: main trace/mercury_trace_declarative.c: Fix a warning from the C compiler. |
||
|
|
27825e8b96 |
Bump the year in the usage messages.
.README.in: bindist/bindist.README: compiler/handle_options.m: doc/faq.texi: doc/library/texi: doc/reference_manual.texi: doc/transition_guide.texi: profiler/mercury_profile.m: trace/mercury_trace_internal.c: Bump the year in the usage messages. |
||
|
|
2f85a4b427 |
Make the compiler bootstrap again in term size profiling grades.
Estimated hours taken: 3
Branches: main
Make the compiler bootstrap again in term size profiling grades.
compiler/llds_out.m:
Don't output a stray & that introduces a C syntax error. This code
was invoked only in term size profiling grades.
library/thread.semaphore.m:
Replace the use of a C macro that isn't defined in term size profiling
grades with a macro that *is* defined.
runtime/mercury_term_size.c:
Handle the dummy type_ctor_rep added recently.
trace/mercury_trace_vars.c:
Update the code that prints the sizes of the terms bound to variables
(which is enabled only in term size profiling grades) to handle the
changes made when I added user event attributes.
tests/debugger/tailrec1.exp2:
Add a new expected output for this case that also prints the variables
added by the term size profiling transformation.
tests/debugger/term_size_words.{m,exp}:
Update this test case for the old breakup of std_util.m and the changes
in the printing of floats.
|
||
|
|
3a76fe424f |
When the user asks for the printing of a non-existent part of a term, make
Estimated hours taken: 3 Branches: main When the user asks for the printing of a non-existent part of a term, make mdb print the path up to the nonexistent part as part of the error message. trace/mercury_trace_var.[ch]: Give to the function that generates those error messages a pointer not just to the bad part of the path, but to the full path as well, so it can print the good part. Remove fixed limits on the size of error messages. trace/mercury_trace_spy.c: Conform to the change in mercury_trace_var.h. runtime/mercury_memory.[ch]: Provide a mechanism for dynamically resizing character buffers for use by mercury_trace_vars.c. We use this instead of snprint because snprint isn't available or doesn't work properly on some platforms. Document a previously overlooked function. tests/debugger/browser_test.exp3: tests/debugger/field_names.exp: Update these test cases to expect the new, more informative error messages. |
||
|
|
53286dd4bf |
Implement a new compiler option, --exec-trace-tail-rec, that preserves direct
Estimated hours taken: 30
Branches: main
Implement a new compiler option, --exec-trace-tail-rec, that preserves direct
tail recursion in det and semidet procedures even when debugging is enabled.
This should allow the debugging of programs that previously ran out of stack.
The problem arose because even a directly tail-recursive call had some code
after it: the code for the EXIT event, like this:
p:
incr_sp
fill in the usual debug slots
CALL EVENT
...
/* tail call */
move arguments to registers as usual
call p, return to p_ret
p_ret:
/* code to move output arguments to right registers is empty */
EXIT EVENT
decr_sp
return
If the new option is enabled, the compiler will now generate code like this:
p:
incr_sp
fill in the usual debug slots
fill in new "stack frame reuse count" slot with 0
CALL EVENT
p_1:
...
/* tail call */
move arguments to registers as usual
update the usual debug slots
increment the "stack frame reuse count" slot
TAILCALL EVENT
goto p_1
The new TAIL event takes place in the caller's stack frame, so that the local
variables of the caller are available. This includes the arguments of the
recursive call (though if they are unnamed variables, the debugger will not
show them). The TAIL event serves as a replacement for the CALL event
of the recursive invocation.
compiler/options.m:
Add the new option.
compiler/handle_options.m:
Handle an implication of the new option: the declarative debugger
does not (yet) understand TAIL events.
compiler/mark_tail_calls.m:
New module to mark directly tail recursive calls and the procedures
containing them as such.
compiler/hlds.m:
compiler/notes/compiler_design.html:
Mention the new module.
compiler/mercury_compile.m:
Invoke the new module when the new option asks us to.
compiler/hlds_goal.m:
Add the feature used to mark tail recursive calls for the debugger.
Rename an existing feature with a similar but not identical purpose
to avoid possible confusion.
compiler/hlds_pred.m:
Add a field to proc_infos that says whether the procedure contains
tail recursive calls.
Minor style improvements.
compiler/passes_aux.m:
Minor change to accommodate the needs of the new module.
compiler/code_info.m:
Transmit the information from mark_tail_calls to the code generator.
compiler/call_gen.m:
Implement the new option.
compiler/trace_gen.m:
Reserve the extra slot needed for the new option.
Switch to state variable notation in the code that does the slot
allocation, since this is less error-prone than the previous approach.
compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
Remember what stack slot holds the stack frame reuse counter,
for transmission to the runtime system.
compiler/proc_gen.m:
Add the new label needed for tail recursion.
Put the arguments of some procedures into a more logical order.
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/saved_vars.m:
compiler/table_gen.m:
Conform to the changes above.
compiler/trace_params.m:
mdbcomp/prim_data.m:
runtime/mercury_trace_base.[ch]:
Add the new event type.
Convert mercury_trace_base.h to four-space indentation.
runtime/mercury_stack_layout.h:
Add a field to the execution trace information we have for each
procedure that gives the number of the stack slot (if any) that holds
the stack frame reuse counter. Add a macro to get the value in the
counter.
Convert this header file to four-space indentation.
runtime/mercury_stack_trace.[ch]:
When walking the stack, we now have to be prepared to encounter stack
frames that have been reused. Modify the algorithms in this module
accordingly, and modify the interfaces of the exported functions
to allow the functions' callers to behave accordingly as well.
Group the information we gather about stack frame for printing into
one structure, and document it.
Convert the header to four-space indentation.
library/exception.m:
mdbcomp/trace_counts.m:
Conform to the changes above.
In trace_counts.m, fix an apparent cut-and-paste error (that hasn't
caused any test case failures yet).
trace/mercury_trace.c:
Modify the implementation of the "next" and "finish" commands
to accommodate the possibility that the procedure at the selected
depth may have had its stack frame reused. In such cases
tests/debugger/tailrec1.{m,inp,exp,data}:
A new test case to check the handling of tail recursive procedures.
|
||
|
|
1776f4f437 |
Some minor fixes to get Mercury compiling out
of the box with MS Visual C version 6.0.
configure.in:
Check for __int64 as providing a 64 bit integer
when using MSVC. Note we still first check,
int, long and long long.
trace/mercury_event_scanner.l:
Under windows we don't have unistd.h so include
mercury_conf.h to check for the availability of
unistd.h and then use that to define YY_NO_UNISTD_H.
? DIFF
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.524
diff -u -r1.524 configure.in
--- configure.in 27 Aug 2008 01:08:04 -0000 1.524
+++ configure.in 16 Sep 2008 07:22:19 -0000
@@ -1569,6 +1569,15 @@
exit(0);
}
+ /* Check for __int64 when using MSVC */
+ #ifdef _MSCVER
+ if (sizeof(__int64) * CHAR_BIT >= 64)
+ {
+ fprintf(fp, "__int64\n");
+ exit(0);
+ }
+ #endif
+
fprintf(fp, "unknown\n");
exit(1);
}],
Index: trace/mercury_event_scanner.l
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_event_scanner.l,v
retrieving revision 1.4
diff -u -r1.4 mercury_event_scanner.l
--- trace/mercury_event_scanner.l 1 May 2007 06:31:26 -0000 1.4
+++ trace/mercury_event_scanner.l 16 Sep 2008 07:22:25 -0000
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <string.h>
+#include "mercury_conf.h" /* for MR_HAVE_UNISTD_H */
#include "mercury_misc.h" /* for MR_fatal_error */
#include "mercury_trace_term.h" /* for MR_Cterm etc */
@@ -36,6 +37,11 @@
#include "mercury_event_spec_missing.h"
#include "mercury_event_parser.h"
+#ifndef MR_HAVE_UNISTD_H
+#define YY_NO_UNISTD_H
+#endif
+
+
/*
** We should #include mercury_event_scanner.h as well, but flex puts into the
** header file it creates a #undef for a macro it needs, so #including
|
||
|
|
9c98a60bd5 |
Add a mechanism for dynamically growing the trail by adding new segments to it
Estimated hours taken: 20
Branches: main
Add a mechanism for dynamically growing the trail by adding new segments to it
in a similar fashion to what we do for the stacks with stack segments. The
mechanism is enabled by the trseg (trail segments) grade component. Unlike
stack segments the trail segment mechanism also works with the high-level C
backend.
The mechanism works by adding a test to MR_trail_{value,function} that checks
if we are about to run out of a trail and allocates a new trail segment if
that test succeeds.
Extend mdb's trail_details command to print the current number of trail
segments in trseg grades.
Fix a bug where the MR_trail_ptr was not being reset correctly after
a trail reset.
runtime/mercury_grade.h:
Add the new grade component.
runtime/mercury_conf_param.h:
Document the new grade component, and the option used to debug
trail segments.
runtime/mercury_memory_zones.h:
Shift the definition MR_MemoryZones to this file in order break
a cyclic dependency between header files.
runtime/mercury_context.h:
Add a new field to the context structure to hold a list previous
trail segments.
Delete the definition of the type MR_MemoryZones from here.
runtime/mercury_trail.[ch]:
When adding a new trail entry in trseg grades first check whether we
need to extend the trail and do so if necessary.
Export the definitions of MR_TRAIL_{BASE,ZONE}.
Add a macro, MR_PREV_TRAIL_ZONES, for accessing the list of trail zones
in a grade independent manner.
Fix a typo in a comment.
Add functions for creating and destroying trail segments.
Handle trail segments in the code that handles untrailing and
resets. This also fixes a bug with trail reset where MR_trail_ptr
was not being reset along with the rest of the trail state.
compiler/options.m:
compiler/handle_options.m:
compiler/compile_target_code.m:
scripts/canonical_grade.sh-subr:
scripts/init_grade_option.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Handle the new grade component.
trace/mercury_trace_cmd_developer.c:
Make the trail_details command print out the number of trail segments
in trseg grades.
tests/trailing/Mmakefile:
tests/trailing/tr_reset_bug.{m,exp}:
Regression test for the bug with trail resets.
|
||
|
|
b83a78a1bf |
Avoid warnings when compiling with MSVC.
trace/Mmakefile: Do not pass -g directly to the C compiler since MSVC doesn't recognise that option. Instead, invoke mgnuc with --c-debug since that causes a flag appropriate to the particular C compiler to be used. |
||
|
|
5b7feec6aa |
The trail_details command should be looking at the saved
Estimated hours taken: 1 Branches: main trace/mercury_trace_cmd_developer.c: The trail_details command should be looking at the saved version of the trail state, since the actual version may have been modified by Mercury code called by the debugger. (Well, the ticket counter and high water mark will be, the trail pointer shouldn't be.) |
||
|
|
6f76b20bd4 |
Add a new developer-only mdb command, trail_details, that prints out
Estimated hours taken: 2 Branches: main Add a new developer-only mdb command, trail_details, that prints out low-level information concerning the state of the trail. This includes things like the current values of the trail pointer and ticket counter. trace/mercury_trace_internal.c: trace/mercury_trace_cmd_developer.c: Add the new command. trace/mercury_trace_cmd_developer.h: Add the new command and delete a prototype for a function not defined by this module. runtime/mercury_trail.h: runtime/mercury_trail.c: Add a new function that returns the number of entries on the trail (for the currently executing thread). doc/user_guide.texi: Document the new command. s/lowlevel/low-level/ in some spots (the latter is consistent with the hyphenation used elsewhere in this documentation.) Break some over-long lines. tests/debugger/completion.exp: tests/debugger/mdb_command_test.inp: Update this for the "trail_details" mdb command. |
||
|
|
580e14075f |
Fix a typo and white space.
Estimated hours taken: 0.1 Branches: main trace/mercury_trace_internal.c: trace/mercury_trace_spy.c: Fix a typo and white space. |
||
|
|
868764c55a |
Fix an old bug in mdb. Given the command "print X" where X was ambiguous
Estimated hours taken: 0.5
Branches: main
Fix an old bug in mdb. Given the command "print X" where X was ambiguous
(it was the name of N variables for N > 1), it printed N lines, but they
all gave the details of just variable repeatedly.
trace/mercury_trace_vars.c:
Fix this bug.
tests/debugger/double_print.{m,inp,exp}:
A new test case for this bug.
tests/debugger/Mmakefile:
Enable the test case.
|
||
|
|
a1f69d35fc |
Fix Mantis bug #45, which was that mdb effectively ignored some commands
Estimated hours taken: 1.5 Branches: main Fix Mantis bug #45, which was that mdb effectively ignored some commands in .mdbrc files. trace/mercury_trace_internal.[ch]: trace/mercury_trace_command_queue.[ch]: Move the code for manipulating the command queue from mercury_trace_internal.c to a new module. This improves the level of abstraction. The ultimate cause of the bug was a lack of abstraction. The old code put commands from startup files in the command queue in a mixed order: respecting order within each startup file, but reversing order among startup files. The cause of the bug was that the commands from .mdbrc files were put into the queue *after* the commands from the system's standard startup file in time, but *before* them in order, so the commands in the standard startup file could override commands from .mdbrc files. The fix is to consistently put commands in order: from the standard system startup file, from .mdbrc, and from the environment. Give better names to some functions. Provide a mechanism for debugging the command queue mechanism. trace/mercury_trace_cmd_backward.c: Use those better names. trace/Mmakefile: Add the new module. tests/debugger/mdbrc_test.{m,inp,exp,mdbrc}: Add a regression test for this bug, a minimally modified version of the bug demo program in Mantis. tests/debugger/Mmakefile: Enable the new test case, which specifies its own .mdbrc file. tests/Mmake.common: Provide a way for a test case to not use the .mdbrc file used by all the other debugger tests, so it could specify its own. |
||
|
|
8af4a5dd82 |
Update copyright messages.
Estimated hours taken: 0.1 Branches: main Update copyright messages. .README.in: compiler/handle_options.m: doc/faq.texi: doc/library/texi: doc/reference_manual.texi: doc/transition_guide.texi: doc/user_guide.texi: profiler/mercury_profile.m: trace/mercury_trace_internal.c: Bump the year in the copyright messages to 2008. INSTALL_CVS: Update a comment: we now require autoconf version 2.58 or greater. |
||
|
|
bbe6de9387 |
Make tabling statistics much more useful, and avoid core dumps while printing
Estimated hours taken: 30 Branches: main Make tabling statistics much more useful, and avoid core dumps while printing them (thereby fixing bug #23 in Mantis). runtime/mercury_tabling.h: Expand the set of statistics we can gather about tabling (starting to gather information about memory consumption). Put the statistics into logical groups: enum functors, non-enum du functors, hash tables, and the expandable table used for I/O tabling. For du types and polymorphic types, we can gather different statistics for different parts of a term. We used to use one field to gather more than one related kind of count, but these are now separated. Group the MR_ProcTableInfo struct fields relating to statistics into substructures. The substructures describing a call or answer table have their own substructures giving the statistics about the individual steps; put these in parallel with the descriptions of the steps themselves. Put those substructures into two-element arrays to allow them to be handled uniformly. runtime/mercury_types.h: Add the typedefs needed by mercury_tabling.h. runtime/mercury_tabling_macros.h: Conform to the modified classification of tabling categories. runtime/mercury_tabling.c: runtime/mercury_hash_lookup_or_add_body.h: runtime/mercury_table_int_fix_index_body.h: runtime/mercury_table_int_start_index_body.h: runtime/mercury_table_type_body.h: runtime/mercury_tabling_stats_defs.h: runtime/mercury_tabling_stats_nodefs.h: runtime/mercury_tabling_stats_undefs.h: Gather the modified and expanded set of statistics. Use more meaningful names (with MR_ prefixes) for macros. library/table_builtin.m: library/table_statistics.m: Move the material relating to statistics that used to be in table_builtin.m to the new module table_statistics.m. This is necessary because table_builtin.m is deliberately not included in the library documentation, yet users needs to know how to print out and interpret tabling statistics. Expand the code for handling statistics, adding predicates for printing them together with (hopefully explanatory) labels. Make it all work with the new runtime data structures. library/library.m: Include the new library module. mdbcomp/prim_data.m: Provide a way to refer to the tabling statistics module. compiler/hlds_pred.m: Add utility function to compute the kind of statistics we gather for a given kind of tabling step. compiler/rtti.m: Change the compiler's representation of tabling's runtime data structures to conform to the change to runtime/mercury_tabling.h. Replace a bool with a purpose-designed type (is_array), and add other similar types (call_or_answer_table, curr_or_prev_table). compiler/rtti_out.m: compiler/llds_out.m: Output the updated data structures. compiler/ml_code_gen.m: Generate the updated data structures. compiler/table_gen.m: Update the C code we generate to gather statistics. Gather the extra information needed by the updated data structures in the compiler (to fill in the updated data structures in the runtime). compiler/mlds.m: Add a new kind of constant, one that has just a name. This allows ml_code_gen.m to avoid lying about the type of constants of enum tyes (such as the kind of tabling stats we gather for a step). compiler/modules.m: Import the new table_statistics module automatically if any tabling pragma asks for statistics. compiler/add_pragma.m: compiler/hlds_out.m: compiler/llds.m: compiler/mlds_to_c.m: compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: compiler/mlds_to_java.m: compiler/mlds_to_managed.m: trace/mercury_trace_cmd_developer.c: Conform to the changes above. tests/tabling/fib_stats.{m,exp}: tests/tabling/specified_stats.{m,exp}: New test cases to the test tabling statistics. tests/tabling/Mmakefile: Enable the new test cases. tests/tabling/fib.m: tests/tabling/specified.m: Clean up the code of these test cases, which were used as the basis of the new test cases. |
||
|
|
b6d6ce9403 |
Address bug #24. The debugger help message referred to the `fail' command,
Estimated hours taken: 0.5 Branches: main Address bug #24. The debugger help message referred to the `fail' command, even though the documentation for it is commented out in the user's guide. The command had been left out of the table of commands in the trace directory, so the debugger didn't respond to it anyway. Since the command doesn't work properly, which is why the documentation in the user's guide is commented out, remove all other user visible documentation that refers to it. Add the `fail' command to the debugger's internal table of commands so that developers can use it. doc/mdb_categories: Delete `fail' from the forward execution commands. It doesn't work properly yet. (See the comments in doc/user_guide.texi.) trace/mercury_trace_internal.c: Add the `fail' command to the table of debugger commands. |
||
|
|
22c5b49792 |
Initial checkin which is all the scaffolding needed to
Estimated hours taken: 4 Branches: main Initial checkin which is all the scaffolding needed to support the new source to source mercury debugger (ssdb). The main addition in this change is the ssdb directory, which will contain the mer_ssdb library. Mmake.workspace: Mmakefile: configure.in: Handle the new ssdb directory. compiler/options.m: Add the --ssdb and --source-to-source-debug options. compiler/mercury_compile.m: Add the ssdb pass (it does nothing at the moment). compiler/modules.m: Implicitly import ssdb_builtin when compiling with --ssdb. mdbcomp/prim_data.m: Handle the ssdb module. ssdb/Mercury.options: ssdb/Mmakefile: ssdb/SSDB_FLAGS.in: ssdb/.mgnuc_copts: ssdb/.mgnuc_opts: ssdb/RESERVED_MACRO_NAMES: Build system for ssdb directory. ssdb/mer_ssdb.m: ssdb/ssdb.m: The operations which are needed by the source to source debugger. tools/bootcheck: Changes to the bootcheck script to handle the new ssdb module. browser/Mmakefile: bytecode/Mmakefile: library/Mmakefile: mdbcomp/Mmakefile: runtime/Mmakefile: trace/Mmakefile: Add the ALLOW_SSDB_PREFIX rules. |
||
|
|
70ba4db53d |
Fix a problem introduced in my previous change to the trace directory
Estimated hours taken: 4 Branches: main Fix a problem introduced in my previous change to the trace directory which introduced a dependency between the runtime and the trace directory which broke compilation of the former in high-level C grades. Fix up conversion specifiers in the printf control strings in the trace directory. runtime/mercury_stack_trace.h: Define MR_FrameLimit, MR_SpecLineLimit and MR_AncestorLevel here rather than in the trace directory because the code in the runtime for stack tracing refers to them. (Some code that was only enabled in high-level C grades and referred to the above types was added as part of my last change; this is what broke compilation in those grades.) Rename MR_AncestorLevel to (the more general) MR_Level in the process. runtime/mercury_stack_trace.c: Use MR_FrameLimit and friends in place of ints here. trace/mercury_trace.h: Delete the typedefs for MR_FrameLimit and friends. trace/mercury_trace_cmd_backward.c: trace/mercury_trace_external.c: Conform to the above change. trace/*.c: Change the signedness of conversion specifiers to conform to recent type changes. |
||
|
|
e298cb36e4 |
Fix the namespace cleanliness check in the trace directory.
Estimated hours taken: 0.1 Branches: main Fix the namespace cleanliness check in the trace directory. trace/mercury_trace_spy.h: Add a missing #include. |
||
|
|
4bf295460a |
Fix up some places in the trace directory where there were (potential)
Estimated hours taken: 5
Branches: main
Fix up some places in the trace directory where there were (potential)
mismatches between the sizes of types used to represent natural numbers.
Much of the existing code in the trace directory assumed that
sizeof(int) == sizeof(MR_Unsigned), which is not true on our 64-bit
machines. Zoltan's recent change to MR_trace_is_natural_number() broke
that assumption in a lot of places. (I committed a workaround for that
yesterday.)
This diff addresses the above problem by changing the types of many of
things that represent natural numbers from int to MR_Unsigned.
This should make the trace code more robust on 64-bit machines and
help avoid a recurrence of problems like the above.
NOTE: this change does not change slot numbers into unsigned values since
they still use negative values as sentinels. I will address slot numbers
in as part of a separate change.
trace/mercury_trace.h:
Add typedefs for MR_Unsigned for several commonly used quantities
within the trace code. For I/O action numbers we just re-use
the type MR_IoActionNum from the runtime, rather than defining
a new typedef here.
trace/mercury_trace_tables.h:
Change the type of the `match_proc_max' and `match_proc_next' fields
of the MR_MatchesInfo structure into MR_Unsigned instead of int.
trace/mercury_trace_cmd_parameter.[ch]:
Change the type of the global variables, MR_scroll_{limit,next}
and MR_num_context_lines into MR_Unsigned instead of int.
trace/mercury_trace_util.[ch]:
Restore Zoltan's change that made the type of the second argument of
MR_trace_is_natural_number() into MR_Unsigned. The places that
caused this to break on 64-bit machines have now been fixed.
Update the documentation of MR_trace_is_natural_number();
Delete MR_trace_is_unsigned() since that now duplicates
MR_trace_is_natural_number().
Add a new function MR_trace_is_nonneg_int() which is similar
to the above functions except that it stores its result in
an int. (This is needed for handling slot numbers which are
still represented using ints.)
trace/mercury_trace_cmd_developer.c:
Refactor some code so that we don't need to use -1 as a sentinel
value.
trace/mercury_trace_cmd_help.c:
Use MR_trace_is_nonneg_int() instead of MR_trace_is_natural_number()
to handle slot numbers.
runtime/mercury_trace_base.[ch]:
Change the type of the first argument of MR_trace_get_action()
from int to MR_IoActionNum.
trace/mercury_trace_alias.c:
trace/mercury_trace_cmd_backward.c:
trace/mercury_trace_cmd_breakpoint.c:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_dd.c:
trace/mercury_trace_cmd_exp.c:
trace/mercury_trace_cmd_forward.c:
trace/mercury_stack_trace.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_spy.[ch]:
trace/mercury_trace_vars.[ch]:
Use MR_Unsigned instead of int to represent natural numbers.
|
||
|
|
880c209188 |
Workaround a problem that was causing the debugger to seg fault on 64-bit
Estimated hours taken: 1 Branches: main Workaround a problem that was causing the debugger to seg fault on 64-bit machines. trace/mercury_trace_util.[ch]: Back out the change that made the type of the second argument of MR_trace_is_natural_number() MR_Unsigned rather than int. At the moment this causes problems on 64-bit machines (where sizeof(MR_Unsigned) != sizeof(int)), because much of the code in the trace directory still uses ints to represent unsigned values. trace/mercury_trace_cmd_browsing.c: Call MR_trace_is_unsigned() instead of MR_trace_is_natural_number() in a spot. Fix some cut-and-paste errors: several calls to fprintf() had more arguments than their format strings had conversion specifiers. |
||
|
|
519d8f9508 |
Fix a bug in the handling of I/O actions by the debugger: the procedural
Estimated hours taken: 12
Branches: main
Fix a bug in the handling of I/O actions by the debugger: the procedural
debugger didn't implement the documented commands for printing I/O actions.
Also implement some new variants of the print commands to make it easier
to print I/O actions.
Also track down and pinpoint a bug that caused the declarative debugger
to ask questions from *outside* the tree it was asked to debug, as shown
by this example from a new test case compiled in a decldebug grade (so that
the library, and thus io.read, gets compiled with deep, not shallow tracing):
-----------------------------------------------------------------------------
mdb ./io_read_bug
1: 1 1 CALL pred io_read_bug.main/2-0 (cc_multi) io_read_bug.m:22
I/O tabling started.
mdb> g 4
Please input the number of queens and a period:
4: 3 2 CALL pred io.read/3-0 (det) io.m:4240 (io_read_bug.m:24)
mdb> f
5.
513: 3 2 EXIT pred io.read/3-0 (det) io.m:4240 (io_read_bug.m:24)
mdb> dd
[1, 3, 5, 2, 4]
main(_, _)
31 tabled IO actions: too many to show
Valid?
-----------------------------------------------------------------------------
browser/declarative_tree.m:
Put an XXX at the spot of the second bug.
browser/declarative_analyser.m:
browser/declarative_debugger.m:
Change the formatting of some code to give consistent and more
meaningful names to some arguments, and to make switches easier
to read. There are no algorithmic changes.
runtime/mercury_trace_base.[ch]:
Move the code for disabling/enabling deep profiling to the code that
does disabling/enabling of I/O actions, to put all relevant actions
for entering and leaving Mercury code together.
Note the similarity of MR_turn_debug_off/MR_turn_debug_back_on
with MR_TRACE_CALL_MERCURY, and make the similarity even greater
by adding the code for disabling/enabling deep profiling to
MR_TRACE_CALL_MERCURY (without which the deep profiler data structures
would have been screwed up by the declarative debugger).
Add a const qualifier to an argument.
trace/mercury_trace_cmd_browsing.c:
Fix the first bug: update the code of the "print" and "browse" mdb
commands to implement their documented capabilities with respect to
printing I/O actions.
Add a new capability: "print io" (or "print action") will now print
a bunch of I/O actions, starting with the first available one, and on
successive invocations will print successive bunches. This is an easy
way to print all I/O actions (without being overwhelmed by a huge
printout if there are too many).
Add a new capability: "print io limits" will now print the numbers of
the first and last I/O actions.
doc/user_guide.texi:
Document the new capabilities.
trace/mercury_trace_declarative.c:
Fix the second bug: disable debugging and then restore the old state
around calls to Mercury code from the declarative debugger.
My guess is that the bug was introduced when we gave declarative
debugging its own trace function; the one it used to share with
the procedural debugger still does the same disable/restore pair.
trace/mercury_trace_internal.c:
Delete the code now moved to mercury_trace_base.c.
trace/mercury_trace_util.[ch]:
Add a utility function for use by the new code in
mercury_trace_cmd_browsing.c, and increase robustness by more
precise representation of unsigned values.
trace/mercury_trace_cmd_dd.c:
Cosmetic fixes.
tests/debugger/declarative/tabled_read_decl.m:
Update this test case to our current coding standards. There are no
changes in the code.
tests/debugger/declarative/tabled_read_decl.{inp,out}:
Test the bug fixes by printing out a bunch of I/O actions.
tests/debugger/declarative/builtin_call_rep.exp:
Update this expected output file to conform for my recent change to
procedure representations.
tests/debugger/declarative/io_read_bug.{m,inp,exp}:
A new test case that exposes the second bug above. The .inp file
exposes the bug; the .exp file is a dummy.
tests/debugger/declarative/Mmakefile:
Add the new test case, but don't enable it yet.
tests/debugger/print_io_actions.{m,inp,exp,data}:
A new test case to test the new "print io" variant of the print
command.
tests/debugger/Mmakefile:
tests/debugger/Mercury.options:
Enable the new test case.
tests/EXPECT_FAIL_TESTS.asm_fast.gc.decldebug:
Expect the big_array_from_list test to fail in decldebug grades,
since we in that grade we can never get tail recursion, even in the
standard library.
|
||
|
|
2dc982cfe4 |
Make a representation of the program available to the deep profiler.
Estimated hours taken: 50 Branches: main Make a representation of the program available to the deep profiler. We do this by letting the user request, via the option "--deep-procrep-file" in MERCURY_OPTIONS, that when the Deep.data file is written, a Deep.procrep file should be written alongside it. The intended use of this information is the discovery of profitable parallelism. When a conjunction contains two expensive calls, e.g. p(...) and q(...) connected by some shared variables, the potential gain from executing them in parallel is limited by how early p produces those variables and how late q consumes them, and knowing this requires access to the code of p and q. Since the debugger and the deep profiler both need access to program representations, put the relevant data structures and the operations on them in mdbcomp. The data structures are significantly expanded, since the deep profiler deals with the whole program, while the debugger was interested only in one procedure at a time. The layout structures have to change as well. In a previous change, I changed proc layout structures to make room for the procedure representation even in non-debugging grades, but this isn't enough, since the procedure representation refers to the module's string table. This diff therefore makes some parts of the module layout structure, including of course the string table, also available in non-debugging grades. configure.in: Check whether the installed compiler can process switches on foreign enums correctly, since this diff depends on that. runtime/mercury_stack_layout.[ch]: runtime/mercury_types.h: Add a new structure, MR_ModuleCommonLayout, that holds the part of the module layout that is common to deep profiling and debugging. runtime/mercury_deep_profiling.[ch]: The old "deep profiling token" enum type was error prone, since at each point in the data file, only a subset was applicable. This diff breaks up the this enum into several enums, each consisting of the choice applicable at a given point. This also allows some of the resulting enums to be used in procrep files. Rename some enums and functions to avoid ambiguities, and in one case to conform to our naming scheme. Make write_out_proc_statics take a second argument. This is a FILE * that (if not NULL) asks write_out_proc_statics to write the representation of the current module to specified stream. These module representations go into the middle part of the program representation file. Add functions to write out the prologue and epilogue of this file. Write out procedure representations if this is requested. Factor out some code that is now used in more than one place. runtime/mercury_deep_profiling_hand.h: Conform to the changes to mercury_deep_profiling.h. runtime/mercury_builtin_types.c: Pass the extra argument in the argument lists of invocations of write_out_proc_statics. runtime/mercury_trace_base.[ch]: Conform to the name change from proc_rep to proc_defn_rep in mdbcomp. runtime/mercury_grade.h: Due to the change to layout structures, increment the binary compatibility version numbers for both debug and deep profiling grades. runtime/mercury_wrapper.[ch]: Provide two new MERCURY_OPTION options. The first --deep-procrep-file, allows the user to ask for the program representation to be generated. The second, --deep-random-write, allows tools/bootcheck to request that only a fraction of all program invocations should generate any deep profiling output. The first option will be documented once it is tested much more fully. The second option is deliberately not documented. Update the type of the variable that holds the address of the (mkinit-generated) write_out_proc_statics function to accept the second argument. util/mkinit.c: Pass the extra argument in the argument list of write_out_proc_statics. mdbcomp/program_representation.m: Extend the existing data structures for representing a procedure body to represent a procedure (complete with name), a module and a program. The name is implemented as string_proc_label, a form of proc_label that can be written out to files. This replaces the old proc_id type the deep profiler. Extend the representation of switches to record the identity of the variable being switched on, and the cons_ids of the arms. Without the former, we cannot be sure when a variable is first used, and the latter is needed for meaningful prettyprinting of procedure bodies. Add code for reading in files of bytecodes, and for making sense of the bytecodes themselves. (It is this code that uses foreign enums.) mdbcomp/prim_data.m: Note the relationship of proc_label with string_proc_label. mdbcomp/rtti_access.m: Add the access operations needed to find module string tables with the new organization of layout structures. Provide operations on bytecodes and string tables generally. trace/mercury_trace_cmd_browsing.c: Conform to the change to mdbcomp/program_representation.m. compiler/layout.m: Add support for a MR_ModuleCommonLayout. Rename some function symbols to avoid ambiguities. compiler/layout_out.m: Handle the new structure. compiler/stack_layout.m: Generate the new structure and the procedure representation bytecode in deep profiling grades. compiler/llds_out.m: Generate the code required to write out the prologue and epilogue of program representation files. Pass the extra argument in the argument lists of invocations of write_out_proc_statics that tells those invocations to write out the module representations between the prologue and the epilogue. compiler/prog_rep.m: When generating bytecodes, include the new information for switches. compiler/continuation_info.m: Replace a bool with a more expressive type. compiler/proc_rep.m: Conform to the change to continuation_info.m. compiler/opt_debug.m: Conform to the change to layout.m. deep_profiler/mdprof_procrep.m: A new test program to test the reading of program representations. deep_profiler/DEEP_FLAGS.in: deep_profiler/Mmakefile: Copy the contents of the mdbcomp module to this directory on demand, instead of linking to it. This is necessary now that the deep profiler depends directly on mdbcomp even if it is compiled in a non-debugging grade. The arrangements for doing this were copied from the slice directory, which has long done the same. Avoid a duplicate include of Mmake.deep.params. Add the new test program to the list of programs in this directory. Mmakefile: Go through deep_profiler/Mmakefile when deciding whether to do "mmake depend" in the deep_profiler directory. The old actions won't work correctly now that we need to copy some files from mdbcomp before we can run "mmake depend". deep_profiler/profile.m: Remove the code that was moved (in cleaned-up form) to mdbcomp. deep_profiler/dump.m: deep_profiler/profile.m: Conform to the changes above. browser/declarative_execution.m: browser/declarative_tree.m: Conform to the changes in mdbcomp. doc/user_guide.texi: Add commented out documentation of the two new options. slice/Mmakefile: Fix formatting, and a bug. library/exception.m: library/par_builtin.m: library/thread.m: library/thread.semaphore.m: Update all the handwritten modules to pass the extra argument now required by write_out_proc_statics. tests/debugger/declarative/dependency.exp: Conform to the change from proc_rep to proc_defn_rep. tools/bootcheck: Write out deep profiling data only from every 25th invocation, since otherwise the time for a bootcheck takes six times as long in deep profiling grades than in asm_fast.gc. However, do test the ability to write out program representations. Use the mkinit from the workspace, not the installed one. Don't disable line wrapping. |
||
|
|
e33ca246a5 |
Move the code for reading procedure representations from the browser directory
Estimated hours taken: 0.2 Branches: main Move the code for reading procedure representations from the browser directory (in declarative_execution.m) to the mdbcomp directory (the file program_representation.m) in order to make it accessible for the deep profiler, since future changes by Paul Bone will require this. browser/declarative_execution.m: mdbcomp/program_representation.m: Make the move. Turn a semidet function into a predicate. Update some old constructs. mdbcomp/program_representation.m: mdbcomp/slice_and_dice.m: Change the prefix on the functions exported to C to MR_MDBCOMP from the previous mixture of MR_MDB and ML. trace/*.c: Conform to the new prefixes on exported C functions. |
||
|
|
7fa0dff1b5 |
Add more documentation for the Erlang backend.
Estimated hours taken: 6
Branches: main
Add more documentation for the Erlang backend.
Make it possible to configure and install the Erlang backend without too
much manual tweaking.
NEWS:
Mention the Erlang backend.
README.Erlang:
Add installation and other notes for Erlang.
doc/reference_manual.texi:
doc/user_guide.texi:
Add documentation for Erlang.
aclocal.m4:
configure.in:
Check that the bootstrap compiler knows about the
builtin_compound_{eq,lt} builtins, and understands
--erlang-native-code.
Make configure check for Erlang tools.
Add configure --enable-erlang-grade option. Erlang support
is disabled by default.
scripts/Mercury.config.in:
Add `--erlang-compiler <erl>' and `--erlang-interpreter <erlc>'
options to be set by configure.
analysis/ANALYSIS_FLAGS.in:
compiler/COMP_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
Add `--erlang-include-directory <dir>/Mercury/hrls' options so that
the compiler can find Erlang header files from other subdirectories.
compiler/Mercury.options:
library/Mercury.options:
Work around bugs in the HiPE compiler when compiling two modules.
Delete the workaround that was necessary while bootstrapping
builtin_compound_{eq,lt}.
compiler/options.m:
Add notes that two options to check that the compiler is recent enough
won't be recognised because they begin "no-" prefixes, and we have
to use "--no-no-" instead.
compiler/options_file.m:
Support ERLANG_FLAGS, EXTRA_ERLANG_FLAGS variables in options files to
be the same as passing --erlang-flags.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
trace/Mmakefile:
Make the build system do the same things in the Erlang grade as for
the IL and Java grades.
scripts/final_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Make these scripts know about the erlang grade so that parts of the
build system won't abort on seeing it.
|
||
|
|
77a9eca744 |
Ignore lines that start with `#' in sourced mdb scripts.
Estimated hours taken: 1 Branches: main Ignore lines that start with `#' in sourced mdb scripts. This is useful for documenting mdb scripts. Create a local copy of the mdbrc file so that we can test new mdb scripts in the test suite. NEWS: Mention the changes. configure.in: Create a copy of mdbrc.in in the tests directory and create an mdbrc from this file using different substitutions than those used for the mdbrc that will be installed. This is necessary so that we can use the local mdbrc file when running the tests. Previously if the mdbrc file was changed (for example a new alias was added), then we had to install it before testing. doc/user_guide.texi: Document the new behaviour of the source command. scripts/mdb_grep: scripts/mdb_open: scripts/mdb_track: Add comments to these mdb scripts. scripts/mdbrc.in: Use a different substitution variable for the location of mdb_doc, since for the test version of mdbrc mdb_doc will be in a different location to the other scripts. tests/Mmake.common: Get mdb to use the local mdbrc when invoked for the tests. Clean mdbrc and mdbrc.in. tests/debugger/Mercury.options: tests/debugger/Mmakefile: tests/debugger/scripts.exp: tests/debugger/scripts.inp: tests/debugger/scripts.m: Add a test case for the three existing mdb scripts. trace/mercury_trace_readline.c: trace/mercury_trace_readline.h: Rename MR_trace_readline_expand_args to MR_trace_readline_from_script and get it to ignore comment lines. trace/mercury_trace_internal.c: Adapt to changes in mercury_trace_readline.h. |
||
|
|
f51d94e054 |
Provide support for list syntax and quoted function symbols in the terms
Estimated hours taken: 6
Branches: main
Provide support for list syntax and quoted function symbols in the terms
that appear in breakpoint conditions.
runtime/mercury_trace_term.[ch]:
Provide the new capability when creating terms from strings.
Since with nonempty lists, the function symbol of the created term
("[|]") does not appear in the original string, do not try to reuse
the memory of the string for the memory of the function symbols;
instead, make a copy of each function symbol as needed. This also
makes the code simpler by avoiding the need to mangle the original
string to null-terminate these function symbols.
Add a mechanism for reporting the location and nature of syntax errors.
Don't assume that the initial string has no spaces.
trace/mercury_trace_spy.[ch]:
Don't record the strings from which the terms in breakpoint conditions
came from, since function symbols' memory no longer comes from there,
and thus we don't have to free them when the breakpoint is deleted.
trace/mercury_trace_cmd_breakpoint.c:
Use the new mechanism for reporting the details of syntax errors in
terms.
Include spaces in the string from which terms are constructed
at the points at which the user included spaces, since the absence
of such spaces in any reports of syntax errors would be surprising.
Delete the temporary memory for strings containing terms as soon
as they have been used to construct their terms.
trace/mercury_trace_internal.c:
Document a problem.
trace/Mmakefile:
Rebuild this directory automatically if a few more headers in the
runtime change.
doc/user_guide.texi:
Document the new capability.
tests/debugger/queens.{inp,exp,exp2}:
Test the new capability.
|