mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
master
50 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cc88a1c70d |
Fix and update more copyright notices.
compiler/*.m:
mdbcomp/*.m:
As above.
|
||
|
|
a16cd8c725 |
Replace three pred_or_func_to_* functions with two.
mdbcomp/prim_data.m:
Delete the pred_or_func_to_string function that used to be defined here,
and replace it with pred_or_func_to_str and pred_or_func_to_full_str
that used to be in parse_tree_out_misc.m. These two names make it
clear which one returns "pred" or "func", and which returns "predicate"
or "function".
compiler/parse_tree_out_misc.m:
Delete the functions moved to prim_data.m.
compiler/add_clause.m:
compiler/add_pred.m:
compiler/hlds_desc.m:
compiler/hlds_out_typeclass_table.m:
compiler/hlds_out_util.m:
compiler/make_hlds_error.m:
compiler/mlds_to_target_util.m:
compiler/mode_errors.m:
compiler/module_qual.qual_errors.m:
compiler/optimize.m:
compiler/parse_tree_out_sym_name.m:
compiler/polymorphism_lambda.m:
compiler/pred_name.m:
compiler/pred_table.m:
compiler/prog_type_test.m:
compiler/recompilation.check.m:
compiler/recompilation.used_file.m:
compiler/style_checks.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_error_spec.m:
Conform to the changes above, mostly by not importing
parse_tree_out_misc.m.
|
||
|
|
b6ec42a132 |
Make some arities into pred_form_arities.
compiler/hlds_pred.m:
Replace the arity field in pred_infos with a pred_form_arity field.
Move the pred_info's pred_or_func field to its usual position
in predicate/function descriptions: at the front (pred/func name/arity).
compiler/hlds_pred.m:
Change two utility operations to return pred_form_arities instead of
just arities, since they get them from pred_infos.
compiler/inst_mode_type_prop.m:
compiler/llds.m:
compiler/rtti.m:
Change some fields whose types used to be arity (or int) to be
pred_form_arity.
In llds.m, include a pred_or_func field in c_procedures,
for use in procedure-start comments.
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
Add notes about two possible future improvements along similar lines.
compiler/prog_data.m:
Add a utility function to calculate the number of extra arguments
added to predicates/functions by compiler passes such as polymorphism.
compiler/add_pragma.m:
Conform to the changes above.
Fix a bug in an error message about ":- external" pragmas:
the message used the pred_form arity instead of the user arity.
(See the diff to external2.err_exp below.)
compiler/hlds_defns.m:
Conform to the changes above.
Include pred/func prefixes before name/arity pairs in the output
where relavnt. (The user guide does not need to be updated, because
its wording permits both the old and the new behavior.)
Fix two separate bugs that referred to functions in user-facing output
with the predicate form of their arity.
compiler/table_gen.m:
compiler/unused_args.m:
Conform to the changes above.
Fix a bug in each module that referred to functions in user-facing output
with the predicate form of their arity.
compiler/recompilation.usage.m:
compiler/xml_documentation.m:
Conform to the changes above.
Mark a probable bug in each module with an XXX.
compiler/direct_arg_in_out.m:
Conform to the changes above.
Improve the wording of an error message a bit.
(See the diff to gh72_errors.err_exp below.)
compiler/accumulator.m:
compiler/bytecode_gen.m:
compiler/complexity.m:
compiler/default_func_mode.m:
compiler/det_report.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/higher_order.m:
compiler/hlds_defns.m:
compiler/hlds_error_util.m:
compiler/hlds_module.m:
compiler/intermod.m:
compiler/intermod_order_pred_info.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/llds_out_file.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/mode_errors.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/old_type_constraints.m:
compiler/optimize.m:
compiler/polymorphism.m:
compiler/polymorphism_goal.m:
compiler/post_typecheck.m:
compiler/pre_typecheck.m:
compiler/pred_table.m:
compiler/proc_gen.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.usage.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/simplify_goal_call.m:
compiler/ssdebug.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_initial.m:
compiler/termination.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/tupling.m:
compiler/type_class_info.m:
compiler/typecheck.m:
compiler/typecheck_error_undef.m:
compiler/types_into_modes.m:
compiler/xml_documentation.m:
Conform to the changes above.
compiler/recompilation.m:
Add a note.
compiler/parse_tree_out_sym_name.m:
Improve variable names.
tests/invalid/external2.err_exp:
Expect the fixed arity in an error message.
tests/invalid/gh72_errors.err_exp:
Expect the expanded text of an error message.
|
||
|
|
9789375cc5 |
Make pre-HLDS passes use file-kind-specific parse trees.
Replacing item blocks file-kind-specific kinds of section markers with
file-kind-specific parse trees has several benefits.
- It allows us to encode the structural invariants of each kind of file
we read in within the type of its representation. This makes the detection
of any accidental violations of those invariants trivial.
- Since each file-kind-specific parse tree has separate lists for separate
kinds of items, code that wants to operate on one or a few kinds of items
can just operate on those kinds of items, without having to traverse
item blocks containing many other kinds of items as well. The most
important consequence of this is not the improved efficiency, though
that is nice, but the increased clarity of the code.
- The new design is much more flexible. For example, it should be possible
to record that e.g. an interface file we read in as a indirect dependency
(i.e. a file we read not because its module was imported by the module
we are compiling, but because its module was imported by *another* imported
module) should be used *only* for the purpose it was read in for. This should
avoid situations where deleting an import of A from a module, because it
is not needed anymore, leads the compiler to generate an error message
about a missing import of module B. This can happen if (a) module B
always *should* have been imported, since it is used, but (b) module A's
import of module B lead to module B's interface being available *without*
an import of B.
Specifically, this flexibility should enable us to establish each module's
.int file as the single source of truth about how values of each type
defined in that module should be represented. When compiling each source
file, this approach requires the compiler to read in that module's .int file
but using only the type_repn items from that .int file, and nothing else.
- By recording a single parse tree for each file we have read, instead of
a varying number of item blocks, it should be significantly easier to
derive the contents of .d files directly from the records of those
parse trees, *without* having to maintain a separate set of fields
in the module_and_imports structure for that purpose. We could also
trivially avoid any possibility of inconsistencies between these two
different sources of truth. (We currently fill in the fields used to
drive the generation of .d files using two different pieces of code,
one used for --generate-dependencies and one used for all other invocations,
and these two *definitely* generate inconsistent results, as the significant
differences in .d files between (a) just after an invocation of
--generate-dependencies and (b) just after any other compiler invocation
can witness.)
This change is big and therefore hard to review. Therefore in many files,
this change adds "XXX CLEANUP" comments to draw attention to places that
have issues that should be fixed, but whose fixes should come later, in
separate diffs.
compiler/module_imports.m:
The compiler uses the module_and_imports structure defined here
to go from a raw compilation unit (essentially a module to be compiled)
to an augmented compilation unit (a raw compilation unit together
with all the interface and optimization files its compilation needs).
We used to store the contents of both the source file and of
the interface and optimization files in the module_and_imports structure
as item blocks. This diff replaces all those item blocks with
file-kind-specific parse trees, for the reasons mentioned above.
Separate out the .int0 files of ancestors modules from the .intN
files for N>0 of directly imported modules. (Their item blocks
used to be stored in the same list.)
Maintain a database of the source, interface and optimization files
we have read in so far. We use it to avoid reading in interface files
if we have already read in a file for the same module that contains
strictly more information (either an interface file with a smaller
number as a suffix, or the source file itself).
Shorten some field names.
compiler/prog_item.m:
Define data structures for storing information about include_module,
import_module and use_module declarations, both in a form that allows
the representation of possibly erroneous code in actual source files,
and in checked-and-cleaned-up form which is guaranteed to be free
of the relevant kinds of errors. Add a block comment at the start
of the module about the need for this distinction.
Define parse_tree_module_src, a data structure for representing
the source code of a single module. This is different from the existing
parse_tree_src type, which represents the contents of a single source file
but which may contain *more* than one module, and also different from
a raw_compilation_unit, which is based on item blocks and is thus
unable to express to invariants such as "no clauses in the interface".
Modify the existing parse_tree_intN types to express the distinction
mentioned just above, and to unify them "culturally", i.e. if they
store the same information, make them store it using the same types.
Fix a mistake by allowing promises to appear in .opt files.
I originally ruled them out because the code that generates .opt files
does not have any code to write out promises, but some of the predicates
whose clauses it writes out have goal_type_promise, which means that
they originated as promises, and get written out as promises.
Split the existing pragma item kind into three item kinds, which have
different invariants applying to them.
- The decl (short for declarative) pragmas give the compiler some
information, such as that a predicate is obsolete or that we
want to type specialize some predicate or function, that is in effect
part of the module's interface. Decl pragmas may appear in module
interfaces, and the compiler may put them into interface files;
neither statement is true of the other two kinds of pragmas.
- The impl (short for implementation) pragmas are named so
precisely because they may appear only in implementation sections.
They give the compiler information that is private to that module.
Examples include foreign_decls, foreign_codes, foreign_procs,
and promises of clause equivalence, and requests for inlining,
tabling etc. These will never be put into interface files,
though some of them can affect the compilation of other modules
by being included in .opt files.
- The gen (short for generated) pragmas can never (legally) appear
in source files at all. They record the results of compiler
analyses e.g. about which arguments of a predicate are unused,
or what exceptions a function can throw, and accordingly they
should only ever occur in compiler-generated interface files.
Use the new type differences between the three kinds of pragmas
to encode the above invariants about which kinds of pragmas can appear
where into the various kinds of parse trees.
Make the augmented compilation unit, which is computed from
the final module_and_imports structure, likewise switch from
storing item blocks to storing the whole parse trees of the
files that went into its construction. With each such parse tree,
record *why* we read it, since this controls what permissions
the source module being compiled has for access to the entities
in the parse tree.
Simplify the contains_foreign_code type, since one of three
function symbols was equivalent to one possible use of another
function symbol.
Provide a way to record which method of which class a compiler-generated
predicate is for. (See hlds_pred.m below.)
Move the code of almost all utility operations to item_util.m
(which is imported by many fewer modules than prog_item.m),
keeping just the most "popular" ones.
compiler/item_util.m:
Move most of the previously-existing utility operations here from
prog_item.m, most in a pretty heavily modified form.
Add a whole bunch of other utility operations that are needed
in more than one other module.
compiler/convert_parse_tree.m:
Provide predicates to convert from raw compilation units to
parse_tree_module_srcs, and vice versa (though the reverse
shouldn't be needed much longer).
Update the conversion operations between the general parse_tree_int
and the specific parse_tree_intN forms for the changes in prog_item.m
mentioned above. In doing so, use a consistent approach, based on
new operations in item_util.m, to detect errors such as duplicate
include_module and import/use_module declarations in all kinds
of parse trees.
Enforce the invariants that the types of parse trees of various kinds
can now express in types, generating error messages for their violations.
Delete some utility operations that have been moved to item_util.m
because now they are also needed by other modules.
compiler/grab_modules.m:
Delete code that did tests on raw compilation units that are now done
when that raw compilation unit is converted to a parse_tree_module_src.
Use the results of the checks done during that conversion to decide
which modules are imported/used and in which module section.
Record a single reason for why we reading in each interface and
optimization file. The code of make_hlds_separate_items.m will use
this reason to set up the appropriate permissions for each item
in those files.
Use separate code for handling different kinds of interface and
optimization files. Using generic traversal code was acceptable economy
when we used the same data structure for every kind of interface file,
but now that we *can* express different invariants for different kinds
of interface and optimization file, we want to execute not just different
code for each kind of file, but the data structures we want to work on
are also of different types. Using file-kind-specific code is a bit
longer, but it is significantly simpler and more robust, and it is
*much* easier to read and understand.
Delete the code that separates the parts of the implementation section
that are exported to submodules, and the part that isn't, since that task
is now done in make_hlds_separate_items.m.
Pass a database of the files we have read through the relevant predicates.
Give some predicates more meaningful names.
compiler/notes/interface_files.html:
Note a problem with the current operation of grab_modules.
compiler/get_dependencies.m:
Add operations to gather implicit references to builtin modules
(which have to be made available even without an explicit import_module
or use_module declaration) in all kinds of parse trees. These have
more code overall, but will be at runtime, since we need only look at
the item kinds that may *have* such implicit references.
Add a mechanism to record the result of these gathering operations
in import_and_or_use_maps.
Give some types, function symbols, predicates and variables
more meaningful names.
compiler/make_hlds_separate_items.m:
When we stored the contents of the source module and the
interface and optimization files we read in to augment it
in the module_and_imports structure as a bunch of item blocks,
the job of this module was to separate out the different kinds of items
in the item blocks, returning a single list of each kind of item,
with each such item being packaged up with its status (which encodes
a set of permissions saying what the source module is allowed
to do with it).
Now that the module_and_imports structure stores this info in
file-kind-specific parse trees, all of which have separate lists
for each kind of item and none of which contain item blocks,
the job of this module has changed. Now its job is to convert
the reason why each file was read in into the (one or more) statuses
that apply to the different kinds of items stored in it, wrap up
each item with its status, and return the resulting overall list
of status/item pairs for each kind of item.
compiler/read_modules.m:
Add predicates that, when reading an interface file, return its contents
in the tightest possible file-kind-specific parse tree.
Refine the database of files we have read to allow us to store
more file-kind-specific parse trees.
Don't require that files in the database have associated timestamps,
since in some cases, we read files we can put into the database
*without* getting their timestamps.
Allow the database to record that an attempt to read a file failed.
compiler/split_parse_tree_src.m:
Rearchitect how this module separates out nested submodules from within
the main module in a file.
Another of the jobs of this module is to generate error messages for
when module A includes module B twice, whether via nesting or via
include_module declarations, with one special exception for the case
where A's interface contains nested submodule A.B's interface,
and A's implementation contains nested submodule A.B's implementation.
The problem ironically was that while it reported duplicate include_module
declarations as errors, split_parse_tree_src.m also *generated*
duplicate include_module declarations. Since it replaced each nested
submodule occurrence with an include_module declaration, in the scenario
above, it generated two include_module declarations for A.B. Even worse,
the interface incarnation of submodule A.B could contain
(the interface of) its own nested submodule A.B.C, while its
implementation incarnation could contain (the implementation section of)
A.B.C. Each occurrence of A.B.C would be its only occurrence in the
including part of its parent A.B, which means local tests for duplicates
do not work. (I found this out the hard way.)
The solution we now adopt adds include_module declarations to the
parents of any submodule only once the parse tree of the entire
file has been processed, since only then do we know all the
includer/included relationships among nested modules. Until then,
we just record such relationships in a database as we discover them,
reporting duplicates when needed (e.g. when A includes B twice
*in the same section*), but not reporting duplicates when not needed
(e.g. when A.B includes A.B.C in *different* sections).
compiler/prog_data.m:
Add a new type, pf_sym_name_and_arity, that exactly specifies
a predicate or function. It is a clone of the existing simple_call_id
type, but its name does NOT imply that the predicate or function
is being called.
Add XXXs that call for some other improvements in type names.
compiler/prog_data_foreign.m:
Give a type, and the operations on that type, a more specific name.
compiler/error_util.m:
Add an id field to all error_specs, which by convention should be
filled in with $pred. Print out the value in this field if the compiler
is invoked with the developer-only option --print-error-spec-id.
This allows a person debugging the compiler find out where in the code
an undesired error message is coming from significantly easier
than was previously possible.
Most of the modules that have changes only "to conform to the changes
above" will be for this change. In many cases, the updated code
will also simplify the creation of the affected error_specs.
Fix a bug that looked for a phase in only one kind of error_spec.
Add some utility operations needed by other parts of this change.
Delete a previously internal function that has been moved to
mdbcomp/prim_data.m to make it accessible in other modules as well.
compiler/Mercury.options:
Ask the compiler to warn about dead predicates in every module
touched by this change (at least in one its earlier versions).
compiler/add_foreign_enum.m:
Replace a check for an inappropriately placed foreign_enum declaration
with a sanity check, since with this diff, the error should be caught
earlier.
compiler/add_mutable_aux_preds.m:
Delete a check for an inappropriately placed mutable declaration,
since with this diff, the error should be caught earlier.
compiler/add_pragma.m:
Instead of adding pass2 and pass3 pragmas, add decl and impl and
generated pragmas.
Delete the tests for generated pragma occurring anywhere except
.opt files, since those tests are now done earlier.
Shorten some too-long predicate names.
compiler/comp_unit_interface.m:
Operate on as specific kinds of parse trees as the interface of this
module will allow. (We could operate on more specific parse trees
if we changed the interface, but that is future work).
Use the same predicates for handling duplicate include_module,
import_module and use_module declarations as everywhere else.
Delete the code of an experiment that shouldn't be needed anymore.
compiler/equiv_type.m:
Replace code that operated on item blocks with code that operates
on various kinds of parse trees.
Move a giant block of comments to the front, where it belongs.
compiler/hlds_module.m:
Add a field to the module_info that lets us avoid generating
misleading error messages above missing definitions of predicates
or functions when those definitions were present but were not
added to the HLDS because they had errors.
Give a field and its access predicates a more specific name.
Mark a spot where an existing type cannot express everything
it is supposed to.
compiler/hlds_pred.m:
For predicates which the compiler creates to represent a class method
(the virtual function, in OOP terms), record not just this fact,
but the id of the class and of the method. Using this extra info
in progress messages (with mmc -V) prevents the compiler from printing e.g.
% Checking typeclass constraints on class method
% Checking typeclass constraints on class method
% Checking typeclass constraints on class method
when checking three such predicates.
compiler/make.m:
Provide a slot in the make_info structure to allow the database
of the files we have read in to be passed around.
compiler/make_hlds_error.m:
Delete predicates that are needed in just one other module,
and have therefore been moved there.
compiler/make_hlds_passes.m:
Add decl, impl and generated pragma separately, instead of adding
pass2 and pass3 pragmas separately.
Do not generate error messages for clauses, initialises or finalises
in module interfaces, since with this diff, such errors should be
caught earlier.
compiler/mercury_compile_main.m:
compiler/recompilation.check.m:
Explicitly pass around the expanded database of parse trees
of files that have been read in.
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.m:
compiler/module_qual.qualify_items.m:
Collect module qualification information, and do module qualification
respectively on parse trees of various kinds, not item blocks.
Take information about what the module may do with the contents
of each interface or optimization file from the record of why
we read that file, not from the section markers in item blocks.
Break up some too-large predicates by carving smaller ones out of them.
compiler/options.m:
Add an option to control whether errors and/or warnings detecting
when deciding what should go into a .intN file be printed,
thus (potentially) preventing the creation of that file.
Add commented-out documentation for a previously totally undocumented
option.
doc/user_guide.texi:
Document the new option.
NEWS:
Announce the new option.
Mention that we now generate warnings for unused import_module and
use_module declarations in the interface even if the module has
submodules.
compiler/write_module_interface_files.m:
Let the new option control whether we filter out any messages generated
when deciding what should go into a .intN file.
compiler/parse_item.m:
Delete actually_read_module_opt, since it is no longer needed;
its callers now call actually_read_module_{plain,trans}_opt instead.
Delete unneeded arguments from some predicates.
compiler/parse_module.m:
Delete some long unused predicates.
compiler/parse_pragma.m:
When parsing pragmas, wrap them up in the new decl, impl or generated
pragma kinds.
compiler/parse_tree_out.m:
Add predicates to write out each of the file-kind-specific parse trees.
compiler/parse_tree_out_pragma.m:
Add predicates to write out decl, impl and generated pragmas.
compiler/polymorphism.m:
Add a conditionally-enabled progress message, which can be useful
in tracking down problems.
compiler/prog_item_stats.m:
Conform NOT to the changes above beyond what is needed to let this module
compile. Let that work be done the next time the functionality of
this module is needed, by which time the affected data structures
maybe have changed further.
compiler/typecheck.m:
Fix a performance problem. With intermodule optimization, we read in
.opt files, some of which (e.g. list.opt and int.opt) contain promises.
These promises are read in as predicates with goal_type_promise,
but they do not have declarations of the types of their arguments
(since promises do not have declarations as such). Those argument types
therefore have to be inferred. That inference replaces the original
"I don't know" argument types with their actual types.
The performance problem is that when we change the recorded argument types
of a predicate, we require another loop over all the predicates in the
module, so that any calls to this predicate can be checked against
the updated types. This is as it should be for callable predicates,
but promises are not callable. So if all the *only* predicates whose
recorded argument types change during the first iteration to fixpoint
are promises, then a second iteration is not needed, yet we used to do it.
The fix is to replace the "Have the recorded types of this predicate
changed?" boolean flag with a bespoke enum that says "Did the checking
of this predicate discover a need for another iteration", and not
setting it when processing predicates whose type is goal_type_promise.
compiler/typecheck_errors.m:
Do not generate an error message for a predicate missing its clauses
is the clauses existed but were not added to the HLDS because they were
in the interface section.
When reporting on ambiguities (when a call can match more than one
predicate or function), sort the possible matches before reporting
them.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/canonicalize_interface.m:
compiler/check_for_missing_type_defns.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_raw_comp_unit.m:
compiler/check_typeclass.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/compiler_util.m:
compiler/dead_proc_elim.m:
compiler/deps_map.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/du_type_layout.m:
compiler/field_access.m:
compiler/find_module.m:
compiler/float_regs.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/handle_options.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/introduce_parallelism.m:
compiler/layout_out.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_top_gen.m:
compiler/mmakefiles.m:
compiler/mode_errors.m:
compiler/mode_robdd.equiv_vars.m:
compiler/modes.m:
compiler/module_qual.qual_errors.m:
compiler/oisu_check.m:
compiler/old_type_constraints.m:
compiler/options_file.m:
compiler/parse_class.m:
compiler/parse_dcg_goal.m:
compiler/parse_goal.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_inst_mode_name.m:
compiler/parse_mutable.m:
compiler/parse_sym_name.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_type_repn.m:
compiler/parse_types.m:
compiler/parse_util.m:
compiler/parse_vars.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/prog_event.m:
compiler/prog_mode.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/recompilation.version.m:
compiler/resolve_unify_functor.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_proc.m:
compiler/state_var.m:
compiler/stratify.m:
compiler/style_checks.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_errors.m:
compiler/term_errors.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
Conform to the changes above.
mdbcomp/prim_data.m:
Move a utility function on pred_or_funcs here from a compiler module,
to make it available to other compiler modules as well.
scripts/compare_s1s2_lib:
A new script that helped debug this diff, and may help debug
similar diffs the future. It can compare (a) .int* files, (b) .*opt
files, (c) .mh/.mih files or (d) .c files between the stage 1 and
stage 2 library directories. The reason for the restriction
to the library directory is that any problems affecting the
generation of any of these kinds of files are likely to manifest
themselves in the library directory, and if they do, the bootcheck
won't go on to compile any of the other stage 2 directories.
tests/debugger/breakpoints.a.m:
tests/debugger/breakpoints.b.m:
Move import_module declarations to the implementation section
when they are not used in the interface. Until now, the compiler
has ignored this, but this diff causes the compiler to generate
a warning for such misplaced import_module declarations even modules
that have submodules. The testing of such warnings is not the point
of the breakpoints test.
tests/invalid/Mercury.options:
Since the missing_interface_import test case tests error messages
generated during an invocation of mmc --make-interface, add the
new option that *allows* that invocation to generate error messages.
tests/invalid/ambiguous_overloading_error.err_exp:
tests/invalid/max_error_line_width.err_exp:
tests/warnings/ambiguous_overloading.exp:
Expect the updated error messages for ambiguity, in which
the possible matches are sorted.
tests/invalid/bad_finalise_decl.m:
tests/invalid/bad_initialise_decl.m:
Fix programming style.
tests/invalid/bad_item_in_interface.err_exp:
Expect an error message for a foreign_export_enum item in the interface,
where it should not be.
tests/invalid/errors.err_exp:
Expect the expanded wording of a warning message.
tests/invalid/foreign_enum_invalid.err_exp:
Expect a different wording for an error message. It is more "standard"
but slightly less informative.
tests/invalid_submodules/children2.m:
Move a badly placed import_module declaration, to avoid having
the message the compiler now generates for it from affecting the test.
tests/submodules/parent2.m:
Move a badly placed import_module declaration, to avoid having
the message the compiler now generates for it from affecting the test.
Update programming style.
|
||
|
|
d465fa53cb |
Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
|
||
|
|
1a778114db |
Fix more warnings from --warn-inconsistent-pred-order-clauses.
mdbcomp/builtin_modules.m:
mdbcomp/feedback.automatic_parallelism.m:
mdbcomp/feedback.m:
mdbcomp/mdbcomp.goal_path.m:
mdbcomp/mer_mdbcomp.m:
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/sym_name.m:
mdbcomp/trace_counts.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
Move one predicate that is needed in two modules from one of them
to a third module (prim_data.m), since that is the one that defines
the type for which the predicate is a utility predicate.
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
mdbcomp/MDBCOMP_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
|
||
|
|
c6ab550db8 |
Remove the code for automatic initialization of solver vars.
We haven't supported it in years, and keeping it in the compiler
is just a maintenance burden and a performance problem.
mdbcomp/prim_data.m:
Delete the spec_pred_init functor, since we don't support special
"init" predicates anymore.
compiler/prog_data.m:
Delete the slot in solver type details that record the name of the
auto-initialization predicate.
compiler/prog_io_type_defn.m:
Don't allow a type definition to specify an auto-initialization predicate.
compiler/options.m:
compiler/globals.m:
Delete the option that allowed support for auto-initialization to be
turned back on.
compiler/inst_match.m:
compiler/inst_util.m:
Delete comments about auto-initialization.
compiler/mode_info.m:
Delete the record of whether we have variables that can be
auto-initialized (we never do anymore) and the flag that controls whether
auto-initialization is permitted or not.
compiler/modecheck_conj.m:
Simplify the code that modechecks conjunctions, since it no longer
has to figure out where to insert auto-initializations of solver vars.
compiler/modecheck_goal.m:
Delete the code that ensured that if one branch of a branched
control structure auto-initialized a solver variable, then they
all did.
compiler/modecheck_unify.m:
Don't auto-initializate variables before unifications.
compiler/modecheck_util.m:
Delete the code that auto-initialized solver variables at the ends
of procedure bodies if this needed to be done and wasn't done before.
compiler/add_special_pred.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/modecheck_call.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/post_term_analysis.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/term_constr_errors.m:
compiler/term_constr_initial.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_util.m:
compiler/unify_proc.m:
Delete code that handled stuff related to auto-initialization,
and now always take the path that would normally be taken in the
absence of auto-initialization.
deep_profiler/read_profile.m:
runtime/mercury_layout_util.c:
runtime/mercury_stack_trace.c:
util/mdemangle.c:
Remove code that recognized the compiler-generated name of initialization
predicates.
tests/debugger/solver_test.m:
tests/hard_coded/solver_construction_init_test.m:
tests/hard_coded/solver_disj_inits.m:
tests/hard_coded/solver_ite_inits.m:
tests/invalid/missing_init_pred.m:
tests/invalid/zinc2mer_lib.m:
tests/valid/fz_conf.m:
tests/valid/solver_type_bug_2.m:
tests/valid/solver_type_mutable_bug.m:
These tests tested the handling of auto-initialization, which we
no longer support. Keep them around (and a bit more visible than
inside the git repo) in case we need them again, but add a comment
to each saying that the test is disabled.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Disable those tests.
tests/warnings/non_term_user_special.{m,exp}:
Part of this test tested the handling of auto-initialization;
delete that part.
tests/warnings/Mercury.options:
Delete the flag required by the deleted part, since we don't support it
anymore.
|
||
|
|
500948d549 |
Break up mdbcomp/prim_data.m. The new modules have much better cohesion.
mdbcomp/sym_name.m:
New module, containing the part of the old prim_data.m that
dealt with sym_names.
mdbcomp/builtin_modules.m:
New module, containing the part of the old prim_data.m that
dealt with builtin modules.
mdbcomp/prim_data.m:
Remove the things that are now in the two new modules.
mdbcomp/mdbcomp.m:
deep_proiler/Mmakefile:
slice/Mmakefile:
Add the two new modules.
browser/*.m:
compiler/*.m:
deep_proiler/*.m:
mdbcomp/*.m:
slice/*.m:
Conform to the above changes.
|
||
|
|
000fa27bbb |
Report errors for bad :- end_module declarations.
Until this diff, the compiler used to crash on such inputs, as mentioned
by Mantis bugs 41, 62 and 268.
compiler/prog_io.m:
When reading in :- module and :- end_module items, we used to blindly
believe what they said. We now check whether they make sense, and report
a fatal error if they don't. Specifically,
- if the name of the module started by a :- module declaration is
qualified, that qualification has to match the name of the
previously-current module, and
- the name of the module ended by a :- end_module declaration
has to match the name of the previously-current module.
Simplify the code we used to use to remove the :- module/:- end_module
wrappers around the top level module. The root of the problem used
to be that this code used to let a malformed item list through to be
processed by later compiler passes, which did not expect it.
The reason WHY it let through malformed item lists seems to be
the loosening of the checks in this code, more than a decade ago.
This was done to account for the possibility that the final :- end_module
in a file's item list is for a submodule of the main module, and not
for the main module itself.
Simplify the code for reading in the whole item list. Previously
this was done by two mutually-recursive predicates, one of which
read in a term for the next item and one which had the term handed
to it by its caller. We now handle the two cases (one of which is
needed only by the special handling required by the first item)
in one self-recursive predicate with a maybe argument.
mdbcomp/prim_data.m:
Add a utility predicate for use by the new code in prog_io.m.
Remove a comment on code that duplicates the code on the declaration.
compiler/modules.m:
Improve some code that handles lists of items.
- Make some previously not-tail-recursive predicates tail recursive.
- Give some predicates and variables more meaningful names.
- Combine some checks where this allows us to reduce the number of
traversals over the item list.
doc/reference_manual.texi:
Fix bad punctuation, and expand the list of things
that can be declared but not defined.
tests/invalid/bad_end_module.{m,err_exp}:
Test the expected output.
tests/invalid/Mmakefile:
Enable the new test case.
tests/hard_coded/sub-module/g12_fe_bug.m:
Fix a typo in a comment.
|
||
|
|
2d0bfc0674 |
The algorithm that decides whether the order independent state update
Estimated hours taken: 120 Branches: main The algorithm that decides whether the order independent state update transformation is applicable in a given module needs access to the list of oisu pragmas in that module, and to information about the types of variables in the procedures named in those pragmas. This diff puts this information in Deep.procrep files, to make them available to the autoparallelization feedback program, to which that algorithm will later be added. Compilers that have this diff will generate Deep.procrep files in a new, slightly different format, but the deep profiler will be able to read Deep.procrep files not just in the new format, but in the old format as well. runtime/mercury_stack_layout.h: Add to module layout structures the fields holding the new information we want to put into Deep.procrep files. This means three things: - a bytecode array in module layout structures encoding the list of oisu pragmas in the module; - additions to the bytecode arrays in procedure layout structures mapping the procedure's variables to their types; and - a bytecode array containing the encoded versions of those types themselves in the module layout structure. This allows us to represent each type used in the module just once. Since there is now information in module layout structures that is needed only for deep profiling, as well as information that is needed only for debugging, the old arrangement that split a module's information between two structures, MR_ModuleLayout (debug specific info) and MR_ModuleCommonLayout (info used by both debugging and profiling), is no longer approriate. We could add a third structure containing profiling-specific info, but it is simpler to move all the info into just one structure, some of whose fields may not be used. This wastes only a few words of memory per module, but allows the runtime system to avoid unnecessary indirections. runtime/mercury_types.h: Remove the type synonym for the deleted type. runtime/mercury_grade.h: The change in mercury_stack_layout.h destroys binary compatibility with previous versions of Mercury for debug and deep profiling grades, so bump their grade-component-specific version numbers. runtime/mercury_deep_profiling.c: Write out the information in the new fields in module layout structures, if they are filled in. Since this changes the format of the Deep.procrep file, bump its version number. runtime/mercury_deep_profiling.h: runtime/mercury_stack_layout.c: Conform to the change to mercury_stack_layout.h. mdbcomp/program_representation.m: Add to module representations information about the oisu pragmas defined in that module, and the type table of the module. Optionally add to procedure representations a map mapping the variables of the procedure to their types. Rename the old var_table type to be the var_name_table type, since it contains just names. Make the var to type map separate, since it will be there only for selected procedures. Modify the predicates reading in module and procedure representations to allow them to read in the new representation, while still accepting the old one. Use the version number in the Deep.procrep file to decide which format to expect. mdbcomp/rtti_access.m: Add functions to encode the data representations that this module also decodes. Conform to the changes above. mdbcomp/feedback.automatic_parallelism.m: Conform the changes above. mdbcomp/prim_data.m: Fix layout. compiler/layout.m: Update the compiler's representation of layout structures to conform to the change to runtime/mercury_stack_layout.h. compiler/layout_out.m: Output the new parts of module layout structures. compiler/opt_debug.m: Allow the debugging of code referring to the new parts of module layout structures. compiler/llds_out_file.m: Conform to the move to a single module layout structure. compiler/prog_rep_tables.m: This new module provided mechanisms for building the string table and the type table components of module layouts. The string table part is old (it is moved here from stack_layout.m); the type table part is new. Putting this code in a module of its own allows us to remove a circular dependency between prog_rep.m and stack_layout.m; instead, both now just depend on prog_rep_tables.m. compiler/ll_backend.m: Add the new module. compiler/notes/compiler_design.html: Describe the new module. compiler/prog_rep.m: When generating the representation of a module for deep profiling, include the information needed by the order independent state update analysis: the list of oisu pragmas in the module, if any, and information about the types of variables in selected procedures. To avoid having these additions increasing the size of the bytecode representation too much, convert some fixed 32 bit numbers in the bytecode to use variable sized numbers, which will usually be 8 or 16 bits. Do not use predicates from bytecode_gen.m to encode numbers, since there is nothing keeping these in sync with the code that reads them in mdbcomp/program_representation.m. Instead, use new predicates in program_representation.m itself. compiler/stack_layout.m: Generate the new parts of module layouts. Remove the code moved to prog_rep_tables.m. compiler/continuation_info.m: compiler/proc_gen.m: Make some more information available to stack_layout.m. compiler/prog_data.m: Fix some formatting. compiler/introduce_parallelism.m: Conform to the renaming of the var_table type. compiler/follow_code.m: Fix the bug that used to cause the failure of the hard_coded/mode_check_clauses test case in deep profiling grades. deep_profiler/program_representation_utils.m: Output the new parts of module and procedure representations, to allow the correctness of this change to be tested. deep_profiler/mdprof_create_feedback.m: If we cannot read the Deep.procrep file, print a single error message and exit, instead of continuing with an analysis that will generate a whole bunch of error messages, one for each attempt to access a procedure's representation. deep_profiler/mdprof_procrep.m: Give this program an option that specifies what file it is to look at; do not hardwire in "Deep.procrep" in the current directory. deep_profiler/report.m: Add a report type that just prints the representation of a module. It returns the same information as mdprof_procrep, but from within the deep profiler, which can be more convenient. deep_profiler/create_report.m: deep_profiler/display_report.m: Respectively create and display the new report type. deep_profiler/query.m: Recognize a query asking for the new report type. deep_profiler/autopar_calc_overlap.m: deep_profiler/autopar_find_best_par.m: deep_profiler/autopar_reports.m: deep_profiler/autopar_search_callgraph.m: deep_profiler/autopar_search_goals.m: deep_profiler/autopar_types.m: deep_profiler/branch_and_bound.m: deep_profiler/coverage.m: deep_profiler/display.m: deep_profiler/html_format.m: deep_profiler/mdprof_test.m: deep_profiler/measurements.m: deep_profiler/query.m: deep_profiler/read_profile.m: deep_profiler/recursion_patterns.m: deep_profiler/top_procs.m: deep_profiler/top_procs.m: Conform to the changes above. Fix layout. tests/debugger/declarative/dependency.exp2: Add this file as a possible expected output. It contains the new field added to module representations. |
||
|
|
ee63cb8d84 |
Heavily polymorphic code, such as that generated by g12, often builds the same
Estimated hours taken: 80 Branches: main Heavily polymorphic code, such as that generated by g12, often builds the same typeinfos and typeclass infos over and over again. We have long had caches that avoid building a new typeinfo or typeclass info if some variable in the current scope already contains the right value, but a program that has many scopes may still build the same typeinfo or typeclass info many times. If that typeinfo or typeclass info is a ground term, the code generators will recognize that fact, and will turn all the constructions of that ground term in different scopes into referencess to the same constant structure. However, in the meantime, the program can be much bigger than necessary. In the motivating test case for this change, a single call to fdic_post is preceded by 133 goals that build the four typeclass infos it needs. The main idea of this diff is to construct constant typeinfos and typeclass infos out of line, in a separate data structure. Polymorphism then binds variables representing typeinfo and typeclass infos to reference to these constant structures. In the motivating example, this allows polymorphism.m to insert just four goals before the call to fdic_post, the minimal possible number: one for each typeclass info that predicate needs. On Leslie's bug344 program, this change speeds up the compiler by a factor of five to eight (reducing compile time from about 80 or 85 seconds to 10 or 15). There is a drawback to this scheme, but it is minor. That drawback is that once a constant structure is entered into our database of constant structures, it cannot (yet) be removed. Even if all the references to a constant structure are eliminated by optimizations, the structure will remain. ------------------------------------------ CHANGES IN THE FRONT END compiler/const_struct.m: A new module to look after our new database of constant structures. Currently, its use is enable only on the LLDS and MLDS C backends. compiler/hlds.m: compiler/notes/compiler_design.html: Add the new module to the HLDS package. compiler/hlds_module.m: Include the constant structure database in the module_info. compiler/hlds_data.m: Add two new cons_ids, which refer to typeinfos and typeclass infos implemented as constant structures. Move the code for calculating the number of extra instance args in base_typeclass_infos here from base_typeclass_info.m, since polymorphism.m now needs it too. We can now also eliminate the duplicate copy of that code in higher_order.m. Make an independent optimization: make the restrict_list_elements function more efficient by avoiding redundant tests. compiler/polymorphism.m: When building typeinfo and typeclass infos, keep track of whether the structure being built is constant. If it is, then put it in the database of constant structures, and replace the code building it with a simple reference to that new entry. Since I now expect most goal sequences inserted before goals to be short, consistent use lists of goals to represent these, since the costs of conversions to and from cord form are unlikely to be paid back by the higher efficiency of cord operations on longer sequences. When we want to get the typeclass info of a superclass out of the typeclass info of a subclass, if the typeclass info of the subclass is known, do the extraction here. We used to do this optimization only in higher_order.m, but doing so here reduces the size of the HLDS between polymorphism.m and higher_order.m, and thus improves compilation time. Reorganize some of the structure of this module to make the above changes possible. In particular, our new approach requires making snapshots of the varsets and vartypes, and later restoring those snapshots if the variables allocated turn out to be unnecessary, due to all of them describing the components of a constant structure. The correctness of such code is much easier to check if the taking and restoring of each snapshot takes places in a single predicate. Remove the code moved to higher_order.m. Add some debugging code for now. If no issues arise in the next few weeks, it can be deleted. compiler/modecheck_unify.m: Treat unifications whose right hand side has a cons_id referring to a constant structure specially. compiler/base_typeclass_info.m: Replace the code that is now in num_extra_instance_args with a call to that predicate. Put the arguments of some predicates in a more logical order. compiler/higher_order.m: When looking up the components of existing typeclass infos, handle cases where those typeclass infos are constant structures. Give some types, fields and variables better names. Avoid a redundant map search. Avoid some redundant tests by providing separate predicates to handle higher order calls and method calls. Move the predicate is_typeclass_info_manipulator here from polymorphism.m, since this is the only module that uses that predicate. ------------------------------------------ CHANGES IN THE LLDS BACKEND: compiler/llds.m: Add a type to map constant structure numbers to rvals together with their LLDS types. Introduce a type to represent rvals together with their LLDS types. compiler/mercury_compile_llds_back_end.m: Before we generate code for the predicates of the module, convert the constant structures to typed LLDS rvals. Create a map mapping each constant structure number to the corresponding typed rvals. compiler/proc_gen.m: Take that map, and put it into the code_info, to allow references to those structures to be translated. Put the arguments of some predicates into a more logical order. compiler/code_info.m: Include a map giving the representation of each constant structure in the code_info. compiler/unify_gen.m: Add the predicates needed to convert the constant structures of a module to LLDS rvals. For now, this code works only on the kinds of constant structures generated by polymorphism.m. Handle unifications whose right hand side is a reference to a constant structure. compiler/global_data.m: compiler/stack_layout.m: Use the new typed_rval type where relevant. ------------------------------------------ CHANGES IN THE MLDS BACKEND: compiler/ml_proc_gen.m: Before we generate code for the predicates of the module, convert the constant structures to typed MLDS rvals. Create a map mapping each constant structure number to the corresponding typed rvals. Factor out some code into a predicate of its own. compiler/ml_gen_info.m: Include a map giving the representation of each constant structure in the ml_gen_info. Also add to the ml_gen_info an indication of what GC system we are generating code for, since the code generator needs to know this often. compiler/ml_unify_gen.m: Add the predicates needed to convert the constant structures of a module to MLDS rvals. For now, this code works only on the kinds of constant structures generated by polymorphism.m. Handle unifications whose right hand side is a reference to a constant structure. Simplify some existing code. ------------------------------------------ MINOR CHANGES: mdbcomp/prim_data.m: Add a predicate that gets both the module name and the base name from a sym_name at the same time. This is used for minor speedups in other code updated in this diff. compiler/dead_proc_elim.m: Scan constant structures for references to entities that need to be kept alive. compiler/term_constr_build.m: compiler/term_traversal.m: Do not build size constraints from references to constant structures. The sizes of constant terms don't change, so they are irrelevant when building constraints for finding argument size changes. ------------------------------------------ TRIVIAL CHANGES TO CONFORM TO OTHER CHANGES: compiler/hlds_out_module.m: Print out the constant structure database if asked. doc/user_guide.tex: Document how to ask for it. compiler/hlds_out_util.m: Print out the new cons_ids. compiler/hlds_out_mode.m: Print out the new cons_ids in insts. Remove a compiler abort, to help debug a problem. Improve the structure of a predicate. compiler/hlds_out_goal.m: Fix some missing newlines. compiler/hlds_code_util.m: Add some utility predicates needed by the modules above. Conform to the changes above. compiler/mlds_to_il.m: Reorder some predicates. Conform to the changes above. compiler/bytecode_gen.m: compiler/ctgc.selector.m: compiler/dependency_graph.m: compiler/erl_unify_gen.m: compiler/export.m: compiler/implementation_defined_literals.m: compiler/inst_check.m: compiler/llds_out_globals.m: compiler/mercury_to_mercury.m: compiler/ml_global_data.m: compiler/ml_switch_gen.m: compiler/ml_type_gen.m: compiler/module_qual.m: compiler/prog_rep.m: compiler/prog_type.m: compiler/prog_util.m: compiler/rbmm.execution_path.m: compiler/switch_gen.m: compiler/switch_util.m: compiler/type_ctor_info.m: compiler/unused_imports.m: compiler/var_locn.m: compiler/xml_documentation.m: Conform to the changes above. ------------------------------------------ OTHER INDEPENDENT CHANGES: compiler/handle_options.m: Add a dump option that is useful for debugging when working on polymorphism.m and constant structures. compiler/equiv_type_hlds.m: Fix an old performance bug: make the code handling try goals keep the old memory cells representing such goals, instead of rebuilding them, if no changes took place inside them. compiler/ml_accurate_gc.m: Move a test earlier, to allow us to avoid more work in the common case. compiler/erl_code_gen.m: compiler/error_util.m: compiler/hhf.m: compiler/inst_util.m: compiler/ml_code_util.m: compiler/ml_util.m: compiler/mlds_to_c.m: compiler/modecheck_call.m: compiler/modecheck_util.m: compiler/post_typecheck.m: compiler/size_prof.m: compiler/stack_opt.m: compiler/stratify.m: compiler/unused_args.m: compiler/post_type_analysis.m: library/erland_rtti_implementation.m: Minor cleanups. ------------------------------------------ CHANGES TO THE TEST SUITE: tests/invalid/any_passed_as_ground.err_exp2: tests/invalid/invalid_default_func_1.err_exp2: tests/invalid/invalid_default_func_3.err_exp2: tests/invalid/try_detism.err_exp2: Add second expected output files for these tests. We need alternate expected outputs because the numbers of some of the typeinfo variables mentioned in error message are different depending on whether or not const structures are enabled. |
||
|
|
0d1ac0f053 |
Prevent not just the deep profiler, but also the other programs in the
Estimated hours taken: 1 Branches: main Prevent not just the deep profiler, but also the other programs in the Mercury system from running out of stack in hlc grades. mdbcomp/shared_utilities.m: A new module to contain the predicate that increases OS limits on stack usage as much as possible. mdbcomp/mdbcomp.m: Include the new module in this package. deep_profiler/startup.m: Remove the stack unlimit predicate that is now in mdbcomp/shared_utilities.m. deep_profiler/Mmakefile: slice/Mmakefile: Copy the new file over from mdbcomp, along with the rest of the files in the mdbcomp package. compiler/mercury_compile.m: slice/mcov.m: slice/mdice.m: slice/mslice.m: slice/mtc_diff.m: slice/mtc_union.m: Invoke the stack unlimit predicate. mdbcomp/prim_data.m: Fix a missing divider. |
||
|
|
a83aad6681 |
Remove references to nondet foreign_proc from the definition of the data
Estimated hours taken: 2 Branches: main Remove references to nondet foreign_proc from the definition of the data structures that define stack layouts. runtime/mercury_stack_layout.h: Remove the trace ports that could occur in nondet foreign_procs from the definition of the trace port type used in C code. mdbcomp/prim_data.m: Remove the trace ports that could occur in nondet foreign_procs from the definition of the trace port type used in Mercury code. compiler/layout_out.m: compiler/stack_layout.m: compiler/trace_params.m: mdbcomp/trace_counts.m: runtime/mercury_trace_base.h: trace/mercury_trace_declarative.h: Delete references to those ports. runtime/mercury_stack_layout.h: Update the binary compatibility version number for debuggable executables, since the port number of user events has changed. |
||
|
|
1241e44a16 |
Mark rtti_implementation.semidet_call_* and result_call_* as builtin predicates
Branches: main, 10.04
Mark rtti_implementation.semidet_call_* and result_call_* as builtin predicates
which don't require typeinfo arguments to be passed. This specifically
improves the implementation of generic_unify and generic_compare on the Java
backend.
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
As above.
library/rtti_implementation.m:
Add a comment.
|
||
|
|
02f9532cc1 |
Optimize calls to formatting functions and predicates such as
Estimated hours taken: 16
Branches: main
Optimize calls to formatting functions and predicates such as
Str = string.format("%s_%d", [s(Prefix), i(Num)])
into
V1 = string.int_to_string(Num),
V2 = "_" ++ V1,
Str = Prefix ++ V2
essentially interpreting the format string at compile time rather than runtime.
At the moment, the optimization applies to calls to string.format/3,
io.format/3 and io.format/4, and only in the case where the format specifiers
are just "%c", "%d", or "%s", with no widths, precisions etc, though
that could be changed relatively easily, though at the cost of coupling
the compiler more tightly to the implementation of library/string.m.
(We don't handle %f, because float_to_string(F) yields a different string
than string.format("%f", [f(F)]). The former yields e.g. "1.23", while the
latter yields "1.23000".)
compiler/format_call.m:
Change the code that looks for malformed calls to formatting predicates
to also look for well-formed, optimizable calls, and to transform them
as shown above.
mdbcomp/prim_data.m:
List the standard library's string module here, since the compiler now
needs to know what its name is (it generates calls to its predicates).
compiler/options.m:
doc/user_guide.texi:
Add a new option, --optimize-format-calls, that calls for this
optimization. Make it enabled by default.
compiler/simplify.m:
Since the transformation in format_call.m will typically introduce
nested conjunctions, we now do it before the rest of the
simplifications. We also invoke the fixups needed by the output
of format_call.m if it actually optimized any code.
Delete the code that used to record whether the procedure has any
format calls, since it now comes too late.
Decide once, when setting up for processing a procedure, whether
we want to invoke format_call.m if appropriate, instead of doing it
later. This allows us to reduce the size of the simplications
data structure we pass around.
Protect the predicates that format_call.m can generate calls to
from being deleted by dead_pred_elim before the simplification pass.
compiler/det_analysis.m:
Since simplify.m itself cannot record early enough whether a given
procedure body contains calls to formatting predicates, do it here.
compiler/det_info.m:
Add a new field to the det_info that records whether we have seen
a call to a formatting predicate.
Add another field to the det_info that records the list of errors
we have found so far, so that we can stop passing it around separately.
compiler/hlds_pred.m:
Add a marker that allows det_analysis.m to record its conclusions.
compiler/hlds_goal.m:
Add utility predicate.
compiler/goal_util.m:
Make the predicates for creating new plain calls (and, for the sake of
uniformity, calls to foreign code) take instmap_deltas, such as those
created by the new utility functions in instmap.m. This allows these
predicates' caller to avoid creating unnecessary intermediate data
structures.
compiler/instmap.m:
Make an existing predicate into a function to allow it to be used
more flexibly.
Move some utility functions for creating instmap_deltas here from
table_gen.m, so that they can be used by other modules.
compiler/liveness.m:
Delete an unused predicate.
compiler/accumulator.m:
compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
compiler/builtin_lib_types.m:
compiler/common.m:
compiler/complexity.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/det_report.m:
compiler/distance_granularity.m:
compiler/granularity.m:
compiler/higher_order.m:
compiler/hlds_out.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/pd_util.m:
compiler/prog_type.m:
compiler/purity.m:
compiler/rbmm.region_transformation.m:
compiler/size_prof.m:
compiler/ssdebug.m:
compiler/table_gen.m:
compiler/try_expand.m:
compiler/typecheck.m:
compiler/unify_proc.m:
Conform to the changes above.
compiler/stm_expand.m:
Conform to the changes above. Also, build pairs by using "-" directly
as the function symbol, instead of this module's old practice
of doing it the slow way by calling the "pair" function.
tests/general/string_format_lib.m:
Cleanup the style of the code of this test case.
tests/hard_coded/opt_format.{m,exp}:
New test case to exercise the behavior of format_call.m's
transformation.
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
Enable the new test case.
|
||
|
|
d69ba1a1f0 |
Include the type_ctor in cons_ids for user-defined types.
Estimated hours taken: 32 Branches: main Include the type_ctor in cons_ids for user-defined types. The intention is two-fold: - It prepares for a future in which we allow more than one function symbol to with the same name to be defined in a module. - It makes the HLDS code more self-contained. In many places, processing construction and deconstruction unifications required knowing which type the cons_id belongs to, but until now, code couldn't know that unless it kept track of the type of the variable unified with the cons_id. With this diff, user-defined cons_ids are represented as cons(SymName, Arity, TypeCtor) The last field is filled in during post-typecheck. After that time, any module qualification in the SymName (which may initially be partial) is redundant, since it is also available in the TypeCtor. In the future, we could make all those SymNames be just unqualified(_) at that time. We could also replace the current maps in HLDS type definitions with full cons_id keys with just name/arity keys (since the module qualifier is a given for any given type definition), we could also support partially qualified cons_ids in source code using a map from name/arity pairs to a list of all the type_ctors that have function symbols with that name/arity, instead of our current practice of inserting all possible partially module qualified version of every cons_id into a single giant table, and we could do the same thing with the field names table. This diff also separates tuples out from user-defined types, since in many respects they are different (they don't have a single type_ctor, for starters). It also separates out character constants, since they were alreay treated specially in most places, though not in some places where they *ought* to have been treated specially. Take the opportunity to give some other cons_ids better names. compiler/prog_data.m: Make the change described above, and document it. Put the implementations of the predicates declared in each part of this module next to the declarations, instead of keeping all the code until the very end (where it was usually far from their declarations). Remove three predicates with identical definitions from inst_match.m, inst_util.m and mode_constraints.m, and put the common definition in prog_data.m. library/term_io.m: Add a new predicate that is basically a reversible version of the existing function espaced_char, since the definition of char_consts needs reversibilty. compiler/post_typecheck.m: For functors of user-defined types, record their type_ctor. For tuples and char constants, record them as such. compiler/builtin_lib_types.m: compiler/parse_tree.m: compiler/notes/compiler_design.html: New module to centralize knowledge about builtin types, specially handled library types, and their function symbols. Previously, the stuff now in this module used to be in several different places, including prog_type.m and stm_expand.m, and some of it was duplicated. mdbcomp/prim_data.m: Add some predicates now needed by builtin_lib_types.m. compiler/builtin_ops.m: Factor out some duplicated code. compiler/add_type.m: Include the relevant type_ctors in the cons_ids generated in type definitions. compiler/hlds_data.m: Document an existing type better. Rename a cons_tag in sync with its corresponding cons_id. Put some declarations into logical order. compiler/hlds_out.m: Rename a misleadingly-named predicate. compiler/prog_ctgc.m: compiler/term_constr_build.m: Add XXXs for questionable existing code. compiler/add_clause.m: compiler/add_heap_ops.m: compiler/add_pragma.m: compiler/add_pred.m: compiler/add_trail_ops.m: compiler/assertion.m: compiler/bytecode_gen.m: compiler/closure_analysis.m: compiler/code_info.m: compiler/complexity.m: compiler/ctgc_selector.m: compiler/dead_proc_elim.m: compiler/deep_profiling.m: compiler/delay_partial_inst.m: compiler/dependency_graph.m: compiler/det_analysis.m: compiler/det_report.m: compiler/distance_granularity.m: compiler/erl_rtti.m: compiler/erl_unify_gen.m: compiler/export.m: compiler/field_access.m: compiler/foreign.m: compiler/format_call.m: compiler/hhf.m: compiler/higher_order.m: compiler/hlds_code_util.m: compiler/hlds_desc.m: compiler/hlds_goal.m: compiler/implementation_defined_literals.m: compiler/inst_check.m: compiler/inst_graph.m: compiler/inst_match.m: compiler/inst_util.m: compiler/instmap.m: compiler/intermod.m: compiler/interval.m: compiler/lambda.m: compiler/lco.m: compiler/make_tags.m: compiler/mercury_compile.m: compiler/mercury_to_mercury.m: compiler/middle_rec.m: compiler/ml_closure_gen.m: compiler/ml_code_gen.m: compiler/ml_code_util.m: compiler/ml_switch_gen.m: compiler/ml_type_gen.m: compiler/ml_unify_gen.m: compiler/ml_util.m: compiler/mlds_to_c.m: compiler/mlds_to_java.m: compiler/mode_constraints.m: compiler/mode_errors.m: compiler/mode_ordering.m: compiler/mode_util.m: compiler/modecheck_unify.m: compiler/modes.m: compiler/module_qual.m: compiler/polymorphism.m: compiler/prog_ctgc.m: compiler/prog_event.m: compiler/prog_io_util.m: compiler/prog_mode.m: compiler/prog_mutable.m: compiler/prog_out.m: compiler/prog_type.m: compiler/prog_util.m: compiler/purity.m: compiler/qual_info.m: compiler/rbmm.add_rbmm_goal_infos.m: compiler/rbmm.execution_path.m: compiler/rbmm.points_to_analysis.m: compiler/rbmm.region_transformation.m: compiler/recompilation.usage.m: compiler/rtti.m: compiler/rtti_out.m: compiler/rtti_to_mlds.m: compiler/simplify.m: compiler/simplify.m: compiler/special_pred.m: compiler/ssdebug.m: compiler/stack_opt.m: compiler/stm_expand.m: compiler/stratify.m: compiler/structure_reuse.direct.detect_garbagem: compiler/superhomoegenous.m: compiler/switch_detection.m: compiler/switch_gen.m: compiler/switch_util.m: compiler/table_gen.m: compiler/term_constr_build.m: compiler/term_norm.m: compiler/try_expand.m: compiler/type_constraints.m: compiler/type_ctor_info.m: compiler/type_util.m: compiler/typecheck.m: compiler/typecheck_errors.m: compiler/unify_gen.m: compiler/unify_proc.m: compiler/unify_modes.m: compiler/untupling.m: compiler/unused_imports.m: compiler/xml_documentation.m: Minor changes, mostly to ignore the type_ctor in cons_ids in places where it is not needed, take the type_ctor from the cons_id in places where it is more convenient, conform to the new names of some cons_ids, conform to the changes in hlds_out.m, and/or add now-needed imports of builtin_lib_types.m. In some places, the handling previously applied to cons/2 (which included tuples and character constants as well as user-defined function symbols) is now applied only to user-defined function symbols or to user-defined function symbols and tuples, as appropriate, with character constants being handled more like the other kinds of constants. In inst_match.m, rename a whole bunch of predicates to avoid ambiguities. In prog_util.m, remove two predicates that did almost nothing yet were far too easy to misuse. |
||
|
|
903a4a1f82 |
Previously, unqualified Mercury modules would result in Java classes which
Branches: main
Previously, unqualified Mercury modules would result in Java classes which
were placed in the default (unnamed) package. This is a problem as Java
doesn't allow packaged classes to import types from the unpackaged classes.
This patch gives all Java classes generated from Mercury files the "mercury."
package prefix.
mmake support for Java files is even more broken than before. It expects
Java files to be placed in the same directory but, due to the "mercury."
prefix, even classes for non-nested modules are placed in a subdirectory
called `mercury'. (The standard library can still be built with mmake using
custom rules.)
Fix creation of `.jar' files. It is not enough to package the `.class' files
that we know will be produced for each module. Nested classes generate
separate `.class' files which also need to be included.
Fix creation of the shell script that launches Java programs.
compiler/java_names.m:
Add a function to add an outermost "mercury" qualifier on module names.
Make `java_module_name' add the outermost "mercury" qualifier.
compiler/mlds_to_java.m:
Add the outermost "mercury" qualifier wherever we are writing out
a package name.
compiler/compile_target_code.m:
Fix creation of `.jar' files, as described.
Use a temporary file and @-syntax to pass the list of class files to
`jar'.
Pass `jar -C <dir> <class> -C <dir> <class> ...' as -C only affects
the argument immediately following it.
Run `jar i' to add an index to jar files.
compiler/file_names.m:
Add `get_class_dir_name' to return the directory that contains class
files.
Make `choose_file_name' work for Java files again (with package
directories) when `--use-subdirs' is disabled.
compiler/module_cmds.m:
Make `create_java_shell_script' work correctly when
`--use-grade-subdirs' is enabled, and when the main module is
packaged (as it will be).
Make Java shell scripts get the path to the class directory from $0,
and make the path to the Java interpreter overridable by an environment
variable.
Make `list_class_files_for_jar' scan the directory containing class
files, to include nested classes. Return a list of class files.
Make `list_class_files_for_jar_mmake' use `get_class_dir_name'.
library/Mmakefile:
Update hacks to build the standard library in the java grade.
mdbcomp/prim_data.m:
Delete `insert_module_qualifier' as `add_outermost_qualifier'
is equivalent.
compiler/module_qual.m:
compiler/prog_type.m:
compiler/write_deps_file.m:
Conform to changes.
|
||
|
|
bc57025e69 |
Make `mmc --make' support submodules when compiling to Java.
Branches: main
Make `mmc --make' support submodules when compiling to Java. Java files must
be placed in subdirectories named after the package that each class belongs to.
compiler/java_names.m
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Add a new module in the parse_tree package to contain code related to
name mangling for Java.
compiler/mlds.m:
compiler/java_util.m:
Move predicates to java_names.m.
compiler/mlds_to_java.m:
Move predicates to java_names.m.
Delete an unused predicate.
compiler/file_names.m:
Rename `erlang_module_name' as it is now also used for Java.
Make `module_name_to_file_name_general' return file names for `.java'
and `.class' files that include package subdirectories.
compiler/make.program_target.m:
Clean `.class' files on make clean.
compiler/mlds_to_il.m:
mdbcomp/prim_data.m:
Move `sym_name_to_list' to mdbcomp.prim_data.
compiler/compile_target_code.m:
compiler/elds_to_erlang.m:
Conform to changes.
library/Mmakefile:
Delete hacks that work around Mercury not writing submodule .java files
in subdirectories.
|
||
|
|
53286dd4bf |
Implement a new compiler option, --exec-trace-tail-rec, that preserves direct
Estimated hours taken: 30
Branches: main
Implement a new compiler option, --exec-trace-tail-rec, that preserves direct
tail recursion in det and semidet procedures even when debugging is enabled.
This should allow the debugging of programs that previously ran out of stack.
The problem arose because even a directly tail-recursive call had some code
after it: the code for the EXIT event, like this:
p:
incr_sp
fill in the usual debug slots
CALL EVENT
...
/* tail call */
move arguments to registers as usual
call p, return to p_ret
p_ret:
/* code to move output arguments to right registers is empty */
EXIT EVENT
decr_sp
return
If the new option is enabled, the compiler will now generate code like this:
p:
incr_sp
fill in the usual debug slots
fill in new "stack frame reuse count" slot with 0
CALL EVENT
p_1:
...
/* tail call */
move arguments to registers as usual
update the usual debug slots
increment the "stack frame reuse count" slot
TAILCALL EVENT
goto p_1
The new TAIL event takes place in the caller's stack frame, so that the local
variables of the caller are available. This includes the arguments of the
recursive call (though if they are unnamed variables, the debugger will not
show them). The TAIL event serves as a replacement for the CALL event
of the recursive invocation.
compiler/options.m:
Add the new option.
compiler/handle_options.m:
Handle an implication of the new option: the declarative debugger
does not (yet) understand TAIL events.
compiler/mark_tail_calls.m:
New module to mark directly tail recursive calls and the procedures
containing them as such.
compiler/hlds.m:
compiler/notes/compiler_design.html:
Mention the new module.
compiler/mercury_compile.m:
Invoke the new module when the new option asks us to.
compiler/hlds_goal.m:
Add the feature used to mark tail recursive calls for the debugger.
Rename an existing feature with a similar but not identical purpose
to avoid possible confusion.
compiler/hlds_pred.m:
Add a field to proc_infos that says whether the procedure contains
tail recursive calls.
Minor style improvements.
compiler/passes_aux.m:
Minor change to accommodate the needs of the new module.
compiler/code_info.m:
Transmit the information from mark_tail_calls to the code generator.
compiler/call_gen.m:
Implement the new option.
compiler/trace_gen.m:
Reserve the extra slot needed for the new option.
Switch to state variable notation in the code that does the slot
allocation, since this is less error-prone than the previous approach.
compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
Remember what stack slot holds the stack frame reuse counter,
for transmission to the runtime system.
compiler/proc_gen.m:
Add the new label needed for tail recursion.
Put the arguments of some procedures into a more logical order.
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/saved_vars.m:
compiler/table_gen.m:
Conform to the changes above.
compiler/trace_params.m:
mdbcomp/prim_data.m:
runtime/mercury_trace_base.[ch]:
Add the new event type.
Convert mercury_trace_base.h to four-space indentation.
runtime/mercury_stack_layout.h:
Add a field to the execution trace information we have for each
procedure that gives the number of the stack slot (if any) that holds
the stack frame reuse counter. Add a macro to get the value in the
counter.
Convert this header file to four-space indentation.
runtime/mercury_stack_trace.[ch]:
When walking the stack, we now have to be prepared to encounter stack
frames that have been reused. Modify the algorithms in this module
accordingly, and modify the interfaces of the exported functions
to allow the functions' callers to behave accordingly as well.
Group the information we gather about stack frame for printing into
one structure, and document it.
Convert the header to four-space indentation.
library/exception.m:
mdbcomp/trace_counts.m:
Conform to the changes above.
In trace_counts.m, fix an apparent cut-and-paste error (that hasn't
caused any test case failures yet).
trace/mercury_trace.c:
Modify the implementation of the "next" and "finish" commands
to accommodate the possibility that the procedure at the selected
depth may have had its stack frame reused. In such cases
tests/debugger/tailrec1.{m,inp,exp,data}:
A new test case to check the handling of tail recursive procedures.
|
||
|
|
ae8ac6d9dd |
Convert the predicates that transform sym_names from clauses to
Estimated hours taken: 0.5 Branches: main mdbcomp/prim_data.m: Convert the predicates that transform sym_names from clauses to explicit disjunctions, since this makes it easier to see what they do (in particular, what they do that is the same and what they do that is different between predicates). |
||
|
|
03035ad2e6 |
Convert Paul's new code to use cords of strings to represent HTML.
Estimated hours taken: 6 Branches: main Convert Paul's new code to use cords of strings to represent HTML. deep_profiler/html_format.m: Convert to using cords. Restructure the code in a couple of places to always put start and end tags around HTML fragments together. Fix a missing "=" in a tag. deep_profiler/interface.m: deep_profiler/mdprof_cgi.m: deep_profiler/read_profile.m: Provide better diagnostics. deep_profiler/create_report.m: deep_profiler/display.m: deep_profiler/display_report.m: deep_profiler/mdprof_feedback.m: deep_profiler/measurement_units.m: deep_profiler/query.m: deep_profiler/report.m: mdbcomp/feedback.m: Misc cleanups. They can be considered my post-commit review of Paul's diff. In mdprof_feedback.m, delete a strange test that prevented the program from being used from the command line. deep_profiler/dump.m: deep_profiler/mdprof_dump.m: deep_profiler/timeout.m: deep_profiler/util.m: Misc cleanups of old code. |
||
|
|
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. |
||
|
|
b000cb322e |
Provide compiler support for Software Transactional Memory through the new
Estimated hours taken: 80 by zs, and lots more by lmika Branches: main Provide compiler support for Software Transactional Memory through the new atomic goal. This work was done by Leon Mika; I merely brought it up to date, resolved conflicts, and cleaned up a few things. There are still several aspects that are as yet incomplete. library/ops.m: Add the operators needed for the syntax of atomic scopes. library/stm_builtin.m: Add the builtin operations needed for the implementation of atomic goals. compiler/hlds_goal.m: Add a new HLDS goal type, which represents an atomic goal and its possible fallbacks (in case an earlier goal throws an exception). Rename the predicate goal_is_atomic as goal_expr_has_subgoals, since now its old name would be misleading. compiler/prog_data.m: compiler/prog_item.m: Add a parse tree representation of the new kind of goal. compiler/prog_io_goal.m: Parse the new kind of goal. compiler/add_clause.m: Translate atomic goals from parse tree form to HLDS. compiler/typecheck.m: compiler/typecheck_errors.m: Do type checking of atomic goals. compiler/modes.m: Do mode checking of atomic goals, and determine whether they are nested or not. compiler/unique_modes.m: Do unique mode checking of atomic goals. compiler/stm_expand.m: New module to expand atomic goals into sequences of simpler goals. library/stm_builtin.m: Add the primitives needed by the transformation. Improve the existing debugging support. mdbcomp/prim_data.m: Add utility functions to allow stm_expand.m to refer to modules in the library. mdbcomp/program_representation.m: Expand the goal_path type to allow the representation of components of atomic goals. compiler/notes/compiler_design.html: Document the new module. compiler/transform_hlds.m: Include the new module in the compiler. compiler/mercury_compile.m: Invoke the STM transformation. compiler/hlds_module.m: Add an auxiliary counter used by the STM transformation. compiler/hlds_pred.m: Add a new predicate origin: the STM transformation. compiler/modules.m: Import the STM builtin module automatically if the module contains any atomic goals. compiler/assertion.m: compiler/bytecode_gen.m: compiler/clause_to_proc.m: compiler/code_gen.m: compiler/code_info.m: compiler/code_util.m: compiler/constraint.m: compiler/cse_detection.m: compiler/deep_profiling.m: compiler/code_util.m: compiler/delay_construct.m: compiler/delay_partial_inst.m: compiler/dep_par_conj.m: compiler/dependency_graph.m: compiler/det_analysis.m: compiler/det_report.m: compiler/distance_granularity.m: compiler/equiv_type_hlds.m: compiler/erl_code_gen.m: compiler/exception_analysis.m: compiler/follow_code.m: compiler/format_call.m: compiler/goal_form.m: compiler/goal_path.m: compiler/goal_util.m: compiler/granularity.m: compiler/hlds_out.m: compiler/implicit_parallelism.m: compiler/inlining.m: compiler/intermod.m: compiler/lambda.m: compiler/layout_out.m: compiler/lco.m: compiler/lookup_switch.m: compiler/make_hlds_warn.m: compiler/mark_static_terms.m: compiler/mercury_to_mercury.m: compiler/middle_rec.m: compiler/ml_code_gen.m: compiler/mode_constraint_robdd.m: compiler/mode_constraints.m: compiler/mode_errors.m: compiler/mode_info.m: compiler/mode_util.m: compiler/ordering_mode_constraints.m: compiler/pd_cost.m: compiler/pd_util.m: compiler/polymorphism.m: compiler/post_typecheck.m: compiler/prog_rep.m: compiler/prog_type.m: compiler/prop_mode_constraints.m: compiler/rbmm.actual_region_arguments.m: compiler/rbmm.add_rbmm_goal_info.m: compiler/rbmm.condition_renaming.m: compiler/rbmm.execution_path.m: compiler/rbmm.points_to_analysis.m: compiler/rbmm.region_transformation.m: compiler/saved_vars.m: compiler/simplify.m: compiler/size_prog.m: compiler/smm_common.m: compiler/structure_reuse.direct.choose_reuse.m: compiler/structure_reuse.direct.detect_garbage.m: compiler/structure_reuse.indirect.m: compiler/structure_reuse.lbu.m: compiler/structure_reuse.lfu.m: compiler/structure_reuse.versions.m: compiler/structure_sharing.analysis.m: compiler/switch_detection.m: compiler/unused_imports.m: compiler/granularity.m: compiler/granularity.m: Conform to the changes above. Mostly this means handling the new kind of goal. compiler/add_heap_ops.m: compiler/add_trail_ops.m: compiler/build_mode_constraints.m: compiler/closure_analysis.m: compiler/dead_proc_elim.m: compiler/deforest.m: compiler/follow_vars.m: compiler/higher_order.m: compiler/live_vars.m: compiler/liveness.m: compiler/loop_inv.m: compiler/module_qual.m: compiler/prog_util.m: compiler/purity.m: compiler/quantification.m: compiler/store_alloc.m: compiler/stratify.m: compiler/tabling_analysis.m: compiler/term_constr_build.m: compiler/term_pass1.m: compiler/term_traversal.m: compiler/trailing_analysis.m: Conform to the changes above. Mostly this means handling the new kind of goal. Switch syntax from clauses to disj. runtime/mercury_stm.[ch]: Implement the primitives needed by the STM transformation. Add more debugging support to the existing primitives. library/term.m: Generalize get_term_context to work on terms of all kinds. |
||
|
|
bbe6de9387 |
Make tabling statistics much more useful, and avoid core dumps while printing
Estimated hours taken: 30 Branches: main Make tabling statistics much more useful, and avoid core dumps while printing them (thereby fixing bug #23 in Mantis). runtime/mercury_tabling.h: Expand the set of statistics we can gather about tabling (starting to gather information about memory consumption). Put the statistics into logical groups: enum functors, non-enum du functors, hash tables, and the expandable table used for I/O tabling. For du types and polymorphic types, we can gather different statistics for different parts of a term. We used to use one field to gather more than one related kind of count, but these are now separated. Group the MR_ProcTableInfo struct fields relating to statistics into substructures. The substructures describing a call or answer table have their own substructures giving the statistics about the individual steps; put these in parallel with the descriptions of the steps themselves. Put those substructures into two-element arrays to allow them to be handled uniformly. runtime/mercury_types.h: Add the typedefs needed by mercury_tabling.h. runtime/mercury_tabling_macros.h: Conform to the modified classification of tabling categories. runtime/mercury_tabling.c: runtime/mercury_hash_lookup_or_add_body.h: runtime/mercury_table_int_fix_index_body.h: runtime/mercury_table_int_start_index_body.h: runtime/mercury_table_type_body.h: runtime/mercury_tabling_stats_defs.h: runtime/mercury_tabling_stats_nodefs.h: runtime/mercury_tabling_stats_undefs.h: Gather the modified and expanded set of statistics. Use more meaningful names (with MR_ prefixes) for macros. library/table_builtin.m: library/table_statistics.m: Move the material relating to statistics that used to be in table_builtin.m to the new module table_statistics.m. This is necessary because table_builtin.m is deliberately not included in the library documentation, yet users needs to know how to print out and interpret tabling statistics. Expand the code for handling statistics, adding predicates for printing them together with (hopefully explanatory) labels. Make it all work with the new runtime data structures. library/library.m: Include the new library module. mdbcomp/prim_data.m: Provide a way to refer to the tabling statistics module. compiler/hlds_pred.m: Add utility function to compute the kind of statistics we gather for a given kind of tabling step. compiler/rtti.m: Change the compiler's representation of tabling's runtime data structures to conform to the change to runtime/mercury_tabling.h. Replace a bool with a purpose-designed type (is_array), and add other similar types (call_or_answer_table, curr_or_prev_table). compiler/rtti_out.m: compiler/llds_out.m: Output the updated data structures. compiler/ml_code_gen.m: Generate the updated data structures. compiler/table_gen.m: Update the C code we generate to gather statistics. Gather the extra information needed by the updated data structures in the compiler (to fill in the updated data structures in the runtime). compiler/mlds.m: Add a new kind of constant, one that has just a name. This allows ml_code_gen.m to avoid lying about the type of constants of enum tyes (such as the kind of tabling stats we gather for a step). compiler/modules.m: Import the new table_statistics module automatically if any tabling pragma asks for statistics. compiler/add_pragma.m: compiler/hlds_out.m: compiler/llds.m: compiler/mlds_to_c.m: compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: compiler/mlds_to_java.m: compiler/mlds_to_managed.m: trace/mercury_trace_cmd_developer.c: Conform to the changes above. tests/tabling/fib_stats.{m,exp}: tests/tabling/specified_stats.{m,exp}: New test cases to the test tabling statistics. tests/tabling/Mmakefile: Enable the new test cases. tests/tabling/fib.m: tests/tabling/specified.m: Clean up the code of these test cases, which were used as the basis of the new test cases. |
||
|
|
0e9c74a52b |
Initial check-in of the source to source debugger.
Estimated hours taken: 20 Branches: main Initial check-in of the source to source debugger. In this change we add the ability to print call and exit events and the call and exit ports of each procedure compiled with --ssdb. compiler/.mgnuc_copts: compiler/COMP_FLAGS.in: compiler/Mmakefile: Allow the mer_ssdb library to be linked into the compiler. compiler/mercury_compile.m: compiler/transform_hlds.m: Call the new ssdebug module. compiler/ssdebug.m: Add the ssdebug module which does the source to source tranformation to place call and exit events in debugged procedures. mdbcomp/prim_data.m: Fix a bug of petdr, where he forgot to rename ssdb_builtin to ssdb. |
||
|
|
22c5b49792 |
Initial checkin which is all the scaffolding needed to
Estimated hours taken: 4 Branches: main Initial checkin which is all the scaffolding needed to support the new source to source mercury debugger (ssdb). The main addition in this change is the ssdb directory, which will contain the mer_ssdb library. Mmake.workspace: Mmakefile: configure.in: Handle the new ssdb directory. compiler/options.m: Add the --ssdb and --source-to-source-debug options. compiler/mercury_compile.m: Add the ssdb pass (it does nothing at the moment). compiler/modules.m: Implicitly import ssdb_builtin when compiling with --ssdb. mdbcomp/prim_data.m: Handle the ssdb module. ssdb/Mercury.options: ssdb/Mmakefile: ssdb/SSDB_FLAGS.in: ssdb/.mgnuc_copts: ssdb/.mgnuc_opts: ssdb/RESERVED_MACRO_NAMES: Build system for ssdb directory. ssdb/mer_ssdb.m: ssdb/ssdb.m: The operations which are needed by the source to source debugger. tools/bootcheck: Changes to the bootcheck script to handle the new ssdb module. browser/Mmakefile: bytecode/Mmakefile: library/Mmakefile: mdbcomp/Mmakefile: runtime/Mmakefile: trace/Mmakefile: Add the ALLOW_SSDB_PREFIX rules. |
||
|
|
2dc982cfe4 |
Make a representation of the program available to the deep profiler.
Estimated hours taken: 50 Branches: main Make a representation of the program available to the deep profiler. We do this by letting the user request, via the option "--deep-procrep-file" in MERCURY_OPTIONS, that when the Deep.data file is written, a Deep.procrep file should be written alongside it. The intended use of this information is the discovery of profitable parallelism. When a conjunction contains two expensive calls, e.g. p(...) and q(...) connected by some shared variables, the potential gain from executing them in parallel is limited by how early p produces those variables and how late q consumes them, and knowing this requires access to the code of p and q. Since the debugger and the deep profiler both need access to program representations, put the relevant data structures and the operations on them in mdbcomp. The data structures are significantly expanded, since the deep profiler deals with the whole program, while the debugger was interested only in one procedure at a time. The layout structures have to change as well. In a previous change, I changed proc layout structures to make room for the procedure representation even in non-debugging grades, but this isn't enough, since the procedure representation refers to the module's string table. This diff therefore makes some parts of the module layout structure, including of course the string table, also available in non-debugging grades. configure.in: Check whether the installed compiler can process switches on foreign enums correctly, since this diff depends on that. runtime/mercury_stack_layout.[ch]: runtime/mercury_types.h: Add a new structure, MR_ModuleCommonLayout, that holds the part of the module layout that is common to deep profiling and debugging. runtime/mercury_deep_profiling.[ch]: The old "deep profiling token" enum type was error prone, since at each point in the data file, only a subset was applicable. This diff breaks up the this enum into several enums, each consisting of the choice applicable at a given point. This also allows some of the resulting enums to be used in procrep files. Rename some enums and functions to avoid ambiguities, and in one case to conform to our naming scheme. Make write_out_proc_statics take a second argument. This is a FILE * that (if not NULL) asks write_out_proc_statics to write the representation of the current module to specified stream. These module representations go into the middle part of the program representation file. Add functions to write out the prologue and epilogue of this file. Write out procedure representations if this is requested. Factor out some code that is now used in more than one place. runtime/mercury_deep_profiling_hand.h: Conform to the changes to mercury_deep_profiling.h. runtime/mercury_builtin_types.c: Pass the extra argument in the argument lists of invocations of write_out_proc_statics. runtime/mercury_trace_base.[ch]: Conform to the name change from proc_rep to proc_defn_rep in mdbcomp. runtime/mercury_grade.h: Due to the change to layout structures, increment the binary compatibility version numbers for both debug and deep profiling grades. runtime/mercury_wrapper.[ch]: Provide two new MERCURY_OPTION options. The first --deep-procrep-file, allows the user to ask for the program representation to be generated. The second, --deep-random-write, allows tools/bootcheck to request that only a fraction of all program invocations should generate any deep profiling output. The first option will be documented once it is tested much more fully. The second option is deliberately not documented. Update the type of the variable that holds the address of the (mkinit-generated) write_out_proc_statics function to accept the second argument. util/mkinit.c: Pass the extra argument in the argument list of write_out_proc_statics. mdbcomp/program_representation.m: Extend the existing data structures for representing a procedure body to represent a procedure (complete with name), a module and a program. The name is implemented as string_proc_label, a form of proc_label that can be written out to files. This replaces the old proc_id type the deep profiler. Extend the representation of switches to record the identity of the variable being switched on, and the cons_ids of the arms. Without the former, we cannot be sure when a variable is first used, and the latter is needed for meaningful prettyprinting of procedure bodies. Add code for reading in files of bytecodes, and for making sense of the bytecodes themselves. (It is this code that uses foreign enums.) mdbcomp/prim_data.m: Note the relationship of proc_label with string_proc_label. mdbcomp/rtti_access.m: Add the access operations needed to find module string tables with the new organization of layout structures. Provide operations on bytecodes and string tables generally. trace/mercury_trace_cmd_browsing.c: Conform to the change to mdbcomp/program_representation.m. compiler/layout.m: Add support for a MR_ModuleCommonLayout. Rename some function symbols to avoid ambiguities. compiler/layout_out.m: Handle the new structure. compiler/stack_layout.m: Generate the new structure and the procedure representation bytecode in deep profiling grades. compiler/llds_out.m: Generate the code required to write out the prologue and epilogue of program representation files. Pass the extra argument in the argument lists of invocations of write_out_proc_statics that tells those invocations to write out the module representations between the prologue and the epilogue. compiler/prog_rep.m: When generating bytecodes, include the new information for switches. compiler/continuation_info.m: Replace a bool with a more expressive type. compiler/proc_rep.m: Conform to the change to continuation_info.m. compiler/opt_debug.m: Conform to the change to layout.m. deep_profiler/mdprof_procrep.m: A new test program to test the reading of program representations. deep_profiler/DEEP_FLAGS.in: deep_profiler/Mmakefile: Copy the contents of the mdbcomp module to this directory on demand, instead of linking to it. This is necessary now that the deep profiler depends directly on mdbcomp even if it is compiled in a non-debugging grade. The arrangements for doing this were copied from the slice directory, which has long done the same. Avoid a duplicate include of Mmake.deep.params. Add the new test program to the list of programs in this directory. Mmakefile: Go through deep_profiler/Mmakefile when deciding whether to do "mmake depend" in the deep_profiler directory. The old actions won't work correctly now that we need to copy some files from mdbcomp before we can run "mmake depend". deep_profiler/profile.m: Remove the code that was moved (in cleaned-up form) to mdbcomp. deep_profiler/dump.m: deep_profiler/profile.m: Conform to the changes above. browser/declarative_execution.m: browser/declarative_tree.m: Conform to the changes in mdbcomp. doc/user_guide.texi: Add commented out documentation of the two new options. slice/Mmakefile: Fix formatting, and a bug. library/exception.m: library/par_builtin.m: library/thread.m: library/thread.semaphore.m: Update all the handwritten modules to pass the extra argument now required by write_out_proc_statics. tests/debugger/declarative/dependency.exp: Conform to the change from proc_rep to proc_defn_rep. tools/bootcheck: Write out deep profiling data only from every 25th invocation, since otherwise the time for a bootcheck takes six times as long in deep profiling grades than in asm_fast.gc. However, do test the ability to write out program representations. Use the mkinit from the workspace, not the installed one. Don't disable line wrapping. |
||
|
|
0f844ef4df |
Handle stm_builtin as builtin module.
Estimated hours taken: 0.1 Branches: main mdbcomp/prim_data.m: Handle stm_builtin as builtin module. |
||
|
|
32d02b697e |
Fix compiler handling of region_builtin module.
Estimated hours taken: 0.5 Branches: main Fix compiler handling of region_builtin module. mdbcomp/prim_data.m: Add a function mercury_region_builtin_module/1 that returns the name of the builtin module that contains the RBMM primitives. Extend other predicates related to builtin modules appropriately. Delete a couple of comments that that indicated which compiler modules some types used to be defined in before they were moved here. Fix some formatting. library/library.m: Add a comment to the effect that changes to the list of builtin modules may require changes to mdbcomp/prim_data.m. |
||
|
|
ebb805a2d3 |
Currently, all disjuncts from a disjunction generate an event with the same
Estimated hours taken: 3 Branches: main Currently, all disjuncts from a disjunction generate an event with the same port: MR_PORT_DISJ. However, the declarative debugger treats first disjuncts differently from later ones, and the g12 visualizer will want this distinction too. Therefore this diff splits MR_PORT_DISJ into two: MR_PORT_DISJ_FIRST and MR_PORT_DISJ_LATER. (The visualizer will also probably want to know when the disjunction is complete, but it is not yet known whether this should be done as a separate port type for the last disjunct or a new kind of event that happens when execution backtracks out of the disjunction overall, so we hold off for now.) runtime/mercury_trace_base.[ch]: Make the split described above. Move the user-visible names of ports from the source file to the header file to make them easier to maintain. Update the list of places that need to be updated when the list of ports is changed. Have two sets of names for trace ports: one that uniquely identifies each port, and one that conflates MR_PORT_DISJ_FIRsT and MR_PORT_DISJ_LATER. The first is for use by automatic tools, the second is for presentation to humans (so that mdb output, for example, remains the same.) Put some parts of the header file in a more logical order. browser/declarative_execution.m: mdbcomp/prim_data.m: mdbcomp/trace_counts.m: compiler/layout_out.m: trace/mercury_trace_internal.m: trace/mercury_trace_tables.m: Conform to the above changes. compiler/trace_params.m: Conform to the above changes. Start numbering ports from 0, since C enums start from 0. This change has no repercussions since we don't yet have any code that depends on the details of the encoding. compiler/trace_gen.m: Decide which kind of disj event to create. trace/mercury_trace_declarative.c: Handle first and later disjuncts separately. |
||
|
|
6e079e5e05 |
Add XML documentation for the modules an source file
Estimated hours taken: 1 Branches: main Add XML documentation for the modules an source file imports. compiler/xml_documentation.m: Add XML documentation for all the imports of a module. Output the correct determinism declarations. mdbcomp/prim_data.m: Add all_builtin_modules which lists all the modules which are automatically imported. compiler/unused_imports.m: Use all_builtin_modules. |
||
|
|
b56885be93 |
Fix a bug that caused bootchecks with --optimize-constructor-last-call to fail.
Estimated hours taken: 12 Branches: main Fix a bug that caused bootchecks with --optimize-constructor-last-call to fail. The problem was not in lco.m, but in follow_code.m. In some cases, (specifically, the LCMC version of insert_2 in sparse_bitset.m), follow_code.m moved an impure goal (store_at_ref) into the arms of an if-then-else without marking those arms, or the if-then-else, as impure. The next pass, simplify, then deleted the entire if-then-else, since it had no outputs. (The store_at_ref that originally appeared after the if-then-else was the only consumer of its only output.) The fix is to get follow_code.m to make branched control structures such as if-then-elses, as well as their arms, semipure or impure if a goal being moved into them is semipure or impure, or if they came from an semipure or impure conjunction. Improve the optimization of the LCMC version of sparse_bitset.insert_2, which had a foreign_proc invocation of bits_per_int in it: replace such invocations with a unification of the bits_per_int constant if not cross compiling. Add a new option, --optimize-constructor-last-call-null. When set, LCMC will assign NULLs to the fields not yet filled in, to avoid any junk happens to be there from being followed by the garbage collector's mark phase. This diff also makes several other changes that helped me to track down the bug above. compiler/follow_code.m: Make the fix described above. Delete all the provisions for --prev-code; it won't be implemented. Don't export a predicate that is not now used anywhere else. compiler/simplify.m: Make the optimization described above. compiler/lco.m: Make sure that the LCMC specialized procedure is a predicate, not a function: having a function with the mode LCMC_insert_2(in, in) = in looks wrong. To avoid name collisions when a function and a predicate with the same name and arity have LCMC applied to them, include the predicate vs function status of the original procedure included in the name of the new procedure. Update the sym_name of calls to LCMC variants, not just the pred_id, because without that, the HLDS dump looks misleading. compiler/pred_table.m: Don't have optimizations like LCMC insert new predicates at the front of the list of predicates. Maintain the list of predicates in the module as a two part list, to allow efficient addition of new pred_ids at the (logical) end without using O(N^2) algorithms. Having predicates in chronological order makes it easier to look at HLDS dumps and .c files. compiler/hlds_module.m: Make module_info_predids return a module_info that is physically updated though logically unchanged. compiler/options.m: Add --optimize-constructor-last-call-null. Make the options --dump-hlds-pred-id, --debug-opt-pred-id and --debug-opt-pred-name into accumulating options, to allow the user to specify more than one predicate to be dumped (e.g. insert_2 and its LCMC variant). Delete --prev-code. doc/user_guide.texi: Document the changes in options.m. compiler/code_info.m: Record the value of --optimize-constructor-last-call-null in the code_info, to avoid lookup at every cell construction. compiler/unify_gen.m: compiler/var_locn.m: When deciding whether a cell can be static or not, make sure that we never make static a cell that has some fields initialized with dummy zeros, to be filled in for real later. compiler/hlds_out.m: For goals that are semipure or impure, note this fact. This info was lost when I changed the representation of impurity from markers to a field. mdbcomp/prim_data.m: Rename some ambiguous function symbols. compiler/intermod.m: compiler/trans_opt.m: Rename the main predicates (and some function symbols) of these modules to avoid ambiguity and to make them more expressive. compiler/llds.m: Don't print line numbers for foreign_code fragments if the user has specified --no-line-numbers. compiler/make.dependencies.m: compiler/mercury_to_mercury.m: compiler/recompilation.usage.m: Don't use io.write to write out information to files we may need to parse again, because this is vulnerable to changes to the names of function symbols (e.g. the one to mdbcomp/prim_data.m). The compiler still contains some uses of io.write, but they are for debugging. I added an item to the todo list of the one exception, ilasm.m. compiler/recompilation.m: Rename a misleading function symbol name. compiler/parse_tree.m: Don't import recompilation.m here. It is not needed (all the components of parse_tree that need recompilation.m already import it themselves), and deleting the import avoids recompiling almost everything when recompilation.m changes. compiler/*.m: Conform to the changes above. compiler/*.m: browser/*.m: slice/*.m: Conform to the change to mdbcomp. library/sparse_bitset.m: Use some better variable names. |
||
|
|
d66ed699a1 |
Add fields to structures representing the C code itself that says whether
Estimated hours taken: 4 Branches: main Add fields to structures representing the C code itself that says whether or not the C code affects the liveness of lvals. This is intended as the basis for future improvements in the optimization of such code. Implement a new foreign_proc attribute that allows programmers to set the value of this field. Eliminate names referring to `pragma c_code' in the LLDS backend in favor of names referring to foreign_procs. compiler/llds.m: Make the changes described above. Consistently put the field containing C code last in the function symbols that contain them. compiler/prog_data.m: Make the changes described above. Rename some other function symbols to avoid ambiguity. compiler/prog_io_pragma.m: Parse the new foreign_proc attribute. doc/reference_manual.texi: Document the new attribute. compiler/pragma_c_gen.m: Rename the main predicates. compiler/opt_util.m: Change some predicates into functions, for more convenient invocation. compiler/livemap.m: Rename the predicates in this module to avoid ambiguity and the need for module qualification. compiler/*.m: Conform to the changes above. |
||
|
|
f1275fa6e8 |
Implement io.write for arbitrary streams. With type specialization
Estimated hours taken: 25 Branches: main Implement io.write for arbitrary streams. With type specialization this is only slightly slower than the original. library/stream.string_writer.m: library/library.m: A module containing predicates for writing to streams which accept strings. library/stream.m: Move stream.format to stream.string_writer.m. Add stream.put_list, which is like io.write_list. library/io.m: Move io.write and io.print to stream.string_writer.m. library/term_io.m: Add stream versions of predicates used by io.write. library/ops.m: Move io.adjust_priority_for_assoc to here (private predicate used only by library modules). Export ops.mercury_max_priority for use by stream.string_writer.write. Mmake.common.in: compiler/modules.m: compiler/mlds.m: compiler/mlds_to_c.m: compiler/mlds_to_java.m: compiler/mlds_to_managed.m: compiler/prog_util.m: compiler/format_call.m: mdbcomp/prim_data.m: Allow sub-modules in the standard library. compiler/polymorphism.m: Fix a bug which caused tests/hard_coded/print_stream.m to fail with this change. The wrong argument type_info would be extracted from a typeclass_info if the constraints of the typeclass-info were not all variables. browser/browse.m: tests/hard_coded/stream_format.m: tests/hard_coded/test_injection.m: tests/invalid/string_format_bad.m: tests/invalid/string_format_unknown.m: Updated for predicates moved between library modules. util/mdemangle.c: The demangler doesn't properly handle the arguments MR_DECL_LL* and various other recently added macros for type specialized procedures. It's still broken (it doesn't handle mode and label suffixes properly), but the output is at least more readable. |
||
|
|
0cc10ba2b0 |
Optimize the functions involving int.bits_per_int, since doing this can speed
Estimated hours taken: 6 Branches: main Optimize the functions involving int.bits_per_int, since doing this can speed up sparse_bitset.m. compiler/options.m: Add an option that says whether we are cross-compiling, since our optimizations work only int.bits_per_int returns the same in the running program as in the compiler that generates its code. compiler/simplify.m: If we are not cross compiling, replace calls to the functions involving bits_per_int whose other arguments have unknown values with simpler, faster operations, one of whose operands is the compiler's value for bits_per_int. Shift some work from const_prop to simplify, since the code to do the above needs it also. compiler/const_prop.m: If we are not cross compiling, evaluate calls to the functions involving bits_per_int whose other arguments have known values. compiler/add_pragma.m: Just as we report errors for attempts to define builtins via clauses, report errors for attempts to define builtins via foreign_procs. compiler/hlds_module.m: Factor out some common code. compiler/Mercury.options: Turn on the new optimizations for sparse_bitset.m. mdbcomp/prim_data.m: Provide a utility predicate for recognizing standard library modules, for use in simplify.m. |
||
|
|
9ec86d6a6d |
The objective of this diff is to switch from a table of solver events built
Estimated hours taken: 32
Branches: main
The objective of this diff is to switch from a table of solver events built
into the compiler (and eventually the debugger) into a table of events
defined by a file provided by the user to the compiler, which the compiler
then records in the executable for use by the debugger.
The current design, for speed of implementation, uses temporary files parsed
by a bison-generated parser. Since the compiler needs to be able to invoke
the parser even if it is compiled in a non-debug grade, the parser is in
a new library, the eventspec library, that is always linked into the Mercury
compiler and is always linked into any Mercury program with debugging enabled
(but is of course linked only once into a Mercury compiler which has debugging
enabled).
Modify the debugger to give it the ability to print the attributes of
user-defined events (for now, only the non-synthesized attributes).
Implement a new debugger command, "user", which goes to the next user-defined
event.
configure.in:
Require flex and and bison to be available.
doc/user_guide.texi:
Document user defined events and the new debugger capabilities.
doc/mdb_categories:
Include "user" in the list of forward movement commands.
Fix some earlier omissions in that list.
runtime/mercury_stack_layout.h:
Include an event number in the user-defined event structure.
Include a string representing an event set specification in module
layout structures.
runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.[ch]:
runtime/mercury_types.h
Switch from solver events to user events in names.
runtime/mercury_trace_term.[ch]:
Provide a representation of flat terms, for use in representing
the calls that generate synthesized attributes.
Ensure that exported field names have an MR_ prefix.
browser/cterm.m:
Conform to the change to runtime/mercury_trace_term.h.
scripts/c2init.in:
scripts/ml.in:
Include the eventspec library in programs compiled with debugging
enabled.
compiler/Mmakefile:
Include the eventspec library in the compiler.
compiler/options.m:
Add a new option, --event-spec-file-name, that allows the user to
specify the set of user-defined events the program may use.
compiler/handle_options.m:
Set this optimization from an environment variable (which may be
set by the mmc script) if the new option is not explicitly given.
compiler/prog_data.m:
Define the data structures for the compiler's representation of the
event set specification.
Move some definitions around to group them more logically.
compiler/hlds_module.m:
Include the event set specification as a new field in the module_info.
compiler/prog_event.m:
Add the code for invoking the parser in the eventspec library,
and for converting the simple term output by the parser to the
compiler own representation, which contains more information
(to wit, the types of the function attributes) and which has had
a whole bunch of semantic checks done on it (e.g. whether synthesized
attributes depend on themselves or on nonexistent attributes).
Provide a function to generate a canonicalized version of the event
specification file.
compiler/module_qual.m:
compiler/equiv_type.m:
Process event spec specifications as well as items, to module qualify
the names of the types of event arguments, and expanding out
equivalence types.
In equiv_type.m, rename some variables to make clear what kind of info
they represent.
compiler/mercury_compile.m:
Process the event set specification file if one has been selected:
read it in, module qualify it, expand its equivalence types, and add
to the module_info.
compiler/compile_target_code.m:
Include the event_spec library when linking debuggable executables.
compiler/call_gen.m:
compiler/continuation_info.m:
compiler/trace_gen.m:
compiler/trace_params.m:
mdbcomp/prim_data.m:
mdbcomp/trace_counts.m:
runtime/mercury_goto.h:
Generate user-defined events instead of solver events.
compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
Include a canonicalized version of the event specification file
in the module layout if the module has any user-defined events.
compiler/code_info.m:
compiler/llds_out.m:
compiler/modes.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/typecheck.m:
Conform to the changes above.
compiler/passes_aux.m:
Rename a predicate to avoid an ambiguity.
trace/Mmakefile:
Add the definition and rules required to build the eventspec library.
trace/mercury_event_scanner.l:
trace/mercury_event_parser.y:
A scanner and a parser for reading in event spec specifications.
trace/mercury_event_spec_missing.h:
Provide the declarations that should be (but aren't) provided by
flex and bison.
trace/mercury_event_spec.[ch]:
The main module of the eventspec library. Provides functions to read
in event set specifications from a file, and to write them out as a
Mercury term in the form needed by the compiler.
trace/mercury_trace_tables.c:
If the module layouts being registered include event set
specifications, then check their consistency. Make the specification
and the consistency indication available to other modules.
trace/mercury_trace_internal.c:
During initialization, if the modules contain a consistent set of event
set specifications, then read that specification into the debugger.
(We don't yet make use of this information.)
Add an extra mdb command, "user", which goes forward to the next
user-defined event.
trace/mercury_trace.[ch]:
trace/mercury_trace_cmd_forward.[ch]:
Implement the new mdb command.
trace/mercury_trace_vars.[ch]:
For user-defined events, include the attributes' values among the
values that can be printed or browsed.
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_declarative.c:
Minor changes.
scripts/scripts/prepare_tmp_dir_grade_part:
Copy the .y and .l files to the tmp dir we use for installs.
tools/bootcheck:
Copy the .y and .l files of the trace directory to stage 2.
tools/lmc.in:
Include the eventspec library when linking debuggable executables.
tests/debugger/user_event.{m,inp,exp}:
tests/debugger/user_event_spec:
New test case to test the new functionality.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/completion.exp:
Expect the new "user" mdb command in the completion output.
|
||
|
|
863874df85 |
Document my recent change implementing coverage testing.
Estimated hours taken: 6 Branches: main Document my recent change implementing coverage testing. At the same time, eliminate the old hack that allowed a file containing a list of file names to be considered a trace count file. We haven't needed it since the addition of mtc_union, and it can lead to incomprensible error messages. (The presence of the old hack made documenting coverage testing harder.) In the process, fix the tools code for rerunning failed test cases only. doc/user_guide.texi: Document my recent change implementing coverage testing, and the elimination of the old hack. mdbcomp/trace_counts.m: Modify the predicates for reading in trace count files along the lines above. mdbcomp/slice_and_dice.m: Modify the predicates for reading in slices and dices along the lines above. Rename some function symbols to avoid ambiguities. compiler/tupling.m: slice/mcov.m: slice/mtc_diff.m: slice/mtc_union.m: trace/mercury_trace_declarative.c: Conform to the changes above. slice/mcov.m: Fix the usage message, which referred to this program by its old name mct. Allow the output to be restricted to a set of named modules only. This is to make testing easier. slice/mtc_diff.m: Rename the long form of the -o option from --out to --output-file, to make it consistent with the other programs. tests/run_one_test: tools/bootcheck: Modify the algorithm we use to gather trace counts for the Mercury compiler from both passed and failed test cases to run mtc_union periodically instead of gathering all the trace counts file and keeping them to the end (which takes far too much disk space). Fix an old bug: gather trace counts from executions of the Mercury compiler only. tests/debugger/Mmakefile: tests/debugger/dice.passes: Modify the dice test case to compute the union of the trace counts for the passed versions of this test case to use mtc_union to create dice.passes, instead of having dice.passes statically contain the list of the names of the passed trace count files (since that capability is deleted by this diff). tools/bootcheck: tests/Mmake.common: Fix the code for rerunning failed tests only. mdbcomp/prim_data.m: Eliminate some ambiguities in predicate names. compiler/*.m: Conform to the change to prim_data.m. compiler/error_util.m: Add reading files as a phase in error messages. compiler/mercury_compile.m: Use the new facilities in error_util for printing an error message. |
||
|
|
9eed887d33 |
This diff is the second step in implementing trace events.
Estimated hours taken: 24 Branches: main This diff is the second step in implementing trace events. It modifies label layouts to include room for solver-event-specific information, and modifies the compiler to generate this information. Modifications to the debugger to use this information, user-level documentation and test cases will come later. runtime/mercury_stack_layout.h: Modify label layouts to allow them to hold information about solver events. Modify the macros creating label layouts to include a null pointer as the value of the label layout's solver event field. For each such macro, add a version that puts a pointer to the label's solver event structure in that field. Modify the definition of the MR_Long_Lval type to allow the representation of constants, since without this capability solver events would often need to be preceded by code to put constant values (e.g. solver ids) into lvals. To make it easier to locate all the places where MR_Long_Lvals are used (which need to be updated), change the type MR_Long_Lval from a synonym for an int to a structure containing an int. runtime/mercury_types.h: Add the typedefs now required for mercury_stack_layout.h. runtime/mercury_goto.h: Add a macro needed by mercury_stack_layout.h. runtime/mercury_grade.h: Change the binary compatibility version number for debug grades, due to the change to label layouts. runtime/mercury_layout_util.c: Update the functions interpreting MR_Long_Lvals to conform to the change in mercury_stack_layout.h. runtime/mercury_deep_profiling_hand.h: Fix a bug, possibly the bug preventing us from bootchecking in deep profiling grades: stack slot numbers of ProcStatic structures are supposed to be plain integers, not MR_Long_Lvals. runtime/mercury_stack_trace.c: library/exception.m: trace/mercury_trace.c: Conform the change in MR_Long_Lval. runtime/mercury_trace_base.[ch]: Add a new port: the solver event port. Add a macro and a function for solver events: MR_SOLVER_EVENT and MR_solver_trace. For now, they do the same thing as MR_EVENT and MR_trace, but in future, they can do something else (e.g. generate information for a visualization tool). mdbcomp/prim_data.m: Add a new port: the solver event port. Rename all ports to eliminate clashes with language keywords such as "call". mdbcmp/trace_counts.m: browser/declarative_execution.m: slice/mcov.m: compiler/tupling.m: Conform to the change in port names, and to the addition of the new port. compiler/trace_params.m: Conform to the change in port names, and to the addition of the new port. Rename some function symbols to avoid some ambiguities. trace/mercury_trace_declarative.c: Ignore the solver port when building the annotated trace, since it doesn't fit into it. compiler/prog_event.m: Extend the representation of events to include names for the event attributes. compiler/call_gen.m: Implement event goals. The implementation consists of a call to MR_SOLVER_EVENT with a layout structure whose solver event field points to a solver event structure giving the event goal's arguments. Rename some function symbols to avoid some ambiguities. compiler/trace_gen.m: Add a predicate for generating solver events. Conform to the change in port names. Rename some function symbols to avoid some ambiguities. compiler/code_info.m: When recording trace layout information for a label, take an extra argument describing the label layout's associated solver event, if any. compiler/continuation_info.m: Extend the first representation of label layouts to include room for solver events. compiler/stack_layout.m: Convert the representation of solver events in continuation_info.m's data structure to the data structure required by layout_out.m. Conform to the changes in MR_Long_Lvals. compiler/layout.m: Extend the compiler's internal representation of the contents of label layout structures to accommodate the optional solver event field. compiler/layout_out.m: Generate the extended label layout structures, using the new macros in mercury_stack_layout.h if necessary. Conform to the change in the MR_Long_Lval type. Conform to the change in port names. Rename some function symbols to avoid some ambiguities. compiler/global_data.m: Modify rval_type_as_arg to require only the value of the relevant option, not a package of such options. This is for the new code in stack_layout.m. compiler/var_locn.m: Conform to the change in global_data.m. compiler/llds_out.m: Conform to the change in continuation_info.m. Delete this module's unused definition of rval_type_as_arg. compiler/opt_debug.m: Conform to the change in continuation_info.m. |
||
|
|
257dcf24ca |
This patch adds preliminary support for deterministic, dependent
Estimated hours taken: 50 Branches: main This patch adds preliminary support for deterministic, dependent parallel conjunctions to the low-level backend. In other backends dependent parallel conjunctions are converted into plain conjunctions. For a parallel conjunction (A & B), if the goal B is dependent on a variable X which is bound by goal A, we transform the conjunction such that goal B must wait for the value to be produced by A before it begins executing. This transformation is not yet useful in practice (you might as well use a sequential conjunction). A later version of this transformation will move the synchronisation deeper into the goals so that B can execute as much as possible before it waits for the value from A. There is no coroutining support yet so if there are not enough threads available then dependent parallel conjunctions can cause the program to deadlock. configure.in: runtime/mercury_conf.h.in: Check for existence of semaphore.h and #define MR_HAVE_SEMAPHORE_H if it does. library/library.m: library/par_builtin.m: library/private_builtin.m: mdbcomp/prim_data.m: mdbcomp/program_representation.m: Add a new module `par_builtin' to hold synchronisation primitives. compiler/modules.m: Import `par_builtin' module in parallel grades. compiler/dep_par_conj.m: compiler/transform_hlds.m: compiler/mercury_compile.m: Add a transformation to detect dependent parallel conjunctions and insert the necessary synchronisation code. compiler/hlds_goal.m: Consider empty parallel conjunctions as atomic, the same as plain conjunctions. compiler/inlining.m: Flatten parallel conjunctions when inlining, as for plain conjunctions. compiler/live_vars.m: Fix build_live_sets_in_par_conj to handle dependent parallel conjunctions. compiler/liveness.m: Delay deaths in parallel conjunctions the same way as for plain conjunctions. Update detect_resume_points_in_par_conj for dependent parallel conjunctions. compiler/mode_util.m: Treat parallel and plain conjunctions equally when recomputing instmap deltas. compiler/modes.m: compiler/unique_modes.m: Treat parallel and plain conjunctions equally when checking modes and uniqueness. However, don't flatten parallel conjunctions into plain conjunctions and vice versa. compiler/simplify.m: Don't reset instmaps and seen calls after each conjunct of a parallel conjunction. compiler/store_alloc.m: Update allocation for dependent parallel conjunctions. compiler/switch_detection.m: Detect switches in parallel conjunctions the same as plain conjunctions. compiler/par_conj_gen.m: Add a todo comment. tests/Mmakefile: tests/par_conj/.cvsignore: tests/par_conj/Mmakefile: tests/par_conj/dep_par_1.m: tests/par_conj/dep_par_10.m: tests/par_conj/dep_par_11.m: tests/par_conj/dep_par_11b.m: tests/par_conj/dep_par_11c.m: tests/par_conj/dep_par_12.m: tests/par_conj/dep_par_13.m: tests/par_conj/dep_par_14.m: tests/par_conj/dep_par_14b.m: tests/par_conj/dep_par_14c.m: tests/par_conj/dep_par_14d.m: tests/par_conj/dep_par_16.m: tests/par_conj/dep_par_17.m: tests/par_conj/dep_par_18.m: tests/par_conj/dep_par_2.m: tests/par_conj/dep_par_20.m: tests/par_conj/dep_par_21.m: tests/par_conj/dep_par_22.m: tests/par_conj/dep_par_23.m: tests/par_conj/dep_par_3.m: tests/par_conj/dep_par_3b.m: tests/par_conj/dep_par_3c.m: tests/par_conj/dep_par_4.m: tests/par_conj/dep_par_5.m: tests/par_conj/dep_par_5b.m: tests/par_conj/dep_par_5c.m: tests/par_conj/dep_par_5d.m: tests/par_conj/dep_par_6.m: tests/par_conj/dep_par_7.m: tests/par_conj/dep_par_8.m: tests/par_conj/dep_par_9.m: tests/par_conj/indep_par_append.exp: tests/par_conj/indep_par_append.m: tests/par_conj/indep_par_nested.exp: tests/par_conj/indep_par_nested.m: Add some parallel conjunction test cases. The dependent parallel conjunction tests are not yet executed as they can deadlock if there are not enough threads available. browser/RESERVED_MACRO_NAMES: library/RESERVED_MACRO_NAMES: runtime/RESERVED_MACRO_NAMES: trace/RESERVED_MACRO_NAMES: Add LINUX_THREADS, _REENTRANT and _THREAD_SAFE. |
||
|
|
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.
|
||
|
|
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. |
||
|
|
b819fbc0a6 |
Give the compiler the capability of detecting errors that manifest themselves
Estimated hours taken: 16
Branches: main
Give the compiler the capability of detecting errors that manifest themselves
as mismatches between the format string and the list of values to be printed
in calls to string.format and io.format.
This capability is controlled through two new options:
--warn-known-bad-format-calls
--warn-unknown-format-calls
The first (which will default to "on" once this change has bootstrapped)
controls whether the compiler emits warnings for statically known mismatches.
The second (which will default to "off") controls whether the compiler emits
warnings in cases where either the format string or the structure of the list
of values to be printed is not available statically to be checked.
NEWS:
Mention the new capability.
compiler/options.m:
Add the two new options.
doc/user_guide.texi:
Document the new options.
compiler/format_call.m:
New module to implement the new capability.
compiler/notes/compiler_structure.html:
Document the new module.
compiler/check_hlds.m:
Include the new module.
compiler/simplify.m:
Invoke the new module if the procedure being processed contains calls
to string.format or io.format.
Fix an old bug: we could generate warnings or even errors when
simplifying predicate bodies imported from other modules via
intermodule optimization.
Don't export get/set predicates that do not need to be exported.
compiler/det_report.m:
Add new kinds of error specifications for the errors detected by the
new module.
Separate out the context of each error specification, in order
to allow the error messages to be sorted by context; this makes
the output much easier to read.
compiler/common.m:
compiler/det_analysis.m:
compiler/simplify.m:
Conform to the change to det_report.m.
mdbcomp/prim_data.m:
Add a utility function for forming the possibly qualified names of
library modules (such as "io" and "string").
library/Mercury.options:
compiler/Mercury.options:
Add the lines that disable the new checks in the modules that need them
disabled. The new lines are commented out until installed compilers all
understand them, at which point in time we will add the requirement to
understand the option to configure.in.
compiler/fact_table.m:
compiler/mlds_to_il.m:
Fix three bugs reported by the new check that have apparently escaped
detection all this time.
library/rtti_implementation.m:
Change some code to avoid a spurious warning from the new checks.
library/string.m:
Rename a predicate to avoid an unnecessary and confusing overloading of
its name.
Replace __ with . as module qualifier connective.
compiler/handle_options.m:
library/pprint.m:
Misc cleanups.
tests/invalid/string_format_bad.{m,err_exp}:
tests/invalid/string_format_unknown.{m,err_exp}:
New test cases to test the new warnings.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
Enable the new test cases.
tests/general/string_format_test*.exp*:
Update any expected abort messages to expect . instead of __ as module
qualifier connective.
tests/invalid/det_errors_cc.err_exp:
tests/invalid/erroneous_throw_promise.err_exp:
tests/warnings/simple_code.exp:
Expect the same error messages in program context order.
|
||
|
|
d47e633804 |
Trace builtin and private_builtin (with the exception of external predicates
Estimated hours taken: 4 Branches: main Trace builtin and private_builtin (with the exception of external predicates and those that are polymorhphic, but have no extra type_info arguments). This allows subterms to be traced through calls to predicates in builtin and private_builtin and fixes an assertion failure in the declarative debugger that was triggered when an untraced builtin called a traced predicate (the debugger would then think the events from the traced predicate were child events of the parent of the untraced predicate, which would cause the assertion failure). compiler/code_gen.m: compiler/hlds_pred.m: compiler/mercury_compile.m: compiler/ml_code_util.m: compiler/polymorphism.m: compiler/stack_layout.m: compiler/term_constr_initial.m: mdbcomp/prim_data.m: mdbcomp/program_representation.m: Move no_type_info_builtin from compiler/hlds_pred.m to mdbcomp/program_representation.m, so that the debugger can call it to see what builtin polymorphic predicates do not have extra type_info arguments. Define pred_is_external to be true for predicates defined with :- external. The debugger needs to know not to expect any events for such predicates. Trace the builtin and private_builtin modules. tests/debugger/loopcheck.exp3: tests/debugger/uci.exp2: tests/debugger/uci_index.exp: Changes to expected output due to the fact that builtins are now traced. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/typed_unify.exp: tests/debugger/declarative/typed_unify.inp: tests/debugger/declarative/typed_unify.m: Test tracking of a subterm through a builtin. |
||
|
|
d609181cb9 |
Consider types of the form
Estimated hours taken: 30
Branches: main
Consider types of the form
:- type x ---> f.
to be dummy types, since they contain no information. Optimize them the same
way we currently optimize io.state and store.store.
runtime/mercury_type_info.h:
Add a new type_ctor_rep for dummy types.
runtime/mercury_tabling.h:
Add a representation for "tabled" dummy types, which don't actually
have a level in the trie, so that the runtime system can handle that
fact.
runtime/mercury_ml_expand_body.h:
When deconstructing a value of a dummy type, ignore the actual value
(since it will contain garbage) and instead return the only possible
value of the type.
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.c:
runtime/mercury_tabling.c:
runtime/mercury_unify_compare_body.h:
library/rtti_implementation.m:
Handle the type_ctor_rep of dummy types.
runtime/mercury_builtin_types.c:
Provide a place to record profiling information about unifications and
comparisons for dummy types.
runtime/mercury_mcpp.h:
java/runtime/TypeCtorRep.java:
library/private_builtin.m:
Add a new type_ctor_rep for dummy types, and fix some previous
discrepancies in type_ctor_reps.
mdbcomp/prim_data.m:
Move a bunch of predicates for manipulating special_pred_ids here from
the browser and compiler directories.
Rename the function symbols of the special_pred_id type to avoid the
need to parenthesize the old `initialise' function symbol.
Convert to four-space indentation.
mdbcomp/rtti_access.m:
Don't hardcode the names of special preds: use the predicates in
prim_data.m.
Convert to four-space indentation.
browser/declarative_execution.m:
Delete some predicates whose functionality is now in
mdbcomp/prim_data.m.
compiler/hlds_data.m:
Replace the part of du type that says whether a type an enum, which
used to be a bool, with something that also says whether the type is a
dummy type.
Convert to four-space indentation.
compiler/make_tags.m:
Compute the value for the new field of du type definitions.
compiler/hlds_out.m:
Write out the new field of du type definitions.
compiler/rtti.m:
Modify the data structures we use to create type_ctor_infos to allow
for dummy types.
Convert to four-space indentation.
compiler/type_ctor_info.m:
Modify the code that generates type_ctor_infos to handle dummy types.
compiler/type_util.m:
Provide predicates for recognizing dummy types.
Convert to four-space indentation.
compiler/unify_proc.m:
Generate the unify and compare predicates of dummy types using a new
code scheme that avoids referencing arguments that contain garbage.
When generating code for unifying or comparing other types, ignore
any arguments of function symbols that are dummy types.
Don't use DCG style access predicates.
compiler/higher_order.m:
Specialize the unification and comparison of values of dummy types.
Break up an excessively large predicate, and factor out common code
from the conditions of a chain of if-then-elses.
compiler/llds.m:
For each input and output of a foreign_proc, include a field saying
whether the value is of a dummy type.
compiler/pragma_c_gen.m:
Fill in the new fields in foreign_proc arguments.
compiler/hlds_goal.m:
Rename some predicates for constructing unifications to avoid
unnecessary ad-hoc overloading. Clarify their documentation.
Rename a predicate to make clear the restriction on its use,
and document the restriction.
Add a predicate for creating simple tests.
Add a utility predicate for setting the context of a goal directly.
compiler/modules.m:
Include dummy types interface files, even if they are private to the
module. This is necessary because with the MLDS backend, the generated
code inside the module and outside the module must agree whether a
function returning a value of the type returns a real value or a void
value, and this requires them to agree on whether the type is dummy
or not.
The impact on interface files is minimal, since very few types are
dummy types, and changing a type from a dummy type to a non-dummy type
or vice versa is an ever rarer change.
compiler/hlds_pred.m:
Provide a representation in the compiler of the trie step for dummy
types.
compiler/layout_out.m:
Print the trie step for dummy types.
compiler/table_gen.m:
Don't table values of dummy types, and record the fact that we don't
by including a dummy trie step in the list of trie steps.
compiler/add_pragma.m:
compiler/add_special_pred.m:
compiler/add_type.m:
compiler/aditi_builtin_ops.m:
compiler/bytecode.m:
compiler/bytecode_gen.m:
compiler/code_gen.m:
compiler/code_info.m:
compiler/continuation_info.m:
compiler/cse_detection.m:
compiler/det_report.m:
compiler/exception_analysis.m:
compiler/inst_match.m:
compiler/livemap.m:
compiler/llds_out.m:
compiler/llds_out.m:
compiler/middle_rec.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.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_il.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/opt_util.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/qual_info.m:
compiler/rl.m:
compiler/rl_exprn.m:
compiler/rl_key.m:
compiler/rtti_out.m:
compiler/simplify.m:
compiler/size_prof.m:
compiler/term_constr_initial.m:
compiler/term_constr_util.m:
compiler/term_norm.m:
compiler/termination.m:
compiler/trace.m:
compiler/typecheck.m:
compiler/unify_gen.m:
Conform to the changes above.
compiler/export.m:
compiler/exprn_aux.m:
compiler/foreign.m:
compiler/polymorphism.m:
compiler/proc_label.m:
compiler/rtti_to_mlds.m:
compiler/special_pred.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/state_var.m:
compiler/switch_util.m:
compiler/trace_params.m:
Conform to the changes above.
Convert to four-space indentation.
compiler/mlds_to_java.m:
compiler/var_locn.m:
Conform to the changes above, which requires threading the module_info
through the module.
Convert to four-space indentation.
compiler/mercury_compile.m:
Pass the module_info to mlds_to_java.m.
compiler/ml_util.m:
compiler/polymorphism.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
Delete some previously missed references to the temporary types used
to bootstrap the change to the type_info type's arity.
compiler/polymorphism.m:
Turn back on an optimization that avoids passing parameters (such as
type_infos) to foreign_procs if they are not actually referred to.
compiler/prog_data.m:
Convert to four-space indentation.
library/svvarset.m:
Add a missing predicate.
trace/mercury_trace.c:
Delete the unused function that used to check for dummy types.
tests/debugger/field_names.{m,inp,exp}:
Add to this test case a test of the handling of dummy types. Check that
their values can be printed out during normal execution, and that the
debugger doesn't consider them live nondummy variables, just as it
doesn't consider I/O states live nondummy variables.
|
||
|
|
ff0759fccb |
Workaround syntax errors that are caused by the addition
Estimated hours taken: 0.1 Branches: main compiler/add_special_pred.m: compiler/post_term_analysis.m: compiler/special_pred.m: compiler/term_constr_initial.m: compiler/trace_params.m: compiler/unify_proc.m: mdbcomp/prim_data.m: Workaround syntax errors that are caused by the addition of `:- initialise' declarations. In the long run we should just change the special_pred_id type. |
||
|
|
87dc81843f |
Tell the declarative debugger that private_builtin predicates don't generate
Estimated hours taken: 1 Branches: main Tell the declarative debugger that private_builtin predicates don't generate any events. When a program is compiled in a .decldebug grade the declarative debugger performs a sanity check when doing subterm dependency tracking. It checks that each interface event matches up to the correct atomic goal in the procedure body. This sanity check was failing when a call to a predicate from private_builtin was encountered, since such calls don't generate any events. compiler/prog_util.m: mdbcomp/prim_data.m: Move the definition of any_mercury_builtin_module and all related predicates from compiler/prog_util.m to mdbcomp/prim_data.m, so that this code can be shared by the compiler and the debugger. compiler/simplify.m: Call mercury_public_builtin_module in mdbcomp/priv_data. mdbcomp/program_representation.m: Call any_mercury_builtin_module when determining if a predicate call should be treated as a primitive or not. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/priv_builtin_bug.exp: tests/debugger/declarative/priv_builtin_bug.inp: tests/debugger/declarative/priv_builtin_bug.m: Add a regression test. Previously this test would result in the following exception being thrown: "match_atomic_goal_to_contour_event: name mismatch on call". The test should only be run in .decldebug grades, since this is the only time the sanity check is done (in other grades some events are allowed to be missing). |
||
|
|
3bded6235e |
Add a --module option to the mdb dice command to limit output to a specific
Estimated hours taken: 6 Branches: main Add a --module option to the mdb dice command to limit output to a specific module or package. Write out the trace counts even if the program aborts because of an uncaught exception. browser/dice.m Handle the --module option by adding an extra argument to the read_dice_to_string predicate which is called from mdb. doc/user_guide.texi Document the --module option. mdbcomp/prim_data.m Add a predicate to check if one module is a sub-module of another. runtime/mercury_trace_base.c runtime/mercury_trace_base.h Add a function which writes the trace counts out to the file indicated by the symbolic constant MERCURY_TRACE_COUNTS_FILE_NAME. Move the symbolic constant MERCURY_TRACE_COUNTS_FILE_NAME from runtime/mercury_wrapper.c to runtime/mercury_trace_base.h, so it is accessible from the above function. runtime/mercury_wrapper.c Register a function to write the trace counts to a file when the program aborts because of an uncaught exception. Call the same function when the program terminates normally. tests/debugger/dice.exp tests/debugger/dice.inp Test the new --module option. trace/mercury_trace_internal.c Add and handle the new --module option. |
||
|
|
b5550df746 |
Add mdb `dice' command which reads in a set of passing trace counts and a
Estimated hours taken: 40 Branches: main Add mdb `dice' command which reads in a set of passing trace counts and a failing trace count and prints a comparison table. The table can be sorted by various metrics and is useful for finding parts of a program executed in a failing run, but not in passing runs. browser/dice.m Add a new module for generating and manipulating a dice. browser/mdb.m Add the dice module. compiler/special_pred.m mdbcomp/prim_data.m Move special_pred_name_arity/3 from compiler/special_pred.m to mdbcomp/prim_data.m so it can be used in dice.m. doc/user_guide.texi Document the `dice' mdb command. Also document the fact that the failing and passing slice file names can be set with the `set' mdb command. Move the `set' command to the misc section from the browser section since it now also sets the passing and failing slice file names, which have nothing to do with the browser. library/list.m Add map4, map5 and map6 since map6 is needed in dice.m. mdbcomp/program_representation.m Add a predicate to convert a goal path to a string. mdbcomp/trace_counts.m Convert string_to_trace_port into a predicate and add a new mode so that a port can be converted back to a string. runtime/mercury_trace_base.h trace/mercury_trace_util.h Move the MR_TRACE_USE_HP and MR_TRACE_CALL_MERCURY macros to runtime/mercury_trace_base.h, so that they can be called from browser/dice.m. tests/Mmake.common Clean up trace counts (which are generated to test the `dice' command). tests/debugger/Mmakefile tests/debugger/dice.exp tests/debugger/dice.exp2 tests/debugger/dice.inp tests/debugger/dice.m tests/debugger/dice.passes Test the `dice' command. trace/mercury_trace_internal.c Add the mdb `dice' command and modify the `set' command so the `fail_trace_count' and `pass_trace_counts' parameters can be set. Add a function to print a dice. Move the `set' command to the misc help section. |
||
|
|
4970242093 |
Use proc_label data structure defined in mdbcomp.prim_data instead of proc_id
Estimated hours taken: 4 Branches: main Use proc_label data structure defined in mdbcomp.prim_data instead of proc_id defined in mdb.declarative_execution and delete proc_id, since these data structures are almost identical. browser/declarative_execution.m Remove proc_id and flat_module_name types. Use mdbcomp.prim_data.proc_label and mdbcomp.prim_data.module_name instead. browser/declarative_debugger.m browser/declarative_oracle.m browser/declarative_tree.m browser/declarative_user.m Use mdbcomp.prim_data.proc_label and mdbcomp.prim_data.module_name instead of mdb.declarative_execution.proc_id and mdb.declarative_execution.module_name. mdbcomp/prim_data.m compiler/prog_out.m Move sym_name_to_string from prog_out to prim_data. Fix comment for prog_out.sym_name_and_arity_to_string. compiler/bytecode.m compiler/check_typeclass.m compiler/code_gen.m compiler/deforest.m compiler/higher_order.m compiler/hlds_code_util.m compiler/hlds_error_util.m compiler/hlds_module.m compiler/hlds_out.m compiler/intermod.m compiler/layout_out.m compiler/make.module_target.m compiler/make_hlds.m compiler/mercury_compile.m compiler/mercury_to_mercury.m compiler/ml_elim_nested.m compiler/mlds_to_c.m compiler/mlds_to_gcc.m compiler/mlds_to_il.m compiler/mlds_to_java.m compiler/mlds_to_managed.m compiler/modes.m compiler/modules.m compiler/opt_debug.m compiler/options_file.m compiler/polymorphism.m compiler/prog_io.m compiler/prog_rep.m compiler/rl.m compiler/rl_exprn.m compiler/rl_gen.m compiler/rl_info.m compiler/rl_out.pp compiler/rtti.m compiler/rtti_out.m compiler/rtti_to_mlds.m compiler/source_file_map.m compiler/table_gen.m compiler/trans_opt.m compiler/unify_gen.m compiler/unique_modes.m compiler/unused_args.m Use mdbcomp.prim_data.sym_name_to_string instead of prog_out.sym_name_to_string. |
||
|
|
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. |