mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 22:35:41 +00:00
5fdad10a934fe85ea461dd41d62056a15c88bc2e
699 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5fdad10a93 |
Demangling hangs under cygwin, so disable it under
Estimated hours taken: 0.25 Branches: main, release Demangling hangs under cygwin, so disable it under cygwin. configure.in: scripts/parse_ml_options.sh-subr.in: Disable demangling under cygwin. |
||
|
|
d7b684da05 |
Put each components of the options list on its own line, to make it
Estimated hours taken: 0.1 Branches: main scripts/mgnuc.in: Put each components of the options list on its own line, to make it possible to add new ones without reformatting the list. |
||
|
|
e26a9c7978 |
Fix another two typos that prevented mdbrc from being installed.
Estimated hours taken: 0.1 Branches: main scripts/Mmakefile: Fix another two typos that prevented mdbrc from being installed. |
||
|
|
ce4489278f |
Fix a typo that prevented mdbrc from being installed.
Estimated hours taken: 0.1 Branches: main scripts/Mmakefile: Fix a typo that prevented mdbrc from being installed. |
||
|
|
d124cad510 |
Reduce the amount of clutter on mgnuc command lines by moving arguments that
Estimated hours taken: 4 Branches: main Reduce the amount of clutter on mgnuc command lines by moving arguments that are always the same for a given directory into a file that is always consulted by mgnuc in the current directory. scripts/mgnuc.in: Always include as C compiler arguments the contents of a file named .mgnuc_copts in the current directory, if it exists. (It is named .mgnuc_copts instead of .mgnuc_opts because it may not contain general mgnuc options, such as --no-mercury-stdlib-dir.) Mmake.workspace: Comment out the additions of search paths to CFLAGS. */Mmakefile: Delete the additions of search paths to CFLAGS. */.mgnuc_copts: New files containing the directory-specific search paths, and in some cases the required macro definitions. These replace what was taken out of Mmake.workspace and */Mmakefile. In some cases, the old search paths included inappropriate directories; the .mgnuc_copt files don't. tests/.mgnuc_copts.ws: New files containing the directory-specific search paths; bootcheck makes tests/.mgnuc_copts from it. */.nocopyright: Don't require copyright notices in .mgnuc_copts files. tools/bootcheck: Copy the various .mgnuc_copts files from the stage1 to stages 2 and 3. They aren't needed in stage3 right now, but that may change. Create tests/.mgnuc_copts. browser/util.m: Delete an unused and inappropriate #include. scripts/Mmake.rules: Use a single invocation of mkdir -p to create all subdirectories needed by Java. Update a piece of documentation. scripts/Mmakefile: Reorganize the process of invoking config.status to avoid invoking it on inappropriate files, and to ensure the right permissions on the files it is invoked on. scripts/prepare_tmp_dir_grade_part: Copy the .mgnuc_copts files when populating tmp_dir. |
||
|
|
8359771713 |
Make only .debug imply .tr, not .decldebug.
Estimated hours taken: 1 Branches: main compiler/handle_options.m: scripts/final_grade_options.sh-subr: Make only .debug imply .tr, not .decldebug. Declarative debugging requires retries, which work in trailing grades only if the entity that does the trailing is prepared for them. configure.in: Make the decldebug grade installed when enabled be the one without .tr. |
||
|
|
5ebb612c9c |
Provide a mechanism that allows the user to specify that a certain
Estimated hours taken: 2 Branches: main util/mkinit.c: Provide a mechanism that allows the user to specify that a certain function should always be executed on Mercury startup. This is intended to be used to initialize global variables that point to Mercury data. This is useful e.g. in constraint solvers, because it removes the need for the solver to check, on every access to its state, whether it has been initialized yet. scripts/parse_ml_options-sh-subr.in: scripts/c2init.in: Pass along the required option to mkinit. scripts/Mmakefile: Provide a mechanism to automatically rebuild c2init and other configured files when ../config.status changes. |
||
|
|
d56de30e9d |
Remove most of the junk from the command lines executed by make when building
Estimated hours taken: 12 Branches: main Remove most of the junk from the command lines executed by make when building the compiler and by bootcheck when building test cases. We do this by moving the junk into files consulted via the --flags option. After this change, it is actually possible to see in a glance not just which files are being compiled but also with which options. The size of the output (measured in bytes) from a bootcheck is now only about 40% of what is was before. configure.in: Remember the path to the bootstrap compiler and the flags it should be invoked with separately. Put the flags into the FLAGS files in various directories. Test whether the default install directory actually exists, so that the -L and -R linker options referring to this directory are passed to the C compiler only if it does. Mmake.common.in: Comment out a bunch of additions of MCFLAGS, the ones whose contents are now in FLAGS files. Conform to the changes in configure.in. Add a template rule for the dependencies of the FLAGS files. Mmake.workspace: Comment out a bunch of additions of MCFLAGS, the ones whose contents are now in FLAGS files. In some cases, add references to the FLAGS files. Mmakefile: When rebuilding Mmake.common, rebuild only Mmake.common, not all files created by configure. analysis/ANALYSIS_FLAGS.in: browser/MDB_FLAGS.in: compiler/COMP_FLAGS.in: deep_profiler/PROF_FLAGS.in: library/LIB_FLAGS.in: mdbcomp/MDBCOMP_FLAGS.in: profiler/DEEP_FLAGS.in: slice/SLICE_FLAGS.in: tests/TESTS_FLAGS.in: Add these files, which each contain the junk flags (the flags which are the same on every invocation and mostly just clutter up compiler command lines) that are needed on each compiler invocation in the relevant directory. Besides the results of configuration (word size etc), and the paths to other parts of the system, these files mostly control which warnings are enabled. Restrict the list of directories in -I options to what is sensible; for example, don't specify -I../analysis in the deep_profiler directory. */.nocopyright: Don't require copyright notices in FLAGS files, since that would make them invalid. library/INTER_FLAGS: Add this file, which contains the flags enabled with intermodule optimization. tests/WS_FLAGS.ws: Add this file. Unlike the .in files, which processed by config.status based on the results of autoconfiguration, this one is processed to specify the location of the workspace being tested. analysis/Mmakefile: browser/Mmakefile: compiler/Mmakefile: deep_profiler/Mmakefile: library/Mmakefile: mdbcomp/Mmakefile: profiler/Mmakefile: tests/Mmakefile: Include the relevant directory's FLAGS file on the command line, to replace all the additions to MCFLAGS in ../Mmake.common and in ../Mmake.workspace, and in some cases, the directory-specific Mmakefile itself. Build the directory's FLAGS file before executing the depend target, since most compiler options beyond --generate-dependencies come from there. Delete the FLAGS files generated by config.status when doing "make clean". tests/Mmakefile: Allow the environment to define DIFF_OPTS. runtime/Mmakefile: Use an option to tell config.status what to rebuild, not some environment variables. tests/invalid/Mercury.options: For two test cases, reset an option that is set in tests/WS_FLAGS, to match the options the affected tests were compiled with before. tests/invalid/*.err2: Update these expected files to account for the use of error_util in error messages by previous changes to the compiler. These expected output files are used only with --use-subdirs. tests/warnings/Mmakefile: For all test cases, reset an option that is set in tests/WS_FLAGS, to match the options the tests were compiled with before. scripts/prepare_tmp_dir_grade_part Copy the flags files when creating the subdirectories of tmp_dir. scripts/mgnuc.in: Provide a mechanism, a per-directory .mgnuc_opts file, for specifying the options that are required for every C file in a directory. The intention is to use this for -I../library etc, but this is not done yet; one thing at a time. tools/bootcheck: Copy the FLAGS files when creating stage2 and stage3. Don't specify the compiler options that are now in FLAGS files. Fill in the location of the workspace in tests/WS_FLAGS before running the tests. Provide a mechanism (a file ~/.bootcheck_diff_opts) to allow the user to specify what options to invoke diff with. Move the setting of MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE after we have built stage1, and always copy the profilers if --use-subdirs is set. The old ways of doing things caused problems if bootcheck was given --use-subdirs but stage1 doesn't use subdirs: the bootcheck modified the stage1 slice, profiler and deep_profiler directories. |
||
|
|
55e0983a79 |
Add this new script (Mercury trace count, by analogy with mdb),
Estimated hours taken: 0.5 Branches: main scripts/mtc: Add this new script (Mercury trace count, by analogy with mdb), which simply invokes the command represented by the rest of the command line after setting up MERCURY_OPTIONS to ask for the trace counts to be generated. scripts/Mmakefile: Add the new script to the list of scripts. scripts/mdb.in: Fix a grammar error. |
||
|
|
86ac840326 |
Implement a mechanism to generate the information required to determine the
Estimated hours taken: weeks Branches: main Implement a mechanism to generate the information required to determine the algorithmic complexity of selected procedures. The basis of the mechanism is a program transformation that wraps up the body of each selected procedure in code that detects top-level (non-recursive) calls, and for each top-level call, records the sizes of the input arguments and information about the cost of the call. For now, the cost information consists only of the number of cells and words allocated during the call, but there is provision for later adding information from a real-time clock. compiler/complexity.m: A new module containing the new transformation. compiler/transform_hlds.m: Add complexity.m to the list of submodules. compiler/mercury_compile.m: Invoke the new module. compiler/notes/compiler_design.html: Mention the new module. compiler/options.m: Add an option, --experimental-complexity. Its argument is a filename that specifies the list of procedures to transform. Add an option, --no-allow-inlining, to disallow all inlining. This is simpler to use than specifying several options to turn off each potential reason to inline procedures. doc/user_guide.texi: Document the new options. The documentation present now is only a shell; it will be expanded later. compiler/table_gen.m: compiler/goal_util.m: Move the predicate for creating renamings from table_gen.m to goal_util.m, since complexity.m also needs it now. In the process, make it more general by allowing outputs to have more complex modes than simply `out'. compiler/goal_util.m: Fix a bug exposed by the new transformation: when renaming goals (e.g. for quantification), rename the variables holding information about term sizes. compiler/handle_options.m: Disable inlining if experimental complexity analysis is enabled. compiler/compile_target_code.m: Pass the --experimental-complexity option on to the linker. library/term_size_prof_builtin.m: Add the Mercury predicates that serve as interfaces to the primitives needed by the experimental complexity transformation. runtime/mercury_term_size.[ch]: Add the implementations of the primitives needed by the experimental complexity transformation. runtime/mercury_wrapper.[ch]: Add global variables holding counters of the numbers of words and cells allocated so far. runtime/mercury_heap.h: Update these global variables when allocating memory. runtime/mercury_complexity.h: New file that contains the definition of the data structures holding the data collected by the experimental complexity transformation. This is separate from mercury_term_size.h, because it needs to be #included in mercury_init.h, the header file of the mkinit-generated <program>_init.c files. runtime/mercury_init.h: runtime/mercury_imp.h: #include mercury_complexity.h. util/mkinit.c: Define and initialize the data structures holding complexity information when given the -X option (mkinit doesn't have long options). Fix some deviations from our coding style. scripts/parse_ml_options.sh-subr.in: Accept the --experiment-complexity option. scripts/c2init.in: Pass the --experiment-complexity option on to mkinit.c. tools/bootcheck: Preserve the files containing the results of complexity analysis, if they exist. tools/makebatch: Allow the specification of EXTRA_MLFLAGS in the generated Mmake.stage.params files. |
||
|
|
2613f3edcc |
Fix the canonicalization of term size profiling grades.
Estimated hours taken: 0.5 Branches: main, release runtime/mercury_grade.h: scripts/canonical_grade.sh-subr: Fix the canonicalization of term size profiling grades. The compiler and the canonical_grade script disagreed on what the canonicalized form of debugging grades with term size profiling enabled were. |
||
|
|
524b112dea |
Update this file.
Estimated hours taken: 0.1 Branches: main scripts/.cvsignore: Update this file. |
||
|
|
6b0fb566ce |
Move the mdbcomp library to its own directory.
Estimated hours taken: 12 Branches: main Move the mdbcomp library to its own directory. To make this change less painful to test, improve the way we handle installs. browser/mdbcomp.m: browser/mer_mdbcomp.m: browser/prim_data.m: browser/program_representation.m: browser/trace_counts.m: Move these files to the mdbcomp directory. browser/Mmakefile: browser/Mercury.options: mdbcomp/Mmakefile: mdbcomp/Mercury.options: Split the contents of the old Mmakefile and Mercury.options file in the browser directory between these files as appropriate. Simplify away the stuff not needed now that there is only one library per directory. Make the browser directory see the relevant files from the mdbcomp directory. Mmake.common.in: Separate out the prefixes allowed in the browser and the mdbcomp directories. Mmake.workspace: Set up a make variable to refer to the mdbcomp directory. Adjust references to the mdbcomp library to point to its new location. Mmakefile: Make invocations visit the mdbcomp library as necessary. Improve the way we install grades. Making temporary backups of the directories modified by the install process is unsatisfactory for two reasons. First, if the install fails, the cleanup script, which is necessary for user friendliness, destroys any evidence of the cause. Second, the restore of the backup wasn't perfect, e.g. it left the .d files modified to depend on .mih files, which don't exist in LLDS grades, and also left altered timestamps. This diff changes the install process to make a single tmp_dir subdirectory of the workspace, with all the work of install_grade being done inside tmp_dir. The original directories aren't touched at all. */Mmakefile: Adjust references to the browser directory to refer to the mdbcomp directory instead or as well. scripts/Mmake.rules: */Mmakefile: Make it easier to debug Mmakefiles. Previously, creating a Mmake.makefile with mmake -s and invoking "make -d" ignored the most fundamental rules of mmake, because Mmake.rules was treating an unset MMAKE_USE_MMC_MAKE as if it were set to "yes", simply because it was different from "no". This diff changes it to treat an unset MMAKE_USE_MMC_MAKE as if it were set to "no", which is a more sensible default. scripts/prepare_tmp_dir_fixed_part.in: scripts/scripts/prepare_tmp_dir_grade_part: Two new scripts that each do half the work of preparing tmp_dir for the real work of the install_grade make target. The fixed_part script prepares the parts of tmp_dir that are grade-independent, while the grade_part scripts prepares the parts that are grade-dependent. configure.in: Test C files in the mdbcomp directory to see whether they need to be recompiled after reconfiguration. Create prepare_tmp_dir_fixed_part from prepare_tmp_dir_fixed_part.in. compiler/*.m: runtime/mercury_wrapper.c: Update the references to the moved files. compiler/notes/overall_design.html: Mention the new directory. |
||
|
|
ae0e875333 |
Fix bug in stylesheet for converting Mercury terms to a XUL tree where
Estimated hours taken: 0.5 Branches: main Fix bug in stylesheet for converting Mercury terms to a XUL tree where term paths with field names weren't displayed correctly when in a list. scripts/xul_tree.xsl Pass fieldtermpath argument when applying template to elements in a list. |
||
|
|
992c8ef353 |
Fix the misspelling that has been screwing up aral's install process:
Estimated hours taken: 0.5 Branches: main scripts/canonical_grade.sh-subr: Fix the misspelling that has been screwing up aral's install process: use_minimal_model_own_stack instead of use_minimal_model_own_stacks. tools/test_mercury: Refer to the mmsc grade by its full name. |
||
|
|
86a83a3462 |
Fix linking error for hlc.par.gc grade on Darwin.
Estimated hours taken: 3 Branches: main Fix linking error for hlc.par.gc grade on Darwin. The problem was that the "-undefined suppress" option is not allowed with two level namespaces. The solution is to use "-undefined dynamic_lookup" instead. However this means the MACOSX_DEPLOYMENT_TARGET environment variable must be set to 10.3 since this feature will not work on Mac OS < 10.3. To allow hlc.gc.par to be built on Mac 10.3, but targetted for Mac OS 10.0 - 10.2 add a configuration option to force the use of flat namespaces (the "-undefined suppress" option may be used with flat namespaces). configure.in Add --enable-darwin-flat-namespace option. This is the default for Mac OS < 10.3. For Mac OS 10.3 two level namespaces are used unless this option is given. Set a variable to cause the MACOSX_DEPLOYMENT_TARGET environment variable to be set if two level namespaces are being used. scripts/mmake.in scripts/ml.in scripts/mmc.in Set the MACOSX_DEPLOYMENT_TARGET environment variable wherever the linker may be called. |
||
|
|
c5c53432fb |
Allow terms to be saved as XML in mdb and allow an XML browser to be invoked on
Estimated hours taken: 5 Branches: main Allow terms to be saved as XML in mdb and allow an XML browser to be invoked on browsable objects in mdb. The user can set two options which control where the XML is dumped and the command used to browse the XML. The defaults assume xsltproc and mozilla are installed. configure.in Check for mozilla/firefox and xsltproc so default the mdb XML browser command can be set if they are found. browser/browse.m Add a predicate to save a browser term as XML to a file. doc/user_guide.texi Document new --xml option for the mdb `browse' command. Document new --xml option for the mdb `save_to_file' command. Document the `set xml_tmp_filename' and `set xml_browser_cmd' commands. scripts/Mmakefile Copy extras/xml_stylesheets/xul_tree.xsl to the mdb install directory so it can be used by the default XML browser command. scripts/mdbrc.in Set default values for xml_browser_cmd and xml_tmp_filename. scripts/xul_tree.xsl Copy this stylesheet here so there isn't a dependency on the extras directory. tests/debugger/browser_test.inp tests/debugger/browser_test.exp Test --xml option for `browse' command. trace/mercury_trace_browse.c trace/mercury_trace_browse.h Add functions to save a term as XML to a file and then invoke the user's XML browser. trace/mercury_trace_internal.c Add --xml option to `browse' and `save_to_file' mdb commands and handle this option. |
||
|
|
ea43cd038d |
Changes to get shared libraries to work on Mac OS X (Darwin).
Estimated hours taken: 20
Branches: main
Changes to get shared libraries to work on Mac OS X (Darwin).
This is phase 2 of 2. Phase 1 added the compiler options described below.
Phase 2 uses these compiler options in the configuration scripts.
Darwin shared libraries have the extension `dylib' instead of `so'. Also
objects that link to a shared library on Darwin don't need to be told the
runtime path in which they should look for the libraries, instead the
shared libraries themselves remember where they will be eventually installed
(called the install-name) and any object which links in the shared library will
get the install-name from the shared library at link time. When a shared
library is built it has to be told where it will be installed which is what
the libtool -install_name option is used for on Darwin.
This diff only enables shared libraries on Darwin, not "bundles" which are
shared objects that can be loaded dynamically at runtime using something like
dlopen. Therefore the interactive query tool in the debugger still doesn't
work on Mac OS X.
Added three new compiler options :
--shlib-linker-use-install-name :
A boolean flag to tell the compiler to use the -install_name option
when building shared libraries. When this flag is set the following
options have no effect: --linker-rpath-flag, --linker-rpath-separator,
--shlib-linker-rpath-flag, --shlib-linker-rpath-separator.
--shlib-linker-install-name-flag :
The flag name to use ("-install_name" for Darwin).
--shlib-linker-install-name-path :
The path where the shared library will eventually end up, excluding the
file name. The file name is appended to the end before the option
is passed on to the linker.
Mmake.common.in
Added variables used for install-name on/off switch and flag name.
NEWS
Mentioned shared libs working now on Mac OS X.
README.MacOS
Removed bit about shared libs not working in Mac OS X.
configure.in
Make shared libs the default when on Darwin and the compiler is gcc.
boehm_gc/Makefile
boehm_gc/Makefile.direct
Added rule to make libgc.dylib and set the install-name correctly.
boehm_gc/Mmakefile
Set variable used in boehm_gc/Makefile to get the final install path
of the gc shared lib.
browser/Mercury.options
Added mer_mdbcomp library for target libmer_browser.dylib.
browser/Mmakefile
Added --shlib-linker-install-name-path option to MC options.
doc/user_guide.texi
Documented the --shlib-linker-install-name-path option. The other
options will be automatically set by the configure script and
should never need to be set by the user, so they're not documented in
the user guide.
runtime/Mmakefile
Added rule to make the Darwin shared library.
scripts/Mercury.config.bootstrap.in
Added default values for --shlib-linker-use-install-name and
--shlib-linker-install-name-flag.
scripts/Mercury.config.in
Added default values for --shlib-linker-use-install-name and
--shlib-linker-install-name-flag.
trace/Mmakefile
Added rule to make the Darwin shared library.
|
||
|
|
807809e333 |
Add the option `--file' to mmake. This allows the user
Estimated hours taken: 1 Branches: main Add the option `--file' to mmake. This allows the user to specify the name of the file that mmake uses as the Mmakefile. This can be useful when porting programs between systems and experimenting with different configurations, particularly when the programs are not under the control of autoconf. The option `--file' may be abbreviated to `-f'. If a file is specified via `--file' then it will be used in preference to any file in the current directory named Mmakefile or Mmake. Unlike GNU make using multiple instances of `--file' will not cause mmake to jointly use all of the specified files. Instead it will use the last one specified and ignore the others. scripts/mmake.in: Add the `--file' option to mmake. |
||
|
|
e854a5f9d9 |
Major improvements to tabling, of two types.
Estimated hours taken: 32
Branches: main
Major improvements to tabling, of two types. The first is the implementation
of the loopcheck and memo forms of tabling for model_non procedures, and the
second is a start on the implementation of a new method of implementing
minimal model tabling, one that has the potential for a proper fix of the
problem that we currently merely detect with the pneg stack (the detection
is followed by a runtime abort). Since this new method relies on giving each
own generator its own stack, the grade component denoting it is "mmos"
(minimal model own stack). The true name of the existing method is changed
from "mm" to "mmsc" (minimal model stack copy). The grade component "mm"
is now a shorthand for "mmsc"; when the new method works, "mm" will be changed
to be a shorthand for "mmos".
configure.in:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
compiler/options.m:
Handle the new way of handling minimal model grades.
scripts/mgnuc.in:
compiler/compile_target_code.m:
Conform to the changes in minimal model grade options.
compiler/table_gen.m:
Implement the transformations required by the loopcheck and memo
tabling of model_non procedures, and the minimal model own stack
transformation.
The new implementation transformations use foreign_procs with extra
args, since there is no point in implementing them both that way and
with separate calls to library predicates. This required making the
choice of which method to use at the top level of each transformation.
Fix an oversight that hasn't caused problems yet but may in the future:
mark goals wrapping the original goals as not impure for determinism
computations.
compiler/handle_options.m:
Handle the new arrangement of the options for minimal model tabling.
Detect simultaneous calls for both forms of minimal model tabling,
and generate an error message. Allow for more than one error message
generated at once; report them all once rather than separately.
compiler/globals.m:
Add a mechanism to allow a fix a problem detected by the changes
to handle_options: the fact that we currently may generate a usage
message more than once for invocations with more than one error.
compiler/mercury_compile.m:
compiler/make.program_target.m:
compiler/make.util.m:
Use the new mechanism in handle_options to avoid generating duplicate
usage messages.
compiler/error_util.m:
Add a utility predicate for use by handle_options.
compiler/hlds_pred.m:
Allow memo tabling for model_non predicates, and handle own stack
tabling.
compiler/hlds_out.m:
Print information about the modes of the arguments of foreign_procs,
since this is useful in debugging transformations such as tabling
that generate them.
compiler/prog_data.m:
compiler/layout_out.m:
compiler/prog_out.m:
runtime/mercury_stack_layout.h:
Mention the new evaluation method.
compiler/goal_util.m:
Change the predicates for creating calls and foreign_procs to allow
more than one goal feature to be attached to the new goal. table_gen.m
now uses this capability.
compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
compiler/polymorphism.m:
compiler/simplify.m:
compiler/size_prof.m:
compiler/typecheck.m:
compiler/unify_proc.m:
Conform to the changes in goal_util.
compiler/code_info.m:
compiler/make_hlds.m:
compiler/modules.m:
compiler/prog_io_pragma.m:
Conform to the new the options controlling minimal model
tabling.
compiler/prog_util.m:
Add a utility predicate for use by table_gen.m.
library/std_util.m:
Conform to the changes in the macros for minimal model tabling grades.
library/table_builtin.m:
Add the types and predicates required by the new transformations.
Delete an obsolete comment.
runtime/mercury_grade.h:
Handle the new minimal model grade component.
runtime/mercury_conf_param.h:
List macros controlling minimal model grades.
runtime/mercury_tabling.[ch]:
Define the types needed by the new transformations,
Implement the performance-critical predicates that need to be
hand-written for memo tabling of model_non predicates.
Add utility predicates for debugging.
runtime/mercury_tabling_preds.h:
Add the implementations of the predicates required by the new
transformations.
runtime/mercury_mm_own_stacks.[ch]:
This new module contains the first draft of the implementation
of the own stack implementation of minimal model tabling.
runtime/mercury_imp.h:
Include the new file if the grade needs it.
runtime/Mmakefile:
Mention the new files, and sort the lists of filenames.
runtime/mercury_tabling_macros.h:
Add a macro for allocating answer blocks without requiring them to be
pointed to directly by trie nodes.
runtime/mercury_minimal_model.[ch]:
The structure type holding answer lists is now in mercury_tabling.h,
since it is now also needed by memo tabling of model_non predicates.
It no longer has a field for an answer num, because while it is ok
to require a separate grade for debugging minimal model tabling,
it is not ok to require a separate grade for debugging memo tabling
of model_non predicates. Instead of printing the answer numbers,
print the answers themselves when we need to identify solutions
for debugging.
Change function names, macro names, error messages etc where this is
useful to distinguish the two kinds of minimal model tabling.
Fix some oversights wrt transient registers.
runtime/mercury_context.[ch]:
runtime/mercury_engine.[ch]:
runtime/mercury_memory.[ch]:
runtime/mercury_wrapper.[ch]:
With own stack tabling, each subgoal has its own context, so record
the identity of the subgoal owning a context in the context itself.
The main computation's context is the exception: it has no owner.
Record not just the main context, but also the contexts of subgoals
in the engine.
Add variables for holding the sizes of the det and nondet stacks
of the contexts of subgoals (which should in general be smaller
than the sizes of the corresponding stacks of the main context),
and initialize them as needed.
Initialize the variables holding the sizes of the gen, cut and pneg
stacks, even in grades where the stacks are not used, for safety.
Fix some out-of-date documentation, and conform to our coding
guidelines.
runtime/mercury_memory_zones.[ch]:
Add a function to test whether a pointer is in a zone, to help
debugging.
runtime/mercury_debug.[ch]:
Add some functions to help debugging in the presence of multiple
contexts, and factor out some common code to help with this.
Delete the obsolete, unused function MR_printdetslot_as_label.
runtime/mercury_context.h:
runtime/mercury_bootstrap.h:
Move a bootstrapping #define from mercury_context.h to
mercury_bootstrap.h.
runtime/mercury_context.h:
runtime/mercury_bootstrap.h:
Move a bootstrapping #define from mercury_context.h to
mercury_bootstrap.h.
runtime/mercury_types.h:
Add some more forward declarations of type names.
runtime/mercury_dlist.[ch]:
Rename a field to avoid assignments that dereference NULL.
runtime/mercury_debug.c:
runtime/mercury_memory.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_stack_trace.c:
runtime/mercury_stacks.[ch]:
trace/mercury_trace_util.c
Update uses of the macros that control minimal model tabling.
runtime/mercury_stack_trace.c:
Provide a mechanism to allow stack traces to be suppressed entirely.
The intention is that by using this mechanism, by the testing system
won't have to provide separate .exp files for hlc grades, nondebug
LLDS grades and debug LLDS grades, as we do currently. The mechanism
is the environment variable MERCURY_SUPPRESS_STACK_TRACE.
tools/bootcheck:
tools/test_mercury:
Specify MERCURY_SUPPRESS_STACK_TRACE.
trace/mercury_trace.c:
When performing retries across tabled calls, handle memo tabled
model_non predicates, for which the call table tip variable holds
a record with a back pointer to a trie node, instead of the trie node
itself.
trace/mercury_trace_internal.c:
When printing tables, handle memo tabled model_non predicates. Delete
the code now moved to runtime/mercury_tabling.c.
Add functions for printing the data structures for own stack minimal
model tabling.
tests/debugger/print_table.{m,inp,exp}:
Update this test case to also test the printing of tables for
memo tabled model_non predicates.
tests/debugger/retry.{m,inp,exp}:
Update this test case to also test retries across memo tabled
model_non predicates.
tests/tabling/loopcheck_nondet.{m,exp}:
tests/tabling/loopcheck_nondet_non_loop.{m,exp}:
New test cases to test loopcheck tabled model_non predicates.
One test case has a loop to detect, one doesn't.
tests/tabling/memo_non.{m,exp}:
tests/tabling/tc_memo.{m,exp}:
tests/tabling/tc_memo2.{m,exp}:
New test cases to test memo tabled model_non predicates.
One test case has a loop to detect, one has a need for minimal model
tabling to detect, and the third doesn't have either.
tests/tabling/Mmakefile:
Add the new test cases, and reenable the existing tc_loop test case.
Rename some make variables and targets to make them better reflect
their meaning.
tests/tabling/test_mercury:
Conform to the change in the name of the make target.
|
||
|
|
8190c16181 |
Get Mercury to work with gcc 3.4. This required fixing several problems.
Estimated hours taken: 16 Branches: main Get Mercury to work with gcc 3.4. This required fixing several problems. One problem that caused errors is that gcc 3.4 is smart enough to figure out that in LLDS grades with gcc gotos, the C functions containing our code are not referred to, and so it optimizes them away. The fix is to ensure that mercury_<module>_init is defined always to call those functions, even if the macro that usually controls this, MR_MAY_NEED_INITIALIZATION, is not defined. The mercury_<module>_init won't be called from the init_modules function in the program's _init.c file, so there is no impact on initialization time, but gcc doesn't know this when compiling a module's .c file, so it doesn't optimize away the code we need. The cost of this change is thus only a small amount of code space. It is worth paying this cost even with compilers other than gcc 3.4 for simplicity. Actually, this size increase seems to be slightly smaller than the size reduction due to the better optimization capabilities of gcc 3.4 compared to gcc 3.2.2. A second problem is that gcc 3.4 warns about casts in lvalues being a deprecated feature. This gave lots of warnings, since we used to define several Mercury abstract machine registers, including MR_succip, MR_hp, MR_sp, MR_maxfr and MR_curfr using lvalue casts. The fix is to have two macros for each of these abstract machine registers, one of type MR_Word that you can assign to (e.g. MR_sp_word), and one of the original type that is of the right type but not an lvalue (e.g. MR_sp). The lvalue itself can't be made the right type, because MR_sp isn't a variable in its own right, but possibly defined to be a machine register. The machine register could made the right type, but only at the cost of a lot of complexity. This problem doesn't apply to the special-purpose Mercury abstract machine registers that can't be allocated to machine registers. Instead of #defining these to slots in MR_fake_reg, we make them global variables of the natural type. This should also make it easier to debug code using these registers. We treat these global variables as if they were machine registers in that MR_save_registers copies values from these global variables to slots reserved for them in the MR_fake_reg array, to allow code to loop over all Mercury abstract machine registers. These saved slots must of course be of type MR_Word, so we again need two macros to refer to them, a lvalue of type MR_Word and an rvalue with the right type. A third problem is that gcc 3.4 warns about conditionals in lvalues being a deprecated feature. This gave a few warnings, since we used to define MR_virtual_reg and MR_saved_reg using lvalues using conditionals. The fix is to have one macro (MR_virtual_reg_value) for use in rvalues and a separate macro which uses an if-then-else instead of a conditional expression (MR_virtual_reg_assign), for assignments. A fourth problem is that gcc 3.4 warns about comma operators in lvalues being a deprecated feature. This gave warnings in the few places where we refer to MR_r(N) for values of N that can map to fake registers directly, since in those cases we preceded the reference to the fake_reg array with a range check of the array index. The fix to this is to move the test to compile time for compiler-generated code. Hand-written code never refers to MR_r(N) for these values, and is very unlikely to do so in the future; instead, it refers to the underlying fake_reg array directly, since that way it doesn't have to worry about which fake registers have their own MR_rN macro and which don't. Therefore no check mechanism for hand-written code is necessary. This change mean that changing the number of MR_rN registers now requires change to the compiler as well as to the runtime system. A fifth problem is that gcc 3.4 by default assumes -fstrict-aliasing at -O2. Since we cast between integers and pointers of different types all the time, and changing that is not practical, at least in the short term, we need to disable -fstrict-aliasing when we enable -O2. NEWS: Note that Mercury now works with gcc 3.4. configure.in: scripts/mgnuc.in: Detect whether the compiler supports -fstrict-aliasing, and if so, whether it assumes it by default with -O2. If the answer is yes to both, make mgnuc specify -fno-strict-aliasing when it specifies -O2. By including it in CFLAGS_FOR_OPT, which gets put into Mercury.config, we also get -f-no-strict-aliasing when mmc invokes the C compiler directly. compiler/llds_out.m: Don't generate #ifdef MR_MAY_NEED_INITIALIZATION around the definitions and calls to the bunch functions, which call the functions we don't want the C compiler to optimize away. Generate the newly required lvalues on the left sides of assignments. We still have code to generate LVALUE_CASTs in some cases, but I don't think those cases ever arise. Add a compile-time check of register numbers. Ideally, the code generator should use stack slots instead of registers beyond the max number, but I don't recall us ever bumping into this limit by accident. compiler/fact_table.m: Use the newly required lvalues on the left sides of assignments in some hand-written C code included in generated .c files. runtime/mercury_regs.h: Make the changes described above to fix the second, third and fourth problems. We still use comma operators in lvalues when counting references to registers, but it is OK to require anyone who wants to enable this feature to use a compiler version that supports comma operators in lvalues or to ignore the warnings. Use the same mapping from Mercury abstract machine registers to the register count array as to the MR_fake_reg array. Have this mapping depend as little as possible on whether we need a real machine register to store MR_engine base, even if it costs a wasted slot in MR_fake_reg. Fix an old inconsistency: treat the Mercury abstract machine registers used for trailing the same way as the other Mercury abstract machine registers, by making MR_save_registers/MR_restore_registers copy them to and from their global variable homes. Document the requirement for the match between the runtime's and the compiler's notions of the maximum MR_rN register number. This requirement makes it harder for users to increase the number of virtual registers, but as far as I know noone has wanted to do this. Change the names of some of the macros to make them clearer. Reorder some parts of this file, and add some documentation, also in the interest of clarity. runtime/mercury_regorder.h: Delete this file after moving its contents, in much modified form, to mercury_regs.h. mercury_regorder.h was always logically part of mercury_regs.h, but was separated out to make it easier to change the mapping from Mercury abstract machine registers to machine registers. However, the cost of incompatibility caused by any such changes would be much greater that any likely performance benefit. runtime/Mmakefile: Remove the reference to mercury_regorder.h. runtime/mercury_regs.[ch]: runtime/mercury_memory_zones.[ch]: Move some functionality dealing with registers from mercury_memory_zones to mercury_regs, since it belongs there. runtime/mercury_regs.[ch]: Add a function to make it easiler to debug changes to map from Mercury abstract machine to MR_fake_reg slots. runtime/mercury_regs.[ch]: runtime/mercury_wrapper.c: Move the code to print counts of register uses from mercury_wrapper.c to mercury_regs.c. Make mercury_wrapper.c call the debugging function in mercury_regs.c if -X is specified in MERCURY_OPTIONS. runtime/mercury_bootstrap.h: Move the old MR_saved_reg and MR_virtual_reg macros from mercury_regs.h to mercury_bootstrap.h to prevent their accidental use. Since they shouldn't be used by user code, move them to the section that is not enabled by default. runtime/mercury_stacks.[ch]: Add _word versions of the macros for stack slots, for the same reason why we need them for Mercury abstract machine registers, and use them. Add global variables for the Mercury abstract machine registers for the gen, cut and pneg stacks. runtime/mercury_heap.h: Change the macros for allocating memory to assign to MR_hp_word instead of MR_hp. runtime/mercury_string.h: Change the macros for allocating strings to accomodate the updates to mercury_heap.h. Also change the expected type of the target to make it MR_String instead of MR_ConstString, since the latter requires casts in the caller. runtime/mercury_trail.h: runtime/mercury_types.h: Move the definition of the type MR_TrailEntry from mercury_trail.h to mercury_types.h, since it is now used in mercury_regs.h. runtime/mercury_accurate_gc.c: runtime/mercury_agc_debug.c: runtime/mercury_calls.h: runtime/mercury_context.[ch]: runtime/mercury_deconstruct_macros.h: runtime/mercury_deep_copy_body.h: runtime/mercury_engine.[ch]: runtime/mercury_hand_compare_body.h: runtime/mercury_hand_unify_body.h: runtime/mercury_ho_call.c: runtime/mercury_layout_util.c: runtime/mercury_make_type_info_body.h: runtime/mercury_minimal_model.c: runtime/mercury_ml_deconstruct_body.h: runtime/mercury_ml_functor_body.h: runtime/mercury_stack_layout.h: runtime/mercury_type_desc.c: runtime/mercury_type_info.c: runtime/mercury_unify_compare_body.h: runtime/mercury_wrapper.c: Conform to the changes in the rest of the runtime. In some cases, fix inconsistencies in indentation. runtime/mercury_stack_trace.c: Add some conditionally compiled debugging code controlled by the macro MR_ADDR_DEBUG, to help debug some problems with stored stack pointers. runtime/mercury_grade.h: Increment the binary compatibility version number. This is needed to avoid potential problems when a Mercury module and the debugger are compiled with different versions of the macros in mercury_regs.h. library/exception.m: Update the code that assigns to abstract machine registers. library/array.m: library/construct.m: library/dir.m: library/io.m: library/string.m: Conform to the new definitions of allocation macros. library/time.m: Delete an unnecessary #include. trace/mercury_trace.c: trace/mercury_trace_declarative.c: trace/mercury_trace_util.c: Conform to the changes in the rest of the runtime. tests/hard_coded/qual_test_is_imported.m: tests/hard_coded/aditi_private_builtin.m: Remove an unnecessary import to avoid a warning. tools/makebatch: Add an option --save-stage2-on-error, that saves the stage2 directory if a bootcheck fails. scripts/ml.in: Make ml more robust in the face of garbage files. |
||
|
|
71d3a6ce52 |
Fix a bug where we used windows paths which contain colons in the colon
seperated VPATH variable.
configure.in:
Check for cygpath -u.
scripts/Mmake.vars.in:
Use cygpath -u or echo to convert each of the directories in the
VPATH into unix format.
|
||
|
|
cdf0383b52 |
Fix a bunch of problems with tabling that I identified in Uppsala.
Estimated hours taken: 32
Branches: main
Fix a bunch of problems with tabling that I identified in Uppsala. These fall
into two categories.
First, the tabling transformations we were using were dividing work up
too finely. This had three bad effects. First, it caused too much time to be
spent on transmitting data to and from library predicates. Second, it made the
transformations hard to document and hard to explain in a paper. Third, it
caused us to misidentify just what the various forms of tabling have in common,
and what forms of tabling work for what determinisms. To fix this problem,
this diff reorients table_builtin.m and table_gen.m from being divided
primarily by determinism to being divided by evaluation method.
Second, we weren't being careful in separating out the parts of the tabling
data structures that are needed only for debugging the tabling system itself.
The fix for this is to introduce a new grade flag, MR_MINIMAL_MODEL_DEBUG,
intended for use by implementors only, to govern whether the tabling data
structures include debug-only components. (If this flag weren't a grade flag,
the sizes of data structures created in files with different values of this
flag could be inconsistent, which is something you don't want when debugging
the complex code of the tabling infrastructure.)
compiler/table_gen.m:
Reorganize the simple (loopcheck and memo) tabling transformations
completely. Instead of separate transformations for model_det and
model_semi predicates, have separate transformations for loopcheck
and memo predicates, since this makes it easier to see (and to ensure)
that the transformation follows the required scheme. Instead of
generating nested if-then-elses, generate switches when possible.
For model_semi loopcheck and memo predicates, generate Mercury code
that obeys our scope rules by not binding output variables in the
condition of the one remaining if-then-else.
Finetune the minimal model tabling transformation by combining some
operations where this improves clarity and performance.
Order the transformation predicates logically, and move the
documentation of each form of tabling next to the code implementing
that form of tabling.
Attach call_table_gen markers to the setup goals that now all
loopcheck, memo and minimal model tabled predicates have,
to avoid having to special case the last lookup goal, and to avoid
having to have separate code for lookups in call tables versus answer
tables.
Generate unique and more meaningful variable names. Change some
predicate names to be more meaningful, both here and in the
transformed code.
Factor out some common code, e.g. for generating lookup goals,
for generating instmap_deltas and for attaching hide_debug_event
markers to goals.
Report errors in cases where the arguments of a tabled predicate
aren't completely input or output.
compiler/hlds_pred.m:
Be more strict about the determinisms of tabled predicates; permit
only the determinisms we really support in all cases, and do not
permit the ones that may happen to work in some cases.
Conform to the change of the name of a builtin.
compiler/det_report.m:
Improve the error message for cases when the determinism is
incompatible with the selected tabling mechanism.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
Handle the new grade component.
library/private_builtin.m:
Provide a semipure analog of the imp predicate, a call to which makes
predicates semipure rather than impure, for use in table_builtin.m.
library/table_builtin.m:
runtime/mercury_tabling_preds.h:
Change the tabling primitives in the ways required by the changes to
the tabling transformations.
Group the primitives by the tabling methods they support, and change
their names to reflect this.
Change the implementation of each of the affected predicates to be
nothing more than the invocation of a macro defined in the new header
file runtime/mercury_tabling_preds.h. The objective of this change
is to make it possible for table_gen.m to replace sequences of calls
to predicates in table_builtin.m with a single extended foreign_proc
goal whose body just invokes the corresponding macros in sequence.
That change should improve performance by allowing the variables
that flow from one tabling primitive to another to stay in x86
registers, instead of being copied to and from Mercury abstract
machines registers, which on the x86 aren't real machine registers.
Benchmarking in Uppsala verified that this is a major cost.
Mark the foreign types used for tabling as can_pass_as_mercury_type;
this was the intended use of that assertion. Make them private to the
module, since the rest of the compiler can now handle this.
Delete the implementations of the predicates for duplicate checking
and for returning answers for completed subgoals. Profiling with gprof
has shown their performance to be critical to the performance of
minimal model tabling overall, and even with our recent changes,
the compiler still can't create optimal C code for them. They are
now implemented with handwritten code in mercury_minimal_model.c.
library/term.m:
Add two utility predicates for use by table_gen.m.
library/Mmakefile:
Since much of the implementation of table_builtin.m is now in
runtime/mercury_tabling_preds.h, make its object files depend
on that header file.
runtime/mercury_conf_params.h:
runtime/mercury_grade.h:
Include MR_MINIMAL_MODEL_DEBUG when computing the grade.
runtime/mercury_minimal_model.[ch]:
Add handwritten code to implement the predicates declared as external
in table_builtin.m.
Conform to the new names of the suspension and completion predicates.
Conform to the presence of debugging fields in tabling data structures
only if MR_MINIMAL_MODEL_DEBUG is defined.
Collect a lot more statistics than before.
Reorder some functions.
Instead of saving the whole generator stack each time, which the new
statistics showed to have O(n^2) behavior on some benchmarks, save only
the segment we need to save.
runtime/mercury_tabling.h:
Conform to the fact that loopcheck and memo predicates now have
separate sets of status values, and import mercury_tabling_preds.h.
runtime/mercury_tabling.c:
runtime/mercury_hash_lookup_or_add_body.h:
Move a huge macro out of mercury_tabling.c to the new file
mercury_hash_lookup_or_add_body.h for ease of editing, and modify it to
gather more statistics.
Make the statistics report easier to read.
runtime/Mmakefile:
Mention mercury_tabling_preds.h and mercury_hash_lookup_or_add_body.h.
runtime/mercury_wrapper.h:
Provide a mechanism (--tabling-statistics in MERCURY_OPTIONS)
that causes the runtime to print tabling statistics at the ends of
executions, for use in benchmarking.
doc/user_guide.texi:
Document --tabling-statistics. (Minimal model tabling is not yet
stable enough to be documented, which is why .dmm isn't documented
either.)
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/mgnuc.in:
Implement the new grade component.
trace/mercury_trace.c:
trace/mercury_trace_internal.c:
Conform to changes in the runtime.
tests/debugger/*.m:
Avoid now invalid combinations of determinism and evaluation method.
tests/debugger/*.exp:
Conform to new goal paths in procedures transformed by tabling.
tests/tabling/*.m:
For tests which had predicate whose determinisms isn't compatible
with the evaluation method, change the determinism if possible,
and the evaluation method otherwise, if either is possible.
Bring these tests up to date with our coding guidelines, since they
may now appear in papers.
tests/tabling/Mmakefile:
Disable the tests whose combination of determinism and evaluation
method is no longer supported, and in which neither one can be changed.
tests/tabling/loopcheck_no_loop.{m,exp}:
Make this test case tougher.
tests/tabling/test_tabling:
Make this script more robust in the face of different kinds of
test case failures.
tests/invalid/loopcheck.{m,err_exp}:
tests/invalid/Mmakefile:
Test that we get the expected error message for an invalid combination
of determinism and evaluation method. The new test invalid/loopcheck.m
is the old test tabling/loopcheck.m.
tests/valid/Mmakefile:
Use a more general pattern to test for minimal model grades,
now that we also use .dmm as a grade component.
|
||
|
|
e0c212359f |
Fix problems in white space in the commit of the fix of the deep profiler.
Estimated hours taken: 0.2 Branches: main Fix problems in white space in the commit of the fix of the deep profiler. These were caused by the fact that the workspace in which the original commit took place was created by applying a patch to a fresh workspace, and the patch was created with diff -b. |
||
|
|
c80d143cc8 |
The following change is only 98% complete, not 100%.
Estimated hours taken: 120
Branches: main
The following change is only 98% complete, not 100%. I am committing it in
this state because (1) we pass many more test cases in deep profiling grade
with it than without it, and (2) the double maintanance involved in fixing
CVS conflicts is preventing me from doing the last 2%.
Get the deep profiler to work for code that sets up to catch exceptions,
which for the last year or more has included the compiler, and to get it
almost working for code that actually catching exceptions.
The basic problem is that code that throws exceptions will in general cause
several calls to "return" without executing the exit or fail port codes that
the deep profiling transformation inserted into their bodies, and this leaves
the data structure being built by the deep profiling inconsistent. The solution
uses the same approach as we have adopted for the debugger: have the code that
handles the throwing of exceptions simulate a return from each call between
the throw and the catch, updating the deep profiling data structures as needed.
This requires us to be able to walk the stack at runtime not just in debugging
grades but also in deep profiling grades. Since the debugger already has the
mechanisms required for this, we reuse them. The procedure layouts used by the
debugger were designed to have three segments: the procedure stack walk
information, the procedure id, and the execution tracing information. We now
modify this design to make the third segment contain two pointers: to the
execution tracing information (for use by the debugger), and to the procedure's
proc_static structure (for use by deep profiling). Each pointer will be null
unless the pointed-to structure is required by compile-time options.
This common use by the debugger and by deep profiling of the stack-walk
structure and the procedure id structure (which deep profiling used to
generate independently and possibly redundantly) required some rearrangement
of the compiler's version of these data structures.
To make this rearrangement simpler, this diff removes a capability that
we theoretically supported but never used: turning on stack traces without
turning on execution tracing and vice versa. After this diff, stack tracing
is enabled if and only if either execution tracing or deep profiling is
enabled.
The diff also includes improvements in the debugging infrastructure for
debugging deep profiling, which were necessary for the implementation of the
rest of the changes.
compiler/deep_profiling.m:
The code in exception.m needs to know the locations of the variables
that we would pass to the exit or fail port code, so it can simulate
leaving the procedure invocation through the exception port. Without
this information, throwing an exception leaves the deep profiling
data structures of the procedure invocations between throw and catch
in an inconsistent state.
Deep_profiling.m creates these variables, but it doesn't know where
they will be at runtime, so it records their identities; the code
generator will allocate them stack slots and record the numbers of
these stack slots for placement in the now expanded proc layout
structures. Deep profiling used to generate static data structures
separately from the HLDS, but since the code generator now needs
access to them, we store their information in proc_infos in the HLDS.
Instead of passing the addresses of proc_static structures to the deep
profiling port procedures, pass the address of proc_layout structures,
since the information about the identities of procedures are now stored
not in the proc_static structure, but in the proc_layout structure
that points to the proc_static structure.
compiler/hlds_pred.m:
compiler/layout.m:
Move the definitions of the static data structures generated by deep
profiling from layout.m to hlds_pred.m, to allow deep_profiling.m
to store them in proc_infos.
compiler/hlds_pred.m:
compiler/rtti.m:
Move the definition of rtti_proc_label from rtti.m to hlds_pred.m,
since some of the new data structures in hlds_pred.m need it. Despite
its name, the rtti_proc_label type doesn't contain any info that
doesn't belong in the HLDS.
Add some information to the rtti_proc_label type that is now needed
by deep profiling, e.g. record determinisms instead of just code
models. Record explicitly the outcome of some tests that used to be
duplicated in more than one place in the compiler, e.g. for whether
the procedure (as opposed to the predicate) is imported. Change some
of the field names to be more precise about the field's meaning.
compiler/code_gen.m:
Transmit the contents of the deep profiling data structures stored in
the proc_info by deep_profiling.m to continuation_info.m, together
with the layout structures created for execution tracing and the
identities of the variables needed for handling exceptions,
when code generation for a procedure is complete.
After the goal that generates these variables, save them to stack
for use by the exception handler.
compiler/hlds_goal.m:
Add a feature to mark the goal that generates the deep profiling
variables needed by the exception handler.
compiler/hlds_llds.m:
Add a utility predicate for new code in code_gen.m
compiler/continuation_info.m:
Hold the deep profiling information computed by code_gen.m for use by
stack_layout.m.
compiler/layout.m:
compiler/layout_out.m:
Update the definitions of the data structures describing procedure
layouts, and the code writing them out, to reflect the use of some
parts of procedure layouts by deep profiling as well as debugging.
Change the layout structures generated by deep profiling to use
rtti_proc_labels, which are backend independent, instead of
proc_labels, which are specific to the LLDS backend.
Conform to the changes in runtime/mercury_stack_layout.h.
compiler/stack_layout.m:
Generate the updated version of proc_layout structures.
compiler/mercury_compile.m:
compiler/global_data.m:
Conform to the fact that deep profiling no longer generates layout
structures separate from proc_infos.
compiler/llds_out.m:
Register proc_layout structures instead of proc_static structures
for use by runtime/mercury_deep_profiling.c.
compiler/options.m:
compiler/handle_options.m:
Rename the require_tracing option as exec_trace, since this more
directly reflects its meaning.
Instead of having --debug set both require_tracing and stack_trace,
make it set (be the user-visible name of) just exec_trace;
the value of stack_trace is implied.
Turn off the specialization of deep profiling for self-tail-recursive
procedures for now. Due to the changes made by this diff in the data
structures involved in debugging, it cannot be debugged until this
change has been installed. Handling the full language is more important
than a specialization that reduces only stack space overheads, not
runtime overheads.
compiler/compile_target_code.m:
Conform to the changes in options.m and runtime/mercury_grade.h.
compiler/hlds_data.m:
Replace the deep_profiling_proc_static cons_id, and its associated tag,
to deep_profiling_proc_layout, since we now generate addresses of proc
layout structures, not of proc_static structures.
compiler/code_util.m:
Simplify some code based on the new info in rtti_proc_labels.
compiler/bytecode_gen.m:
compiler/dependency_graph.m:
compiler/higher_order.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_util.m:
compiler/ml_unify_gen.m:
compiler/opt_debug.m:
compiler/proc_label.m:
compiler/prog_rep.m:
compiler/rl_exprn.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/switch_util.m:
compiler/unify_gen.m:
Minor changes to conform to the change from deep_profiling_proc_static
to deep_profiling_proc_layout, to the change in the structure of
rtti_proc_labels, to the changes in types of layout.m, and/or to the
new goal feature.
deep_profiler/measurements.m:
Reserve space for exception counts.
deep_profiler/html_format.m:
Add a column for exception counts.
deep_profiler/profile.m:
deep_profiler/read_profile.m:
Rename the data structures referring to compiler generated unify,
compare and index predicates to avoid misleading names: they are
not the only compiler generated predicates.
deep_profiler/read_profile.m:
runtime/mercury_deep_profiling.c:
Update the string that identifies deep profiling data files.
This is necessary because the format has changed: it now includes
information about exception port counts.
library/exception.m:
In deep profiling grades, execute the exception port code for every
procedure invocation between a throw and a catch, using the procedure
layout structures now generated by the compiler for every procedure.
Rename the function involved to reflect its new, more general purpose.
Update the definitions of the hand-written proc_static and proc_layout
structures for the procedures implemented via hand-written C code.
Indent C preprocessor directives and foreign_procs according to our
coding standards.
library/profiling_builtin.m:
Change the parameters of the call port code procedures from proc_static
to proc_layout. Reach the proc_static structure from the proc_layout
structure when needed. Include the proc_layout structure in any
messages from assertion failures.
Add some conditionally compiled debugging code.
Give some variables better names.
runtime/mercury_type_info.h:
runtime/mercury_builtin_types.c:
Move the macros required to create the proc_static structures
of unify and compare predicates from mercury_type_info.h
to mercury_builtin_types.c, since the latter is the only file
that needs them.
Use the same macros for creating the proc_static structures
of hand-written unify, compare and compare_reprentation predicates
as for user defined predicates. This required changing their naming
scheme.
runtime/mercury_unify_compare_body.h:
Conform to the new naming scheme.
runtime/mercury_ho_call.c:
Provide the mechanism for mercury_unify_compare_body.h to conform
to the new naming scheme.
Remove the definitions of the proc_static structures for
hand-written unify, compare and compare_reprentation predicates,
since these now have to be defined together with the corresponding
proc_layout structures in mercury_builtin_types.c.
runtime/mercury_builtin_types.[ch]:
Update the definitions of the hand-written proc_static and proc_layout
structures for the procedures implemented via hand-written C code,
and add the required declarations first.
Handle deep profiling of compare_representation as well as unify
and compare predicates on builtin types.
Handle deep profiling of compare_representation on user-defined types,
since this is done entirely in the runtime, not by compiler generated
predicates.
runtime/mercury_builtin_types_proc_layouts.h:
New header file containing the declarations of the proc layout
structures of the unify, compare and index predicates of builtin types.
Logically, these declarations belong in mercury_builtin_types.h,
but putting them there causes problems for the linker; the details
are explained in the file itself.
runtime/Mmakefile:
Add the new header file.
runtime/mercury_minimal_model.[ch]:
Update the definitions of the hand-written proc_static and proc_layout
structures for the procedures implemented via hand-written C code,
and add the required declarations first.
runtime/mercury_grade.h:
Replace the MR_REQUIRE_TRACING grade option with MR_EXEC_TRACING.
Besides being better named, the MR_EXEC_TRACING option implies
MR_STACK_TRACE.
Besides the overall binary compatibility version number, add subsidiary
version numbers for binary compatibility in deep profiling and
debugging grades. These will make it easier to bootstrap changes
(such as this) that affect binary compatibility only in such grades.
runtime/mercury_trace_base.c:
trace/mercury_trace.c:
Conform to the new names of the configuration parameters.
runtime/mercury_hand_compare_body.h:
runtime/mercury_hand_unify_body.h:
runtime/mercury_hand_unify_compare_body.h:
runtime/mercury_ho_call.c:
tools/make_port_code:
Pass proc_layout structures instead of proc_static structures
to deep profiling port routines.
runtime/mercury_conf_param.h:
Make MR_DEEP_PROFILING as well as MR_EXEC_TRACING imply MR_STACK_TRACE,
since deep profiling now needs stack tracing. (MR_STACK_TRACE needs
to be set in this file, because tests in this file depend on knowing
its value, and this file is among the first files included (in this
case indirectly) in mercury_imp.h.)
Document the macros controlling the debugging of deep profiling.
Enable printing of label names when the relevant deep profiling
debugging macro is set.
runtime/mercury_debug.c:
runtime/mercury_deep_rec_depth_actions.h:
runtime/mercury_deep_rec_depth_body.h:
runtime/mercury_exception_catch_body.h:
Get to proc_statics via proc_layouts.
runtime/mercury_deep_call_port_body.c:
runtime/mercury_deep_leave_port_body.c:
Get to proc_statics via proc_layouts.
Allow the debugger to disable deep profiling in Mercury code that is
part of the debugger, not of the user program being executed.
Add some more assertions.
runtime/mercury_engine.[ch]:
Add a new debugging flag that controls at runtime whether we generate
a human readable Deep.debug equivalent to the binary Deep.data files.
(We already had a mechanism for controlling this at compile time,
but this isn't flexible enough.)
runtime/mercury_wrapper.c:
Allow this new debugging flag to be set from MERCURY_OPTIONS.
runtime/mercury_deep_profiling.[ch]:
Respect this new debugging flag.
Update the hand-written proc_static structures representing the runtime
system.
Print out addresses of proc_layout as well as proc_static structures
when assertions fail.
Add a field to the measurement structure for exception port counts,
and write out this field with the other port counts.
Remove procedure id information from proc_static structures,
deep profiling now uses the procedure id in the proc_layout structure.
Add to proc_static structures fields that specify where, if anywhere,
the variables needed by exception.m to executed the exception port code
are in the procedure's stack frame.
Define a global flag that allows the debugger to disable deep
profiling in Mercury code that is part of the debugger, not of the
user program being executed.
Increase type safety by providing two versions of the function
for registering proc_layouts, one for the proc_layout structures
of user-defined predicates and one for unify, compare and index
predicates.
Fix a bug that occurs only if MR_DEEP_PROFILING_EXPLICIT_CALL_COUNTS is
defined (which it usually isn't): the initial call count was wrong.
runtime/mercury_deep_profiling_hand.h:
Fix a bug: the handwritten code saving deep profiling variables was
saving them in slots that didn't belong to the relevant stack frame.
Update to conform to the modified definitions of proc_static structures
and the fact that we now reach them via proc_layout structures.
runtime/mercury_exception_catch_body.h:
runtime/mercury_stacks.h:
Fix the other side of the bug in mercury_deep_profiling_hand.h
by reserving the right number of stack slots in the stack frames
of the various modes of exception__catch. Make it harder to make
the same bug in the future by getting the needed info from the
place in mercury_stacks.h that defines the structure of the relevant
stack frame.
runtime/mercury_proc_id.h:
Rename the procedure id structure fields referring to compiler
generated unify, compare and index predicates: they are not the only
compiler-generated predicates.
runtime/mercury_stack_layout.h:
Change procedure layout structures to allow them to be used for deep
profiling as well as for debugging, as described in the prologue above.
We don't need the capability to support label layout structures with
links to misnamed proc layout structures, and supporting it is
inconvenient, so delete the capability.
runtime/mercury_debug.c:
runtime/mercury_deep_profiling_hand.h:
runtime/mercury_layout_util.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_stack_trace.c:
runtime/mercury_types.h:
trace/mercury_trace_external.c:
Conform to the new names of the procedure id structure fields.
runtime/mercury_std.h:
Add some more arities for MR_PASTE for use in some of the modified
modules in the runtime.
trace/mercury_trace_internal.c:
Disable deep profiling actions in Mercury code that is part of the
debugger, not of the program being debugged.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Make changes parallel to the ones in runtime/mercury_grade.h: delete
--stack-trace as an independent option, and make --debug set its
own option, not --require-tracing.
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/c2init.in:
scripts/mgnuc.in:
scripts/ml.in:
Conform to the changes in grade options for debugging and for deep
profiling.
tools/bootcheck:
If Mmake.stage.{browser,deep,library,runtime,trace}.params exist,
copy them to become the file Mmake.$dir.params in stage2/$dir
(where dir is derived from the name of the original file in the obvious
way). This allows more flexibility in the creation of the stage2;
for example, it allows some directories (e.g. runtime or library)
to be compiled with more debugging than other directories (e.g.
compiler). This may be required because compiling all directories
with lots of debugging may cause the linker to thrash.
Add an option, --disable-debug-libs, that clobbers the libraries
that should be linked in only in debugging grades.
To conserve disk space, remove Deep.data files created by the bootcheck
by default. Add an option, --keep-deep-data, to preserve these files.
Use a consistent mechanism (test -f) for testing the existence of
all files whose existence is tested.
When recording modification times, record the modification times
of some more files.
tests/hard_coded/Mmakefile:
In deep profiling grades, disable the test cases that we don't now
pass in such grades, and document the reasons for their failure.
Fix the misclassification of the write_binary test case.
|
||
|
|
3c61d96d2f |
Add an option, --print-map, that allows the user to request the linker
Estimated hours taken: 1 Branches: main scripts/parse_ml_options.in: scripts/ml.in: Add an option, --print-map, that allows the user to request the linker to generate information that can be used to diagnose link problems. |
||
|
|
48424918de |
When linking with the MSVCRT we also need to pass /nodefaultlib:libc to
Estimated hours taken: 0.25 Branches: main scripts/ml.in: When linking with the MSVCRT we also need to pass /nodefaultlib:libc to the linker, so that it doesn't also try and link with the standard C library and have duplicate symbol errors. |
||
|
|
dbb9c9063c |
When building using MS Visual C runtime, we also need to pass
Estimated hours taken: 0.5 Branches: main scripts/mgnuc.in: When building using MS Visual C runtime, we also need to pass /MD at compile time (despite it being documented as a linker flag). |
||
|
|
9a9652bd71 |
Allow at configure time to build the compiler so that it uses the MS
Estimated hours taken: 2 Branches: main Allow at configure time to build the compiler so that it uses the MS Visual C runtime by default. This is needed here at MC to build some components which require linking against the MS Visual C runtime versus the standard C runtime. configure.in: Add the option --with-msvcrt so that the scripts/mgnuc.in: If we wish to use the MS Visual C runtime, then we need to define GC_NOT_DLL when we are not in a parallel grade, as otherwise the header files for boehm_gc decide the collector must've been built as a DLL, which isn't true. scripts/ml.in: Pass /MD to the linker so that it links against the MS Visual C runtime, if required. README.MS-VisualC: Document the --with-msvcrt option. |
||
|
|
52ea36dca5 |
When invoking $(JAVAC), pass $(ALL_JAVACFLAGS).
Estimated hours taken: 0.25 Branches: main scripts/Mmake.rules: When invoking $(JAVAC), pass $(ALL_JAVACFLAGS). |
||
|
|
bf70ebd080 |
Simplify use of the Java grade by automatically setting the classpath.
Estimated hours taken: 1.5 Branches: main Simplify use of the Java grade by automatically setting the classpath. scripts/Mercury.config.in: scripts/Mercury.config.bootstrap.in: Set the --java-classpath option in DEFAULT_MC_FLAGS. Define STD_LIB_NAME, RT_LIB_NAME. scripts/c2init.in: Add the above two files to the list of those which use STD_LIB_NAME and RT_LIB_NAME. library/Mmakefile: Use RT_LIB_NAME instead of STD_LIB_NAME.runtime compiler/modules.m: Remove the XXX comment that worries about this issue. README.Java: Remove instructions relating to setting the classpath manually. |
||
|
|
d3cd9ef9e1 |
Bug fix for Mercury.config.bootstrap.in.
Estimated hours taken: 0.2 Branches: main Bug fix for Mercury.config.bootstrap.in. scripts/Mercury.config.bootstrap.in: Moved a comment that was causing problems. |
||
|
|
f08f93af2f |
Make --target il' imply --high-level-data'.
Estimated hours taken: 0.25 Branches: main compiler/handle_options.m: scripts/final_grade_options.sh-subr: Make `--target il' imply `--high-level-data'. This is needed to ensure that the `--il' and `--target il' options select the `il' grade, which uses high-level data, rather than the `ilc' grade, which uses low-level data and which is no longer documented because it is not useful; high-level data is better for both efficiency and interoperability and for IL there are no advantages to low-level data. |
||
|
|
75f3a934e7 |
Have the configure script decide whether to install the Java grade.
Estimated hours taken: 8 Branches: main Have the configure script decide whether to install the Java grade. configure.in: Add Java to the list of library grades to install by default, if the Java SDK is installed. Add the option to disable the Java grade. aclocal.m4: Detect whether the Java SDK is installed. Currently this is done by checking for javac, java and jar, then testing whether a program can be compiled which confirms the version is recent enough. scripts/Mmake.vars.in: Add JAVAC, JAVA_INTERPRETER and JAR to the generated make variables. Add JAR_CREATE_FLAGS make variable, set as "cf" scripts/Mercury.config.in: scripts/Mercury.config.bootstrap.in: Define environmental variables MERCURY_JAVA_COMPILER and MERCURY_JAVA_INTERPRETER. Have the configure script set the default java compiler and interpreter as part of DEFAULT_MC_FLAGS. library/Mmakefile: Use "$(JAR) $(JAR_CREATE_FLAGS)" instead of "jar cf" |
||
|
|
89adfe0d7b |
Clean up the handling of the --java' and --gc' compilation options.
Estimated hours taken: 3
Branches: main
Clean up the handling of the `--java' and `--gc' compilation options.
README.Java:
Document the `--java' and `--target java' options,
and use `--java' rather than `--grade java' in the examples.
compiler/handle_options.m:
Fix a bug where `mmc --java --output-grade-string'
was printing "java.gc" instead of "java". It was calling
set_gc_method to set the gc_method field in the globals structure,
but it was not setting the corresponding string option in the
options table, and compute_grade was looking at the string option.
The fix was to also set the string option.
scripts/parse_grade_options.sh-subr:
Handle the `--java' and `--java-only' options.
scripts/final_grade_options.sh-subr:
For the IL and Java back-ends, set the gc_method to automatic.
For the Java back-end, set highlevel_data to true.
compiler/globals.m:
Fix an XXX: add a new alternative to the gc_method type,
"automatic", to distinguish lack of GC ("none") from the
automatic GC done by Java or the .NET CLR.
compiler/options.m:
doc/user_guide.texi:
Document the new `--gc automatic' alternative for the `--gc' option.
Delete the documentation of the deprecated `--gc conservative'
option (which has been replaced with `--gc boehm').
compiler/compile_target_code.m:
compiler/handle_options.m:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
Handle the new `--gc automatic' option..
|
||
|
|
e8964ef186 |
Add or update .cvsignore files.
Estimated hours taken: 0.2 Branches: main Add or update .cvsignore files. .cvsignore: */.cvsignore: Update/Add .cvsignore files where necessary. |
||
|
|
f8541c230b |
New rules for installing the Mercury standard library in grade Java.
Estimated hours taken: 3 Branches: main New rules for installing the Mercury standard library in grade Java. library/Mmakefile: Added new target 'jars' which creates a jar file for the library classes and a jar file for the runtime classes. Modified target 'install_library' so that it adds these jar files to a new directory in the install path. To use these jar files, the CLASSPATH environment variable must be set to: <library_path>/mer_std.jar:<library_path>/mer_std.runtime.jar:. scripts/Mmake.vars.in: Added variable INSTALL_JAVA_LIBRARY_DIR to define where the above jar files will be installed. |
||
|
|
664ae084e1 |
Apply a review comment from Peter Moulder: use "foo()" rather than
Estimated hours taken: 0.25 Branches: main scripts/mtags: Apply a review comment from Peter Moulder: use "foo()" rather than "&foo", since the latter disables prototype-checking. |
||
|
|
b46512215c |
Change the way that mtags gets invoked so that it passes `-w'
Estimated hours taken: 1
Branches: main
scripts/mtags:
Change the way that mtags gets invoked so that it passes `-w'
to perl, to enable warnings, and fix the resulting warnings:
- use "&foo" instead of the deprecated "do foo" notation for
calling subroutines
- use uppercase for file handle variables, instead of lowercase
(which could overlap with future keywords)
- s/shift(ARGV)/shift(@ARGV)/g
- add underscore prefixes to singleton variables
($_cmd, $_running_under_some_shell).
- use 'exec perl ... ${1+"$@"}' instead of "exec perl $*".
This is necessary for correct handling of command-line arguments
that contain spaces.
|
||
|
|
e7ce0fe989 |
Fix a syntax error: s/break;/last;/
Estimated hours taken: 0.25 Branches: main, release scripts/mtags: Fix a syntax error: s/break;/last;/ |
||
|
|
c52500cb82 |
Fix a bug in Zoltan's previous change to add the mdbcomp library:
Estimated hours taken: 0.25 Branches: main scripts/ml.in: Fix a bug in Zoltan's previous change to add the mdbcomp library: mdbcomp was missing from the list of libraries to link with when when tracing and static linking are both enabled. |
||
|
|
ecdc285bc7 |
Split the existing browser library into two libraries, by making the
Estimated hours taken: 10 Branches: main Split the existing browser library into two libraries, by making the program_representation module into its own library. This is useful because the compiler refers to program_representation.m, whose code thus needs to be linked into compiler executables even if the compiler isn't compiled with debugging enabled. By creating a new library for this module, we avoid any chance of the linker dragging in the rest of the modules in the browser library. (This is a problem with an upcoming diff.). The name of the new library is "mdbcomp", because the intention is that it contain code that is shared between the debugger and the compiler. This means mostly the definitions of data structures that the compiler generates for the debugger, and the predicates that operate on them. Mmake.common.in: Allow MDB_COMP_ as a prefix for symbol names in the browser directory. Mmake.workspace: Add a make variable holding for the name of the new library, and add the name to the relevant lists of libraries. Avoid duplicating the lists of filenames that need to be updated when adding new libraries or changing their names. Mmakefile: Use make variables to refer to library names. browser/mdbcomp.m: browser/mer_mdbcomp.m: Add these files as the top modules of the new library. browser/program_representation.m: Make program_representation.m a submodule of mdbcomp, not mdb. browser/program_representation.m: browser/browser_info.m: Move a predicate from program_representation.m to browser_info.m to avoid the mdbcomp library depend on the browser library, since this would negate the point of the exercise. browser/mdb.m: Delete program_representation.m from the list of submodules. browser/Mmakefile: Update this file to handle the new module. browser/Mercury.options: Mention the new module. browser/*.m: Update the lists of imported modules. Import only one browser module per line. compiler/notes/overall_design.html: Document the new library. compiler/compile_target_code.m: Add the mdbcomp library to the list of libraries we need to link with. compiler/prog_rep.m: trace/mercury_trace_internal.c: Import program_representation.m by its new name. scripts/c2init.in: Centralize knowledge about which files need to be updated when the list of libraries changes here. scripts/c2init.in: scripts/ml.in: tools/binary: tools/binary_step: tools/bootcheck: tools/linear: tools/lml: Update the list of libraries programs are linked with. |
||
|
|
f007b45df8 |
Implement the infrastructure for term size profiling.
Estimated hours taken: 400
Branches: main
Implement the infrastructure for term size profiling. This means adding two
new grade components, tsw and tsc, and implementing them in the LLDS code
generator. In grades including tsw (term size words), each term is augmented
with an extra word giving the number of heap words it contains; in grades
including tsc (term size cells), each term is augmented with an extra word
giving the number of heap cells it contains. The extra word is at the start,
at offset -1, to leave almost all of the machinery for accessing the heap
unchanged.
For now, the only way to access term sizes is with a new mdb command,
"term_size <varspec>". Later, we will use term sizes in conjunction with
deep profiling to do experimental complexity analysis, but that requires
a lot more research. This diff is a necessary first step.
The implementation of term size profiling consists of three main parts:
- a source-to-source transform that computes the size of each heap cell
when it is constructed (and increments it in the rare cases when a free
argument of an existing heap cell is bound),
- a relatively small change to the code generator that reserves the extra
slot in new heap cells, and
- extensions to the facilities for creating cells from C code to record
the extra information we now need.
The diff overhauls polymorphism.m to make the source-to-source transform
possible. This overhaul includes separating type_ctor_infos and type_infos
as strictly as possible from each other, converting type_ctor_infos into
type_infos only as necessary. It also includes separating type_ctor_infos,
type_infos, base_typeclass_infos and typeclass_infos (as well as voids,
for clarity) from plain user-defined type constructors in type categorizations.
This change needs this separation because values of those four types do not
have size slots, but they ought to be treated specially in other situations
as well (e.g. by tabling).
The diff adds a new mdb command, term_size. It also replaces the proc_body
mdb command with new ways of using the existing print and browse commands
("print proc_body" and "browse proc_body") in order to make looking at
procedure bodies more controllable. This was useful in debugging the effect
of term size profiling on some test case outputs. It is not strictly tied
to term size profiling, but turns out to be difficult to disentangle.
compiler/size_prof.m:
A new module implementing the source-to-source transform.
compiler/notes/compiler_design.html:
Mention the new module.
compiler/transform_hlds.m:
Include size_prof as a submodule of transform_hlds.
compiler/mercury_compile.m:
If term size profiling is enabled, invoke its source-to-source
transform.
compiler/hlds_goal.m:
Extend construction unifications with an optional slot for recording
the size of the term if the size is a constant, or the identity of the
variable holding the size, if the size is not constant. This is
needed by the source-to-source transform.
compiler/quantification.m:
Treat the variable reference that may be in this slot as a nonlocal
variable of construction unifications, since the code generator needs
this.
compiler/compile_target_code.m:
Handle the new grade components.
compiler/options.m:
Implement the options that control term size profiling.
doc/user_guide.texi:
Document the options and grade components that control term size
profiling, and the term_size mdb command. The documentation is
commented out for now.
Modify the wording of the 'u' HLDS dump flag to include other details
of unifications (e.g. term size info) rather than just unification
categories.
Document the new alternatives of the print and browse commands. Since
they are for developers only, the documentation is commented out.
compiler/handle_options.m:
Handle the implications of term size profiling grades.
Add a -D flag value to print HLDS components relevant to HLDS
transformations.
compiler/modules.m:
Import the new builtin library module that implements the operations
needed by term size profiling automatically in term size profiling
grades.
Switch the predicate involved to use state var syntax.
compiler/prog_util.m:
Add predicates and functions that return the sym_names of the modules
needed by term size profiling.
compiler/code_info.m:
compiler/unify_gen.m:
compiler/var_locn.m:
Reserve an extra slot in heap cells and fill them in in unifications
marked by size_prof.
compiler/builtin_ops.m:
Add term_size_prof_builtin.term_size_plus as a builtin, with the same
implementation as int.+.
compiler/make_hlds.m:
Disable warnings about clauses for builtins while the change to
builtin_ops is bootstrapped.
compiler/polymorphism.m:
Export predicates that generate goals to create type_infos and
type_ctor_infos to add_to_construct.m. Rewrite their documentation
to make it more detailed.
Make orders of arguments amenable to the use of state variable syntax.
Consolidate knowledge of which type categories have builtin unify and
compare predicates in one place.
Add code to leave the types of type_ctor_infos alone: instead of
changing their types to type_info when used as arguments of other
type_infos, create a new variable of type type_info instead, and
use an unsafe_cast. This would make the HLDS closer to being type
correct, but this new code is currently commented out, for two
reasons. First, common.m is currently not smart enough to figure out
that if X and Y are equal, then similar unsafe_casts of X and Y
are also equal, and this causes the compiler do not detect some
duplicate calls it used to detect. Second, the code generators
are also not smart enough to know that if Z is an unsafe_cast of X,
then X and Z do not need separate stack slots, but can use the same
slot.
compiler/type_util.m:
Add utility predicates for returning the types of type_infos and
type_ctor_infos, for use by new code in polymorphism.m.
Move some utility predicates here from other modules, since they
are now used by more than one module.
Rename the type `builtin_type' as `type_category', to better reflect
what it does. Extend it to put the type_info, type_ctor_info,
typeclass_info, base_typeclass_info and void types into categories
of their own: treating these types as if they were a user-defined
type (which is how they used to be classified) is not always correct.
Rename the functor polymorphic_type to variable_type, since types
such as list(T) are polymorphic, but they fall into the user-defined
category. Rename user_type as user_ctor_type, since list(int) is not
wholly user-defined but falls into this category. Rename pred_type
as higher_order_type, since it also encompasses functions.
Replace code that used to check for a few of the alternatives
of this type with code that does a full switch on the type,
to ensure that they are updated if the type definition ever
changes again.
compiler/pseudo_type_info.m:
Delete a predicate whose updated implementation is now in type_util.m.
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
Still treat type_infos, type_ctor_infos, typeclass_infos and
base_typeclass_infos as user-defined types, but prepare for when
they won't be.
compiler/hlds_pred.m:
Require interface typeinfo liveness when term size profiling is
enabled.
Add term_size_profiling_builtin.increase_size as a
no_type_info_builtin.
compiler/hlds_out.m:
Print the size annotations on unifications if HLDS dump flags call
for unification details. (The flag test is in the caller of the
modified predicate.)
compiler/llds.m:
Extend incr_hp instructions and data_addr_consts with optional fields
that allow the code generator to refer to N words past the start of
a static or dynamic cell. Term size profiling uses this with N=1.
compiler/llds_out.m:
When allocating memory on the heap, use the macro variants that
specify an optional offset, and specify the offset when required.
compiler/bytecode_gen.m:
compiler/dense_switch.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/goal_form.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/inst_match.m:
compiler/intermod.m:
compiler/jumpopt.m:
compiler/lambda.m:
compiler/livemap.m:
compiler/ll_pseudo_type_info.m:
compiler/lookup_switch.m:
compiler/magic_util.m:
compiler/middle_rec.m:
compiler/ml_code_util.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/modecheck_unify.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_conj_gen.m:
compiler/post_typecheck.m:
compiler/reassign.m:
compiler/rl.m:
compiler/rl_key.m:
compiler/special_pred.m:
compiler/stack_layout.m:
compiler/static_term.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unused_args.m:
compiler/use_local_vars.m:
Minor updates to conform to the changes above.
library/term_size_prof_builtin.m:
New module containing helper predicates for term size profiling.
size_prof.m generates call to these predicates.
library/library.m:
Include the new module in the library.
doc/Mmakefile:
Do not include the term_size_prof_builtin module in the library
documentation.
library/array.m:
library/benchmarking.m:
library/construct.m:
library/deconstruct.m:
library/io.m:
library/sparse_bitset.m:
library/store.m:
library/string.m:
Replace all uses of MR_incr_hp with MR_offset_incr_hp, to ensure
that we haven't overlooked any places where offsets may need to be
specified.
Fix formatting of foreign_procs.
Use new macros defined by the runtime system when constructing
terms (which all happen to be lists) in C code. These new macros
specify the types of the cell arguments, allowing the implementation
to figure out the size of the new cell based on the sizes of its
fields.
library/private_builtin.m:
Define some constant type_info structures for use by these macros.
They cannot be defined in the runtime, since they refer to types
defined in the library (list.list and std_util.univ).
util/mkinit.c:
Make the addresses of these type_info structures available to the
runtime.
runtime/mercury_init.h:
Declare these type_info structures, for use in mkinit-generated
*_init.c files.
runtime/mercury_wrapper.[ch]:
Declare and define the variables that hold these addresses, for use
in the new macros for constructing typed lists.
Since term size profiling can refer to a memory cell by a pointer
that is offset by one word, register the extra offsets with the Boehm
collector if is being used.
Document the incompatibility of MR_HIGHTAGS and the Boehm collector.
runtime/mercury_tags.h:
Define new macros for constructing typed lists.
Provide macros for preserving the old interface presented by this file
to the extent possible. Uses of the old MR_list_cons macro will
continue to work in grades without term size profiling. In term
size profiling grades, their use will get a C compiler error.
Fix a bug caused by a missing backslash.
runtime/mercury_heap.h:
Change the basic macros for allocating new heap cells to take
an optional offset argument. If this is nonzero, the macros
increment the returned address by the given number of words.
Term size profiling specifies offset=1, reserving the extra
word at the start (which is ignored by all components of the
system except term size profiling) for holding the size of the term.
Provide macros for preserving the old interface presented by this file
to the extent possible. Since the old MR_create[123] and MR_list_cons
macros did not specify type information, they had to be changed
to take additional arguments. This affects only hand-written C code.
Call new diagnostic macros that can help debug heap allocations.
Document why the macros in this files must expand to expressions
instead of statements, evn though the latter would be preferable
(e.g. by allowing them to declare and use local variables without
depending on gcc extensions).
runtime/mercury_debug.[ch]:
Add diagnostic macros to debug heap allocations, and the functions
behind them if MR_DEBUG_HEAP_ALLOC is defined.
Update the debugging routines for hand-allocated cells to print the
values of the term size slot as well as the other slots in the relevant
grades.
runtime/mercury_string.h:
Provide some needed variants of the macro for copying strings.
runtime/mercury_deconstruct_macros.h:
runtime/mercury_type_info.c:
Supply type information when constructing terms.
runtime/mercury_deep_copy_body.h:
Preserve the term size slot when copying terms.
runtime/mercury_deep_copy_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_ml_expand_body.h:
Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
that allocate cells also allocate space for the term size slot if
necessary.
Reduce code duplication by using a now standard macro for copying
strings.
runtime/mercury_grade.h:
Handle the two new grade components.
runtime/mercury_conf_param.h:
Document the C macros used to control the two new grade components,
as well as MR_DEBUG_HEAP_ALLOC.
Detect incompatibilities between high level code and profiling.
runtime/mercury_term_size.[ch]:
A new module to house a function to find and return term sizes
stored in heap cells.
runtime/mercury_proc_id.h:
runtime/mercury_univ.h:
New header files. mercury_proc_id.h contains the (unchanged)
definition of MR_Proc_Id, while mercury_univ.h contains the
definitions of the macros for manipulating univs that used to be
in mercury_type_info.h, updated to use the new macros for allocating
memory.
In the absence of these header files, the following circularity
would ensue:
mercury_deep_profiling.h includes mercury_stack_layout.h
- needs definition of MR_Proc_Id
mercury_stack_layout.h needs mercury_type_info.h
- needs definition of MR_PseudoTypeInfo
mercury_type_info.h needs mercury_heap.h
- needs heap allocation macros for MR_new_univ_on_hp
mercury_heap.h includes mercury_deep_profiling.h
- needs MR_current_call_site_dynamic for recording allocations
Breaking the circular dependency in two places, not just one, is to
minimize similar problems in the future.
runtime/mercury_stack_layout.h:
Delete the definition of MR_Proc_Id, which is now in mercury_proc_id.h.
runtime/mercury_type_info.h:
Delete the macros for manipulating univs, which are now in
mercury_univ.h.
runtime/Mmakefile:
Mention the new files.
runtime/mercury_imp.h:
runtime/mercury.h:
runtime/mercury_construct.c:
runtime/mercury_deep_profiling.h:
Include the new files at appropriate points.
runtime/mercury.c:
Change the names of the functions that create heap cells for
hand-written code, since the interface to hand-written code has
changed to include type information.
runtime/mercury_tabling.h:
Delete some unused macros.
runtime/mercury_trace_base.c:
runtime/mercury_type_info.c:
Use the new macros supplying type information when constructing lists.
scripts/canonical_grade_options.sh-subr:
Fix an undefined sh variable bug that could cause error messages
to come out without identifying the program they were from.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade components and the options controlling them.
trace/mercury_trace_internal.c:
Implement the mdb command "term_size <varspec>", which is like
"print <varspec>", but prints the size of a term instead of its value.
In non-term-size-profiling grades, it prints an error message.
Replace the "proc_body" command with optional arguments to the "print"
and "browse" commands.
doc/user_guide.tex:
Add documentation of the term_size mdb command. Since the command is
for implementors only, and works only in grades that are not yet ready
for public consumption, the documentation is commented out.
Add documentation of the new arguments of the print and browse mdb
commands. Since they are for implementors only, the documentation
is commented out.
trace/mercury_trace_vars.[ch]:
Add the functions needed to implement the term_size command, and
factor out the code common to the "size" and "print"/"browse" commands.
Decide whether to print the name of a variable before invoking the
supplied print or browse predicate on it based on a flag design for
this purpose, instead of overloading the meaning of the output FILE *
variable. This arrangement is much clearer.
trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
Supply type information when constructing terms.
browser/program_representation.m:
Since the new library module term_size_prof_builtin never generates
any events, mark it as such, so that the declarative debugger doesn't
expect it to generate any.
Do the same for the deep profiling builtin module.
tests/debugger/term_size_words.{m,inp,exp}:
tests/debugger/term_size_cells.{m,inp,exp}:
Two new test cases, each testing one of the new grades.
tests/debugger/Mmakefile:
Enable the two new test cases in their grades.
Disable the tests sensitive to stack frame sizes in term size profiling
grades.
tests/debugger/completion.exp:
Add the new "term_size" mdb command to the list of command completions,
and delete "proc_body".
tests/debugger/declarative/dependency.{inp,exp}:
Use "print proc_body" instead of "proc_body".
tests/hard_coded/nondet_c.m:
tests/hard_coded/pragma_inline.m:
Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
that allocate cells also allocate space for the term size slot if
necessary.
tests/valid/Mmakefile:
Disable the IL tests in term size profiling grades, since the term size
profiling primitives haven't been (and probably won't be) implemented
for the MLDS backends, and handle_options causes a compiler abort
for grades that combine term size profiling and any one of IL, Java
and high level C.
|
||
|
|
7590b41922 |
Fix bugs in the binary distribution.
Estimated hours taken: 0.2 Branches: main Fix bugs in the binary distribution. configure.in: Move the code to work out the arguments to pass when reconfiguring before macro calls which clobber the argument list. scripts/mercury_config.in: Don't abort because tools/lmc.in and tools/dotime.in when configuring the binary distribution. |
||
|
|
404a95cdd7 |
Remove Unix dependencies in the compiler.
Estimated hours taken: 50 Branches: main Remove Unix dependencies in the compiler. Avoid calling passes_aux.invoke_shell_command, which requires the presence of a Unix shell. The implementation of fact tables still has dependencies on Unix utilities (e.g. sort). aclocal.m4: Don't pass Unix style paths to MSVC. configure.in: Use `cygpath -m' rather than `cygpath -w'. `cygpath -m' uses '/' as the directory separator, so it doesn't cause quoting problems in shell scripts. Apply $CYGPATH to $PREFIX, $LIBDIR, $CONFIG_PREFIX and $CONFIG_LIBDIR. Don't pass `-lm' when linking with MSVC. configure.in: compiler/options.m: scripts/Mercury.config.in: Add extra configuration options to deal with differences between linking with gcc and MSVC: --linker-opt-separator --linker-link-lib-flag --linker-link-lib-suffix --shlib-linker-link-lib-flag --shlib-linker-link-lib-suffix --linker-path-flag NEWS: doc/user_guide.texi: compiler/options.m: compiler/compile_target_code.m: compiler/make.program_target.m: Instead of substituting in an arbitrary shell script when processing `--pre-link-command' and `--extra-init-command', require that these options specify a command which will be passed the name of the source file containing the main module as the first argument, with the source files containing the remaining modules following. This is simpler and avoids dependencies on a shell. Fix quote_arg to handle Windows paths better. compiler/handle_options.m: Don't attempt to use symlinks if they're not available. compiler/compile_target_code.m: Be more careful about quoting. Don't call invoke_shell_command where invoke_system_command would do. Allow linking using MSVC. compiler/modules.m: Remove make_directory, which is now implemented by dir.m. Use io.make_symlink rather than shell scripts. Implement mercury_update_interface in Mercury. compiler/llds_out.m: compiler/make.program_target.m: Use dir.make_directory, not modules.make_directory, which has been removed. compiler/make.module_target.m: Invoke mercury_compiler directly, not through the mmc script to avoid shell dependencies. If we can't fork() child `mmc --make' processes, pass the arguments to the child process using a file to avoid overflowing system limits on Windows. compiler/mercury_compile.m: compiler/options_file.m: Read argument files. Handle backslash-newline in options files correctly. compiler/passes_aux.m: invoke_system_command shouldn't set the exit status -- the caller may be able to try something else. compiler/process_util.m: Export can_fork for use by make.module_target.m. Remove hacks to work around bugs in the implementation of zero-arity foreign procs. compiler/prog_io.m: Handle bizarre file names without aborting. library/Mmakefile: library/print_extra_inits: Move code to find extra initialization functions into print_extra_inits, due to the change to the handling of the --extra-init-command option described above. scripts/mmc.in: Set the MERCURY_COMPILER environment variable if it is not already set, so that the mercury_compile executable knows where to find itself. scripts/mercury.bat.in: Make this actually work. tools/bootcheck: Set ANALYSIS_LIB_NAME. Apply cygpath (-m not -w) to $root. Link print_extra_inits into the stage2 and stage3 library directories. util/mkinit.c: Handle '\\' in path names. |
||
|
|
a32f16b9dd |
Fix a bug which caused Mmake to ignore the
Estimated hours taken: 0.1 Branches: main scripts/mmake.in: Fix a bug which caused Mmake to ignore the value of MERCURY_CONFIG_DIR. |
||
|
|
5099371a94 |
Document why this file includes canonical_grade_options.sh-subr
Estimated hours taken: 0.1 Branches: main scripts/c2init.in: Document why this file includes canonical_grade_options.sh-subr without including the other files (init_grade_options.sh-subr, parse_grade_options.sh-subr and final_grade_options.sh-subr) that canonical_grade_options.sh-subr depends on. |
||
|
|
f0192eee15 |
Don't create symlinks when installing with a Win32 version
Estimated hours taken: 1 Branches: main Don't create symlinks when installing with a Win32 version of the compiler. The compiler won't know how to follow the symlinks. configure.in: scripts/Mmake.vars.in: scripts/Mercury.config.in: compiler/modules.m: When using `gcc -mno-cygwin' or MS Visual C++ to build the compiler, don't create symlinks when installing. compiler/options.m: Add an option `--no-use-symlinks'. |
||
|
|
b235326b9f |
s/GRADE/GRADESTRING/ in a path name.
Estimated hours taken: 0.1 Branches: main, release scripts/Mmake.vars.in: s/GRADE/GRADESTRING/ in a path name. |
||
|
|
a5ea3c76e3 |
Always pass ALL_GRADEFLAGS to mmc, even when building the
Estimated hours taken: 0.25 Branches: main compiler/modules.m: Always pass ALL_GRADEFLAGS to mmc, even when building the interface files. This avoids spurious "debugging is available only in low-level C grades" errors when the default grade is hlc.gc. Zoltan did this for scripts/Mmake.rules but not modules.m. scripts/Mmake.rules: Pass ALL_GRADEFLAGS when errorchecking and converting to Mercury. |