compiler/write_error_spec.m:
Move maybe_print_delayed_error_messages here from mercury_compile_main.m,
and move the mutables that the code already in write_error_spec.m was
using to record infor for maybe_print_delayed_error_messages
here as well from globals.m.
The intention is that the make package should also be able to call
maybe_print_delayed_error_messages.
compiler/globals.m:
compiler/mercury_compile_main.m:
Delete the moved code.
We have two main notions of trace levels. The first is the global trace level,
which is set by compiler options, and the second is the effective trace level
for a given procedure. The two are different not just in that the effective
trace level for a procedure may differ from the global trace level, but also
in that there exist effective trace levels that cannot be specified using
compiler options.
compiler/trace_params.m:
Add the new type eff_trace_level for representing effective trace levels.
(Old code has long used "Eff" as an abbreviation for "effective".)
Use it where relevant.
Delete functions that (a) first compute the effective trace level
for a procedure, and (b) then test that effective trace level,
and replace each of them with a function that does only (b).
There was already a function that did only (a); rename it to avoid
an ambiguity.
compiler/code_info.m:
Store the effective trace level of the procedure being translated
in the code_info, to save it from having to be recomputed many times.
compiler/code_loc_dep.m:
Get the effective trace level for the procedure being compiled
from code_info.
compiler/hlds_out_pred.m:
Write out each procedure's effective trace level.
compiler/llds.m:
Include the effective trace level in generated c_procs, for use by
continuation_info.m.
compiler/continuation_info.m:
Rename a predicate to avoid a name clash.
Conform to the changes above.
compiler/handle_options.m:
Note a non-problem.
compiler/globals.m:
compiler/layout.m:
compiler/layout_out.m:
compiler/liveness.m:
compiler/optimize.m:
compiler/proc_gen.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_scope.m:
compiler/simplify_info.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/store_alloc.m:
compiler/trace_gen.m:
compiler/transform_llds.m:
Conform to the changes above.
compiler/mercury_compile_front_end.m:
Fix a misleading predicate name.
compiler/hlds_out_module.m:
Simplify some code.
runtime/mercury_goto.h:
Fix misplaced/wrong casts and stray backslashes in macros that are usually
only used when debugging the debugger.
compiler/globals.m:
compiler/table_gen.m:
Apply stricter checking of whether a tabling pragma conflicts
with the selected grade. The version in globals.m just says
whether a tabling pragma is compatible with the selected grade;
the version in table_gen.m also generates a specific error message
for each incompatility. (These error messages are not used just yet,
since the callers of the code in globals.m preempt them.)
compiler/prog_data_pragma.m:
Separate out tabled eval methods from non-tabled eval methods.
This enables us to use an eval method type specific to tabling
(tabled_eval_method) in the several contexts that benefit from one.
compiler/prog_item.m:
Use the tabled_eval_method type in the representation of tabling
pragmas.
compiler/llds.m:
Use the tabled_eval_method type in the tabling_info_struct.
compiler/hlds_pred.m:
Use the tabled_eval_method type in the proc_table_info_struct.
Replace functions that operated on eval_methods with functions
that operate on tabled_eval_methods, when these were the only
eval_methods (a) they make sense for, or (b) were ever used with.
Delete a function which would now just duplicate the eval_normal
vs eval_tabled distinction.
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/dead_proc_elim.m:
compiler/det_report.m:
compiler/hlds_out_pred.m:
compiler/item_util.m:
compiler/layout_out.m:
compiler/llds_out_global.m:
compiler/ml_top_gen.m:
compiler/modes.m:
compiler/parse_pragma.m:
compiler/parse_pragma_tabling.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_out.m:
compiler/simplify_goal_call.m:
compiler/tabling_analysis.m:
Conform to the changes above.
In several places, fix or improve error messages.
(Shame that none of them have tests in tests/invalid.)
In the high-level data representation, make a subtype term be
represented using the class corresponding to the base type constructor
instead of its own class. This is necessary to be able to downcast
a term from a type to a subtype in Java and C#.
compiler/du_type_layout.m:
Move get_base_type_ctor predicate to type_util.m.
Abort in a couple of places that should not occur.
compiler/type_util.m:
Add get_base_type_ctor predicate.
compiler/globals.m:
Add compilation_target_high_level_data predicate.
compiler/lco.m:
Use compilation_target_high_level_data predicate.
compiler/ml_type_gen.m:
When using the high-level data representation,
don't generate a MLDS type definition (class) for a subtype.
compiler/mlds.m:
When using the high-level data representation,
replace a Mercury subtype with its base type in an mlds_type.
Move foreign_type_to_mlds_type.
compiler/ml_unify_gen_util.m:
To access a field when using the high-level data representation,
use field names from the base type constructor of a subtype.
compiler/unify_proc.m:
When using the high-level data representation,
generate unify/compare procs for subtypes that just call the
unify/compare proc for the base type constructor.
compiler/options.m:
Delete references to --high-level and --high-level-data.
---------------
runtime/mercury_type_info.h:
Document a new field MR_type_ctor_base in MR_TypeCtorInfo_Struct.
The field is unnecessary and does not exist in the
MR_TypeCtorInfo_Struct for C.
runtime/mercury_dotnet.cs.in:
Add type_ctor_base member to MR_TypeCtorInfo_Struct for C#.
java/runtime/TypeCtorInfo_Struct.java
Add type_ctor_base member to MR_TypeCtorInfo_Struct for Java.
compiler/rtti.m:
compiler/type_ctor_info.m:
Add field corresponding to MR_type_ctor_base in type_ctor_details
for enum, notag and general du types.
compiler/rtti_to_mlds.m:
Initialize the MR_type_ctor_base field in type_ctor_infos
for high-level data grades.
compiler/rtti_out.m:
Don't write out the MR_type_ctor_base field when using
the low-level data representation.
library/rtti_implementation.m:
In Java and C# grades (high-level data grades), use the
MR_type_ctor_base field to get the type_ctor_info of the base type
ctor when constructing or deconstructing terms of a subtype.
It is necessary to perform reflection using class and field names
from the base type constructor since there are no classes
corresponding to subtypes.
Clean up some code.
---------------
tests/hard_coded/Mmakefile:
tests/hard_coded/subtype_abstract.m:
tests/hard_coded/subtype_abstract_2.m:
tests/hard_coded/subtype_abstract.exp:
Add a test case.
tests/hard_coded/subtype_rtti.m:
tests/hard_coded/subtype_rtti.exp2:
Enable a test that was previously skipped in Java and C# grades.
compiler/globals.m:
Set up a system that should eventually allow us to output most or all
compiler output to five streams, which can be individually directed
to module-specific files by users if needed.
compiler/options.m:
Add the five options that give users this control.
doc/user_guide.text:
Document the (user-visible) new options.
compiler/mercury_compile_main.m:
Close any module-specific output streams that we opened.
compiler/polymorphism.m:
A first use of this system.
This will be used by an upcoming change to du_type_layout.m.
compiler/globals.m:
Add word_size, which is either word_size_32 or word_size_64, as a field
to the globals.
compiler/handle_options.m:
Set the value of word_size from the value of the bit_per_int configuration
option. Autoconf succeeds *only* if bit_per_int is 32 or 64.
compiler/decide_type_repn.m:
Delete a type moved to globals.m.
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.
compiler/handle_options.m:
As above.
compiler/globals.m:
Add a prefix to the names of the ssdb trace levels, to differentiate
them from mdb trace levels.
compiler/get_dependencies.m:
compiler/mercury_compile_middle_passes.m:
compiler/ssdebug.m:
Conform to the change in globals.m.
... using an approach proposed by Peter, with an extra twist from Julien.
Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.
The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.
Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.
library/getopt.m:
library/getopt_io.m:
Make the changes described above.
library/Mmakefile:
Instead of building both getopt_io.m and getopt.m from getopt_template,
build getopt.m from getopt_io.m.
tools/bootcheck:
Delete references to getopt_template.
compiler/typecheck_errors.m:
When a type error involves one of the getopt/getopt_io predicates
whose interfaces are changed by this diff, tell the user about
how these changes could have caused the error, and thus what the
probable fix is.
compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
Use the updated getopt interface.
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Replace references to getopt_io.m with references to getopt.m.
tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
New test cases for the extra help
tests/invalid/Mmakefile:
Enable the new test cases.
This implements Mantis feature request #495.
NEWS:
Announce the change.
compiler/optimization_options.m:
A new module for managing optimization options.
It defines a separate bespoke type for every boolean optimization option
to make it harder to confuse them. It defines a tuple type (opt_tuple)
for accessing optimization options quickly. It implements the turning on
(but NOT turning off) of optimizations when a given optimization level
is selected.
tools/make_optimization_options_middle:
tools/make_optimization_options_db:
The script that generates the meat of optimization_options.m,
and the database of option names, kinds and initial values
that it uses as its input. The script also generates some code
for the special_handler predicate in compiler/options.m.
tools/make_optimization_options_start:
tools/make_optimization_options_end:
The handwritten initial and final parts of optimization_options.m.
tools/make_optimization_options:
The script that pulls these parts together to form optimization_options.m.
compiler/options.m:
Make every optimization option a special option, to be handled by
the special_handler predicate. That handling consists of simply
adding a representation of the option to the end of a cord of
optimization options, to be processed later by optimization_options.m.
That processing will record the values of these options in the opt_tuple,
which is where every other part of the compiler should get them from.
Change the interface of special_handler to make the above possible.
Add an "optopt_" (optimization option) prefix to the name of
every optimization option, to make them inaccessible to the rest
of the compiler under their old name, and thus help enforce the switch
to using the opt_tuple. Any access to these options to look up
their values would fail anyway, since the option data would no longer be
e.g. bool(yes), but bool_special, but the name change makes this failure
happen at compile time, not runtime.
Reclassify a few options to make the above make sense. Some options
(unneeded_code_debug, unneeded_code_debug_pred_name, and
common_struct_preds) were classified as oc_opt even though they
control only the *debugging* of optimizations, while some options
(c_optimize and inline_alloc) were not classified as oc_opt
even though we do set them automatically at some optimization levels.
Delete the opt_level_number option, since it was not used anywhere.
Delete the code for handling -ON and --opt-space, since that is now
done in optimization_options.m.
Add some XXXs.
compiler/handle_options.m:
Switch to using getopt_io.process_options_userdata_se, as required
by the new interface of the special_handler in options.m.
In the absence of errors, invoke optimization_options.m to initialize
the opt_tuple. Then update the opt_tuple incrementally when processing
option implications that affect optimization options.
compiler/globals.m:
Put the opt_tuple into a new field of the globals structure.
compiler/accumulator.m:
compiler/add_pragma_type_spec.m:
compiler/add_trail_ops.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/compile_target_code.m:
compiler/const_struct.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/disj_gen.m:
compiler/erl_code_gen.m:
compiler/format_call.m:
compiler/global_data.m:
compiler/grab_modules.m:
compiler/higher_order.m:
compiler/hlds_pred.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/libs.m:
compiler/llds_out_code_addr.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_instr.m:
compiler/llds_out_util.m:
compiler/matching.m:
compiler/mercury_compile_front_end.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_disj_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_optimize.m:
compiler/ml_proc_gen.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/optimize.m:
compiler/pd_util.m:
compiler/peephole.m:
compiler/polymorphism.m:
compiler/proc_gen.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_scope.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/simplify_tasks.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/tag_switch.m:
compiler/tupling.m:
compiler/unify_gen_construct.m:
compiler/unneeded_code.m:
compiler/unused_args.m:
Conform to the changes above, mostly by looking up optimization options
in the opt_tuple. In some places, replace bools containing optimization
options with the bespoke type of that specific optimization option.
library/getopt_template:
Fix a bug that screwed up an error message.
The bug happened when processing a --file option. If one of the
options in the file was a special option whose special handler failed,
the code handling that failing option returned both an error indication,
and the rest of the argument list read in from the file. The code
handling the --file option then *ignored* the error indication from
the failed special option, and returned an error message of its own
complaining about the unconsumed remaining arguments in the file,
believing them to be non-option arguments, even though these arguments
were never looked it to see if they were options.
The fix is for the code handling --flag options to check whether
the code processing the file contents found any errors, and if so,
return that error *without* looking at the list of remaining arguments.
In an unrelated change, factor out a duplicate call.
compiler/globals.m:
compiler/write_module_interface_files.m:
As above.
compiler/error_util.m:
compiler/handle_options.m:
compiler/mercury_compile_main.m:
compiler/read_modules.m:
Conform to the changes in globals.m.
In mercury_compile_main.m, add an XXX.
The effect of --tags none is to tell the compiler not to use any primary
tag bits. The option is not needed when targeting Java, C# or Erlang,
since with these languages we can't use primary tags. It was effective
only in C grades. However, since using primary tags is always faster,
the only use case for --tags none was to measure *how much* faster.
This was useful in Mercury's early development, but has become obsolete
ages ago.
compiler/options.m:
doc/user_guide.texi:
Delete the --tags option. For non-C targets, it was never needed,
and with the deletion of first --tags high and now --tags none,
--tags low is the only supported value for C.
Change the documentation of the --num-ptag-bits option to emphasize
that name, not its older but less specific synonym, --num-tag-bits.
Document that the only reason to use this option is cross-compilation.
In user_guide.texi, also delete some references to long-deleted
options for reserved addresses and objects, and some duplicate lines
in comments.
NEWS:
Document the option removal.
compiler/globals.m:
Delete the tags_method field of the globals, since it is not
needed anymore.
compiler/handle_options.m:
Delete the code that converts the value of the --tags option to the
value of the tags_method field of the globals.
Ensure that the value of the num_ptag_bits option is (a) zero when
not targeting C, and (b) either 2 or 3 when targeting C.
compiler/du_type_layout.m:
Check that we are using 2 or 3 ptag bits when targeting C.
compiler/const_struct.m:
Conform to the changes above.
runtime/mercury_grade.h:
Generate an error if MR_TAGBITS is zero (which could happen
only with --tags none).
runtime/mercury_tags.h:
Delete the definitions of the list access macros for the MR_TAGBITS == 0
case.
As we discussed, it has fallen into disuse. Its main purpose was to
pave the way for the .net backend and later for the java and csharp grades.
Now that the .net backend is ancient history and the java and csharp grades
are established, that purpose is gone, and for every other purpose,
hlc is better because it is simpler and faster.
compiler/options.m:
Delete the --high-level-data option. It is no longer needed,
bacause the data representation scheme is now a direct function
of the target language.
doc/user_guide.texi:
Delete references to the --high-level-data option.
NEWS:
Mention that --high-level-data is no longer supported.
compiler/compute_grade.m:
Delete references to the hl grade component, and conform
to the deletion of the --high-level-data option.
compiler/compile_target_code.m:
Give some predicates more meaningful names, and conform to the
deletion of the --high-level-data option.
compiler/const_struct.m:
compiler/du_type_layout.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/lco.m:
compiler/mercury_compile_main.m:
compiler/ml_gen_info.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_c_util.m:
Conform to the deletion of the --high-level-data option.
grade_lib/grade_spec.m:
grade_lib/grade_vars.m:
Delete the datarep solver variable, since the data representation
is now a direct function of the target language.
Delete the requirements involving the deleted solver variable.
grade_lib/grade_structure.m:
Delete the datarep component of the representation of MLDS C grades,
since its value would now be fixed.
grade_lib/grade_solver.m:
grade_lib/grade_string.m:
grade_lib/try_all_grade_structs.m:
grade_lib/var_value_names.m:
Conform to the changes above.
grade_lib/Mmakefile:
Link the grade library's test programs statically, like we do
the executables in the other directories.
library/io.m:
library/robdd.m:
library/rtti_implementation.m:
runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
runtime/mercury_hlc_types.h:
Remove references to MR_HIGHLEVEL_DATA, as well as any code
that was guarded by #ifdef MR_HIGHLEVEL_DATA.
scripts/Mmake.vars.in:
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
scripts/mmake.in:
scripts/mmc.in:
scripts/mtc:
scripts/parse_grade_options.sh-subr:
scripts/parse_ml_options.sh-subr.in:
Remove references to --high-level-data options.
In canonical_grade.sh-subr, compute the base grade more directly.
Remove a few left-over references to the assembler backend.
Add or fix vim modelines where relevant.
Fix inconsistent indentation.
Add missing ;;s in case statements.
Switch to using ${var} references instead of just $var.
tests/invalid/Mercury.options:
Make the test_feature_set test case run in grade java instead of hl.gc.
tests/invalid/test_feature_set.err_exp:
Update the expected out for the grade change.
If a file name is listed in the source file map then
do not use that file name as the source file for any other module.
Fixes Mantis bug #489.
compiler/source_file_map.m:
Make the source_file_map a bimap.
Make lookup_module_source_file return `no' if there is no source
file for the requested module, because the default file name for
that module has been mapped to another module.
compiler/file_names.m:
Make module_name_to_file_name_general return a dummy file name
(that is not supposed to exist) when lookup_module_source_file
returns `no'.
compiler/globals.m:
compiler/introduce_parallelism.m:
compiler/xml_documentation.m:
Conform to changes.
doc/reference_manual.texi:
NEWS:
Document the extension.
compiler/prog_item.m:
Add a field to the representation of obsolete pragmas to hold
an optional list of suggested possible replacements.
compiler/parse_pragma.m:
Parse the optional second argument in obsolete pragmas.
Improve the error messages we generate for several kinds of errors
we may encounter when parsing pragmas by making them more specific.
compiler/hlds_pred.m:
Since an obsolete pragma now contains more than one bit of information
(present vs not present), change their representation from a simple marker
to a field containing the possible replacements.
Make a comment about access stats more useful by sorting its contents
on frequency of access, and putting it before the structure it is about.
compiler/simplify_goal_call.m:
When generating warnings about calls to obsolete predicates or functions,
mention the suggested replacements, if there are any.
compiler/add_pragma.m:
Fill in the new field when adding an obsolete pragma to the HLDS.
compiler/globals.m:
Add a function for use by new codee in parse_pragma.m.
compiler/canonicalize_interface.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/hlds_out_pred.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_item_stats.m:
compiler/recompilation.version.m:
compiler/table_gen.m:
Conform to the changes above.
tests/invalid/bad_foreign_code.err_exp:
tests/invalid/bad_foreign_enum.err_exp:
tests/invalid/bad_foreign_export.err_exp:
Expect the improved error messages from parse_pragma.m.
tests/warnings/simple_code.{m,exp}:
Add tests of the new forms of the obsolete pragma.
My plan to ensure that the compilation of every module sees a consistent
set of type representations requires these representations to be put
into interface files. This diff is the first step in the implementation
of that plan. It defines the structure of the items that hold type
representation information, and adds code both to write out such items,
and to read them in.
compiler/prog_item.m:
Add the kinds of tc_repn items that I expect my plan will need.
compiler/parse_tree_out.m:
Add code to output the new kinds of tc_repn items.
Give the exported predicates more meaningful names.
compiler/parse_type_repn.m:
Add code to parse the new kinds of tc_repn items.
compiler/du_type_layout.m:
Add sanity checks that prohibits arity zero function symbols
having any existential type constraints (since they have no arguments
whose types could contain constrainable type variables).
Don't pass around an ultimately unused argument.
Delete some obsolete comments. Improve some other comments.
compiler/globals.m:
Add a predicate version of an existing functions, so we can give it
a reverse mode (which is needed by parsing code above).
compiler/mercury_compile_main.m:
compiler/module_qual.qualify_items.m:
compiler/write_module_interface_files.m:
Conform to the change in the names of the predicates exported
by parse_tree_out.m.
compiler/prog_data.m:
Clarify a comment,
We last used in the mid 1990s, and there is no reason to ever use it again.
compiler/globals.m:
Delete the tags_high alternative in the tags_method type.
compiler/builtin_ops.m:
Delete the mktag and unmktag operations, since they are no-ops
in the absence of tags_high.
compiler/bytecode.m:
compiler/c_util.m:
compiler/compile_target_code.m:
compiler/const_struct.m:
compiler/erl_call_gen.m:
compiler/handle_options.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/ml_unify_gen.m:
compiler/mlds_dump.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
compiler/opt_debug.m:
compiler/options.m:
compiler/peephole.m:
compiler/tag_switch.m:
compiler/unify_gen.m:
Conform to the changes above.
runtime/mercury_conf_param.h:
Delete the MR_HIGHTAGS macro, which is what calls for the tags_high
representation in the runtime.
runtime/mercury_grade.h:
runtime/mercury_tags.h:
runtime/mercury_wrapper.c:
Delete references to MR_HIGHTAGS, and the code that was included
only if it was defined.
compiler/globals.m:
compiler/mode_info.m:
As above: put all the sub-word-sized fields in a term next to each other
to allow the compiler to pack them all into a single word.
The getopt data in globals is not type safe at compile time. When this
leads to a runtime exception provide more information in that runtime
exception to help the developer locate the problem. This means printing the
option name and retrived value.
compiler/globals.m:
As above.
The prog_data.m module is imported by most modules of the compiler; by
359 modules out of 488, to be exact. Yet it has many parts that most of
those 359 modules don't need. This diff puts those parts into four new
modules. The number of imports of these modules:
348 modules import prog_data.m
84 modules import prog_data_foreign.m
62 modules import prog_data_pragma.m
12 modules import prog_data_event.m
5 modules import prog_data_used_modules.m
compiler/prog_data_event.m:
compiler/prog_data_foreign.m:
compiler/prog_data_pragma.m:
compiler/prog_data_used_modules.m:
New modules. They contain the parts of the parse tree that deal
respectively with the specification of events and event sets,
interfacing to foreign languages, pragmas, and the sets of used
(i.e. not unused) modules.
compiler/prog_data.m:
Delete the stuff that is now in the new modules. Put the remaining parts
of the module into a logical order.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Include and document the new modules.
compiler/globals.m:
Move a type here from prog_data.m, since this is where it belongs.
compiler/add_foreign_proc.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma.m:
compiler/add_solver.m:
compiler/add_trail_ops.m:
compiler/call_gen.m:
compiler/code_gen.m:
compiler/code_loc_dep.m:
compiler/comp_unit_interface.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/continuation_info.m:
compiler/coverage_profiling.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.livedata.m:
compiler/ctgc.selector.m:
compiler/deep_profiling.m:
compiler/dep_par_conj.m:
compiler/deps_map.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/elds_to_erlang.m:
compiler/equiv_type.m:
compiler/erl_call_gen.m:
compiler/exception_analysis.m:
compiler/export.m:
compiler/fact_table.m:
compiler/foreign.m:
compiler/frameopt.m:
compiler/get_dependencies.m:
compiler/goal_form.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_pred.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/ite_gen.m:
compiler/item_util.m:
compiler/jumpopt.m:
compiler/layout.m:
compiler/layout_out.m:
compiler/live_vars.m:
compiler/livemap.m:
compiler/llds.m:
compiler/llds_out_file.m:
compiler/llds_out_global.m:
compiler/llds_out_instr.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make_hlds.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/ml_call_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_proc_gen.m:
compiler/ml_tailcall.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
compiler/modecheck_goal.m:
compiler/module_imports.m:
compiler/module_qual.m:
compiler/module_qual.qualify_items.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/par_conj_gen.m:
compiler/parse_pragma.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_out_pragma.m:
compiler/pd_cost.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_gen.m:
compiler/prog_ctgc.m:
compiler/prog_event.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/purity.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_graph.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_scope.m:
compiler/simplify_proc.m:
compiler/smm_common.m:
compiler/stack_layout.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_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/term_constr_pass2.m:
compiler/term_constr_util.m:
compiler/term_errors.m:
compiler/term_pass1.m:
compiler/term_pass2.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/type_constraints.m:
compiler/typecheck.m:
compiler/unique_modes.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/use_local_vars.m:
compiler/write_deps_file.m:
Conform to the changes above.
The options that help determine the op_mode are only sort-of mutually
exclusive; in some cases, more than one can be set. Using the op_mode
instead of the options themselves means that we are using the result
of the process (in op_mode.m) that resolves conflicts between them.
Another benefit is that in some places in the code, many op_modes
have already been processed, which means that the set of remaining op_modes
is a reasonably small set.
compiler/options.m:
Give all the options that op_mode.m uses to compute the op_mode
new internal names. (The user-visible names are not affected.)
Each new internal name is the old internal name with an added
"only_opmode_" prefix, indicating that the option should not be used
for any purpose other than computing the op_mode.
Change the documentation of the --generate-module-order and --imports-graph
options. (See handle_options.m below for the reason.)
doc/user_guide.texi:
Change the documentation of the --generate-module-order and --imports-graph
options, as in compiler/options.m.
compiler/handle_options.m:
Delete implications that set the values of options that help decide the
op_mode, since those implications used to be executed *after* we decided
the op_mode. Replace each of their functionalities with something else.
For the implication from --rebuild to --make, the replacement is
new code in op_mode.m (see below).
For the implication from --invoked-by-mmc-make to --no-make,
the needed replacement code was already in op_mode.m.
For the implications from --generate-module-order and --imports-graph
to --generate-dependencies, do not replace them. Instead, document that
they are effective only if the op mode is generating dependencies.
This goes against the current documentation of --generate-module-order,
though not of --imports-graph (the help message for --imports-graph
is silent on its relationship with --generate-dependencies). However,
the new documented (and implemented) behavior is actually more useful,
since it allows both options to be specified in Mmakefiles or
Mercury.options files, have them be acted on when making dependencies,
but not get error messages about incompatible op mode options.
However, it does mean that "mmc --generate-module-order x.m" would
now try to compile x.m while ignoring the option, whereas previously
it would implicitly act as if the command line were "mmc
--generate-dependencies --generate-module-order x.m". And similarly
for --imports-graph.
Simplify the code that disables smart recompilation when it is not
relevant.
NEWS:
Mention the changes to --generate-module-order and --imports-graph.
compiler/op_mode.m:
Make the opm_top_make functor take an argument that says whether we
are forcing rebuilds or not. The --rebuild option implies we are;
the --make option without --rebuild implies we are not. This replaces
the deleted implication in handle_options.m.
Conform to the name changes in options.m.
compiler/add_type.m:
compiler/compile_target_code.m:
compiler/exception_analysis.m:
compiler/headvar_names.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mode_errors.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.versions.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/term_constr_initial.m:
compiler/termination.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
Replace tests of op_mode options with tests of the op_mode itself.
In mercury_compile*.m, get the op_mode to the places that now need it.
In a few places in make.*.m, replace code that sets op_mode options
(temporarily, for the duration of an operation) with code that sets
the op_mode itself.
compiler/globals.m:
Add the now-needed capability to set the op_mode.
We haven't supported it in years, and keeping it in the compiler
is just a maintenance burden and a performance problem.
mdbcomp/prim_data.m:
Delete the spec_pred_init functor, since we don't support special
"init" predicates anymore.
compiler/prog_data.m:
Delete the slot in solver type details that record the name of the
auto-initialization predicate.
compiler/prog_io_type_defn.m:
Don't allow a type definition to specify an auto-initialization predicate.
compiler/options.m:
compiler/globals.m:
Delete the option that allowed support for auto-initialization to be
turned back on.
compiler/inst_match.m:
compiler/inst_util.m:
Delete comments about auto-initialization.
compiler/mode_info.m:
Delete the record of whether we have variables that can be
auto-initialized (we never do anymore) and the flag that controls whether
auto-initialization is permitted or not.
compiler/modecheck_conj.m:
Simplify the code that modechecks conjunctions, since it no longer
has to figure out where to insert auto-initializations of solver vars.
compiler/modecheck_goal.m:
Delete the code that ensured that if one branch of a branched
control structure auto-initialized a solver variable, then they
all did.
compiler/modecheck_unify.m:
Don't auto-initializate variables before unifications.
compiler/modecheck_util.m:
Delete the code that auto-initialized solver variables at the ends
of procedure bodies if this needed to be done and wasn't done before.
compiler/add_special_pred.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/modecheck_call.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/post_term_analysis.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/term_constr_errors.m:
compiler/term_constr_initial.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_util.m:
compiler/unify_proc.m:
Delete code that handled stuff related to auto-initialization,
and now always take the path that would normally be taken in the
absence of auto-initialization.
deep_profiler/read_profile.m:
runtime/mercury_layout_util.c:
runtime/mercury_stack_trace.c:
util/mdemangle.c:
Remove code that recognized the compiler-generated name of initialization
predicates.
tests/debugger/solver_test.m:
tests/hard_coded/solver_construction_init_test.m:
tests/hard_coded/solver_disj_inits.m:
tests/hard_coded/solver_ite_inits.m:
tests/invalid/missing_init_pred.m:
tests/invalid/zinc2mer_lib.m:
tests/valid/fz_conf.m:
tests/valid/solver_type_bug_2.m:
tests/valid/solver_type_mutable_bug.m:
These tests tested the handling of auto-initialization, which we
no longer support. Keep them around (and a bit more visible than
inside the git repo) in case we need them again, but add a comment
to each saying that the test is disabled.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Disable those tests.
tests/warnings/non_term_user_special.{m,exp}:
Part of this test tested the handling of auto-initialization;
delete that part.
tests/warnings/Mercury.options:
Delete the flag required by the deleted part, since we don't support it
anymore.
compiler/globals.m:
Put the op_mode into the globals structure.
compiler/handle_options.m:
Invoke the code that computes the op_mode *before* creating the globals.
Delete the code duplication concerning the computation of the Link flag.
compiler/op_mode.m:
New module containing the definition of the op_mode type,
and the predicate that figures out the op_mode from the values of options.
These are taken from mercury_compile.m, and the latter is adapted
to work on the option_table, not the globals, since it is now invoked
as *part* of the code to build up the globals.
compiler/libs.m:
compiler/notes/compiler_design.html:
Include the new module.
Do not include the atsort.m module in the libs package, since it
hasn't been used in a long time, and its inclusion adds to the bulk
of the compiler executable without any compensating gain.
compiler/mercury_compile.m:
Delete the code now in op_mode.m.
Conform to the changes above.
compiler/make.m:
compiler/make.program_target.m:
compiler/make.util.m:
Conform to the changes above.
compiler/mercury_compile_erl_back_end.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
Standardise dividing lines.
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.
compiler/prog_data.m:
A foreign_import_module_info structure used to record not just what
module's target language header file is imported in what target language,
but also a context associated with that import, which was set to the
context of the compiler-generated `:- pragma foreign_import_module'
declaration in the .opt file we read it in from. However, we never did
anything useful with this context, and took advantage of that fact
by setting that field to dummy values in pretty much all the
foreign_import_module_info structures created by the compiler.
Since the target language code we generate may need to import the same
target language header file for many different reasons, it is very
unlikely that there is ever going to be a *single* context we may
ever want to associate with the import of one header for one language.
Therefore delete the context field from foreign_import_module_infos.
After this deletion, there is no point in keeping around multiple
foreign_import_module_infos for the same target language / module name
combination. Instead of a set of such pairs, use a representation
that stores a set of imported module names for each of the possible
target languages, since this makes operations faster.
Provide predicates for the operations on the new foreign_import_modules
type that are needed in more than one place.
compiler/prog_item.m:
Avoid having the pragma_info_foreign_import_module type being a duplicate
of the now slimmed-down foreign_import_module_info type by making the
former a wrapper around the latter. (One could replace the former
by the latter, but the current arrangement costs nothing at runtime,
and keeps the documentation of this pragma next to the documentation
of the related pragmas.)
compiler/add_pragma.m:
compiler/comp_unit_interface.m:
compiler/compile_target_code.m:
compiler/deps_map.m:
compiler/foreign.m:
compiler/globals.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_proc_gen.m:
compiler/mlds_to_c.m:
compiler/module_imports.m:
compiler/modules.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_foreign.m:
compiler/prog_io_pragma.m:
compiler/write_deps_file.m:
Conform to the above changes. In many places, we can avoid such things as
(a) filtering all foreign_import_module_infos looking for given languages,
or (b) converting from cords to lists to sets, operating on the sets,
and converting the result back to lists and maybe to cords.
compiler/intermod.m:
As above, but also order the source code of the main predicates
of this module in the same order as their invocation, and give some
of them more meaningful names.
compiler/globals.m:
Allow the filename part of the --limit-error-contexts option's value
(1) to be empty, and (2) to contain colons.
Add a mutable for recording whether a messages was suppressed by such
options.
compiler/error_util.m:
Respect the universal line number ranges as well as the per-file ones,
and record when any messages is suppressed.
compiler/mercury_compile.m:
Print a message at the end of compilation if any messages were suppressed.
compiler/options.m:
Update the option's help message.
When the compiler is invoked with the accumulating options
--limit-error-contexts file1.m:10-20,30-40
--limit-error-contexts file2.m:100-200,300-
then don't print any error messages whose contexts are
for file1.m with line number 1-9, 21-29 or 41+
for file2.m with line number 1-99, or 201-299
The idea is that when programmers work on one part of a large file,
then error messages about other parts of that file are just distractions
they have to dig through to get to the error messages they are interested in
right then and there. This new option allows them to tell the compiler
to shut up about other errors.
compiler/options.m:
Add the new option.
compiler/globals.m:
Add a new field to the globals to hold the value of this option
in a convenient format.
compiler/error_util.m:
When printing error messages, suppress messages for files named
in these options if the line number of the message is not in one of
the ranges given for that file. (The suppressed messages still affect
the exit status as usual.)
To make the above easier, factor out come common code.
Fix an unrelated issue: when printing raw messages, don't eliminate
line breaks in them. When two or more --limit-error-context options
have problems, we want to print them on separate lines, since the
option value can be quite long.
compiler/handle_options.m:
Arrange for the value of this option to be included in the globals.
Fix an unrelated issue: use cords for storing messages about bad
options. (I don't think the worst-case behavior of cords is useful here;
I just used the representation change to help track down the location
of the bug that eliminated newlines in raw error messages.)
Each of the new modules has much better cohesion than the original modules
they came from, and the now-slimmed-down make_hlds_passes.m and
add_pragma.m do too.
There are no algorithmic changes. The only change that does more than
move code around is the deletion of unnecessary !QualInfo arguments
from some predicates.
compiler/add_mutable_aux_preds.m:
Move the remainder of the code that handles mutables here from
make_hlds_passes.m. Note that add_mutable_aux_preds.m is now
*bigger* than what remains of make_hlds_passes.m, though some of this
is from unnecessary code duplication.
compiler/add_foreign_enum.m:
New module that adds foreign enums to the HLDS, carved out of add_pragma.m.
compiler/add_foreign_proc.m:
New module that adds foreign procs to the HLDS, carved out of add_pragma.m.
compiler/add_pragma_tabling.m:
New module that handles tabling pragmas, carved out of add_pragma.m.
compiler/add_pragma_type_spec.m:
New module that handles type_spec pragmas, carved out of add_pragma.m.
compiler/add_pred.m:
Move a predicate here from make_hlds_passes.m, since it is used here,
and belongs here.
Put related predicates together.
compiler/du_type_layout.m:
New module that decides how values of du types are represented
(mainly with respect to issues of argument packing). It was carved out
of make_hlds_passes.m.
compiler/add_pragma.m:
compiler/make_hlds_passes.m:
Remove the code moved to other modules. Put the remaining code
into a logical order, with the code executed in one pass separated
from code executed in other passes, and within each pass, each pragma
or item type handled in separate blocks of code, with the order of those
blocks matching the order of the arms of the switches that call them.
Previously, both modules had the code for different passes, pragmas
and items mixed together.
compiler/prog_data.m:
Move some utility functions here, since the data type they work on
is defined here.
compiler/globals.m:
Move a utility function here, since the data types it links are
both defined here.
compiler/*.m:
Conform to the above changes.
compiler/notes/compiler_design.html:
Document what the new modules do.
compiler/equiv_type.m:
Don't export a predicate that does not need to be exported.
compiler/hlds_data.m:
compiler/polymorphism.m:
mdbcomp/goal_path.m:
Put knowledge of the goal_id to hand head constraints in only one place:
mdbcomp/goal_path.m.
compiler/goal_path.m:
Allocate goal_ids using counters.
compiler/foreign.m:
Delete an unused predicate.
compiler/ite_gen.m:
Factor out some common code.
compiler/equiv_type_hlds.m:
compiler/error_util.m:
compiler/exception_analysis.m:
compiler/global_data.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/goal_form.m:
compiler/granularity.m:
compiler/hlds_args.m:
compiler/hlds_out_util.m:
compiler/interval.m:
compiler/java_names.m:
compiler/jumpopt.m:
compiler/labelopt.m:
compiler/lambda.m:
compiler/lco.m:
compiler/live_vars.m:
compiler/livemap.m:
compiler/modecheck_conj.m:
compiler/type_constraints.m:
Minor style cleanups.
It was intended that the C compiler type string for MSVC would eventually have
the form "msvc_<n>" (where <n> is the version number). The configure script is
still generating the older form of string, "cl_<n>"; we want to avoid this
because it's too easy to confuse with clang. Make configure generate the new
kind of C compiler type string.
configure.ac:
Generate the new sort of compiler type strings for MSVC.
scripts/mgnuc.in:
compiler/globals.m:
Do not recognise the old sort any longer.
Drop support for lcc as a C compiler. lcc itself does not seem to have been
updated since around 2010 and Mercury's support for it has not been updated for
quite a while before that.
Derivatives of lcc, for example lcc-win32, would almost certainly need to be
treated separately anyway, so this change doesn't affect them (i.e. they are
already not supported).
configure.ac:
m4/mercury.m4:
Do not recognise lcc as a C compiler.
Unrelated change: remove residual support for a.out executables on Linux.
scripts/mgnuc_file_opts.sh-subr:
Do not define the macros __EXTENSIONS__ and _GNU_SOURCE if the mgnuc script
is invoked with --no-ansi. This was originally done to support lcc on Linux.
Doing so on *all* systems as this code actually does is not a good idea.
(If it becomes necessary to reinstate this behaviour on some system, it
should be controlled from the configure script not here.)
runtime/mercury_wrapper.c:
Delete a workaround for lcc.
scripts/mgnuc.in:
scripts/ml.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/globals.m:
compiler/ml_code_gen.m:
Delete support for lcc.
README.lcc:
Delete this file.
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.
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.
Library installation with mmc --make sometimes attempt to install libraries in
non-existent grades, for example java.par or java.trseg. The cause of this
problem is some left over code from the GCC backend, in particular the
high-level C base grade components imply multiple possible target languages, C
and asm. This is a problem because of the XXX in the predicate
convert_grade_option/3, where we only update the current target language if the
base grade component has a single target language associated with it.
For example, when a library is being installed in the grades java and hlc.par.gc and
we are at the step where we install it in the hlc.par.gc grade (second, since the
libgrade list is sorted), we build up the following command line for the mmc subprocess
that will do the installation in that grade:
mmc --invoked-by-mmc-make ... --make \
--grade java --use-grade-subdirs \
--grade hlc.par.gc --use-grade-subdirs \
--java-only --use-subdirs <target>
(XXX I don't know why we need to keep repeating --use-grade-subdirs like this,
or why we have to pass --use-subdirs at all given that it is implied by
--use-grade-subdirs. Or what the rationale for passing all the --grade options
to the subprocess is.)
When the option "--grade java" is processed the target language will be set to
Java, but because of the XXX in convert_grade_option/3, the target language
will not be set to C when the option "--grade hlc.par.gc" is subsequently
processed, hence the compiler will attempt to install the library in the
non-existent grade java.par. (Since --target java implies automatic GC,
the .gc component will vanish.)
The fix is to remove the asm target language for the high-level C base grade
components.
Additionally, remove other left over code for supporting --target asm.
compiler/handle_options.m:
Delete the "asm" target language for the high-level C base grade
components.
compiler/make.m:
compiler/globals.m:
compiler/add_pragma.m:
compiler/write_deps_file.m:
Delete references to "--target asm" and update some other comments
where necessary.
compiler/modules.m:
Delete two unused predicate that were only required by the GCC backend.
compiler/compile_target_code.m:
Delete the unused predicate assemble/7 that was only required by the
GCC backend.
compiler/mlds_to_c.m:
Add an XXX comment about some code that was required to support
"--target asm".
NEWS:
Announce the fix.
As Tomas By's recent emails suggest, this support is doing more harm than good,
by falsely implying to people that MPS is a viable alternative to the Boehm
collector. The MPS collector was only ever experimental, and never performed
as well as Boehm. MPS isn't even in the git repository on git hub. It was
stored in a separate CVS repository on mundula, and (as far as I know)
wasn't carried over to github. The code of MPS was last touched a long time
ago; I would be surprised if it worked on today's systems without changes.
Mmake.common.in:
Mmake.workspace:
RESERVED_MACRO_NAMES:
boehm_gc/Mmakefile:
compiler/add_pragma.m:
compiler/compile_target_code.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c.m:
compiler/options.m:
compiler/peephole.m:
doc/user_guide.texi:
library/benchmarking.m:
runtime/Mmakefile.m:
runtime/mercury.h:
runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
runtime/mercury_wrapper.[ch]:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
scripts/parse_grade_options.sh-subr:
util/mkinit.c:
Remove all references to MPS.
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.
compiler/options.m:
Change the type of the max_error_line_width option from int to maybe_int.
Change its documentation accordingly.
doc/user_guide.texi:
Change the option's documentation here as well.
compiler/globals.m:
Since this is the compiler's first maybe_int option, add a predicate
to look up such options.
compiler/error_util.m:
If the user specifies --no-max-error-line-width, do not try to pack the
words of an error paragraph into lines; just return all the words on one
line.
Factor out some common code in the group_words predicate, and give that
predicate a more accurate name.
tests/invalid/any_to_ground_in_ite_cond_nomax.{m,err_exp}:
Add this copy of the existing any_to_ground_in_ite_cond test case.
tests/invalid/Mercury.options::
Specify --no-max-error-line-width for the new test case.
tests/invalid/Mmakefile:
Enable the new test.
On some 32-bit architectures, we were violating memory alignment
requirements for double-precision floats, in cell fields and on det and
nondet stacks. Bug #299.
We now only take the address of a double field when it occurs on an
aligned memory address, i.e. when it starts at an even word offset from
the start of a cell (this assumption is incompatible with term-size
profiling which adds a hidden word before the start of the cell).
For the det stack, we can round up allocations to keep the stack pointer
double-aligned, then allocate slots for doubles at even word offsets
from the stack pointer.
It would be trickier for the nondet stack. Multiple frame types exist
on the nondet stack, and the different frame types are identified by
their sizes: 3-word and 4-word temporary frames, and 5/6+ word ordinary
frames. Rather than rounding up frame sizes to even numbers of words,
we would probably want to dynamically pad ordinary frame allocations,
such that any doubles in the frame will be at aligned addresses.
However, in this change, we simply store box floats on the nondet stack.
compiler/globals.m:
Add predicate which returns whether double-width floats
should be stored on the det stack.
compiler/handle_options.m:
Disable double-word fields in term-size profiling grades.
compiler/code_info.m:
Add a predicate to round up det stack frame sizes.
Remember the width of floats stored on the det stack in
exprn_opts.
compiler/hlds_llds.m:
compiler/llds.m:
compiler/stack_layout.m:
Delete the possibility of double-width slots on the nondet
stack.
Remember det_stack_float_width in exprn_opts.
compiler/llds_out_data.m:
Add wrapper macro `MR_dword_ptr' when taking the address of a
double.
Only take the address of doubles on the det stack.
compiler/llds_out_instr.m:
compiler/llds_out_util.m:
Only assign a double field in a single C statement when it is
aligned.
Assert that the stack pointer is incremented by an even number,
if necessary.
compiler/mlds_to_c.m:
Only take the address of doubles when aligned.
compiler/middle_rec.m:
compiler/proc_gen.m:
Round up det stack frame allocations to even numbers of words
when necessary.
compiler/stack_alloc.m:
Add padding as required so that double-word variables will
be allocated at even-word offsets from the stack pointer.
compiler/opt_debug.m:
compiler/par_conj_gen.m:
Conform to changes.
runtime/mercury_conf_param.h:
runtime/mercury_float.h:
Add macro `MR_dword_ptr' to be wrapped around instances where
the address of a double is taken. When `MR_DEBUG_DWORD_ALIGNMENT'
is defined (and using gcc or clang) the address is checked to be
properly aligned. Almost all our development is done on x86 or
x86-64 architecture which do not have strict memory alignment
requirements, making violations hard to check otherwise.
runtime/mercury_deconstruct.c:
runtime/mercury_layout_util.c:
Use `MR_float_from_dword' over `MR_float_from_dword_ptr' as the
former does not require dword alignment.
Related fix: looking up `double' variables on the nondet stack
used the stack pointer for the det stack instead. Fix it,
though the code now won't be executed after this change.
tests/debugger/nondet_stack.exp5:
Add new expected output. This is the same as nondet_stack.exp
except that det stack frames have been rounded up.
The "system" environment type is the environment type that external programs
invoked by the Mercury compiler (e.g. the C compiler) are run in. That is, it
is the environment type that you get when you run a command use the C standard
library's system() function. (Or equivalently, the Mercury standard library
predicate io.call_system/4.)
On sane operating systems this is identical to the host environment type. On
native Windows**, the system environment is whatever command interpreter the
environment variable COMSPEC is pointing to (by default, cmd.exe), regardless
of what value the Mercury option --host-env-type has. For example. if
--host-env-type is set to "msys" or "powershell" the system environment is
cmd.exe. The new option allows us to fully describe to the compiler which
environment types we intend it to interact with. Not being able to specify
this information has been one of the things preventing the powershell
environment from working properly.
** that is, Windows where the Mercury compiler is a native Windows executable,
so not on Cygwin when compiled against cygwin.dll, but on MinGW/MSYS.
compiler/options.m:
Add a new option, --system-env-type, which allows the "system"
environment to be specified.
Make the --env-type option also set the system environment type
as well as the host and target environment types.
compiler/handle_options.m:
Handle the new option. Make --system-env-type default to the value
of --host-env-type if the former is not given on the command line.
compiler/compile_target_code.m:
Use the system env type in place of the host env type in spots where
the former is what is actually meant.
compiler/globals.m:
Add a slot to the globals structure to hold the system environment
type.
doc/user_guide.texi:
Document the new option.
Allow the possibility of the compiler automatically deciding what command(s) to
use to install files and directories instead of using the value of
--install-command (which defaults to "cp"). The eventual intention (NYI) is
that in the absence of a value for --install-command, the compiler will choose
an appropriate command based on the setting of --host-env-type (and possibly
some other stuff, for the example the OS version).
The rationale for all this to try to improve the current situation on Windows
(in the absence of Cygwin or MSYS) where file copying is a bit of a mess. It
should also mean that the same Mercury installation can be more easily used
from both MSYS and cmd.exe.
NOTE: for the moment --install-command is still specified in Mercury.config.
This will be removed in a later change and the compiler will default to
choosing automatically.
compiler/globals.m:
Add a type whose values describe how we should install files and
directories.
Add a field of that type, file_install_cmd, to the globals structure.
Add access predicates.
compiler/handle_options.m:
Set the new field in the globals.
compiler/file_util.m:
Provide functions for constructing a command line for installing files
and directories based on the value of the file_install_cmd field in
the globals.
compiler/make.program_target.m:
compiler/module_cmds.m:
Use the new functions in file_util.m.
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.