mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
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.
30 lines
911 B
Mathematica
30 lines
911 B
Mathematica
% vim: ts=4 sw=4 et ft=mercury
|
|
%
|
|
% This is a regression test for Mantis bug 93. Versions of the compiler before
|
|
% 22 Sep 2009 used to throw "Unexpected: do_unravel_unification:
|
|
% from_ground_term not conj" on this code. The reason is that the
|
|
% unification introduced for the first argument of the call to log_tf
|
|
% has a ground term above the size threshold specified in Mercury.options
|
|
% on the right hand side, but unraveling it yields not a conjunction of
|
|
% construct unifications, but a single unification with an rhs_lambda_goal
|
|
% right hand side.
|
|
|
|
:- module from_ground_term_bug.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module string.
|
|
|
|
main(!IO):-
|
|
log_tf(((func) = "s3nav Server version: " ++ "\n" ++ "\n" ++ "\n"), !IO),
|
|
io.write_string("ok\n", !IO).
|
|
|
|
:- pred log_tf(((func) = string)::in, io::di, io::uo) is det.
|
|
|
|
log_tf(_, !IO).
|