Files
mercury/compiler/libs.m
Peter Wang 5e638af0f1 Speed up retrieval of foreign imports.
For a do-nothing build of Prince with intermodule optimisation enabled,
mmc --make spends a large fraction of its time computing foreign imports,
or rather looking up the cached results of such. (There are 650 modules,
and the results for each module are looked up tens to hundreds of
thousands of times each.)

This change replaces the representation of cached_foreign_imports from
tree234 to one based on version_array. It reduces the average run time
for a do-nothing build of Prince on my machine from 7.80 s to 5.87 s,
for a speedup of ~25%.

compiler/va_map.m:
    Add a simplified version of a module that I originally wrote for
    Prince. I have permission to include it in the Mercury compiler and
    assign copyright to the Mercury team.

compiler/libs.m:
    Include the new module in the libs package.

compiler/make.deps_set.m:
    Implement a typeclass needed to use module_index as a va_map key.

compiler/make.dependencies.m:
    Implement a typeclass needed to use maybe(T) as a va_map_value.

    Use va_map to represent cached_foreign_imports instead of map.
2022-11-23 16:50:45 +11:00

61 lines
2.0 KiB
Mathematica

%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%-----------------------------------------------------------------------------%
% Copyright (C) 2002-2003, 2005, 2008-2009 The University of Melbourne.
% Copyright (C) 2015, 2017, 2019-2022 The Mercury team
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
%
% This package contains general utilities that are used by other packages.
%
:- module libs.
:- interface.
% Option handling.
:- include_module globals.
:- include_module options.
:- include_module handle_options.
:- include_module optimization_options.
:- include_module op_mode.
:- include_module compute_grade.
:- include_module trace_params.
% Error handling.
:- include_module compiler_util.
:- include_module maybe_succeeded.
% Representation of mmakefile fragments.
:- include_module mmakefiles.
% Existence checks for required libraries.
:- include_module check_libgrades.
% Generic algorithms and data structures that are not quite useful enough
% or otherwise aren't in the standard library.
% :- include_module atsort. % currently unused
:- include_module dependency_graph.
:- include_module file_util.
:- include_module graph_colour.
:- include_module int_emu.
:- include_module md5.
:- include_module pickle.
:- include_module uint_emu.
:- include_module va_map.
% OS interfaces not provided by the standard library.
:- include_module process_util.
:- include_module shell_util.
:- include_module timestamp.
% Constraint machinery for the termination analysers.
:- include_module lp.
:- include_module lp_rational.
:- include_module polyhedron.
:- include_module rat.
%-----------------------------------------------------------------------------%
:- end_module libs.
%-----------------------------------------------------------------------------%