mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 14:57:03 +00:00
2ed239c28642fd9e22bf28b09b121cbe487ec2ef
16 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a00596c283 |
The file modules.m contains lots of different kinds of functionality.
Estimated hours taken: 16 Branches: main The file modules.m contains lots of different kinds of functionality. While much of it belongs together, much of it does not. This diff moves most of the functionality that does not belong with the rest to several new modules: libs.file_util parse_tree.deps_map parse_tree.file_names parse_tree.module_cmds parse_tree.module_imports parse_tree.read_module parse_tree.write_deps_file To make them coherent, move some predicates from hlds.passes_aux, parse_tree.prog_io and parse_tree.prog_out to the new modules, making them more accessible, reducing the required access from the hlds package to parse_tree, or from the parse_tree package to libs. In the same spirit, this diff also moves some simple predicates and functions dealing with sym_names from prog_util.m to mdbcomp/prim_data.m. This allows several modules to avoid depending on parse_tree.prog_util. Rename some of the moved predicates and function symbols where this avoids ambiguity. (There were several that differed from other predicates or function symbols only in arity.) Replace several uses of bools with purpose-specific types. This makes some of the code significantly easier to read. This diff moves modules.m from being by far the largest module, to being only the seventh largest, from 8900+ lines to just 4200+. It also reduces the number of modules that import parse_tree.modules considerably; most modules that imported it now import only one or two of the new modules instead. Despite the size of the diff, there should be no algorithmic changes. compiler/modules.m: compiler/passes_aux.m: compiler/prog_io.m: compiler/prog_out.m: Delete the moved functionality. compiler/file_util.m: New module in the libs package. Its predicates search for files and do simple error or progress reporting. compiler/file_names.m: New module in the parse_tree package. It contains predicates for converting module names to file names. compiler/module_cmds.m: New module in the parse_tree package. Its predicates handle the commands for manipulating interface files of various kinds. compiler/module_import.m: New module in the parse_tree package. It contains the module_imports type and its access predicates, and the predicates that compute various sorts of direct dependencies (those caused by imports) between modules. compiler/deps_map.m: New module in the parse_tree package. It contains the data structure for recording indirect dependencies between modules, and the predicates for creating it. compiler/read_module.m: New module in the parse_tree package. Its job is reading in modules, both human-written and machine-written (such as interface and optimization files). compiler/write_deps_file.m: New module in the parse_tree package. Its job is writing out makefile fragments. compiler/libs.m: compiler/parse_tree.m: Include the new modules. compiler/notes/compiler_design.m: Document the new modules. mdbcomp/prim_data.m: compiler/prog_util.m: Move the predicates that operate on nothing but sym_names from prog_util to prim_data. Move get_ancestors from modules to prim_data. compiler/prog_item.m: Move stuff that looks for foreign code in a list of items here from modules.m. compiler/source_file_map.m: Note why this module needs to be in the parse_tree package. compiler/add_pred.m: compiler/add_special_pred.m: compiler/analysis.file.m: compiler/analysis.m: compiler/assertion.m: compiler/check_typeclass.m: compiler/compile_target_code.m: compiler/cse_detection.m: compiler/det_analysis.m: compiler/elds_to_erlang.m: compiler/exception_analysis.m: compiler/export.m: compiler/fact_table.m: compiler/higher_order.m: compiler/hlds_module.m: compiler/hlds_pred.m: compiler/intermod.m: compiler/llds_out.m: compiler/make.dependencies.m: compiler/make.m: compiler/make.module_dep_file.m: compiler/make.module_target.m: compiler/make.program_target.m: compiler/make.util.m: compiler/make_hlds_passes.m: compiler/maybe_mlds_to_gcc.pp: compiler/mercury_compile.m: compiler/mlds.m: compiler/mlds_to_c.m: compiler/mlds_to_gcc.m: compiler/mlds_to_ilasm.m: compiler/mlds_to_java.m: compiler/mmc_analysis.m: compiler/mode_constraints.m: compiler/mode_debug.m: compiler/modes.m: compiler/module_qual.m: compiler/optimize.m: compiler/passes_aux.m: compiler/proc_gen.m: compiler/prog_foreign.m: compiler/prog_io.m: compiler/prog_io_util.m: compiler/prog_mutable.m: compiler/prog_out.m: compiler/pseudo_type_info.m: compiler/purity.m: compiler/recompilation.check.m: compiler/recompilation.usage.m: compiler/simplify.m: compiler/structure_reuse.analysis.m: compiler/structure_reuse.direct.detect_garbage.m: compiler/structure_reuse.direct.m: compiler/structure_sharing.analysis.m: compiler/tabling_analysis.m: compiler/term_constr_main.m: compiler/termination.m: compiler/trailing_analysis.m: compiler/trans_opt.m: compiler/type_util.m: compiler/typecheck.m: compiler/typecheck_info.m: compiler/unify_proc.m: compiler/unused_args.m: compiler/unused_imports.m: compiler/xml_documentation.m: Minor changes to conform to the changes above. |
||
|
|
801125616f |
A first step towards rationalizing the parse tree representation of the
Estimated hours taken: 24 Branches: main A first step towards rationalizing the parse tree representation of the program. This step moves the information specific to each kind of item into a structure specific to that kind of item. In the short term, this allows us to express some old invisible invariants as types. For example, we used to store general items in method definitions; we now store clause-specific data there. This allows us to simplify some code and eliminate some old "can't fail" tests. In the longer term, this change will allow us to replace the old list of items representation of the parse tree with a more structured representation, which aggregates each kind of item differently. For example, we could keep clause items in a list, but map module imports to the contexts of their :- import_module items, which would allow us to detect duplicate imports. We could also change the current three pass structure of the parse tree to HLDS conversion step, where each pass processes *all* items, to a much more flexible structure where each pass processes only what it needs to process, new passes could be added much more simply, and in fact the whole notion of a "pass" could be eliminated. In a bunch of places, factor out some common code. compiler/prog_item.m: Make the change to the item type as above. Rename the old item_pred_or_func as item_pred_decl (it already had a field to indicate predicate or function) and item_pred_or_func_mode as item_mode_decl. These names are much more consistent with the other item names. Eliminate the item_and_context type by moving the context into the items themselves. In code that cares about contexts, this makes it easier to match up each item with its context. In code that doesn't care about contexts, this avoids the extra code that would be required to discard the item_and_context wrapper. compiler/prog_data.m: Store item_clause_infos instead of items in method definitions. compiler/prog_io.m: compiler/prog_io_dcg.m: compiler/prog_io_pragma.m: compiler/prog_io_typeclass.m: Construct the new item structure when creating the parse tree. Instead of constructing items and later attaching the context to them, pass the context down, since we now need to include them in items. Some old code was assuming that term.variables had no contexts; update such code. In prog_io_pragma.m, replace a single predicate that parsed all kinds of pragmas, which spanned more than one thousand lines and whose clauses had been interspersed with the clauses of other predicates, with a predicate whose only job is to select which of a bunch of pragma-type-specific parse predicates to invoke. Each of these pragma-type-specific parse predicates corresponds to one of the clauses of the old predicate. In that form, the predicates can be declared det, even though the predicate as a whole is semidet (since not all pragma names are valid). This actually exposed an old bug; the case MaybeAttributes = error1(_) was not handled in foreign_export_enum pragmas. To make the diff easier to check, I left the predicates in the original order of the clauses, even though that order does not make sense (it does not group related pragmas together). I did leave an XXX comment about this. The matter will be addressed in a later diff. (A similar problem occurs in some of the other modules in which I broke up very large predicates.) compiler/prog_io_util.m: Remove some stuff that the new item structure makes unnecessary. compiler/make_hlds_passes.m: compiler/add_class.m: compiler/add_mode.m: compiler/add_pragma.m: compiler/add_solver.m: Conform to the new item structure when converting it to HLDS. Break up excessively large predicates. compiler/prog_foreign.m: Provide a function to return all supported foreign languages, instead of requiring callers to call solutions to compute this list. compiler/mercury_to_mercury.m: Print out the new item structure. Break up excessively large predicates. Rename some predicates to avoid name collisions. compiler/equiv_type.m: compiler/hlds_module.m: compiler/intermod.m: compiler/make.module_dep_file.m: compiler/mercury_compile.m: compiler/module_qual.m: compiler/modules.m: compiler/prog_mutable.m: compiler/recompilation.check.m: compiler/recompilation.version.m: compiler/state_var.m: compiler/trans_opt.m: Operate on the new item structure. Factor out code (usually tests) where the new item structure makes this possible and desirable. Turn if-then-elses into switches where this is desirable. Build up large terms from named pieces instead of all at once. Break up excessively large predicates. In equiv_type.m, rename a predicate to clarify its function, and add an XXX about a possible improvement in abstraction. In modules.m, simplify the interface between some predicates and their callers, turn some predicates into functions, and make some code return error specifications instead of doing raw printing of error messages. Note that this module still has plenty of scope for improvement (I marked some with XXXs), but that is for a later date. In some cases, mark potential bugs with XXXs. compiler/equiv_type_hlds.m: Conform to the change in equiv_type.m. library/term.m: compiler/recompilation.check.m: Move the function for getting the context out of a term from recompilation.check.m to term.m, so it can be used from other modules. (Also, adding such a function to the standard library is long overdue.) NEWS: Note the change to term.m. |
||
|
|
665ea0786c |
Removed support for Managed C++ as a foreign language for the IL backend.
Estimated hours taken: 3 Branches: main Removed support for Managed C++ as a foreign language for the IL backend. This is being removed for the following reasons: * It is only supported by Microsoft, making it harder to use code using it with other CIL platforms (e.g. Mono). * It is not used in any of the standard library (only C# and IL are used). * Removing it will simplify the dependencies and the build process. * Microsoft have deprecated it in favour of C++/CLI. NEWS: Mentioned the change. aclocal.m4: Remove checks for the Microsoft.NET C++ compiler. compiler/globals.m: Delete Managed C++ from the set of supported languages. compiler/mlds_to_managed.m: Remove support for Managed C++ code generation. compiler/*.m: Remove all references to Managed C++. runtime/Mmakefile: runtime/mercury_mcpp.h: Remove the Managed C++ part of the Mercury runtime. runtime/mercury_il.il: runtime/mercury_typeclass_info.h: runtime/mercury_type_info.h: Remove all references to Managed C++, including instructions to keep certain parts in sync with Managed C++ part of the runtime. doc/reference_manual.texi: Remove the Managed C++ sections in the Foreign Language Interface chapter. doc/user_guide.texi: Remove the documentation of Managed C++ related flags. library/Mmakefile: Remove Managed C++ flag settings. library/io.m: Remove commented out Managed C++ code. library/list.m: Change a comment referring to Managed C++ to refer to C# instead. scripts/Mmake.rules: scripts/Mmake.vars.in: Remove all rules and variables for Managed C++ from mmake. tests/hard_coded/foreign_import_module.m: tests/hard_coded/foreign_import_module_2.m: tests/hard_coded/foreign_proc_make.m: tests/hard_coded/redoip_clobber.m: Replace Managed C++ code with C# code in the relevant tests. |
||
|
|
637c76926d |
Add some preliminary infrastructure for an HLDS->Erlang code generator.
Estimated hours take: 4
Branches: main
Add some preliminary infrastructure for an HLDS->Erlang code generator.
compiler/globals.m:
compiler/options.m:
Recognise "erlang" as a valid compilation target.
Add new options: `--erlang' and `--erlang-only' as synonyms
for `--target erlang' and `--target erlang --target-code-only'.
XXX the new options are currently undocumented.
compiler/hlds_data.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
Recognise "Erlang" as a valid language for foreign code.
compiler/handle_options.m:
For erlang targets, set the gc_method to automatic and disable
optimize_constructor_last_call.
compiler/add_pragma.m:
compiler/add_type.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/foreign.m:
compiler/granularity.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_gen.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/modules.m:
compiler/pragma_c_gen.m:
compiler/prog_foreign.m:
compiler/simplify.m:
Conform to the above changes.
|
||
|
|
9482049101 |
Fix an inconsistency between the compiler's handling of foreign_import_module
Estimated hours taken: 4 Branches: main Fix an inconsistency between the compiler's handling of foreign_import_module pragmas (which was itself inconsistent between backends) and what is documented about that pragma in the reference manual. According to the reference manual if foreign code (in either a foreign_proc or foreign_code pragma) wants to refer to pragma foreign_exported procedures from the same module then there needs to be a foreign_import_module in the module for itself. The high-level C backend ignores this entirely and modules always effectively implicitly foreign import themselves. The situation with the low-level C backend varies depending on whether a module has any children or not; if it does then it does not implicitly foreign import itself otherwise it does. This diff changes the language to require that modules always implicitly foreign import themselves and adds a workaround to the low-level C backend to make sure this always happens. (A better fix would be to modify the frontend of the compiler to handle the implicit foreign imports for both backends but the lack of structure in the parse tree makes this quite awkward at the moment.) Fix a bunch of comments that were out-of-date. doc/reference_manual.texi: Change the description of behaviour of `:- pragma foreign_import_module' so that it matches what the implementation actually does (well, at least what it actually does most of the time.) The new behaviour removes the requirement that modules need to foreign_import themselves. This is pretty much what users (and implementors) have assumed anyway compiler/mercury_compile.m: Make sure that in LLDS grades modules always foreign import themselves (this was the exception to "most of the time" above.) Change an if-then-else into a switch. tests/hard_coded/sub-modules/Makefile: tests/hard_coded/sub-modules/sm_exp_bug.m: tests/hard_coded/sub-modules/sm_exp_bug.child.m: tests/hard_coded/sub-modules/sm_exp_bug.exp: Test case for the above. compiler/mlds.m: Update a comment. pragma foreign_export has been implemented for other backends. compiler/modules.m: Fix the formatting of the module_imports structure. Divide some of this module more visibly into sections. compiler/process_util.m: Replace a pragma_export with pragma foreign_export. compiler/add_pragma.m: compiler/det_analysis.m: compiler/export.m: compiler/hlds_module.m: compiler/make.m: compiler/make_hlds_passes.m: compiler/ml_code_gen.m: compiler/ml_elim_nested.m: compiler/mlds_to_c.m: compiler/prog_foreign.m: s/pragma export/pragma foreign_export/ compiler/make_hlds.m: compiler/prog_io_pragma.m: compiler/prog_item.m: Minor formatting fixes. |
||
|
|
74b6457c51 |
Add some preliminary infrastructure for the LLDS->x86_64 assembler
Estimated hours taken: 2 Branches: main Add some preliminary infrastructure for the LLDS->x86_64 assembler code generator that Fransiska is working on. compiler/globals.m: compiler/options.m: compiler/handle_options.m: compiler/mercury_compile.m: Recognise "x86_64" as a valid compilation target. Add new options: `--x86_64' and `--x86_64-only' as synonyms for `--target x86_64' and `--target x86_64 --target-code-only'. In the backend passes for the lowlevel backend branch appropriately depending on whether we are generating C or x86_64 assembler. compiler/foreign.m: compiler/prog_foreign.m: When compiling to x86_64 assembler use C as the preferred foreign language. compiler/mlds.m: compiler/ml_code_gen.m: compiler/ml_optimize.m: compiler/ml_switch_gen.m: compiler/ml_type_gen.m: compiler/ml_unify_gen.m: compiler/mlds_to_c.m: Handle "x86_64" as a target in the MLDS backend. This does (and should) cause a compiler abort since "x86_64" is intended to be an MLDS target language. compiler/make.module_target.m: compiler/make.program_target.m: compiler/modules.m: Add placeholders for --target x86_64 in the build systems. compiler/make_hlds_passes.m. We don't currently support mutables with --target x86_64. compiler/simplify.m: We don't currently support runtime conditions on trace goals with --target x86_64. compiler/add_type.m: compiler/compile_target_code.m: compiler/granularity.m: compiler/intermod.m: Conform to the above changes. |
||
|
|
b4c3bb1387 |
Clean up in unused module imports in the Mercury system detected
Estimated hours taken: 3 Branches: main Clean up in unused module imports in the Mercury system detected by --warn-unused-imports. analysis/*.m: browser/*.m: deep_profiler/*.m: compiler/*.m: library/*.m: mdbcomp/*.m: profiler/*.m: slice/*.m: Remove unused module imports. Fix some minor departures from our coding standards. analysis/Mercury.options: browser/Mercury.options: deep_profiler/Mercury.options: compiler/Mercury.options: library/Mercury.options: mdbcomp/Mercury.options: profiler/Mercury.options: slice/Mercury.options: Set --no-warn-unused-imports for those modules that are used as packages or otherwise break --warn-unused-imports, e.g. because they contain predicates with both foreign and Mercury clauses and some of the imports only depend on the latter. |
||
|
|
f9cac21e3e |
Get rid of a bunch more ambiguities by renaming predicates, mostly
Estimated hours taken: 8
Branches: main
Get rid of a bunch more ambiguities by renaming predicates, mostly
in polymorphism.m, {abstract,build,ordering}_mode_constraints.m, prog_type.m,
and opt_debug.m in the compiler directory and term_io.m, term.m, parser.m,
and string.m in the library.
In some cases, when the library and the compiler defined the same predicate
with the same code, delete the compiler's copy and give it access to the
library's definition by exporting the relevant predicate (in the undocumented
part of the library module's interface).
NEWS:
Mention that the names of some library functions have changed.
library/*.m:
compiler/*.m:
mdbcomp/*.m:
browser/*.m:
Make the changes mentioned above, and conform to them.
test/general/string_test.m:
test/hard_coded/string_strip.m:
test/hard_coded/string_strip.exp:
Conform to the above changes.
|
||
|
|
2b2f3d3cbe |
This diff contains no algorithmic changes.
Estimated hours taken: 8 Branches: main This diff contains no algorithmic changes. It merely renames apart a bunch of function symbols to reduce ambiguity. Basically I went through prog_data.m, prog_item.m, hlds_data.m, hlds_goal.m and hlds_pred.m looking for type definitions containing function symbol names that were either language "keywords" (e.g. "terminates", which is an annotation on foreign_procs), used with slightly different meanings in several types (e.g. "sym"), or both (e.g. "call"). When I found such type definitions, I changed the names of the function symbols, usually by adding a prefix or suffix indicating the type to all function symbols of the type. For example, the old function symbol "foreign_proc" in type "pragma_type" is now named "pragma_foreign_proc", and the names of all other function symbols in that type also start with "pragma_". All of this should yield simpler compiler error messages when we make mistakes, and will make it more likely that looking up a function symbol using a tags file will take you to the actual definition of the relevant instance of that function symbol. However, the most important benefit is the increase in the readability of unfamiliar code; the reader won't have to emulate the compiler's type ambiguity resolution algorithm (which in many cases used to require distinguishing between f/14 and f/15 by counting the arguments, e.g. for "pred_or_func"). compiler/prog_data.m: compiler/prog_item.m: compiler/hlds_data.m: compiler/hlds_goal.m: compiler/hlds_pred.m: Rename function symbols as explained above. compiler/*.m: Conform to the function symbol renames. In some cases, rename other function symbols as well. Minor style fixes, e.g. replace if-then-elses with switches, or simple det predicates with functions. |
||
|
|
74ce85d476 |
Provide a mechanism for collecting statistics about tabling operations,
Estimated hours taken: 60
Branches: main
Provide a mechanism for collecting statistics about tabling operations,
and provide a much more convenient mechanism for resetting tables.
Since it would too complex to do this while preserving the capability
of setting --tabling-via-extra-args to no, eliminate that capability
and the option. That option was useful only for measurements of the
performance boost from setting --tabling-via-extra-args to yes in any case,
so users lose no functionality.
Previously, the only way to debug the low level details of the tabling
mechanism was to build a runtime with a specific C macro (MR_TABLE_DEBUG)
and link with that runtime; this was cumbersome. Change that so that
every one of the debuggable tabling macros has a bool argument that says
whether debugging is enabled or not. The compiler can then set this to
MR_TRUE if the new option --table-debug is given, and to MR_FALSE otherwise.
If set to MR_FALSE, the C compiler should optimize away the debug code,
with zero impact on program size or speed.
Since these changes to macros require nontrivial bootstrapping, which we don't
want to do unnecessarily, modify the interface of the tabling macros as
required to support size limits on tables. This diff also implements the
parsing of size limit specifications on tables, but does not implement them
yet; that is for a future change.
To make the syntax simpler, this diff deletes the free-standing fast_loose_memo
pragma. The same functionality is now available with a fast_loose annotation
on an ordinary memo pragma.
Make a bunch of changes to improve readability and maintainability
in the process. These mostly take the form of renaming ambiguous and/or
not sufficiently expressive function symbols.
runtime/mercury_stack_layout.h:
runtime/mercury_tabling.h:
Move the description of structure of tables from mercury_stack_layout.h
to mercury_tabling.h, since we now need it for statistics even if
execution tracing is not enabled.
Modify those data structures to have room for the statistics.
Don't distinguish "strict", "fast_loose" and "specified" memoing
as separate eval methods; treat them as just different kinds
of the same eval method: "memo".
Remove underscores from the names of some types that the style guide
says shouldn't be there.
runtime/mercury_tabling_preds.h:
runtime/mercury_tabling_macros.h:
Modify the approach we use for macros that implement the predicates
of library/table_builtin.m. Instead of selecting between debug and
nondebug based on whether MR_TABLE_DEBUG is defined or not, add
an explicit argument controlling this to each debuggable macro.
The advantage of the new arrangement is that it scales. Another
argument controls whether we are computing statistics (and if yes,
where do we put it), and a third argument controls whether we maintain
back links in the tries and hash tables (this last argument is present
but is ignored for now).
Since the values of the arguments will be known when the .c files
containing calls to these macros are compiled, we pay the space and
time cost of debugging, statistics gathering and the maintenance of
back links if and only we need the revelant functionality.
Provide macros for limited backward compatibility with the old set
of macros; these allow workspaces created by old compilers to work
with the new macros in the runtime. The old macros followed the
naming scheme MR_table_*, the new ones are named MR_tbl_*.
runtime/mercury_table_int_fix_index_body.h:
runtime/mercury_table_int_start_index_body.h:
runtime/mercury_table_type_body.h:
New files containing parts of the old mercury_tabling.c. Each of these
files contains the body of the functions that used to be in
mercury_tabling.c. The new mercury_tabling.c #includes each of these
files more than once, to provide more than one variant of the old
function. These variants differ in aspects such as whether debugging
is enabled or statistics is being collected. Each variant therefore
incurs only the time costs it needs to. (We pay the space cost of
having all these variants all the time of course, but this cost
is negligible.)
runtime/mercury_tabling_stats_defs.h:
runtime/mercury_tabling_stats_nodefs.h:
runtime/mercury_tabling_stats_undefs.h:
New files that serve as wrappers around the newly #included files,
controlling how they handle statistics.
runtime/mercury_tabling.c:
Delete functions now in the new files, and #include them instead.
Delete the data structures that used to contain summary statistics;
the new approach keeps statistics in compiler-generated,
procedure-specific data structures.
runtime/mercury_trace_base.c:
Use the new versions of the tabling macros to access the I/O table.
runtime/mercury_type_info.h:
Update some documentation for the movement of code out of
mercury_tabling.c.
runtime/mercury_types.h:
Provide forward declarations of the identifiers denoting the new types
in mercury_tabling.h.
runtime/mercury_grade.h:
Increment the exec trace version number, since we have changed
a part of the exec trace structure.
runtime/mercury_bootstrap.h:
Fix some temporary issues that arise from some renames above.
runtime/mercury_hash_lookup_or_add_body.h:
Fix comment.
runtime/Mmakefile:
Mention the new files and the dependencies that involve them.
library/table_builtin.m:
Provide a type for representing statistics and a predicate for
printing statistics.
Use the updated versions of the macros in
runtime/mercury_tabling_preds.h.
compiler/prog_item.m:
Change representation of tabling pragmas to allow room for the new
attributes.
Allow an item to be marked as being generated by the compiler
as a result of a pragma memo attribute. We use this for the reset
and statistics predicates.
compiler/mercury_to_mercury.m:
Write out the new attributes of the tabling pragma.
compiler/prog_data.m:
compiler/hlds_data.m:
Change the cons_id that used to refer to a procedure's call table root
to refer to the entirety of the new data structure now containing it.
The compiler now needs a way to refer to the other components of this
new data structure, since it contains the statistics.
As in the runtime, don't distinguish "strict", "fast_loose" and
"specified" memoing as separate eval methods; treat them as just
different kinds of the same eval method: "memo".
Rename some of the uses of the function symbols "c", "java", "il".
compiler/hlds_pred.m:
Add an extra field in proc_infos for storing any tabling attributes.
Change the existing proc_info field that records information about
the kinds of arguments of tabled procedures to record the information
needed by the debugger too. This was needed to allow us to shift all
the RTTI for procedure-specific tables (as opposed to the RTTI for
the global I/O table) from mercury_stack_layout.h to mercury_tabling.h
without duplicating the data (which would be a maintenance problem).
Reformat some comments to make them easier to read.
compiler/layout.m:
compiler/layout_out.m:
Delete the part of the exec trace information that used to record
RTTI for tables, since this information is not generated only as
part of the debugger data structures anymore.
compiler/prog_io_pragma.m:
Recognize the updated syntax for tabling pragmas.
compiler/add_pragma.m:
When processing tabling pragmas for inclusion in the HLDS, create
any reset and statistics predicates they ask for.
compiler/make_hlds_passes.m:
Export a predicate now needed by add_pragma.m.
Handle the new attributes on tabling pragmas
compiler/globals.m:
Change the function symbols of the types describing backends and
foreign languages to say what they are. Previously, both types (as well
as several others) included the function symbol "c"; now, they are
target_c and lang_c respectively.
compiler/table_gen.m:
Implement the changes described at the top.
When passing around varsets and vartypes, pass the arguments in the
standard order.
compiler/goal_util.m:
compiler/hlds_goal.m:
When passing around varsets and vartypes, pass the arguments in the
standard order.
compiler/rtti.m:
Provide types for representing the runtime's data structures for
tabling (which are now significantly more complex than a single word)
and predicates for manipulating them, for use by both the ml and ll
backends.
compiler/llds.m:
Replace the comp_gen_c_var type with the tabling_info_struct type,
which contains the information needed to create the per-procedure
tabling data structures.
Replace references to call tables with references to the various
components of the new tabling data structures.
compiler/llds_out.m:
Add code to write out tabling_info_structs.
Delete the code required for the old, hacky way of resetting tables.
Reorder some code more logically.
compiler/proc_gen.m:
Generate tabling_info_structs.
compiler/stack_layout.m:
Don't generate the information now generated in proc_gen.m.
compiler/mlds.m:
Give mlds_proc_labels their own function symbols, instead of using
a pair. Rename some other function symbols to avoid ambiguity and add
expressiveness.
Provide for the representation of references to the various components
of the new tabling data structures, and for the representation of their
types.
compiler/ml_code_gen.m:
When generating code for a tabled procedure, generate also the data
structures required for its table.
compiler/rtti_to_mlds.m:
compiler/ml_util.m:
Move some predicates from rtti_to_mlds.m to ml_util.m, since we
now also want to call them from ml_code_gen.m.
compiler/name_mangle.m:
Add some utility predicates.
compiler/options.m:
Delete the old --allow-table-reset option.
Add the new --table-debug option.
Comment out an implementor-only option.
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_trail_ops.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/dependency_graph.m:
compiler/det_report.m:
compiler/export.m:
compiler/fact_table.m:
compiler/foreign.m:
compiler/global_data.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_label.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/prog_mutable.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_util.m:
compiler/recompilation.version.m:
compiler/size_prof.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/transform_llds.m:
compiler/tupling.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
Conform to the changes above, and/or improve some comments.
mdbcomp/prim_data.m:
Make the names of the function symbols of the proc_label type more
expressive and less ambiguous.
mdbcomp/prim_data.m:
mdbcomp/mdbcomp.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
Use . instead of __ as module qualifier.
Conform to the change to prim_data.m.
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
Conform the change to mdbcomp/prim_data.m.
tests/debugger/Mercury.options:
Don't specify --allow-table-reset for fib.m, since that option
doesn't exist anymore.
tests/debugger/fib.m:
Use the new mechanism for resetting the table.
tests/debugger/print_table.m:
Use the new syntax for pragma memo attributes.
tests/invalid/specified.{m,err_exp}:
Use to the new syntax and reset method for pragma memo attributes.
Test the handling of errors in the new attribute syntax.
tests/tabling/Mercury.options:
Don't specify --allow-table-reset for specified.m, since that option
doesn't exist anymore.
tests/tabling/specified.m:
Use the new syntax for pragma memo attributes, and use the new
mechanism for resetting tables. We could also use this test case
for testing the printing of statistics, but the format of that
output is still not final.
tests/tabling/fast_loose.m:
Use the new syntax for pragma memo attributes, and use the new
mechanism for resetting tables.
trace/mercury_trace.c:
trace/mercury_trace_cmd_developer.c:
Conform to the changes in the RTTI data structures regarding tabling.
Remove underscores from the names of some types that the style guide
says shouldn't be there.
library/robdd.m:
Comment out the tabling pragma until this change is bootstrapped.
Without this, the conflict between the old calls to macros generated
by the existing compiler and the new definition of those macros
in the runtime would cause errors from the C compiler.
|
||
|
|
be5b71861b |
Convert almost all the compiler modules to use . instead of __ as
Estimated hours taken: 6 Branches: main compiler/*.m: Convert almost all the compiler modules to use . instead of __ as the module qualifier. In some cases, change the names of predicates and types to make them meaningful without the module qualifier. In particular, most of the types that used to be referred to with an "mlds__" prefix have been changed to have a "mlds_" prefix instead of changing the prefix to "mlds.". There are no algorithmic changes. |
||
|
|
9d8ca0ad37 |
Remove residual parts of the Aditi backend that weren't deleted the other day.
Estimated hours taken: 1.5 Branches: main Remove residual parts of the Aditi backend that weren't deleted the other day. configure.in: Mmake.common.in: Remove support for enabling the Aditi backend. runtime/mercury_aditi.h: Remove this file. runtime/Mmakefile: runtime/mercury.h: runtime/mercury_imp.h: runtime/mercury_ho_call.[ch]: runtime/mercury_wrapper.[ch]: Delete support for Aditi in the runtime. scripts/Mmake.rules: scripts/Mmake.vars.in: scripts/c2init.in: scripts/parse_ml_options.sh-subr.in: Remove mmake support for building .rlo files, etc. util/mkinit.c: Remove Aditi specific code. compiler/bytecode_data.m: compiler/closure_analysis.m: compiler/code_model.m: compiler/compile_target_code.m: compiler/det_analysis.m: compiler/handle_options.m: compiler/hlds_goal.m: compiler/hlds_module.m: compiler/make.dependencies.m: compiler/make.m: compiler/make.module_target.m: compiler/make.program_target.m: compiler/make.util.m: compiler/make_hlds_error.m: compiler/make_hlds_passes.m: compiler/mercury_to_mercury.m: compiler/mlds_to_gcc.m: compiler/modecheck_call.m: compiler/modules.m: compiler/opt_debug.m: compiler/options.m: compiler/prog_data.m: compiler/prog_foreign.m: compiler/prog_mode.m: compiler/prog_type.m: compiler/rtti.m: compiler/rtti_out.m: compiler/rtti_to_mlds.m: compiler/term_errors.m: compiler/unify_proc.m: mdbcomp/prim_data.m: Remove residual support for Aditi. library/ops.m: Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the ops table. doc/reference_manual.texi: doc/user_guide.texi: Delete the sections on the Aditi interface. extras/aditi/*: Delete this. |
||
|
|
2a477fb7e7 |
Split the parse tree (currently defined in prog_data.m) into two
Estimated hours taken: 3.5 Branches: main Split the parse tree (currently defined in prog_data.m) into two separate modules. The reason for doing this is that while over 80% of the modules in the compiler import prog_data, very few of them actually require access to the types that define the parse tree (principally the item type). At the moment even small changes to these types can result in recompiles that rebuild almost all of the compiler. This change shifts the item type (and related types) into a new module, prog_item, that is only imported where these types are required (mostly at the frontend of the compiler). This should reduce the size of recompiles required when the parse tree is modified. This diff does not change any algorithms; it just shifts things around. compiler/prog_data.m: Move the item type and any related types that are not needed after the HLDS has been built to the new prog_item module. Fix bitrot in comments. Fix formatting and layout of comments. Use unexpected/2 in place of error/1 in a spot. compiler/prog_item.m: New file. This module contains any parts of the parse tree that are not needed by the rest of the compiler after the HLDS has been built. compiler/check_typeclass.m: s/list(instance_method)/instance_methods/ compiler/equiv_type.m: compiler/hlds_module.m: compiler/intermod.m: compiler/make.module_dep_file.m: compiler/make_hlds.m: compiler/mercury_compile.m: compiler/mercury_to_mercury.m: compiler/module_qual.m: compiler/modules.m: compiler/parse_tree.m: compiler/prog_io.m: compiler/prog_io_dcg.m: compiler/prog_io_goal.m: compiler/prog_io_pragma.m: compiler/prog_io_typeclass.m: compiler/prog_io_util.m: compiler/prog_out.m: compiler/prog_util.m: compiler/recompilation.check.m: compiler/recompilation.usage.m: compiler/recompilation.version.m: compiler/trans_opt.m: Conform to the above changes. compiler/notes/compiler_design.html: Mention the new module. |
||
|
|
df620a3384 |
Don't print out any given piece of foreign declaration code more than
Estimated hours taken: 0.2 Branches: main compiler/llds_out.m: Don't print out any given piece of foreign declaration code more than once. With intermodule inlining, the redundant foreign_import_modules the front end generates lead to the .mh files of library modules being printed literally dozens of times. It would be nice to avoid redundant foreign_import_modules in the first place, but that is harder to do. compiler/prog_foreign.m: Convert to four space indentation, add field names. |
||
|
|
bdb50b33ce |
Break the cycle in the package dependency graph between the
Estimated hours taken: 1 Branches: main Break the cycle in the package dependency graph between the hlds and backend_libs packages by moving yet more of the contents of the foreign module into the new prog_foreign module. There are no changes to any code other than moving it around. compiler/foreign.m: compiler/prog_foreign.m: Shift most of the types related to the foreign language interface into the latter module. Fix a typo in a comment at the beginning of prog_foreign.m. Clean up the formatting of comments in foreign.m. compiler/hlds.m: Update the comment about why the transform_hlds package is imported here. compiler/*.m: Minor changes caused by the above. |
||
|
|
601fe20aba |
Simplify the structure of the compiler by removing the cycle
Estimated hours taken: 3.5 Branches: main Simplify the structure of the compiler by removing the cycle parse_tree -> backend_libs -> check_hlds -> parse_tree from the package dependency graph. I've done this by factoring out the code in backend_libs.foreign and backend_libs.name_mangle that is needed by the frontend of the compiler and putting it in a new module, parse_tree.prog_foreign. This removes the dependency between the parse_tree and backend_libs packages. The obvious downside to this is that the name mangler is now split in two, although such a division was always in implicit in the predicates of the name_mangle module anyway, ie. between those bits that operate on the HLDS/MLDS/LLDS level data structures and those that don't. compiler/name_mangle.m: compiler/foreign.m: compiler/prog_foreign.m: Move code for dealing with foreign language procedures that is required by the parse_tree package into a new module, prog_foreign. Update the formatting in some of these modules so that they match our current coding standard. compiler/*.m: Update to reflect the above change. compiler/notes/compiler_design.html: Include the new module. Fix some spelling errors. |