mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
master
93 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d8a31e574e |
Move six utility modules from check_hlds to hlds.
compiler/inst_lookup.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_util.m:
compiler/mode_util.m:
compiler/type_util.m:
Move these modules from the check_hlds package to the hlds package.
The reason is that all the content of five of these modules, and
most of the content of one module (inst_util.m) is not used
exclusively during semantic checking passes. (A later diff
should deal with the exception.) Some are used by the pass that
builds the initial HLDS, and all are used by middle-end and backend
passes. The move therefore reduces the number of inappropriate imports
of the check_hlds package.
compiler/check_hlds.m:
compiler/hlds.m:
Effect the transfer.
compiler/*.m:
Conform to the changes above.
|
||
|
|
d97a37db5e |
Delete ":- type xs == list(x)" equivalences ...
... and replace occurrences of xs with list(x). |
||
|
|
7613c18e04 |
Update and fix copyright notices.
compiler/hlds*.m:
compiler/state_var.m:
As above.
|
||
|
|
f74e2b70c6 |
Rename the bound_inst type to bound_functor.
compiler/prog_data.m:
As above. The main function symbol of the type was already named
bound_functor, and "bound inst", when spoken/typed in text,
usually refers to the bound/3 function symbol of the mer_inst type,
not to new-renamed type.
compiler/add_mutable_aux_preds.m:
compiler/comp_unit_interface.m:
compiler/cse_detection.m:
compiler/det_report.m:
compiler/direct_arg_in_out.m:
compiler/equiv_type_hlds.m:
compiler/error_msg_inst.m:
compiler/float_regs.m:
compiler/hlds_code_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_mode.m:
compiler/hlds_statistics.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_match.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/inst_util.m:
compiler/lco.m:
compiler/mode_constraints.m:
compiler/mode_errors.m:
compiler/mode_top_functor.m:
compiler/mode_util.m:
compiler/modecheck_coerce.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_inst_mode_name.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_out_item.m:
compiler/parse_tree_to_term.m:
compiler/pd_util.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/simplify_goal_switch.m:
compiler/switch_detection.m:
compiler/types_into_modes.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Perform s/bound_inst/bound_functor/ and s/BoundInst/BoundFunctor/ where
appropriate, with some instances of s/bound_inst_list/bound_functors/.
|
||
|
|
5a45d1afb8 |
Replace the cons/3 cons_id ...
... with the du_data_ctor/1 cons_id, which contains a du_ctor/3.
Putting all the info about discriminated union data constructors into a
separate type allows code that works only with the cons_ids of du types
to stop having to worry about all the other kinds of cons_ids.
compiler/prog_data.m:
As above.
Delete the cons_ctor type from this module after moving it to
recompilation.usage.m, which is the only part of the compiler
that uses it.
compiler/add_foreign_enum.m:
Replace cons_id_to_tag_map with du_ctor_to_tag_map, since the only
cons_ids the map handles are du_ctors.
compiler/hlds_cons.m:
Replace cons_ids with du_ctors in the cons_table and in the
info we keep about du types' fields.
compiler/hlds_data.m:
Replace cons_ids with du_ctors in cheaper_tag_tests.
Provide two forms of a utility function. Both return du_ctors,
but one wraps them up as cons_ids.
compiler/type_assign.m:
Replace cons_ids with du_ctors in cons_type_info_sources.
compiler/type_util.m:
Switch many of the utility predicates and functions in this module
to operate on du_ctors instead of cons_ids. Split some of the others
to have both du_ctor and cons_id versions.
Replace a predicate that returned a set of solutions one at a time
on backtracking with a predicate that returns all the solutions
at once in a list.
Reduce unnecessary variability in variable names.
Add some XXXs for code with unclear motivations.
compiler/typecheck_error_undef.m:
Delete a function argument that was used only in a sanity check,
because the code at its only call site derived that argument using code
that made it impossible for the sanity check to fail.
Factor out some common code.
compiler/parse_tree_out_cons_id.m:
For three functions that operate on cons_ids, add versions
that do the same job on du_ctors.
compiler/inst_match.m:
Conform to the changes above. This diff rewrites from scratch
the algorithm for testing whether a list of bound insts covers
*all* the du_ctors of a type, because the old code was both inefficient
and very opaque.
compiler/float_regs.m:
Conform to the changes above, and delete a conditionally enabled abort
that shouldn't ever be enabled.
compiler/inst_util.m:
Conform to the changes above, and rename a predicate to avoid
an ambiguity.
compiler/mode_errors.m:
Conform to the changes above, and switch to printing the cons_ids
in some error messages using the standard mechanisms of
write_error_spec.m.
compiler/resolve_unify_functor.m:
Conform to the changes above. Factor out repeated tests against
du_data_ctor.
compiler/term_norm.m:
Conform to the changes above. Add XXXs for some bugs.
compiler/add_type.m:
compiler/assertion.m:
compiler/builtin_lib_types.m:
compiler/comp_unit_interface.m:
compiler/complexity.m:
compiler/const_struct.m:
compiler/cse_detection.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/delay_partial_inst.m:
compiler/direct_arg_in_out.m:
compiler/distance_granularity.m:
compiler/du_type_layout.m:
compiler/error_msg_inst.m:
compiler/field_access.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/goal_util.m:
compiler/hhf.m:
compiler/higher_order.specialize_calls.m:
compiler/higher_order.specialize_unify_compare.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_type_table.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_decide.m:
compiler/lco.m:
compiler/ml_global_data.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_util.m:
compiler/mode_top_functor.m:
compiler/mode_util.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/old_type_constraints.m:
compiler/parse_inst_mode_name.m:
compiler/parse_tree_out_item.m:
compiler/parse_tree_to_term.m:
compiler/polymorphism_goal.m:
compiler/polymorphism_lambda.m:
compiler/pre_typecheck.m:
compiler/prog_ctgc.m:
compiler/prog_mode.m:
compiler/prog_rep.m:
compiler/prog_type.m:
compiler/prog_util.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.usage.m:
compiler/recompilation.used_file.m:
compiler/recompute_instmap_deltas.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/size_prof.m:
compiler/ssdebug.m:
compiler/stack_opt.m:
compiler/structure_reuse.direct_choose_reuse.m:
compiler/structure_reuse.direct_detect_garbage.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_build.m:
compiler/typecheck_clauses.m:
compiler/typecheck_error_util.m:
compiler/typecheck_errors.m:
compiler/unify_gen_test.m:
compiler/unify_gen_util.m:
compiler/unify_proc.m:
compiler/untupling.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
Expect diagnostics generated using the standard error_spec representations
of cons_ids.
|
||
|
|
ca932da67e |
Delete the lambda_eval_method type and its uses.
compiler/prog_data.m:
The lambda_eval_method type has only ever been used by the Aditi backend,
and it has been a dummy type since that backend has been deleted.
Delete this type, and the lambda_eval_method fields from closure_cons
cons_ids, from the corresponding closure_tag cons_tag, and from
the representation of higher order types, in order to avoid having to
maintain code that sets or copies fields that have no purpose.
The lambda_eval_method type is (now was) separate from the eval method
stored in proc_infos, which does have alternatives to the normal
eval method. All of these alternatives are forms of tabling, but
lambdas cannot be tabled on their own.
compiler/hlds_goal.m:
Delete the lambda_eval_method field from rhs_lambda_goals.
compiler/*.m:
Conform to the changes above.
|
||
|
|
a13a6d0f97 |
Carve hlds_proc_util.m out of hlds_pred.m.
compiler/hlds_pred.m:
compiler/hlds_proc_util.m:
As above. hlds_proc_util.m now contains utility predicates
that most modules that import hlds_pred.m don't need.
(More than four times as many modules import hlds_pred.m
as now import hlds_proc_util.m.)
compiler/*.m:
Conform to the changes above.
|
||
|
|
dde8c1f396 |
Delete mer_inst's free/1 functor.
This functor was intended to have the same semantics as free/0, while
containing the type of the value it was applied to. However, commit
|
||
|
|
92941c4239 |
Delete mer_inst's abstract_inst functor.
We have never supported abstract insts, and we are not likely to start
using them any time soon, but we have had them in the representation of insts
since the beginning. Since they were never actually generated, the code
that operated on them was never really tested, which is good, because
in many places, that code simply threw an exception. The code that didn't
throw an exception when it found an abstract inst had to work correctly
for the abstract_insts that we actually generated, which were abstract
only in the sense that they were references to a would-be user-defined inst
name that wasn't actually defined.
There were two sources of such "abstract" insts.
- One was failed calls to inst_lookup that specified an user_inst inst_name.
- The other consisted of predicates whose job was to construct error messages
involving insts. These either converted cons_ids into abstract insts,
or mangled valid user_inst inst_names into invalid user_inst inst_names,
because error_msg_inst.m generated good-looking messages when given
the results of such conversions.
The first is handled by the fact that module qualification detects and
reports references to undefined insts and modes, and does not let the
compiler proceed to the compiler phases that may call inst_lookup.
The second is handled by the changes to error_msg_inst.m below.
These change to handle the use cases of the two error-message-constructing
predicates that used to employ abstract_insts, but now employ user_inst
defined_insts with a two particular kinds of undefined inst ctor,
one for each use case.
compiler/prog_data.m:
Delete the abstract_int function symbol from the mer_inst type.
compiler/inst_lookup.m:
When the lookup of an user_inst inst_name inside a defined_inst
fails, don't convert that defined_inst into abstract inst,
throw an exception.
compiler/error_msg_inst.m:
Add code to deal with the insts that add_mutable_aux_preds.m and
mode_errors.m generate for us to convert to lists of error message pieces.
The addition is done twice, in an as identical a fashion as possible,
when generating non-inline pieces and when generating inline pieces.
compiler/add_mutable_aux_preds.m:
compiler/mode_errors.m:
Document how these modules cooperates with error_msg_inst.m.
compiler/add_mode.m:
compiler/comp_unit_interface.m:
compiler/direct_arg_in_out.m:
compiler/equiv_type_hlds.m:
compiler/float_regs.m:
compiler/hlds_code_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_mode.m:
compiler/hlds_statistics.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_match.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/inst_util.m:
compiler/make_hlds_passes.m:
compiler/mode_top_functor.m:
compiler/modecheck_coerce.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/pd_util.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/types_into_modes.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above, mostly by deleting code dealing with
abstract_insts.
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid_nodepend/occurs.err_exp:
Update these expected outputs, which each involve errors generated
by the modified code in mode_errors.m or add_mutable_aux_preds.m.
Some of these referred to some things as "named insts" when they were
*not* named insts in the program.
tests/invalid_nodepend/kind.{m,err_exp}:
Add some invalid code to this test, and update the expected output
accordingly.
|
||
|
|
b6d6a874e6 |
Improve the argument list of a predicate.
compiler/hlds_code_util.m:
As above.
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
Conform to the changes above.
|
||
|
|
08365979d0 |
Move pred_name.m to the HLDS package.
This is so that it can become the home of the type currently named
pred_origin in hlds_pred.m, which (after being given new name) will become
a structured representation of predicate names.
The only thing that kept pred_name.m in the parse_tree package was the fact
that parse_pragma.m, which has no access to the hlds package, called it
to create the name of a type-specialized predicate when parsing
type_spec pragmas. The main part of this diff, apart from the trivial
updates to import hlds.pred_name instead parse_tree.pred_name, deals
with this issue.
The problem is how to ensure that the compiler invocations that create
type-specialized predicates (invocations that compile the module containing
the type_spec pragma that calls for this) and the invocations that create
the calls to those predicates (invocations that mostly compile other modules)
agree on the name of the name of the type-specialized predicate.
The old approach was this.
When reading in (say) mod1.m which contains a type_spec pragma,
we construct the name of the type-specialized predicate from
- the name of the module (mod1),
- the name of the predicate to be specialized, and
- the type substitution in the pragma.
We then record this name in the pragma.
If the compiler invocation generates code, we use this name in the
predicate definition. If the compiler invocation creates a .int file,
we record the name in the third argument of the type_spec pragma.
This third argument is NOT allowed to exist in .m files.
Other compiler invocations that read in mod1.int when compiling
another module, e.g. mod2.m, use the specialized name in the third argument
of the type_spec pragma as the name to use in calls.
In this approach, the single-source-of-truth about the name of the
type-specialized predicate is the name constructed when parsing mod1.m,
which is conveyed to compiler invocations on other modules through
the third argument of the type_spec pragma.
The new approach is this:
When reading in (say) mod1.m which contains a type_spec pragma,
we give guaranteed-to-be-unique names to all the anonymous variables
in the type_spec pragma. We also record in the type_spec pragma
the name of the module whose (source or interface) file we read
the pragma from. The name of the predicate to be specialized
was of course already in the pragma.
If the compiler invocation generates code, we construct the name
of the type-specialized version of the predicate when we add the
all-tvars-are-named type_spec pragma to the HLDS. If the compiler
invocation creates a .int file, we write out the all-tvars-are-named
version of the type_spec pragma. The pragma also contains the predicate
name to be specialized. It does not contain the name of the module,
but we will write out type_spec pragmas from module_x.m *only* to
module_x.int, never to any other .int file, so any readers of
the type_spec pragma from mod1.int will also know the name of the
module that the pragma came from.
Other compiler invocations that read in mod1.int when compiling
another module, e.g. mod2.m, therefore get exactly the same
- module name,
- the name of the predicate to be specialized, and
- the type substitution in the pragma
as the compiler invocations on mod1.m. The module name are the
predicate name are never changed by being written out and then
read back in, and *due to the explicit names given to any formerly
anonymous variables*, the type substitution is changed by this either.
This means that the compiler invocations on mod1.m and mod2.m
give the same parameters to the same function, and therefore they are
guaranteed to get the same string as the name of the type-specialized
version of the predicate.
In this approach, the single-source-of-truth about the name of the
type-specialized predicate is the function constructing that name
and its inputs.
compiler/hlds.m:
compiler/parse_tree.m:
compiler/pred_name.m:
Move pred_name.m from the parse_tree package to the hlds package.
compiler/prog_item.m:
Change the representation of type_spec pragmas to
- delete the name of the specialized predicate, and replace it with
- the name of the module the pragma was read in from.
compiler/parse_pragma.m:
Delete the code for parsing the third argument of type_spec pragmas.
Allow them to exist for a short transition period, but ignore them.
(If we read in files containing them, the result will be a link error
if the type substitution contains anonymous variables. In that case,
a rebuild of the program with all modules compiled using the *same
compiler version* will work.)
Give guaranteed-to-be-unique names to all anonymous type variable
in the type substitution part of the type_spec pragma we construct.
compiler/add_pragma_type_spec.m:
Construct the name of the type-specialized predicate as the type_spec
pragma is added to the HLDS.
compiler/parse_tree_out_pragma.m:
Never write out a type_spec par_loop_control with a third argument.
Delete the var_name_print argument of the predicate that writes out
type_spec pragmas. Instead, *always* use print_name_only.
compiler/options.m:
Add a way of testing whether the installed compiler has this change.
compiler/accumulator.m:
compiler/add_pragma_tabling.m:
compiler/add_special_pred.m:
compiler/base_typeclass_info.m:
compiler/check_typeclass.m:
compiler/dep_par_conj.m:
compiler/distance_granularity.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/intermod.m:
compiler/lambda.m:
compiler/layout_out.m:
compiler/lco.m:
compiler/loop_inv.m:
compiler/make_hlds_passes.m:
compiler/name_mangle.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_loop_control.m:
compiler/parse_tree_out.m:
compiler/pd_info.m:
compiler/prog_rep.m:
compiler/ssdebug.m:
compiler/stm_expand.m:
compiler/structure_reuse.versions.m:
compiler/table_gen.m:
compiler/tupling.m:
compiler/untupling.m:
compiler/unused_args.m:
|
||
|
|
ea4f95a7ed |
Use var_tables in lco.m, and when dumping goals.
Since this is the first converted module that dumps out goals when
debugging trace flags are enabled, this required generalizing the code
that does that, to take either varsets or var_tables as a means of
specifying the names of variables. We do this via a new type,
var_name_source, which contains either a varset or a var_table.
Almost all of this diff is there to implement this generalization.
A large part of it affects code in the parse_tree package that we use
to write out the parts of HLDS goals that are defined by types defined
in that package. Since we want to avoid making any part of the parse_tree
package dependent on the hlds package, this required defining the
var_name_source type in the parse_tree package, which in turn requires
var_table.m to be in that same package.
compiler/lco.m:
Convert this module to use var_tables instead of varsets and vartypes.
compiler/var_table.m:
Move this module from the hlds package to the parse_tree package.
To make this, possible, move the parts that required access to the HLDS
to hlds_pred.m, from where it was usually invoked.
Export some utility predicates to allow the moved code to work
in hlds_pred.m without access to the actual definition of the
var_table type.
Define the var_name_source type.
Add some utility functions for use by code writing out variable names.
compiler/hlds_pred.m:
Add the code moved from var_table.m.
compiler/vartypes.m:
Move this module from the hlds package to the parse_tree package,
for symmetry with var_table.m. It did not depend on being in hlds
in any way.
compiler/hlds.m:
compiler/parse_tree.m:
Move vartypes.m and var_table.m from the hlds package
to the parse_tree package.
compiler/hlds_out_goal.m:
Change all the predicates in this module to take a var_name_source
instead of a prog_varset.
Fix some comments.
compiler/hlds_out_util.m:
Change some of the predicates in this module (those called from
hlds_out_goal.m) to take a var_name_source instead of a prog_varset.
compiler/parse_tree_out_term.m:
Provide variants of some existing predicates and functions that take
var_name_sources instead of varsets. The code of the copies
duplicates the logic of the originals, though I hope that this
duplication can be done away with at the end of the transition.
(The best solution would be to use a typeclass with methods
that convert vars to their names, but we would want to ensure
that the compiler can specialize all the affected predicates
and functions to the two instances of this typeclass, which is
something that we cannot do yet. In the meantime, the lack of
any generalization in the old versions preserves their performance.)
tools/sort_imports:
tools/filter_sort_imports:
A new tool that automatically sorts any occurrences of consecutive
":- import_module" declarations in the named files. The sorting is done
in filter_sort_imports; sort_imports loops over the named files.
After automatically replacing all occurrences of hlds.{vartypes,var_table}
in import_module declarations with their parse_tree versions, the updated
import_module declarations were usually out of order with respect to
their neighbours. I used this script to fix that, and some earlier
out-of-order imports.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_heap_ops.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/analysis.m:
compiler/arg_info.m:
compiler/build_mode_constraints.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/check_promise.m:
compiler/closure_analysis.m:
compiler/closure_gen.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/continuation_info.m:
compiler/convert_parse_tree.m:
compiler/coverage_profiling.m:
compiler/cse_detection.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/direct_arg_in_out.m:
compiler/disj_gen.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/file_names.m:
compiler/float_regs.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/goal_mode.m:
compiler/goal_path.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_clauses.m:
compiler/hlds_code_util.m:
compiler/hlds_error_util.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/hlds_out_pred.m:
compiler/hlds_rtti.m:
compiler/hlds_statistics.m:
compiler/inlining.m:
compiler/inst_check.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/instance_method_clauses.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_analysis.m:
compiler/interval.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/lookup_switch.m:
compiler/loop_inv.m:
compiler/make.module_target.m:
compiler/make.util.m:
compiler/make_goal.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_types.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_commit_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_unify_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mmc_analysis.m:
compiler/mode_comparison.m:
compiler/mode_constraints.m:
compiler/mode_debug.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_ordering.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/module_cmds.m:
compiler/old_type_constraints.m:
compiler/opt_debug.m:
compiler/optimize.m:
compiler/options_file.m:
compiler/ordering_mode_constraints.m:
compiler/par_loop_control.m:
compiler/parse_item.m:
compiler/parse_string_format.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/parse_util.m:
compiler/pd_debug.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/peephole.m:
compiler/polymorphism.m:
compiler/polymorphism_info.m:
compiler/polymorphism_lambda.m:
compiler/polymorphism_type_class_info.m:
compiler/polymorphism_type_info.m:
compiler/post_typecheck.m:
compiler/pragma_c_gen.m:
compiler/pred_name.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/quantification.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_graph.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.used_file.m:
compiler/recompilation.version.m:
compiler/recompute_instmap_deltas.m:
compiler/resolve_unify_functor.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/set_of_var.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_goal_scope.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/smm_common.m:
compiler/ssdebug.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.domain.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_data.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/term_constr_util.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/try_expand.m:
compiler/tupling.m:
compiler/type_assign.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_debug.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/var_locn.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
Conform to the changes above.
|
||
|
|
3a306a7f1f |
Prepare to add new warnings about instances.
Prepare for these new options, --warn-unnecessarily-private-instance and
--warn-inconsistent-instance-order, by
- moving some checks on instance declarations to a point in time
when the set of instance declarations in the module is complete, and
- adding a new field to instance declarations to record a context needed
for the second of the above warnings.
compiler/add_class.m
compiler/check_typeclass.m
Move some checks on instances from add_class.m, where they have to
work with incomplete data, to check_typeclass.m, where they have access
to all instance declarations. The tests moved are
- the test whether the abstract and concrete forms of an instance
specify the same constraints or not,
- the test for duplicate concrete instances, and
- the test for overlapping instances.
The new code can be, and is, much more systematic in looking for
inconsistencies between instance declarations. For example,
it distinguishes between duplicate and overlapping instance declarations,
whereas the old code did not. This allows it to generate more precise
messages.
We do in fact generate a new warning message, for duplicate abstract
instance declarations.
Crucially, the new code can also gather the information needed
for --warn-inconsistent-instance-order, although the gathered info
is then throw away. This will change soon.
Record phase_type_check as the phase of all the error_specs generated
in this module, not just most of them.
Avoid constructing doing a global traversal of the entire instance table
when a local traversal of just the part for one class_id will do.
Give some predicates more meaningful names.
compiler/hlds_class.m
To check whether abstract instance declarations are in the same order
as concrete instance declarations, check_typeclass.m needs to record,
with each concrete instance declaration, the context of the corresponding
abstract instance declaration (if any). Add a slot for this information.
Change instance_id from an equivalence type to a notag type,
to reduce the chances of values of that type being confused
with integers whose semantics is something else.
Document why the structure of the instance table is what it is.
compiler/base_typeclass_info.m
compiler/dead_proc_elim.m
compiler/higher_order.m
compiler/hlds_code_util.m
compiler/hlds_defns.m
compiler/hlds_out_typeclass_table.m
compiler/intermod.m
compiler/polymorphism_type_class_info.m
compiler/recompilation.usage.m
compiler/typeclasses.m
compiler/unused_imports.m
Conform to the change in hlds_class.m.
compiler/hlds_out_util.m
Add a utility function for use by new code in hlds_out_typeclass_table.m.
tests/invalid/incompatible_instance_constraints.err_exp
tests/invalid/missing_concrete_instance.err_exp
tests/invalid/typeclass_test_9.err_exp
Expect updated error messages.
|
||
|
|
5750c35e64 |
Move pred-name-constructing code to pred_name.m.
compiler/pred_name.m:
Support the construction of predicate names for more predicate transforms,
including those done by higher_order.m and table_gen.m. Neither conformed
to the naming scheme of the other predicate transformations. For the
transforms done by higher_order.m, add XXXs noting this. For the transform
done by table_gen.m, make it generate names that do conform to our pattern.
We can do this because we only generate the affected predicates (and their
names) in minimal model own stack grades, which are not operational :-(
Move code to create names for the predicates implementing typeclass
methods here.
Move code to create names for unify, compare and index predicates here.
Include "sym_name" in the names of the predicates that construct sym_names.
Rename one of the existing transform_names to avoid ambiguity.
compiler/hlds_pred.m:
Change the argument order of pred_info_init, partly to put first things
first, but also to flush out places that construct predicate names.
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/hlds_code_util.m:
Delete the code moved to pred_name.m.
compiler/accumulator.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/base_typeclass_info.m:
compiler/dep_par_conj.m:
compiler/distance_granularity.m:
compiler/higher_order.m:
compiler/lambda.m:
compiler/layout_out.m:
compiler/loop_inv.m:
compiler/name_mangle.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_loop_control.m:
compiler/parse_pragma.m:
compiler/pd_info.m:
compiler/prog_rep.m:
compiler/special_pred.m:
compiler/structure_reuse.versions.m:
compiler/table_gen.m:
compiler/tupling.m:
compiler/untupling.m:
compiler/unused_args.m:
Conform to the changes above.
tests/debugger/mmos_print.exp:
Update the only minimal_model_own_stack generator predicate name
outside the compiler.
|
||
|
|
3d0028840e |
Build the no_tag_type_nap in decide_type_repns_new.
compiler/du_type_layout.m:
As above.
compiler/old_type_constraints.m:
compiler/prog_out.m:
Move an old utility predicate used for debugging, type_to_string,
from old_type_constraints.m to prog_out.m, to make it available to
du_type_layout.m, and rename it type_to_debug_string, to avoid giving
the impression that it generates valid Mercury code, when it does not.
compiler/hlds_code_util.m:
Rename the local version of type_to_string to instance_type_ctor_to_string,
to better reflect its purpose.
compiler/prog_item.m:
Add an XXX for a possible future improvement.
|
||
|
|
40725f170e |
Replace ten int cons_ids with one.
We currently have one function symbol in the cons_id type for each
of our ten types of integer constants: signed vs unsigned, and
word-sized, 8-bit, 16-bit, 32-bit and 64-bit. In most places in the compiler,
these are all treated the same, and it gets tedious to have to write
the same logic ten times. This diff therefore changes things so that
the distinction between int constants of these ten types is pushed
to one level lower than the cons_id type.
compiler/prog_data.m:
Replace the ten cons_ids {int,uint}{,8,16,32,64}_const with just one,
some_int_const, whose argument now has those function symbols.
Add some utility functions on integer constants.
compiler/prog_out.m:
Add a utility predicate for converting int constants to strings.
compiler/parse_tree_to_term.m:
Add a utility predicate for converting int constants to terms.
compiler/old_type_constraints.m:
Conform to the changes above.
Fix an old bug, though this does not matter since this module is unused.
compiler/add_pred.m:
compiler/bytecode_gen.m:
compiler/const_prop.m:
compiler/coverage_profiling.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/dep_par_conj.m:
compiler/distance_granularity.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/make_goal.m:
compiler/mercury_to_mercury.m:
compiler/ml_global_data.m:
compiler/mode_util.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/module_qual.qualify_items.m:
compiler/parse_util.m:
compiler/polymorphism.m:
compiler/polymorphism_type_info.m:
compiler/prog_ctgc.m:
compiler/prog_rep.m:
compiler/prog_type.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.region_transformation.m:
compiler/simplify_goal_call.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/superhomogeneous.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above. Use the new utility predicates
to avoid code duplication.
|
||
|
|
a19a5f0267 |
Delete the Erlang backend from the compiler.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_backend.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
compiler/erlang_rtti.m:
compiler/mercury_compile_erl_back_end.m:
Delete these modules, which together constitute the Erlang backend.
compiler/notes/compiler_design.html:
Delete references to the deleted modules.
compiler/parse_tree_out_type_repn.m:
Update the format we use to represent the sets of foreign_type and
foreign_enum declarations for a type as part of its item_type_repn_info,
now that Erlang is no longer a target language.
compiler/parse_type_repn.m:
Accept both the updated version of the item_type_repn_info and the
immediately previous version, since the installed compiler will
initially generate that previous version. However, stop accepting
an even older version that we stopped generating several months ago.
compiler/parse_pragma_foreign.m:
When the compiler finds a reference to Erlang as a foreign language,
add a message about support for Erlang being discontinued to the error
message.
Make the code parsing foreign_decls handle the term containing
the foreign language the same way as the codes parsing foreign
codes, procs, types and enums.
Add a mechanism to help parse_mutable.m to do the same.
compiler/parse_mutable.m:
When the compiler finds a reference to Erlang as a foreign language,
print an error message about support for Erlang being discontinued.
compiler/compute_grade.m:
When the compiler finds a reference to Erlang as a grade component,
print an informational message about support for Erlang being discontinued.
compiler/pickle.m:
compiler/make.build.m:
Delete Erlang foreign procs and types.
compiler/add_foreign_enum.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/const_struct.m:
compiler/convert_parse_tree.m:
compiler/dead_proc_elim.m:
compiler/decide_type_repn.m:
compiler/deps_map.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/foreign.m:
compiler/globals.m:
compiler/granularity.m:
compiler/handle_options.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_module.m:
compiler/inlining.m:
compiler/int_emu.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/lco.m:
compiler/llds_out_file.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_separate_items.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/ml_code_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_target_util.m:
compiler/ml_top_gen.m:
compiler/mlds.m:
compiler/mlds_dump.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_type.m:
compiler/module_imports.m:
compiler/parse_pragma_foreign.m:
compiler/parse_tree_out.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/prog_data.m:
compiler/prog_data_foreign.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/simplify_goal_scope.m:
compiler/special_pred.m:
compiler/string_encoding.m:
compiler/top_level.m:
compiler/uint_emu.m:
compiler/write_deps_file.m:
Remove references to Erlang as a backend or as a target language.
tests/invalid/bad_foreign_code.{m,err_exp}:
tests/invalid/bad_foreign_decl.{m,err_exp}:
tests/invalid/bad_foreign_enum.{m,err_exp}:
tests/invalid/bad_foreign_export.{m,err_exp}:
tests/invalid/bad_foreign_export_enum.{m,err_exp}:
tests/invalid/bad_foreign_import_module.{m,err_exp}:
tests/invalid/bad_foreign_proc.{m,err_exp}:
tests/invalid/bad_foreign_type.{m,err_exp}:
Add a test for Erlang as an invalid foreign language. Expect both the
new error message for this new error, and the updated list of now-valid
foreign languages on all errors.
|
||
|
|
d5ade25753 |
Implement the obsolete_proc pragma.
While the existing obsolete pragma declares an entire predicate or function
obsolete, the new obsolete_proc pragma does this for only THE NAMED MODE
of a predicate or function.
NEWS:
doc/reference_manual.texi:
Mention and document the new pragma.
compiler/prog_item.m:
Add the new pragma. Rename the old pragma to "obsolete_pred". (This affects
only the compiler's internal name; the user visible name stays the same.)
Move a type definition next to its related types.
compiler/parse_pragma.m:
Read in the new pragma.
compiler/hlds_pred.m:
Create a slot in proc_infos for the information in the new pragma.
compiler/add_pragma.m:
Add the new pragma to the HLDS.
To avoid adding to the substantial existing code duplication in this
module, factor out two commonly recurring pieces of code: one that
looks up the (hopefully unique) pred_id specified by a pragma, and
one that looks up and (if found) transforms the procedure specified
by a pragma.
Use error-message phraseology consistent with that employed by
the newly-factored-out predicate even in places that cannot use them.
Move the code handling foreign_export pragma here from add_foreign_proc.m
to take advantage of the newly-factored out predicates.
compiler/add_foreign_proc.m:
Delete the code moved to add_pragma.m.
Fix the structure of the remaining code by putting related code fragments
next to each other.
compiler/simplify_goal_call.m:
Generate warnings to obsolete procedures as well as obsolete predicates.
compiler/parse_tree_out_pragma.m:
Output the new pragma.
Factor out existing common code.
compiler/hlds_code_util.m:
Put a predicate's arguments into a more meaningful order.
compiler/make_hlds_error.m:
Allow the caller of report_undefined_pred_or_func_error to specify
whether the error applies to a predicate or a function. Most callers
don't have that info, but some do, and using this info when available
allows us to generate a more specific error message.
compiler/add_clause.m:
Conform to the changes above.
Make a predicate easier to read by moving unimportant code out-of-line.
compiler/intermod.m:
Conform to the changes above. Do this in a way that is adaptable to
making intermod.m generate lists of items instead of simply writing
stuff out, even though this makes the diff to this file more complex
than immediately necessary.
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_type_spec.m:
compiler/canonicalize_interface.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/item_util.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.qualify_items.m:
compiler/prog_data_pragma.m:
compiler/prog_item_stats.m:
compiler/recompilation.version.m:
Conform to the changes above.
compiler/options.m:
Provide a simple way for the configure script to test for the presence
of this new addition.
tests/invalid/obsolete_proc_pragma.{m,err_exp}:
A test case for the new pragma.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
Enable the new test case, and set it to run with --halt-at-warn.
tests/invalid/bug83.err_exp:
tests/invalid/require_tailrec_invalid.err_exp:
Update these two files to expect updated error messages.
|
||
|
|
86f563a94d |
Pack subword-sized arguments next to a remote sectag.
compiler/du_type_layout.m:
If the --allow-packing-remote-sectag option is set, then try to pack
an initial subsequence of subword-sized arguments next to remote sectags.
To allow the polymorphism transformation to put the type_infos and/or
typeclass_infos it adds to a function symbol's argument list at the
*front* of that argument list, pack arguments next to remote sectags
only in function symbols that won't have any such extra arguments
added to them.
Do not write all new code for the new optimization; instead, generalize
the code that already does a very similar job for packing args next to
local sectags.
Delete the code we used to have that picked the packed representation
over the base unpacked representation only if it reduced the
"rounded-to-even" number of words. A case could be made for its usefulness,
but in the presence of the new optimization the extra code complexity
it requires is not worth it (in my opinion).
Extend the code that informs users about possible argument order
rearrangements that yield better packing to take packing next to sectags
into account.
compiler/hlds_data.m:
Provide a representation for cons_tags that use the new optimization.
Instead of adding a new cons_tag, we do this by replacing several old
cons_tags that all represent pointers to memory cells with a single
cons_tag named remote_args_tag with an argument that selects among
the old cons_tags being replaced, and adding a new alternative inside
this new type. The new alternative is remote_args_shared with a
remote_sectag whose size is rsectag_subword(...).
Instead of representing the value of the "data" field in classes
on the Java and C# backends as a strange kind of secondary tag
that is added to a memory cell by a class constructor instead of
having to be explicitly added to the front of the argument vector
by the code of a unification, represent it more directly as separate
kind of remote_args_tag. Continuing to treat it as a sectag would have
been very confusing to readers of the code of ml_unify_gen_*.m in the
presence of the new optimization.
Replacing several cons_tags that were usually treated similarly with
one cons_tag simplifies many switches. Instead of an switch with that
branches to the same switch arm for single_functor_tag, unshared_tag
and shared_remote_tag, and then switches on these three tags again
to get e.g. the primary tag of each, the new code of the switch arm
is executed for just cons_tag value (remote_args_tag), and switches
on the various kinds of remote args tags only when it needs to.
In is also more natural to pass around the argument of remote_args_tag
than to pass around a variable of type cons_tag that can be bound to only
single_functor_tag, unshared_tag or shared_remote_tag.
Add an XXX about possible further steps along these lines, such as
making a new cons_tag named something like "user_const_tag" represent
all user-visible constants.
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_gen_test.m:
compiler/unify_gen_util.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
Implement X = f(Yi) unifications where f uses the new representation,
i.e. some of its arguments are stored next to a remote sectag.
Some of the Yi are stored in a tagword (a word that also contains a tag,
in this case the remote secondary tag), while some are stored in other
words in a memory cell. This means that such unifications have similarities
both to unifications involving arguments being packed next to local
sectags, and to unifications involving ordinary arguments in memory cells.
Therefore wherever possible, their implemenation uses suitably generalized
versions of existing code that did those two jobs for two separate kinds of
cons_tags.
Making such generalizations possible in some cases required shifting the
boundary between predicates, moving work from a caller to a callee
or vice versa.
In unify_gen_deconstruct.m, stop using uni_vals to represent *either* a var
*or* a word in a memory cell. While this enabled us to factor out some
common code, the predicate boundaries it lead to are unsuitable for the
generalizations we now need.
Consistently use unsigned ints to represent both the whole and the parts
of words containing packed arguments (and maybe sectags), except when
comparing ptag constants with the result of applying the "tag" unop
to a word, (since that unop returns an int, at least for now).
In a few cases, avoid the recomputation of some information that we
already know. The motivation is not efficiency, since the recomputation
we avoid is usually cheap, but the simplification of the code's correctness
argument.
Use more consistent terminology in things such as variable names.
Note the possibility of further future improvements in several places.
compiler/ml_foreign_proc_gen.m:
Delete a long unused predicate.
compiler/mlds.m:
Add an XXX documenting a possible improvement.
compiler/rtti.m:
Update the compiler's internal representation of RTTI data structures
to make them able to describe secondary tags that are smaller than
a full word.
compiler/rtti_out.m:
Conform to the changes above, and delete a long-unused predicate.
compiler/type_ctor_info.m:
Use the RTTI's du_hl_rep to represent cons_tags that distinguish
between function symbols using a field in a class.
compiler/ml_type_gen.m:
Provide a specialized form of a function for code in ml_unify_gen_*.m.
Conform to the changes above.
compiler/add_special_pred.m:
compiler/bytecode_gen.m:
compiler/export.m:
compiler/hlds_code_util.m:
compiler/lco.m:
compiler/ml_closure_gen.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/rtti_to_mlds.m:
compiler/switch_util.m:
compiler/tag_switch.m:
Conform to the changes above.
runtime/mercury_type_info.h:
Update the runtime's representation of RTTI data structures to make them
able to describe remote secondary tags that are smaller than a full word.
runtime/mercury_deconstruct.[ch]:
runtime/mercury_deconstruct.h:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_ml_arg_body.h:
runtime/mercury_ml_deconstruct_body.h:
runtime/mercury_ml_functor_body.h:
These modules collectively implement the predicates in deconstruct.m
in the library, and provide access to its functionality to other C code,
e.g. in the debugger. Update these to be able to handle terms with the
new data representation optimization.
This update requires a significant change in the distribution of work
between these files for the predicates deconstruct.deconstruct and
deconstruct.limited_deconstruct. We used to have mercury_ml_expand_body.h
fill in the fields of their expand_info structures (whose types are
defined in mercury_deconstruct.h) with pointers to three vectors:
(a) a vector of arg_locns with one element per argument, with a NULL
pointer being equivalent to a vector with a given element in every slot;
(b) a vector of type_infos with one element per argument, constructed
dynamically (and later freed) if necessary; and (c) a vector of argument
words. Once upon a time, before double-word and sub-word arguments,
vector (c) also had one word per argument, but that hasn't been true
for a while; we added vector (a) help the consumers of the expand_info
decode the difference. The consumers of this info always used these
vectors to build up a Mercury term containing a list of univs,
with one univ for each argument.
This structure could be stretched to handle function symbols that store
*all* their arguments in a tagword next to a local sectag, but I found
that stretching it to cover function symbols that have *some* of their
arguments packed next to a remote sectag and *some other* of their
arguments in a memory cell as usual would have required a well-nigh
incomprehensibly complex, and therefore almost undebuggable, interface
between mercury_ml_expand_body.h and the other files above. This diff
therefore changes the interface to have mercury_ml_expand_body.h
build the list of univs directly. This make its code relatively simple
and self-contained, and it should be somewhat faster then the old code
as well, since it never needs to allocate, fill in and then free
vectors of type_infos (each such typeinfo now gets put into a univ
as soon as it is constructed). The downside is that if we ever wanted
to get all the arguments at once for a purpose other than constructing
a list of univs from them, it would nevertheless require constructing
that list of univs anyway as an intermediate data structure. I don't see
this downside is significant, because (a) I don't think such a use case
is very likely, and (b) even if one arises, debuggable but a bit slow
is probably preferable to faster but very hard to debug.
Reduce the level of indentation of some of these files to make the code
easier to edit. Do this by
- not adding an indent level from switch statements to their cases; and
- not adding an indent level when a case in a switch has a local block.
Move the break or return ending a case inside that case's block,
if it has one.
runtime/mercury_deep_copy_body.h:
runtime/mercury_table_type_body.h:
Update these to enable the copying or tabling of terms whose
representations uses the new optimization.
Use the techniques listed above to reduce the level of indentation
make the code easier to edit.
runtime/mercury_tabling.c:
runtime/mercury_term_size.c:
Conform to the changes above.
runtime/mercury_unify_compare_body.h:
Make this code compile after the changes above. It does need to work
correctly, since we only ever used this code to compare the speed
of unify-by-rtti with the speed of unify-by-compiler-generated-code,
and in real life, we always use the latter. (It hasn't been updated
to work right with previous arg packing changes either.)
library/construct.m:
Update to enable the code to construct terms whose representations
uses the new optimization.
Add some sanity checks.
library/private_builtin.m:
runtime/mercury_dotnet.cs.in:
java/runtime/Sectag_Locn.java:
Update the list of possible sectag kinds.
library/store.m:
Conform to the changes above.
trace/mercury_trace_vars.c:
Conform to the changes above.
tests/hard_coded/deconstruct_arg.{m,exp,exp2}:
Extend this test to test the deconstruction of terms whose
representations uses the new optimization.
Modify some of the existing terms being tested to make them more diverse,
in order to make the output easier to navigate.
tests/hard_coded/construct_packed.{m,exp}:
A new test case to test the construction of terms whose
representations uses the new optimization.
tests/debugger/browse_packed.{m,exp}:
A new test case to test access to the fields of terms whose
representations uses the new optimization.
tests/tabling/test_packed.{m,exp}:
A new test case to test the tabling of terms whose
representations uses the new optimization.
tests/debugger/Mmakefile:
tests/hard_coded/Mmakefile:
tests/tabling/Mmakefile:
Enable the new test cases.
|
||
|
|
b06b2621b3 |
Move towards packing args with secondary tags.
compiler/hlds_data.m:
Add bespoke types to record information about local and remote secondary
tags. The one for local secondary tags includes the value of the
primary and secondary tag together, since construct unifications
need to assign this value, and it is better to compute this once,
instead leaving the target language compiler to do it, potentially
many times.
Use a wrapped uint8 to record primary tag values, and wrapped uints
to record secondary tag values. The wrap is to prevent any accidental
confusion with other values. The use of uint8 and uint has two purposes.
First, using the tighest possible representation. Tags are never negative,
and primary tags cannot exceed 7. Second, using these types in the compiler
help us eat our own dogfood; if a change causes a problem affecting
these types, its bootcheck should fail, alerting us to the problem.
Add commented-out types and fields that will be needed for packing
sub-word-sized arguments together with both local and remote secondary
tags.
compiler/du_type_layout.m:
Generate references to tags in the new format.
compiler/ml_unify_gen.m:
compiler/unify_gen.m:
compiler/modecheck_goal.m:
Conform to the changes above.
Fix an old bug: the inst corresponding to a constant with a primary
and a local secondary tag is not the secondary tag alone, but both tags
together.
compiler/bytecode.m:
compiler/bytecode_gen.m:
compiler/closure_gen.m:
compiler/disj_gen.m:
compiler/export.m:
compiler/hlds_code_util.m:
compiler/jumpopt.m:
compiler/lco.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/lookup_switch.m:
compiler/lookup_util.m:
compiler/ml_accurate_gc.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_util.m:
compiler/ml_elim_nested.m:
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_type_gen.m:
compiler/mlds_dump.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_stmt.m:
compiler/opt_debug.m:
compiler/peephole.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/string_switch.m:
compiler/switch_util.m:
compiler/tag_switch.m:
compiler/type_ctor_info.m:
Conform to the change to hlds_data.m.
In two places, in rtti_out.m and rtti_to_mlds.m, delete old code
that was needed only to implement reserved tags, which we have
stopped supporting a few months ago.
library/uint8.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
Add predicates to cast from each of these types to uint.
|
||
|
|
15aa457e12 | Delete $module arg from calls to unexpected. | ||
|
|
1693c784fe |
Carve hlds_class.m out of hlds_data.m.
compiler/hlds_class.m:
New module containing the parts of hlds_data.m that deal with
type classes and type class constraints.
compiler/hlds_data.m:
Delete the moved code.
compiler/hlds.m:
Include the new module.
compiler/notes/compiler_design.html:
Document the new module.
compiler/add_class.m:
compiler/base_typeclass_info.m:
compiler/check_typeclass.m:
compiler/dead_proc_elim.m:
compiler/float_regs.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_defns.m:
compiler/hlds_module.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/recompilation.usage.m:
compiler/resolve_unify_functor.m:
compiler/type_assign.m:
compiler/type_class_info.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/typeclasses.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
|
||
|
|
8e6033f1f1 |
Avoid using a soon-to-be-deleted field.
I intend to delete the field in du_type_repns that maps cons_ids to cons_tags.
The information in that map is now present in the field that maps
(the names of) cons_ids to not just the tag of that cons_id, but all the other
representation information for that cons_id. (The duplicate storage of that
information is just a transition arrangement.)
compiler/hlds_code_util.m:
compiler/modecheck_goal.m:
compiler/stack_opt.m:
Look up the tags of cons_ids using type_util.get_cons_repn_defn, which
does the task the way it should be done in the future.
compiler/type_util.m:
Delete the type_ctor argument of get_cons_repn_defn{,_det}, since
its value can always be determined from the value of the cons_id argument.
compiler/ml_unify_gen.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/unify_gen.m:
Conform to the change in type_util.m.
|
||
|
|
fb97df69ed |
Make "compute type representations" a separate pass.
The ultimate purpose of this diff is to prepare for future improvements
in type representations, allowing values of some data types to be represented
more compactly than up to now.
The main way this diff does that is by creating a separate pass for deciding
how values of each type should be represented. We have traditionally decided
data representations for each type as its type definition was processed
during the make_hlds pass, but these decisions were always tentative,
and could be overridden later, e.g. when we processed foreign_type or
foreign_enum pragmas for the type. This dispersed decision making algorithm
is hard to understand, and therefore to change.
This diff centralizes decisions about type representations in a separate
pass that does nothing else. It leaves the algorithm distributed among
several files (du_type_layout.m, make_tags.m, and add_foreign_enum.m) for now,
to make reviewing this diff easier, but soon after it is committed I intend
to move all the relevant code to du_type_layout.m, to centralize the decision
code in "space" as well as in time.
For the reason why this pass runs before any of the semantic analysis
passes, instead of after all of them as I originally intended and as we
discussed on m-dev in late october 2017, see the big comment at the start of
du_type_layout.m.
As per another part of that same discussion on m-dev, this diff
makes a start on implementing a new type of item, the type_repn item,
which is intended *only* to be used in compiler-generated interface files,
*not* in source files. It is only a start because we can use these items
only *after* the creation of a separate type representation decision pass,
and this diff is already very big. The code for making the compiler understand
these items will be added later. The code for generating them will be added
later still, once the code for understanding them has been installed on
all our systems.
Since I was going to be working on the affected code anyway, this diff
also carries out two other decisions that came out of that discussion:
- the deletion of the ability to reserve a tag in a type for HAL,
either via a compiler option or via a pragma, and
- the deletion of the ability to represent a functor using the address
of a statically allocated object (which we haven't used and won't use,
because it slows down accesses to *all the other functors* of the type).
compiler/mercury_compile_front_end.m:
Invoke the new pass for making decisions about type representations
after the make_hlds pass. (We used to do only the final part of it then.)
Fix a bad dump stage name.
Add an extra check for what it means for a module to be error free.
Make a sub-switch explicit.
compiler/hlds.m:
compiler/make_hlds.m:
Move the modules that implement the new pass from the make_hlds package
to the hlds package, to give the compiler's top level access to them.
Make the same move for the modules that the new pass's modules need.
Since they are now part of hlds, they cannot reach into make_hlds,
and I think this is a cleaner solution than forwarding predicates.
Delete some forwarding predicates that are no longer needed.
compiler/notes/compiler_design.html:
Document the updated location of the moved modules.
Add an XXX to note a place where the documentation has not been
updated in the past.
compiler/du_type_layout.m:
Add code to implement the new pass.
Keep the algorithm for deciding type representations as close
to the previously used algorithm as possible, since this diff
is already big enough. (The previous algorithm was scattered across
add_type.m, add_foreign_enum.m, and make_hlds_passes.m.)
Simplifications and optimizations will come later, after this module
is merged with make_tags.m and with (at least) the foreign_enum half of
add_foreign_enum.m.
compiler/make_tags.m:
Keep the functionality of this module, which does both the first part
of deciding type representations (tentatively assigning tags to functors,
an assignment that may be overridden later), and the last part (packing
multiple adjacent less-than-word-sized enum args into a single word,
if possible.), but simplify it where possible, and note possibilities
for further improvements.
compiler/add_foreign_enum.m:
This module has two halves, one dealing with foreign_enum pragmas
and one dealing with foreign_export_enum pragmas.
Change the half that deals with foreign_enum pragmas to just build
a data structure that du_type_layout.m will need to make its decisions,
this structure being a map from type_ctors to the foreign enum
specification applicable to the current target language. Include
in this structure a component that add_foreign_enum.m itself can use
to report better error messages for duplicate foreign_enum pragmas;
this component records, for each type_ctor and language, the context
of the previous foreign_enum pragma for that combo.
Change the input for the half that deals with foreign_export_enum pragmas
to reflect the fact that it is invoked by du_type_layout.m after all
decisions about type representations have already been made.
compiler/add_special_pred.m:
Move this module from the make_hlds package to the hlds package,
since the code that adds special preds for type is now called from
du_type_layout.m.
Change the names of predicates to make clear whether they add
only the declaration of a predicate, only its definition, or both.
Don't try to pre-guess whether the implementation of a type's
compare predicate will need an index predicate. Let the code
that generates calls to the index predicate both declare and define
the index predicate. This change removes the potential for
inconsistencies between the two pieces of code.
compiler/add_pred.m:
Move this module from the make_hlds package to the hlds package,
since add_special_pred.m needs access to it.
compiler/add_type.m:
When adding a type definition to the HLDS, don't try to decide
its representation. Any such decision was tentative anyway, due
to the possibility of e.g. the later processing of foreign_type
or foreign_enum pragmas for the type. Likewise, don't try to
create the special (unify, compare) predicates for the type.
Leave both tasks to the du_type_layout pass.
Likewise, don't try to pack the representation of types, or record
no_tag types in the table of no_tag types, during the post-processing
pass either; leave both of these to du_type_layout as well.
Rename the predicate that post_processes type definitions to reflect
the two tasks left for it to do.
compiler/prog_data.m:
Do not store width information about the arguments of those data
constructors in the parse tree. That information is not computed
until later; until then, it was always filled in with dummy values.
(But see hlds_data.m below.)
Use bespoke types to represent the presence or absence of user-specified
unify and compare predicates.
Change the representation of data constructors to use a single "maybe"
type, not two lists, to denote the presence or absence of existentially
typed arguments.
Give the HLDS the ability to hold representation information about
abstract types that in the future we will get from type_repn items
in the defining modules' interface files.
Delete the uses_reserved_tag type, since we never use reserved tags
anymore.
compiler/prog_item.m:
Add the new type_repn item type, which is not used yet.
Delete the reserve_tag pragma.
Fix an earlier mistake in the wording of a context message.
compiler/hlds_data.m:
Put all the fields of hlds_du_type (the type definition variant dealing
with discriminated union types) that deal with type representation
issues in a single "maybe" field that is set to "no" before the
type representation decision pass has been run.
Add new type, constructor_repn, that stores the same information as the old
constructor type (defined in prog_data.m), PLUS the information
describing how terms with that data constructor are stored.
Likewise, add a new type ctor_arg_rep, which likewise stores
the widths of each constructor argument. When we implement
argument reordering, we would store the offset of the arg as well.
Since the parse tree representations of constructors and their arguments
don't store representation information anymore, the cons_table they
are stored in doesn't either. Make the lookup of representation information
for a given constructor possible by adding a map to the new "maybe" field
of hlds_du_type.
Provide some utility predicates.
Optimize some existing predicates.
Rename some types to better reflect their meaning.
compiler/hlds_module.m:
Provide a slot in the module_info for storing the information
gathered by make_hlds.m that is needed by the new pass.
compiler/make_hlds_separate_items.m:
When we see either a foreign_enum or a foreign_export_enum pragma,
return values of a bespoke type for them (a type defined in
hlds_module.m), instead of an item_pragma. This makes handling them
considerably easier.
compiler/make_hlds_passes.m:
With the changes in this diff, adding a type to the HLDS won't
decide its representation. Therefore delete the code that used
to loop over foreign_export_enum pragmas; in the absence of
the final type representation information, it won't work right.
Record the information that the du_type_layout pass will need
in the module_info.
compiler/add_pragma.m:
Delete the code for passing on foreign_enum and foreign_export_enum
pragmas to add_foreign_enum.m; they are now passed to add_foreign_enum.m
by du_type_layout.m.
Move a utility predicate to make_hlds_error.m, to allow add_foreign_enum.m
to call it.
compiler/make_hlds_error.m:
Add the utility predicate moved from add_pragma.m.
Move the module from the make_hlds to the hlds package.
compiler/module_qual.m:
Provide a mechanism for recording error messages about e.g. undefined
types without recording that we found an undefined type. This sounds
strange, but there is a valid use case.
When a type definition declares a functor's argument to be of an
undefined type, that error is usually fatal; we stop the compiler
from proceeding even to typechecking, since the typechecker will
probably abort with a map lookup failure. Most other references
to undefined types are similarly fatal for the same reason. However,
if e.g. a foreign_export_enum pragma refers to an undefined type,
that error *won't* be visible to the typechecker, and therefore
won't crash it. The error will still cause the compiler to exit
without generating any target language code, but at least it will be
able to run the typechecker and other semantic analysis passes.
Without this change, the compiler will report only one error in
the ee_invalid.m test case; with it, it reports *every* error
in the test case expected output.
compiler/module_qual.qualify_items.m:
Use the capability describe above for undefined types in
foreign_export_enum pragmas.
compiler/module_qual.qual_errors.m:
Delete a (somewhat incorrect) copy of a predicate in prog_item.m,
to reduce code duplication.
compiler/prog_type.m:
Add ways to represent abstract types whose representations are nevertheless
known (from type_repn items in the defining modules' interface files)
to be notag or dummy types. This will be needed to fix Mantis bug #441,
a fix that will probably be one of the first later changes to build
on this diff.
Delete a type moved to type_util.m.
compiler/type_util.m:
Provide extra versions of some predicates, with the difference between
the old and the new versions being that one requires type representations
to have been decided already, and the other one does not.
Move the definition of the ctor_defn type here from prog_type.m,
since prog_type.m itself does not use it, but type_util.m does.
Give some predicates more meaningful names.
compiler/parse_type_defn.m:
Simplify the code for parsing type definitions, to make it easier
to reuse to parse type_repn items.
Add a sanity check that requires existential constraints to have
*some* existential variables to apply to.
Allow "type_is_representable_in_n_bits" as a synonym for
"type_is_abstract_enum", since in the future we want to be able to pack
e.g. multiple int8s, not just multiple enums, into a single word.
Generate more specific error messages for some classes of malformed input.
compiler/parse_type_repn.m:
New module to parse type_repn items.
compiler/polymorphism.m:
Make some predicates that operate on type constructors take
the type constructors themselves as input arguments, not a whole type
*using* that type constructor. Put the arguments of those predicates
in a more standard order.
Note that some predicates don't belong in this module.
compiler/special_pred.m:
Make the code that decides whether a special predicate for a type
constructor can be defined lazily avoid using type representation
information. (Actually, we now make decisions about lazy vs eager
definitions after type representation is available, but that was
not so in an earlier version of this change, and the new code
is more robust.)
compiler/unify_proc.m:
When we decide to generate code for a compare predicate that needs
the type to have an index predicate, don't presume that the index
predicate has already been declared and defined; instead, declare
and define it then and there. (Index predicates are *never* called
from anywhere else.)
Pack the information needed to define a special predicate
into a single structure, to simplify the above.
Since the creation of a clause for a compare predicate may now require
the declaration and definition of an index predicate, the module_info
field of the unify_proc_info is now a writeable field.
Give some predicates and function symbols more meaningful names.
Note some problems with the existing code.
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_solver.m:
compiler/check_typeclass.m:
compiler/code_info.m:
compiler/comp_unit_interface.m:
compiler/ctgc.selector.m:
compiler/ctgc.util.m:
compiler/default_func_mode.m:
compiler/det_report.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/erl_code_gen.m:
compiler/export.m:
compiler/foreign.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/inst_test.m:
compiler/inst_util.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make_hlds_warn.m:
compiler/ml_accurate_gc.m:
compiler/ml_simplify_switch.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
compiler/mode_util.m:
compiler/modecheck_goal.m:
compiler/module_qual.collect_mq_info.m:
compiler/modules.m:
compiler/parse_item.m:
compiler/parse_pragma.m:
compiler/parse_tree.m:
compiler/parse_tree_out.m:
compiler/parse_tree_out_pragma.m:
compiler/post_term_analysis.m:
compiler/proc_requests.m:
compiler/prog_item_stats.m:
compiler/qual_info.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/resolve_unify_functor.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/simplify_goal_ite.m:
compiler/stack_opt.m:
compiler/state_var.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/superhomogeneous.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_constr_build.m:
compiler/term_norm.m:
compiler/trailing_analysis.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/untupling.m:
compiler/unused_imports.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the changes above.
tests/invalid/Mmakefile:
Disable the reserve_tag test case, as it is not applicable anymore.
tests/invalid/exported_foreign_enum.{m,err_exp}:
tests/invalid/pragma_qual_error.{m,err_exp}:
Delete reserve_tag pragmas from these test cases, and its effects
from the expected outputs.
tests/invalid/bad_foreign_type.err_exp:
tests/invalid/bigtest.err_exp:
tests/invalid/foreign_enum_invalid.err_exp:
tests/invalid/type_lhs_var.err_exp:
tests/invalid/uu_type.err_exp:
tests/invalid/where_abstract_enum.err_exp:
tests/invalid/where_direct_arg.err_exp:
Expect the updated messages for some errors.
tests/valid/Mmake.valid.common:
tests/valid/Mmakefile:
Disable any reserve_tag test cases, as they are not applicable anymore.
|
||
|
|
f519e26173 |
Add builtin 64-bit integer types -- Part 1.
Add the new builtin types: int64 and uint64.
Support for these new types will need to be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognise 'int64' and 'uint64' as builtin types.
- Extends the set of builtin arithmetic, bitwise and relational operators
to cover the new types.
- Adds the new internal option '--unboxed-int64s' to the compiler; this will be
used to control whether 64-bit integer types are boxed or not.
- Extends all of the code generators to handle the new types.
- Extends the runtimes to support the new types.
- Adds new modules to the standard library intend to contain basic operations
on the new types. (These are currently empty and not documented.)
There are bunch of limitations marks with "XXX INT64"; these will be lifted in
part 2 of this change. Also, 64-bit integer types are currently always boxed,
again this limitation will be lifted in later changes.
compiler/options.m:
Add the new option --unboxed-int64s.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognise int64 and uint64 as builtin types.
compiler/builtin_ops.m:
Add builtin operations for the new types.
compiler/hlds_data.m:
Add new tag types for the new types.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/rtti.m:
compiler/table_gen.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support writing out constants of the new types.
compiler/llds.m:
Add a representation for constants of the new types to the LLDS.
compiler/stack_layout.m:
Add a new field to the stack layout params that records whether
64-bit integers are boxed or not.
compiler/call_gen.:m
compiler/code_info.m:
compiler/disj_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/lookup_switch.m:
compiler/mercury_compile_llds_back_end.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/var_locn.m b/compiler/var_locn.m:
Support the new types in the LLDS code generator.
compiler/mlds.m:
Support constants of the new types in the MLDS.
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_global_data.m:
compiler/ml_rename_classes.m:
compiler/ml_top_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/mlds_to_target_util.m:
compiler/rtti_to_mlds.m:
Conform to the above changes to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
Generate the appropriate target code for constants of the new types
and operations involving them.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle the new types in the bytecode generator; we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_unify_gen.m:
Handle the new types in the Erlang code generator.
library/private_builtin.m:
Add placeholders for the builtin unify and compare operations for
the new types. Since the bootstrapping compiler will not recognise
the new types we give them polymorphic arguments. These can be
replaced after this change has bootstrapped.
Update the Java list of TypeCtorRep constants here.
library/int64.m:
library/uint64.m:
New modules that will eventually contain builtin operations on the new
types.
library/library.m:
library/MODULES_UNDOC:
Do not include the above modules in the library documentation for now.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
library/table_statistics.m:
deep_profiler/program_representation_utils.m:
mdbcomp/program_representation.m:
Handle the new types.
configure.ac:
runtime/mercury_conf.h.in:
Define the macro MR_BOXED_INT64S. For now it is always defined, support for
unboxed 64-bit integers will be enabled in a later change.
runtime/mercury_dotnet.cs.in:
java/runtime/TypeCtorRep.java:
runtime/mercury_type_info.h:
Update the list of type_ctor reps.
runtime/mercury.h:
runtime/mercury_int.[ch]:
Add macros for int64 / uint64 -> MR_Word conversion, boxing and
unboxing.
Add functions for hashing 64-bit integer types suitable for use
with the tabling mechanism.
runtime/mercury_tabling.[ch]:
Add additional HashTableSlot structs for 64-bit integer types.
Omit the '%' character from the conversion specifiers we pass via
the 'key_format' argument to the macros that generate the table lookup
function. This is so we can use the C99 exact size integer conversion
specifiers (e.g. PRIu64 etc.) directly here.
runtime/mercury_hash_lookup_or_add_body.h:
Add the '%' character that was omitted above to the call to debug_key_msg.
runtime/mercury_memory.h:
Add new builtin allocation sites for boxed 64-bit integer types.
runtime/mercury_builtin_types.[ch]:
runtime/mercury_builitn_types_proc_layouts.h:
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_preds.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Add the new builtin types and handle them throughout the runtime.
runtime/Mmakefile:
Add mercury_int.c to the list of .c files.
doc/reference_manual.texi:
Add the new types to the list of reserved type names.
Add the mapping from the new types to their target language types.
These are commented out for now.
|
||
|
|
7c42aa1aa2 |
Use a separate type to describe integer tags.
compiler/hlds_data.m
Use a separate type to describe integer tags and parameterise
the int_tag functor of the cons_tag/0 type by that new type.
compiler/bytecode_gen.m:
compiler/dense_switch.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/hlds_code_util.m:
compiler/make_tags.m:
compiler/ml_type_gen.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
Conform to the above change.
compiler/ml_code_util.m:
Add a utility function for use by the above.
|
||
|
|
8a240ba3f0 |
Add builtin 8, 16 and 32 bit integer types -- Part 1.
Add the new builtin types: int8, uint8, int16, uint16, int32 and uint32.
Support for these new types will need to be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognise 'int8', 'uint8', 'int16', 'uint16', 'int32'
and 'uint32' as builtin types.
- Extends the set of builtin arithmetic, bitwise and relational operators to
cover the new types.
- Extends all of the code generators to handle new types. There currently lots
of limitations and placeholders marked by 'XXX FIXED SIZE INT'. These will
be lifted in later changes.
- Extends the runtimes to support the new types.
- Adds new modules to the standard library intended to hold the basic
operations on the new types. (These are currently empty and not documented.)
This change does not introduce the two 64-bit types, 'int64' and 'uint64'.
Their implementation is more complicated and is best left to a separate change.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognise int8, uint8, int16, uint16, int32 and uint32 as builtin types.
Add new type, int_type/0,that enumerates all the possible integer types.
Extend the cons_id/0 type to cover the new types.
compiler/builtin_ops.m:
Parameterize the integer operations in the unary_op/0 and binary_op/0
types by the new int_type/0 type.
Add builtin operations for all the new types.
compiler/hlds_data.m:
Add new tag types for the new types.
compiler/hlds_pred.m:
Parameterize integers in the table_trie_step/0 type.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/prog_util.m:
compiler/rbmm.exection_path.m:
compiler/rtti.m:
compiler/rtti_to_mlds.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support generating the builtin operations for the new types.
doc/reference_manual.texi:
Add the new types to the list of reserved type names.
Add the mapping from the new types to their target language types.
These are commented out for now.
compiler/llds.m:
Replace the lt_integer/0 and lt_unsigned functors of the llds_type/0,
with a single lt_int/1 functor that is parameterized by the int_type/0
type.
Add a representations for constants of the new types to the LLDS.
compiler/call_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_global.m:
compiler/llds_out_instr.m:
compiler/lookup_switch.m:
compiler/middle_rec.m:
compiler/peephole.m:
compiler/pragma_c_gen.m:
compiler/stack_layout.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/tag_switch.m:
compiler/trace_gen.m:
compiler/transform_llds.m:
Support the new types in the LLDS code generator.
compiler/mlds.m:
Support constants of the new types in the MLDS.
compiler/ml_accurate_gc.m:
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_global_data.m:
compiler/ml_lookup_switch.m:
compiler/ml_simplify_switch.m:
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/mlds_to_target_util.m:
Conform to the above changes to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
Generate the appropriate target code for constants of the new
types and operations involving them.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle the new types in the bytecode generator; we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
Handle the new types in the Erlang code generator.
library/private_builtin.m:
Add placeholders for the builtin unify and compare operations for
the new types. Since the bootstrapping compiler will not recognise
the new types we give the polymorphic arguments. These can be
replaced after this change has bootstrapped.
Update the Java list of TypeCtorRep constants.
library/int8.m:
library/int16.m:
library/int32.m:
library/uint8.m:
library/uint16.m:
library/uint32.m:
New modules that will eventually contain builtin operations
on the new types.
library/library.m:
library/MODULES_UNDOC:
Do not include the above modules in the library documentation
for now.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
deep_profiler/program_representation_utils.m:
mdbcomp/program_representation.m:
Handle the new types.
runtime/mercury_dotnet.cs.in:
java/runtime/TypeCtorRep.java:
runtime/mercury_type_info.h:
Update the list of TypeCtorReps.
configure.ac:
runtime/mercury_conf.h.in:
Check for the header stdint.h.
runtime/mercury_std.h:
Include stdint.h; abort if that header is no present.
runtime/mercury_builtin_types.[ch]:
runtime/mercury_builtin_types_proc_layouts.h:
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_preds.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Add the new builtin types and handle them throughout the runtime.
|
||
|
|
2ac8465659 |
Make the code adding new types to the HLDS readable.
The motivation for this diff was that I wanted the compiler to generate
a warning if a module declared the same type twice. (During the cleanup
of unify_proc.m I did recently, I found and fixed such a duplicate
declaration.)
compiler/add_type.m:
The old code of module_add_type_defn was not just long (210+ lines),
it is also very complex.
Part of this complexity was sort-of justified. It dealt with adding
three separate kinds of item_type_defns: abstract type "definitions",
which are actually declarations; the definitions of Mercury types,
and the definitions of foreign types. A single type could have more than
one of these (e.g. declaration and a definition, or a Mercury definition
and a foreign definition), and it had to be prepared to process these
in any order.
Part of this complexity was self-inflicted. The parts of the predicate
that dealt with the same kind of definition were not always next to each
other, and for some parts, it wasn't even clear *what* kind of definition
it was dealing with. It did the same tests on both the old and updated
versions of definitions, when those definitions were guaranteed to be
identical; the "updating" predicate was a no-op. And it used completely
different code for detecting and handling related errors.
This diff fixes the above problems. It separates the task of adding
an item_type_defn to the HLDS into three subtasks, done in three separate
predicates: adding type declarations, adding Mercury definitions, and
adding foreign definitions. It specializes each predicate to its task,
and simplifies its decision flow. It also delegates the creation of
(most) error messages to separate predicates. Together, these changes
make each of module_add_type_defn_{abstract,mercury,foreign} easily
understandable.
Generate a warning if a type is declared twice, i.e. if e.g.
":- type x." is followed by another ":- type x.".
Call module_info_incr_errors to register the presence of errors in just
one central place. (Before, some of the places that generated error
messages incremented the error count, and some places didn't.)
Improve the wording of some error messages.
Refer to type names in error messages by unqualified sym_names
in cases where the module qualifier being elided is obvious from
the name of the module being compiled.
Add documentation.
Add descriptions of potential future improvements.
Add some XXXs at places that I think deserve them.
Give some predicates and variables better names.
compiler/prog_data.m:
Change the parse tree representation of type definitions by
explicitly specifying a type for storing the contents of each kind
of type definition.
compiler/hlds_data.m:
Give a predicate a better name.
Use one of the new types in prog_data.m in the HLDS version of type
definitions, to minimize differences between the parse tree and HLDS
versions.
compiler/add_foreign_enum.m:
compiler/add_pragma.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/du_type_layout.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/foreign.m:
compiler/get_dependencies.m:
compiler/hlds_code_util.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_separate_items.m:
compiler/make_tags.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/module_qual.qualify_items.m:
compiler/parse_pragma.m:
compiler/parse_tree_out.m:
compiler/parse_type_defn.m:
compiler/post_term_analysis.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/resolve_unify_functor.m:
compiler/simplify_goal_ite.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/term_norm.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the changes in prog_data.m.
library/io.m:
library/store.m:
Delete duplicate type declarations that add_type.m now complains about.
tests/invalid/bad_foreign_type.{m,err_exp}:
Extend this test to test the new warning.
Expect the updated versions of some error messages.
tests/invalid/extra_info_prompt.err_exp:
tests/invalid/foreign_type_visibility.err_exp:
tests/invalid/user_eq_dummy.err_exp:
Expect the updated versions of some error messages.
|
||
|
|
092e175f45 |
Add a builtin unsigned word sized integer type -- Part 1.
Add a new builtin type: uint, which is an unsigned word sized integer type.
Support for this new type will need be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognize 'uint' as a builtin type.
- Extends the set of builtin operations to include relational and (some)
arithmetic operations on uints.
- Extends all of the code generators to handle the above. There are some
limitations currently marked by 'XXX UINT'. These will be lifted once
the compiler recognised uint and additional library support becomes
available.
- Extends the runtime to support uints.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognize uint as a builtin type.
Add a new alternative to the cons_id/0 type corresponding to the uint type
-- for bootstrapping purposes its argument is currently an int.
compiler/builtin_ops.m:
Add builtin relational and arithmetic operations on uints. Note that the
existing 'unsigned_le' operation is actually intended for use with signed
values. Rather than attempt to modify its meaning, I have just added new
operations specific to the uint type.
compiler/hlds_data.m:
Add a new tag type for uints.
compiler/type_ctor_info.m:
Recognise uint as a builtin.
Bump the RTTI version number here.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/rtti.m:
compiler/special_pred.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/type_constraints.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support generating builtin operations for uints.
compiler/llds.m:
Add a representation for uint constants to the LLDS.
Map uints onto MR_Unsigned.
compiler/call_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/opt_debug.m:
compiler/opt_util.m:
Support uints in the LLDS code generator.
compiler/mlds.m:
Support uint constants in the MLDS.
compiler/ml_accurate_gc.m:
compiler/ml_call_gen.m:
compiler/ml_global_data.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/rtti_to_mlds.m:
Conform to the above change to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
compiler/mlds_to_cs.m:
Generate the appropriate target code for uint constants and uint
relational operations.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle uints in the bytecode generator: we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
Handle uints in the Erlang code generator.
library/private_builtin.m:
Add placeholders for builtin_{unify,compare}_uint. Since the
bootstrapping compiler will not recognize uint as a type, we
give them polymorphic arguments. These can be replaced after
this change has bootstrapped.
Update the Java list of TypeCtorRep constants, which for some
reason is defined here.
library/uint.m:
New module that will eventually contain operations on uints.
library/MODULES_DOCS:
library/library.m:
Add the uint module.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
mdbcomp/program_representation.m:
Handle uints.
deep_profiler/program_representation_utils.m:
Conform to the above change.
runtime/mercury_dotnet.cs.in:
Update the list of TypeCtorReps for C#
java/runtime/TypeCtorRep.java:
Update this, although the actual TypeCtorRep constants
are defined the library.
runtime/mercury_type_info.h:
Bump the RTTI version number.
Add an alternative for uints to the tyepctor rep enum.
runtime/mercury_builtin_types.{h,c}:
runtime/mercury_builtin_types_proc_layouts.h:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_unify_compare_body.h:
Add uint as a builtin type and handle it throughout the runtime.
runtime/mercury_grade.h:
Bump the binary compatibility version.
runtime/mercury_term_size.c:
runtime/mercury_ml_expand_body.h:
Handle uint and fix probable bugs with the handling of ints on
64-bit Windows.
|
||
|
|
b2ae55c29c |
Change 'none' to 'none_or_default_func' in ho_inst_info.
This value of ho_inst_info is used for first-order values as well as for functions that have the default inst, and the new name better reflects that. Places using this value have been checked for correctness. Issues that need to be looked at have been marked with XXX, although have not been addressed in this change. compiler/prog_data.m: Update the type. compiler/inst_match.m: Add XXX comments. This module needs to check for non-default function insts in a bunch of places. compiler/inst_util.m: Add XXX comments. We lose information about non-default function insts when merging bound and any. The information needs to be either preserved or disallowed entirely. compiler/float_regs.m: Add XXX comments. This module may miss cases involving default function insts. compiler/modecheck_unify.m: Add XXX comment. We should exclude pred and non-default func lambda non-locals from becoming locked, an addition to default functions. compiler/*.m: No special handling is required for other modules. |
||
|
|
cc9912faa8 |
Don't import anything in packages.
Packages are modules whose only job is to serve as a container for submodules. Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages in this (informal) sense. Besides the include_module declarations for their submodules, most of the packages in the compiler used to import some modules, mostly other packages whose component modules their submodules may need. For example, ll_backend.m used to import parse_tree.m. This meant that modules in the ll_backend package did not have to import parse_tree.m before importing modules in the parse_tree package. However, this had a price. When we add a new module to the parse_tree package, parse_tree.int would change, and this would require the recompilation of ALL the modules in the ll_backend package, even the ones that did NOT import ANY of the modules in the parse_tree package. This happened even at one remove. Pretty much all modules in every one of the backend have to import one or more modules in the hlds package, and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m, any addition of a new middle pass to the transform_hlds package required the recompilation of all backend modules, even in the usual case of the two having nothing to do with each other. This diff removes all import_module declarations from the packages, and replaces them with import_module declarations in the modules that need them. This includes only a SUBSET of their child modules and of the non-child modules that import them. |
||
|
|
9e01e8da4a |
Improve error messages for bad insts in mutables.
compiler/add_mutable_aux_preds.m:
compiler/hlds_code_util.m:
Move the code that tests the insts in mutables to see if they are allowed
in mutables from hlds_code_util.m to add_mutable_aux_preds.m, since that
code is not a generally useful utility.
Change that code so that instead of generating the same error message
("this is not a valid inst for a mutable") for all errors, we now
(a) generate a separate error message for each problem in the inst, and
(b) generate a message that is specific to the error, for each such
error.
compiler/prog_item.m:
Record two insts for each mutable, not one. The two differ in that
one is processed by equiv_type.m, the other isn't. If possibly,
add_mutable_aux_preds.m generates error messages from the latter,
because it preserves the original structure of the inst. This is
important, because having the compiler complain about e.g. a "unique"
inst in a mutable is confusing if the inst in the mutable is just "i1".
You want the error message to explain that "unique" is part of the
expansion of "i1", and this can only be done if the test works on an inst
in which equiv_type.m hasn't replaced "i1" with its definition.
Record two types for each mutable, not one, with the same difference,
for the same reason, for use by future checks on types in mutables.
Put the fields of item_mutable_infos into a more logical order.
compiler/equiv_type.m:
Process only one of each pair of type and inst fields in
item_mutable_infos.
compiler/get_dependencies.m:
compiler/module_qual.m:
compiler/parse_tree_out.m:
compiler/prog_io_mutable.m:
compiler/recompilation.version.m:
compiler/write_module_interface_files.m:
Conform to the change in prog_item.m.
tests/invalid/bad_mutable.err_exp:
tests/invalid/user_mutable.err_exp:
Expect the improved error messages.
|
||
|
|
3dd02876a5 |
Delete the MLDS->IL backend.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
Delete the modules making up the MLDS->IL code generator.
compiler/globals.m:
compiler/prog_data.m:
Delete IL as a target and foreign language.
compiler/prog_io_pragma.m:
Delete the max_stack_size/1 foreign proc attribute. This was only
ever required by the IL backend.
compiler/options.m
Delete options used for the IL backend.
compiler/write_deps_file.m:
Don't generate mmake targets for .il files etc.
compiler/*.m:
Conform to the above changes.
compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
Conform to the above changes.
library/*.m:
Delete IL foreign_proc and foreign_export pragmas.
README.DotNet:
Delete this file.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
Conform the above changes.
configure.ac:
Don't check that IL is a supported foreign language when performing the
up-to-date check.
Delete the '--enable-dotnet-grades' option.
scripts/Mmake.vars.in:
Delete variables used for the IL backend (and in on case by the Aditi
backend).
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
Delete stuff related to the 'il' and 'ilc' grades.
doc/reference_manual.texi:
Delete the documentation of the 'max_stack_size' option.
doc/user_guide.texi:
Delete stuff related to the IL backend.
tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
Delete these tests: they are no longer relevant.
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
Delete IL foreign_procs where necessary.
tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
Conform to the above changes.
|
||
|
|
656493dfdf |
Use separate types for the status of different entity kinds.
We used the old import_status type to represent the status of six different
kinds of entities:
- types
- insts
- modes
- typeclasses
- instances
- predicates
even though some statuses that made sense for one kind of entity didn't for
another another (e.g. predicates can be pseudo imported/exported, but the
other five kinds of entities cannot).
Create the new types type_status, inst_status, ..., pred_status to represent
the status of these entities in the HLDS. For now, these are just wrappers
around the renamed old_import_status type, but I plan to replace them with
status types that *are* specialized to the applicable kind of entity,
along the lines of compiler/notes/status_proposal. This is a necessary
first step towards that proposal.
compiler/status.m:
Define the six new entity-kind-specific status types, and replicate
the test predicates that used to work on the import_status type
to work on these instead.
Define a status type, item_mercury_status, that contains just the info
that is common to all entities in an item block, for use during
the process of adding items to the HLDS.
Move the predicates that converted section markers to statuses
from here to make_hlds_passes.m, since that is the only place
where they are used, or can be used.
Move the combine_status predicate here from add_type.m, since
it is needed for combining the statuses of other kinds of entities
as well, not just types.
compiler/hlds_data.m:
Change the HLDS types that record the information we have about
types, du type fields, insts, modes, typeclasses and instances
to have kind-specific status fields, instead of the old generic
import_status type.
Change the prefix on the field names of the hlds_instance_defn type
to avoid a name clash, and to make them more meaningful.
Change the prefix on the field names of the hlds_class_defn type
to make them more meaningful.
compiler/hlds_pred.m:
Change the HLDS type that records the information we have about predicates
to have a kind-specific status field, instead of the old generic
import_status type.
Update the predicates that test predicate statuses accordingly.
compiler/hlds_module.m:
Change the HLDS types that record the information we have about
type constructors to be type_status, not the old generic import_status.
compiler/make_hlds_passes.m:
As we process each item block, pass along an item_mercury_status
instead of an import_status. The code used to use only a subset
of the possible values of the import_status type, since we can never say
that all the entities in an item block are e.g. pseudo-exported.
An item_mercury_status has just the information we actually *know*
about the item block as a whole. We convert the item_mercury_status
to a kind-specific status if and when we need to, but for several purposes,
the item_mercury_status is enough on its own.
In a few cases, add a new predicate to do this conversion.
Pass the need_qualifier flag separately from the status. It is needed
in only a few places, but this was not apparent when we always passed it
around paired with the import_status.
Move the predicates that converted section markers to statuses
to here from status.m, since here is the only place where they are used,
or can be used.
compiler/add_class.m:
Convert the statuses of typeclasses and instances to the statuses
of the predicates implementing their virtual and concrete methods.
compiler/check_typeclass.m:
Simplify some over-complex code.
compiler/add_special_pred.m:
Convert the statuses of types to the statuses of the predicates
implementing their unify, index, compare and solver init operations.
Note some places where the process of this conversion is (to say the least)
unclear and undocumented.
compiler/hlds_out_util.m:
Provide utility predicates to print all the new kinds of statuses.
These replace the old predicate that did the same in hlds_out_pred.m,
but printing e.g. type statuses in hlds_out_pred doesn't seem right.
compiler/intermod.m:
Conform to the changes above.
Consistently use switches on the booleans returned by xxx_status_to_write,
instead wrapping a semidet predicate around it and calling that.
The switches yield code that is both smaller and more maintainable.
compiler/make_hlds_error.m:
Conform to the changes above.
Delete a simple wrapper predicate that was used only in one place.
That place now does the wrapping itself.
compiler/qual_info.m:
Replace the import_status field in the qual_info with a simple
is_opt_imported/is_not_opt_imported flag, since that was the only
thing we used the import_status field for.
compiler/accumulator.m:
compiler/add_clause.m:
compiler/add_foreign_enum.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/base_typeclass_info.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/dep_par_conj.m:
compiler/dependency_graph.m:
compiler/det_report.m:
compiler/elds_to_erlang.m:
compiler/equiv_type_hlds.m:
compiler/erl_code_gen.m:
compiler/export.m:
compiler/float_regs.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/inst_check.m:
compiler/lambda.m:
compiler/lco.m:
compiler/make_hlds.m:
compiler/make_hlds_warn.m:
compiler/make_tags.m:
compiler/ml_proc_gen.m:
compiler/ml_type_gen.m:
compiler/mode_errors.m:
compiler/oisu_check.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/prop_mode_constraints.m:
compiler/recompilation.usage.m:
compiler/simplify_proc.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/ssdebug.m:
compiler/status.m:
compiler/stm_expand.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.versions.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_class_info.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_info.m:
compiler/typeclasses.m:
compiler/unify_proc.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
|
||
|
|
b8eb51bc43 | Convert (C->T;E) to (if C then T else E). | ||
|
|
62ec97d443 |
Report imports shadowed by other imports.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
|
||
|
|
89628ae791 |
More speedups of inst handling code.
On tools/speedtest -l -m, my tests show a speedup of about 2%, but
on Dirk's stress test module, for which the compiler (used to) spend
almost all its time handling insts, the speedup is about 40%.
This diff also contains some small incidental changes I stumbled upon
the "need" for while working on the main change.
compiler/prog_data.m:
The existing inst_test_results type used to be able to hold the results
of four tests about a bound inst. Add two more: the set of inst vars that
may occur in the inst, and whether a type constructor has already been
propagated into the cons_ids of the bound insts.
Put the fields of the the unify_inst and merge_inst inst_names into
a more sensible order.
Define types that hold the information stored in specific kinds of
inst_names, for use by hlds_data.m (see below).
compiler/inst_user.m:
For each user defined bound inst that matches exactly one parameterless
type, propagate its type constructor into it, and record the fact that
it has been done. This avoids having to do it many times later.
Also record the set of inst vars in each inst, again to avoid having
to repeat the test many times later.
compiler/mercury_compile_front_end.m:
Invoke the inst_user module as soon after inst_check.m as we can.
compiler/hlds_data.m:
Make the structure of six subtables of the inst table private, to allow
them to be experimented with (and possibly changed) without code changes
being required in other modules.
The unify_inst_table, the ground_inst_table and the any_inst_table
used to be maps whose keys were inst_names, but they were each only ever
used with one kind of inst_name. Change their keys to the new types
unify_inst_info, ground_inst_info and any_inst_info, which each contain
the information in the unify_inst, ground_inst and any_inst inst_names
respectively. That way, the searches in the maps will perform comparisons
that don't need to switch on what kind of inst_name they are dealing with,
and instead go directly to comparing the arguments.
With the unify_inst_table, also go a step further. The unify_inst_info
has two fields that are equivalent to booleans. Comparing these
at every level of the map is wasteful, so switch the representation
of the unify_inst_table from one map to four maps, one map for each
possible combination of those booleans. This way, the two booleans
in the unify_inst_info key are tested just once, when the applicable map
is selected.
The merge_inst_table used to have a pair of insts as keys. Replace that
with the merge_inst_info type, which also holds a pair of insts,
but on which comparisons should be a bit faster, since it is not
polymorphic, and thus does not need an implicit typeinfo passed along.
Provide a combined search_insert operation on each of the inst_tables,
since their pattern of use is exactly that: search the table, and if
the key is not found, insert a marker that says the entry is being
worked on. This avoid one traversal of a possibly-large tree, with
its associated (possibly very expensive) comparisons.
For each inst table, provide conversion predicates to and from
sorted association lists, for use by equiv_type_hlds.m
compiler/equiv_type_hlds.m:
Expand equivalence types in the new structure of the inst tables.
compiler/inst_util.m:
Use the new search_insert predicates for the various inst_tables.
If one of the two insts being unified is free, then avoid using
the unify_inst_table, since just doing the abstract unification
is faster, and does not pollute the unify_inst_table.
If both insts being merged are bound insts, then avoid using the
merge_inst_table, since (a) the lookup is slower than just doing
the merge, and (b) it can pollute the merge_inst_table to the extent
that *all other lookups* in it become very slow.
compiler/inst_match.m:
Use test result information in bound insts to speed up the corresponding
tests.
compiler/set_of_var.m:
Change the representation of sets of vars back to sparse_bitsets.
I changed them to tree_bitsets several years ago to avoid some bad
worst-case behavior with sparse_bitsets (which occurred when repeatedly
appending to the "ends" of sets), but other algorithmic changes have
since avoiding using set_of_vars in ways that induce that behavior,
and now my benchmarking tells me that the bottleneck operation is
conversion of set_of_vars to lists of vars. This is faster with
sparse_bitsets, since unlike tree_bitsets, they don't have to unravel
a tree structure.
compiler/mode_util.m:
Export a predicate now needed by inst_user.m, and clean up the code a bit,
factoring out repeated code.
compiler/modecheck_util.m:
Modify an equality comparison of two insts to compare the instantiation
states themselves, but NOT the test results about those instantiation
states, since these can differ if the two insts have different histories.
compiler/hlds_code_util.m:
compiler/hlds_out_mode.m:
compiler/hlds_out_module.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/polymorphism.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
The following changes are mostly incidental.
compiler/hlds_args.m:
Speed up a predicate by avoiding the materialization of a list
that is needed only for a test.
compiler/instmap.m:
Clarify some code.
compiler/liveness.m:
Avoid computing some value when it is not needed.
compiler/mode_errors.m:
Avoid referring to "arguments" (plural) for errors involving *one*
argument.
compiler/mode_info.m:
Move the documentation of some predicates to their declarations.
compiler/modecheck_unify.m:
Compute some data closer to where it is needed, to reduce the number
of stack slots needed.
tests/invalid/constrained_poly_insts2.err_exp:
Expect the updated error message from mode_errors.m (with "argument"
in singular), as well as module qualified insts, since having inst_user.m
push type_ctors into the definitions of named inst module qualifies
the bound_insts inside those definitions.
|
||
|
|
13b6f03f46 |
Module qualify end_module declarations.
compiler/*.m:
Module qualify the end_module declarations. In some cases, add them.
compiler/table_gen.m:
Remove an unused predicate, and inline another in the only place
where it is used.
compiler/add_pragma.m:
Give some predicates more meaningful names.
|
||
|
|
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.
|
||
|
|
8a6ffaab19 |
Fix Mantis bug #354.
I/O tabling has two main purposes. The first and more important is to allow the
debugger to replay parts of the program execution for the programmer, which
requires making I/O operations idempotent (so that we get the same results on
the second, third etc "execution" as on the first). The second purpose is to
let the person using the debugger actually see a list of the I/O actions, and
their results.
The root of the problem here is that the compiler can do the second part
only if it has access to the type_infos describing the types of the arguments
of the I/O action. With the current infrastructure for representing typeclass
information, this is not always possible in the presence of typeclass
constraints on I/O action predicates. The reason is that polymorphism.m can
put the typeinfo for a type variable that is subject to a typeclass constraint
arbitrarily deep inside the typeclass_info for that constraint, but the RTTI
can encode such locations only up to a fixed depth (currently only the
shallowest embedded is encodable).
Before this fix, the test case for this bug got a compiler abort when the
I/O tabling transformation tried to figure out how to table the typeclass
info representing the typeclass constraint on a I/O action predicate.
We still cannot table typeclass infos. We could store them (I/O tabling
does not require anything more complicated), but the problem of deeply buried
typeinfos inside them would still remain. So this fix consists of two parts:
- for typeclass constrained I/O primitives, recording only enough information
to allow them to replayed (the first purpose above), and not to print them
out (the second purpose), and
- getting the runtime system to understand this, and not crash with a core dump
in the absence of the information required for the second purpose.
This second part requires changes to the RTTI used by I/O tabling. These
changes BREAK BINARY COMPATIBILITY in debug grades.
runtime/mercury_stack_layout.h:
Rename the MR_TableIoDecl structure as the MR_TableIoEntry structure,
since the I/O table entries that it describes are used not just for
declarative debugging, but also for printing out I/O actions.
Add a field to it that specifies whether the fields describing
the types of the I/O action's arguments are meaningful.
runtime/mercury_grade.h:
Bump the debug-only binary compatibility version number, since
the change to mercury_stack_layout.h requires it.
runtime/mercury_trace_base.[ch]:
When returning information about a tabled I/O action, return a boolean
that says whether the information abouts its arguments is actually
present or not. Do not return information about the arguments if
we cannot convert them into univs due to missing type information.
browser/io_action.m:
Pay attention to the new info returned by MR_trace_get_action,
and avoid a potential core dump by generating a description of the
requested I/O action only if the argument type information needed
to generate that description is actually available.
trace/mercury_trace_vars.c:
Pay attention to the new info returned by MR_trace_get_action.
When the argument type information needed to generate an accurate
description of the I/O action is not available, generate a
"description" that mentions this fact.
trace/mercury_trace_cmd_browsing.c:
Make the fix to mercury_trace_vars.c easier to test by adding a mechanism
to print out all existing I/O actions, as long as there aren't too many
of them.
compiler/hlds_pred.m:
compiler/layout.m:
compiler/prog_data.m:
Prepare for the possibility that we have cannot record the information
needed to reconstruct the runtime types of the arguments of a I/O tabled
predicate.
compiler/table_gen.m:
If an I/O tabled predicate has one or more typeclass constraints,
do not attempt to record the RTTI needed to reconstruct the types
of its arguments at runtime.
compiler/continuation_info.m:
compiler/hlds_data.m:
Rename some data structures that referred to the old MR_TableIoDecl
structure to refer to its replacement, the MR_TableIoEntry structure.
compiler/bytecode_gen.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/erl_unify_gen.m:
compiler/export.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_out_mode.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/layout.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_to_mercury.m:
compiler/ml_global_data.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mode_util.m:
compiler/module_qual.m:
compiler/opt_debug.m:
compiler/proc_gen.m:
compiler/prog_data.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_type.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/stack_layout.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
runtime/mercury_misc.h:
runtime/mercury_tabling.h:
Conform to the above changes.
tests/debugger/tabled_typeclass.{m,inp,exp,exp2}:
New test case to test that I/O actions that have typeclass constraints
on them can be printed in mdb.
tests/debugger/Mmakefile:
tests/debugger/Mercury.options:
Enable the new case.
|
||
|
|
c3c4ec7772 |
Delete the LLDS->x86_64 asm backend.
No progress has been made on the LLDS->x86_64 backend since the initial work on it and it is now more have a maintenance headache then anything else. compiler/llds_to_x86_64.m: compiler/llds_to_x86_64_out.m: compiler/x86_64_instrs.m: compiler/x86_64_out.m: compiler/x86_64_regs.m: Delete these modules. compiler/globals.m: Delete the x86_64 target type. compiler/*.m: Conform to the above changes. |
||
|
|
f6bdd99a80 |
Delete the MLDS->GCC (assembler) backend.
As discussed in the recent Mercury meeting, remove support for the GCC backend.
It was very much out of date and supporting it proprerly would means having to
track changes to GCC's internals. Furthermore, its presence complicates
building the compiler.
The main thing this change does not address is the fact that we invoke
the compiler through C code, e.g. main.c in the top-level of the source
tree. This was required by the GCC backend and can now be removed, but
I will do that as a separate change.
configure.ac:
Mmake.common.in:
scripts/Mmake.rules:
compiler/Mercury.options:
compiler/Mmakefile:
compiler/gcc.m:
compiler/maybe_mlds_to_gcc.pp:
compiler/mlds_to_gcc.m:
Delete the files containing the GCC backend.
compiler/options.m:
compiler/handle_options.m:
Delete support for `--target asm' and `--pic'.
(The latter was only used by the GCC backend.)
compiler/*.m:
doc/user_guide.texi:
compiler/notes/comiler_design.html:
compiler/notes/work_in_progress.m:
Conform to the above change.
README.gcc-backend.m:
Delete this file.
|
||
|
|
a83c9b662f |
Move some predicates to the modules where they belong. There are no
algorithmic changes. compiler/add_pragma.m: compiler/hlds_code_util.m: Move some predicates from add_pragma.m to hlds_code_util.m; they are used not only when adding pragmas. compiler/prog_io.m: compiler/prog_mode.m: Move some predicates from prog_io.m to prog_mode.m; they do not do parsing. compiler/add_clause.m: compiler/prog_io_pragma.m: Conform to the changes above. compiler/hlds.m: Fix typos. |
||
|
|
3b98b9dcb7 |
Fix bug #258: the recent change to use a dummy integer tag for arity-zero
Branches: main Fix bug #258: the recent change to use a dummy integer tag for arity-zero tuples results in invalid C# or Java code with the respective backed. Revert to the old approach for those backends. compiler/hlds_code_util.m: Do not use a dummy integer tag for arity-zero tuples with the C# or Java backends. |
||
|
|
884838b9df |
If the backend supports constant structures, and we do not need unifications
Estimated hours taken: 8
Branches: main
If the backend supports constant structures, and we do not need unifications
to retain their original shapes, then convert each from_ground_term scope
into a unification with a cons_id that represents the ground term being
built up.
This speeds up the compilation of training_cars_full.m by about 6%.
compiler/simplify.m:
Make the conversion if enabled. By doing the conversion in this phase,
we don't have to teach the semantic analysis passes about unifications
with the new cons_id, but we do get the benefit of later passes being
faster, because they have less code to process.
compiler/const_struct.m:
The declarative debugger does not yet know how to handle the new
cons_id, so do not introduce it if we are preparing for declarative
debugging.
compiler/trace_params.m:
Export a predicate for const_struct.m.
compiler/prog_data.m:
Add the new cons_id, ground_term_const.
compiler/hlds_data.m:
Add the tag of the new cons_id, ground_term_const_tag.
compiler/hlds_code_util.m:
Convert the new cons_id to the new cons_tag.
Fix an old problem with that conversion process: it always converted
tuple_cons to single_functor_tag. However, arity-zero tuples are
(dummy) constants, not heap cells, so we now convert them to a (dummy)
integer tag. This matters now because the process that generates
code (actually data) for constant structures handles the cons_tags that
build constants and heap cells separately. As a side benefit, we
no longer reserve a word-sized heap cell for arity-zero tuples.
compiler/unify_gen.m:
compiler/ml_unify_gen.m:
Implement the generation of code for arbitrary constant structures,
not just those that can implement typeinfos and typeclass_infos.
compiler/term_norm.m:
Compute the sizes of ground terms for each of our norms.
compiler/term_traversal.m:
Manage the computation of sizes of ground terms.
Simplify and thereby speed up a predicate.
compiler/term_constr_build.m:
Note that we should manage the computation of sizes of ground terms.
compiler/term_util.m:
Simplify the style of a predicate.
compiler/layout.m:
Give some field names prefixes to avoid ambiguities.
compiler/bytecode_gen.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/erl_unify_gen.m:
compiler/export.m:
compiler/higher_order.m:
compiler/hlds_out_mode.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/ml_global_data.m:
compiler/ml_type_gen.m:
compiler/mode_util.m:
compiler/module_qual.m:
compiler/polymorphism.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/xml_documentation.m:
Conform to the changes above.
tests/hard_coded/ground_terms.{m,exp}:
A new test case to test the handling of ground terms.
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
Enable the new test case.
|
||
|
|
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. |
||
|
|
d9c9e1cc13 |
Fix a problem in the mutable inst validity check.
Branches: main
Fix a problem in the mutable inst validity check.
compiler/hlds_code_util.m:
Make the mutable inst validity check handle recursive user defined insts
correctly.
tests/nvalid/uniq_mutable.{m,err_exp}:
Add a test case for the above.
|
||
|
|
1ea012d0ff |
Fix a problem I identified in my previous diff, and which Julien
Estimated hours taken: 0.5
Branches: main
compiler/hlds_code_util.m:
Fix a problem I identified in my previous diff, and which Julien
confirmed in his review: the inst of a mutable must have ALL its
parts pass the relevant test, not just SOME.
tests/invalid/bad_mutable.{m,err_exp}:
Add a mutable whose inst contains as components both ground (which is
ok in mutables) and unique (which is not ok). The old compiler did not
generate an error for this mutable; the updated compiler does.
|
||
|
|
932f7256ba |
A large part of the cost of a large ground term is incurred not when the
Estimated hours taken: 40 Branches: main A large part of the cost of a large ground term is incurred not when the term is constructed, but when it is used. The inst of the term will be huge, and will typically have to be traversed many times. Some of those traversals would be linear if not for the fact that, in order to avoid infinite loops on recursive insts, the predicate doing the traversal has to keep a set of the insts visited so far. When the traversal is in the middle of the ground term's inst, it is looking up that inst in a set of the insts of its containing terms all the way up to the root. When the ground term contains a list with many repeated elements near the start, the cost of the traversal is cubic in the length of the list: a linear number of set membership tests, each of which tests the current inst against a linear number of large insts, the test itself being linear. This diff aims to totally sidestep all that. It extends the mer_inst type to allow (but not require) the creator of an inst to record what the outcome of some tests on the inst would be. Is it ground? Does it contain "any"? What inst names and types may it contain? If the creator records this answer, which the code that creates ground terms does, then many tests will now run in CONSTANT time, not linear, quadratic or cubic. We do this only for bound insts. While the concept can apply to all insts, for small insts it can cost more to interpret the results term than to do the test directly. Insts cannot be large without being composed mostly of bound insts, so by recording this info only for bound insts, we can speed up the handling of all large insts. This also has the side benefit that in many cases, a traversal that operates on an inst will often do so in order to compute an updated version of that inst. In many cases, the updated version is the same as the original version, but since the traversal has to be prepared for updates, it makes a copy of the inst anyway. The result of the traversal is thus an inst that has the same value as the original inst but not the same address. This makes it useless to try to do equality checks of related insts in constant time by looking at the pointers. With this diff, many such traversals can be avoided, allowing the updated inst to keep the address as well as the value of the corresponding original inst. Without this diff, the compiler takes more than 10 seconds to compile zm_rcpsp_cpx.m, with most of that time being spent in mode checking. With this diff, it takes less than 5 seconds. Basically, mode checking went from 6+ seconds to 1. The profile of the compiler is now flat on this input; no single pass takes much more time than the others. The speed of the compiler is unaffected on tools/speedtest. (Actually, it gets a very slight speedup, but it is in the noise.) compiler/prog_data.m: Change the bound/2 functor of the mer_inst type to bound/3, adding a field that gives the outcome of some common tests performed on insts. When we attach insts to the variables representing parts of ground terms, we mark the insts accordingly. This allows us to perform many tests on insts in constant time, not in a time that is linear, quadratic or worse in the size of the inst. compiler/add_pragma.m: compiler/const_prop.m: compiler/distance_granularity.m: compiler/equiv_type_hlds.m: compiler/float_regs.m: compiler/hlds_code_util.m: compiler/hlds_goal.m: compiler/inst_check.m: compiler/inst_match.m: compiler/inst_util.m: compiler/lco.m: compiler/mercury_to_mercury.m: compiler/mode_constraints.m: compiler/mode_debug.m: compiler/mode_util.m: compiler/modecheck_goal.m: compiler/modecheck_unify.m: compiler/modecheck_util.m: compiler/module_qual.m: compiler/pd_util.m: compiler/polymorphism.m: compiler/prog_io.m: compiler/prog_io_util.m: compiler/prog_mode.m: compiler/prog_util.m: compiler/recompilation.usage.m: compiler/recompilation.version.m: compiler/simplify.m: compiler/try_expand.m: compiler/unique_modes.m: compiler/unused_imports.m: compiler/xml_documentation.m: Conform to the above change. Obviously, this required the modification of most predicates dealing with insts. Where the original predicates used multiple clauses, inconsistent variable names and/or bad grouping or ordering of code, this diff fixes that. More to the point, while in many places, the new code ignores the new field in input insts as either not relevant or not useful, in several places, the new code - pays attention to this field in input insts and executes less or faster code if the result of some test it needs is already available in it, or - fills in the field in insts it generates as output. Most, but not all, of changes in the first of those two categories were in inst_util.m and inst_match.m. compiler/hlds_out_mode.m: When writing out insts, or converting them to term form as the first step in printing them out, print the new field if we are generating debug output (such as a HLDS dump), but do not do so if we are generating actual Mercury code (such as a .opt file). Reorder the arguments of many predicates to move the context argument BEFORE the argument representing the object to be printed or converted to a term, since this allows us to use list.map on lists of such objects. compiler/hlds_out_util.m: Define a type that allows us to distinguish between the two. compiler/hlds_out_goal.m: compiler/hlds_out_module.m: compiler/hlds_out_pred.m: Thread values of this flag type through a bunch of predicates as needed. compiler/intermod.m: Specify output_mercury when writing clauses for optimization files. This is needed because mode-specific clauses can have insts in their heads. (The mode declarations in .int* files are written out by a separate set of predicates, in mercury_to_mercury.m, which ALWAYS ignore the new field.) compiler/prog_util.m: There were two predicates named construct_qualified_term, with different arities: one took a context, the other didn't. Rename the former to avoid the ambiguity. compiler/goal_expr_to_goal.m: Conform to the change to prog_util.m. compiler/prog_io.m: There were two predicates named constrain_inst_vars_in_mode; rename one. Add an XXX about why they are here in the first place. compiler/format_call.m: Give some type and field names prefixes to avoid some ambiguities. |
||
|
|
12281f3419 |
Implement a type representation optimisation ("direct argument functors"),
Branches: main
Implement a type representation optimisation ("direct argument functors"),
where a functor with exactly one argument can be represented by a tagged
pointer to the argument value, which itself does not require the tag bits,
e.g.
:- type maybe_foo ---> yes(foo) ; no.
:- type foo ---> foo(int, int). % aligned pointer
To ensure that all modules which could construct or deconstruct the functor
agree on the type representation, I had planned to automatically output
extra information to .int files to notify importing modules about functors
using the optimised representation:
:- type maybe_foo ---> yes(foo) ; no
where direct_arg is [yes/1].
However, the compiler does not perform enough (or any) semantic analysis
while making interface files. The fallback solution is to only use the
optimised representation when all importing modules can be guaranteed to
import both the top-level type and the argument type, namely, when both
types are exported from the same module. We also allow certain built-in
argument types; currently this only includes tuples.
Non-exported types may use the optimised representation, but when
intermodule optimisation is enabled, they may be written out to .opt files.
Then, we *do* add direct_arg attributes to .opt files to ensure that importing
modules agree on the type representation. The attributes may also be added by
Mercury programmers to source files, which will be copied directly into .int
files without analysis. They will be checked when the module is actually
compiled.
This patch includes work by Zoltan, who independently implemented a version
of this change.
compiler/hlds_data.m:
Record the direct arg functors in hlds_du_type.
Add a new option to cons_tag.
Fix some comments.
compiler/prog_data.m:
compiler/prog_io_type_defn.m:
Parse and record `direct_arg' attributes on type definitions.
compiler/prog_io_pragma.m:
Issue an error if the `direct_arg' attribute is used with a foreign
type.
compiler/make_tags.m:
compiler/mercury_compile_front_end.m:
Add a pass to convert suitable functors to use the direct argument
representation. The argument type must have been added to the type
table, so we do this after all type definitions have been added.
Move code to compute cheaper_tag_test here.
compiler/ml_unify_gen.m:
compiler/unify_gen.m:
Generate different code to construct/deconstruct direct argument
functors.
compiler/intermod.m:
Write `direct_arg' attributes to .opt files for functors
using the direct argument representation.
compiler/mercury_to_mercury.m:
Write out `direct_arg' attributes.
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
Add an option to the types which describe the location of secondary
tag options. The functors which can use the optimised representation
are a subset of those which require no secondary tag.
Output "MR_SECTAG_NONE_DIRECT_ARG" instead of "MR_SECTAG_NONE" in
RTTI structures when applicable.
compiler/add_pragma.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/check_typeclass.m
compiler/code_info.m:
compiler/equiv_type.m:
compiler/export.m:
compiler/foreign.m:
compiler/hlds_code_util.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/ml_proc_gen.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_type_gen.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/simplify.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/tag_switch.m:
compiler/term_norm.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to changes.
Bump RTTI version number.
doc/reference_manual.texi:
Add commented out documentation for `direct_arg' attributes.
library/construct.m:
Handle MR_SECTAG_NONE_DIRECT_ARG in construct.construct/3.
library/private_builtin.m:
Add MR_SECTAG_NONE_DIRECT_ARG constant for Java for consistency,
though it won't be used.
runtime/mercury_grade.h:
Bump binary compatibility version number.
runtime/mercury_type_info.h:
Bump RTTI version number.
Add MR_SECTAG_NONE_DIRECT_ARG.
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Handle MR_SECTAG_NONE_DIRECT_ARG in RTTI code.
tests/debugger/Mmakefile:
tests/debugger/chooser_tag_test.exp:
tests/debugger/chooser_tag_test.inp:
tests/debugger/chooser_tag_test.m:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/construct_test.exp:
tests/hard_coded/construct_test.m:
tests/hard_coded/direct_arg_cyclic1.exp:
tests/hard_coded/direct_arg_cyclic1.m:
tests/hard_coded/direct_arg_cyclic2.m:
tests/hard_coded/direct_arg_cyclic3.m:
tests/hard_coded/direct_arg_intermod1.exp:
tests/hard_coded/direct_arg_intermod1.m:
tests/hard_coded/direct_arg_intermod2.m:
tests/hard_coded/direct_arg_intermod3.m:
tests/hard_coded/direct_arg_parent.exp:
tests/hard_coded/direct_arg_parent.m:
tests/hard_coded/direct_arg_sub.m:
tests/invalid/Mmakefile:
tests/invalid/where_direct_arg.err_exp:
tests/invalid/where_direct_arg.m:
tests/invalid/where_direct_arg2.err_exp:
tests/invalid/where_direct_arg2.m:
Add test cases.
tests/invalid/ee_invalid.err_exp:
Update expected output.
|