library/*.m:
Delete Erlang foreign code and foreign types.
Delete documentation specific to Erlang targets.
library/deconstruct.m:
Add pragma no_determinism_warning to allow functor_number_cc/3
to compile for now.
library/Mercury.options:
Delete workaround only needed when targetting Erlang.
browser/listing.m:
mdbcomp/rtti_access.m:
Delete Erlang foreign code and foreign types.
library/math.m:
library/exception.m:
Move the domain_error type from math.m to exception.m.
NEWS:
Announce the change as a potentially breaking change.
deep_profiler/query.m:
library/float.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/integer.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
Replace all references to math.domain_error with just domain_error.
Delete imports of math.m where this was the only reason for the import.
library/math.m:
Since code in math.m uses C macros defined in a foreign_decl in float.m,
math.m needs a foreign_import_module for float, but it did not have one.
This caused compilation of math.c to math.o to fail *except* with
intermodule optimization, which gave math.m the required access to
float.m's internals anyway. The reason we didn't notice is that
intermodule optimization is the default.
browser/collect_lib.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
compiler/make.util.m:
compiler/pickle.m:
compiler/process_util.m:
compiler/prog_event.m:
library/array.m:
library/benchmarking.m:
library/bit_buffer.m:
library/builtin.m:
library/char.m:
library/deconstruct.m:
library/dir.m:
library/erlang_rtti_implementation.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/io.m:
library/math.m:
library/mutvar.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.format.m:
library/string.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
ssdb/ssdb.m:
As above. This mostly involved two things.
The first was grouping foreign_procs by predicate instead of by language.
In a few cases, this revealed that some predicates *had* no foreign_proc
for a language, while related predicates did have one that just aborted
if called. This diff adds similar aborting foreign_procs to predicate/
language combinations that were missing them, when this seemed obviously
the right thing to do.
The second was moving pragmas about a predicate from the middle of the
block of clauses of that predicate to the start of that block.
Fix a test case failure in spf grades.
library/math.m:
Document how the "next integer" operations handle arguments of infinite
magnitude.
tests/general/float_test.m:
s/ceil/ceiling/ in a spot.
Test next integer operations with +/-infinity (and zero).
In the erlang grades, avoid running parts of these tests that
rely on library functionality that is NYI.
Document what the expected outputs correspond to.
tests/general/float_test.exp:
Update this expected output.
tests/general/float_test.exp2:
Replace the contents of this file: previously it contained output for
some ancient version of MSVC; it now contains the spf version of the
output.
tests/general/float_test.exp3:
A new expected output for the erlang grades.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
Many predicates that do their jobs via foreign_procs in C have a fallback
Mercury clause for non-C backends, which usually throws an exception.
When compiled in non-C grades, these often get a warning that their
determinism declaration could have been tigther, e.g. erroneous instead of det.
*.m:
Add no_determinism_warnings pragmas before such fallback clauses.
library/dir.m:
As above, but also remove the unnecessary "dir." prefix on many predicate
declarations and clause heads.
NOTE: this change does not affect the io module -- I've left that for a
separate change.
library/*.m:
As per the recent change to the coding standard, avoid module
qualification in library interfaces where possible.
Reformat declarations and descriptive comments to better utilise
any space freed up by the above.
Support the fused multiply-add operation in C grades, where the underlying math
library provides it. Add a predicate that allows program to test for the
presence of this operation.
(The non-C target languages do not currently provide this operation.)
library/math.m:
Add the function fma/3.
Add the predicate have_fma/0 which can be used to test for the
presence of fma operation in the current grade / platform.
configure.ac:
runtime/mercury_conf.h.in:
Check whether the C99 fma() function is available.
NEWS:
Announce the above.
Use foreign_procs to define the hyperbolic operations in the Java grade.
Java has provided these since version 1.5 and since that is the minimum
version required by Mercury we can rely on them being present.
library/math.m:
As above.
Branches: main
library/math.m:
Add unchecked versions of all the operations in this module
that don't already have them.
Delete the stuff in the header comment about
ML_OMIT_MATH_DOMAIN_CHECKS; with the unchecked versions
available recompiling the library to omit the domain
checks is no longer necessary.
NEWS:
Announce the above additions.
Branches: main, 10.04
Allow inlining of Java foreign_procs.
This revealed a problem with directly using the `succeeded' flag directly as
the success indicator in Java foreign_procs. When the code of the foreign_proc
becomes a nested function, and after nested functions are eliminated, there may
not be a variable called `succeeded' in that context; it is moved into
environment struct, and the transformation is not able to update handwritten
code to reflect that. The solution is to declare a local variable for the
foreign_proc, let the handwritten code assign that, then assign its final
value to the `succeeded' flag with an MLDS statement.
We take the opportunity to name the local variable `SUCCESS_INDICATOR', in
line with other backends.
compiler/inlining.m:
Allow inlining of Java foreign_procs.
compiler/ml_foreign_proc_gen.m:
In the code generated for semidet Java foreign_procs, declare a local
`SUCCESS_INDICATOR' variable and assign its value to the `succeeded'
flag afterwards.
Add braces to give the foreign_proc variables a limited scope.
compiler/make_hlds_warn.m:
Conform to renaming.
doc/reference_manual.texi:
Update documentation for the renaming of the `succeeded' variable.
library/array.m:
library/bitmap.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/dir.m:
library/exception.m:
library/float.m:
library/int.m:
library/io.m:
library/math.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/string.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/version_array.m:
Conform to renaming.
Fix problems with Java foreign_procs that may now be copied into other
modules when intermodule optimisation is enabled, some by disallowing
the procedures from being duplicated, some by making referenced
classes/fields `public'.
[Some of the `may_not_duplicate' attributes may not indicate actual
problems, just that it seems not worthwhile inlining calls to the
procedure.]
extras/solver_types/library/any_array.m:
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/external_unification_pred.m:
tests/hard_coded/java_test.m:
tests/hard_coded/redoip_clobber.m:
tests/hard_coded/user_compare.m:
tests/valid/exported_foreign_type2.m:
tests/warnings/warn_succ_ind.m:
tests/warnings/warn_succ_ind.exp3:
Conform to renaming.
Estimated hours taken: 0.2
Branches: main
library/bit_buffer.m:
Fix incorrect result type on new_buffer_2.
library/math.m:
Fix Erlang implementation of math.round/1.
library/profiling_builtin.m:
library/table_builtin.m:
Add Erlang stubs for :- external procedures for deep profiling and
tabling.
Estimated hours taken: 16
Branches: main
Implement the TypeCtorInfo RTTI so that generic compare
and unify work via rtti_implementation.
However after discussion with zs, this current design of
RTTI has to be adapted to become more erlang specific, due
to the different data representation on the erlang backend.
The current code will serve as a template for this new design
though, which is why it is being checked in.
Add various erlang library implementations which are
needed to run useful programs when testing the erlang backend.
compiler/elds.m:
Add a type_info_id.
compiler/elds_to_erlang.m:
We now generate type_ctor_info's so call them.
compiler/erl_rtti.m:
After discussions with zs, type_info and pseudo_type_infos
should never occur on the erlang backend as they are needed
for gc and the debugger so throw an exception for them.
Add an implementation of creating a static type_info, but which
isn't used in case we need it again later.
Create type_ctor_info with all the fields except the
TypeFunctors, the TypeLayout and the FunctorNumberMap
compiler/special_pred.m:
Make sure we generate RTTI for the builtin types.
library/builtin.m:
library/char.m:
library/exception.m:
library/float.m:
library/int.m:
library/io.m:
library/lexer.m:
library/math.m:
library/mutvar.m:
library/ops.m:
library/par_builtin.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/solutions.m:
library/store.m:
library/string.m:
library/table_builtin.m:
library/thread.semaphore.m:
library/time.m:
library/type_desc.m:
Erlang implementations of std library functions.
Estimated hours taken: 12
Branches: main
compiler/use_local_vars.m:
Extend this optimization to handle temporaries being both defined in
and used by foreign_proc_code instructions. This should eliminate
unnecessary accesses to the MR_fake_reg array, and thus speed up
programs that use foreign code a lot, including typeclass- and
tabling-intensive programs, since those features are implemented using
inline foreign code. I/O intensive should also benefit, but not much,
since the cost of the I/O itself overwhelms the cost of the
MR_fake_reg accesses.
Group together the LLDS instructions that are handled similarly.
Factor out some common code.
compiler/opt_util.m:
Allow for the fact that foreign_proc_codes can now refer to
temporaries.
compiler/opt_debug.m:
Print more useful information about foreign_proc_code components.
compiler/prog_data.m:
Rename the types and function symbols of the recently added
foreign_proc attributes to avoid clashing with the keywords
representing them in source code.
Add a new foreign_proc attribute, proc_may_duplicate that governs
whether the body of foreign code is allowed to be duplicated.
compiler/table_gen.m:
Include does_not_affect_liveness among the annotations for the
foreign_proc calls generated by this module. Some of these procedures
affect memory beyond their arguments, but that memory is in tables,
not in unlisted registers.
Allow some of the smaller code fragments generated by this module
to be duplicated.
compiler/inlining.m:
Respect the may_not_duplicate foreign_proc attribute.
compiler/pragma_c_gen.m:
Transmit any annotations about liveness from the HLDS to the LLDS,
since without does_not_affect_liveness annotations use_local_vars.m
cannot optimize foreign_proc_codes.
Transmit any annotations about may_duplicate from the HLDS to the LLDS,
since with them jumpopt can do a better job.
compiler/llds.m:
Use the new foreign_proc attribute instead of a boolean to represent
whether a foreign code fragment may be duplicated.
compiler/simplify.m:
Generate an error message if a may_duplicate or may_not_duplicate
attribute on a foreign_proc conflicts with a no_inline or inline pragma
(respectively) on the predicate it belongs to.
compiler/hlds_pred.m:
Fix some comment rot.
compiler/jumpopt.m:
compiler/livemap.m:
compiler/proc_gen.m:
compiler/trace_gen.m:
Conform to the changes above.
doc/reference_manual.texi:
Document the new foreign_proc attribute.
library/array.m:
library/builtin.m:
library/char.m:
library/dir.m:
library/float.m:
library/int.m:
library/io.m:
library/lexer.m:
library/math.m:
library/private_builtin.m:
library/string.m:
library/version_array.m:
Add does_not_affect_liveness annotations to the C foreign_procs that
deserve them.
configure.in:
Require the installed compiler to support does_not_affect_liveness.
tests/invalid/test_may_duplicate.{m,err_exp}:
Add a new test case to test the error checking code in simplify.m.
tests/invalid/Mmakefile:
Enable the new test case.
Estimated hours taken: 1
Branches: main
compiler/table_gen.m:
compiler/unused_args.m:
Instead of printing each error message immediately, pass them back to
mercury_compile.m to print them all at once.
compiler/mercury_compile.m:
Do the printing.
compiler/hlds_goal.m:
compiler/inst_graph.m:
library/float.m:
library/int.m:
library/math.m:
Rename some predicates to avoid ambiguity.
compiler/*.m:
Conform to the changes above.
Estimated hours taken: 0.2
Branches: main, release
library/*.m:
Improve the library reference manual by formatting the beginning of
library modules consistently.
library/integer.m:
Fix some bad indentation.
Estimated hours taken: 1
Branches: main
library/*.m:
Replace __ with . as the module qualifier everywhere.
tests/hard_coded/test_injection.exp:
Replace __ with . as the module qualifier in expected exceptions.
Estimated hours taken: 0.5
Branches: main
library/*.m:
Annotate foreign_procs with trail usage information throughout most of
the standard library.
Fix an out of date comment in string.m.
Fix some minor formatting problems.
Estimated hours taken: 4
Branches: main
library/*.m:
Convert to four-space indentation most of the library modules that
weren't already indented that way. Use predmode syntax where possible.
In some modules, shorten long lines by deleting module name prefixes.
Fix departures from our coding standards.
In some modules, simplify code, mostly using field names and/or state
variables.
There are no changes in algorithms, except for neg_list in integer.m.
Estimated hours taken: 3
Branches: main, version-0_12-branch
library/array.m:
library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree_set.m:
library/bitmap.m:
library/bool.m:
library/builtin.m:
library/cord.m:
library/float.m:
library/graph.m:
library/group.m:
library/hash_table.m:
library/int.m:
library/lexer.m:
library/list.m:
library/map.m:
library/math.m:
library/multi_map.m:
library/ops.m:
library/parser.m:
library/rbtree.m:
library/set.m:
library/stack.m:
library/store.m:
library/string.m:
library/time.m:
Minor reformatting; added some renamed preds and funcs to improve
consistency of naming in the library; removed some preds and types that
have been marked obsolete since 0.11.
Estimated hours taken: 8
Branches: main
library/*.m:
Bring these modules up to date with our current style guidelines.
Use predmode declarations where appropriate. Use state variable syntax
where appropriate. Reorder arguments where this makes it possible to
to use state variable syntax. Standardize format of predicate
description comments. Standardize indentation.
Estimated hours taken: 0.25
Branches: main
Bug fix for math library.
library/math.m:
Changed the order of the parameters for the mercury implementation of
math__log_2/2
The old version is incorrect with respect to the library documentation.
'math__log(B, X) = Log' is supposed to return Log as the logarithm to
base B of X. After doing domain checks, this predicate calls
math__log_2(B, X), which is defined correctly for the C and C#
implementations, but had the parameters the wrong way around for the
(default) mercury implementation, so it in fact returned Log as the
logarithm to base X of B (in other words the reciprocal of what was
intended).
Estimated hours taken: 4
Branches: main
Implement some library procedures for the Java back-end.
Tested with a modified form of /tests/general/float_test (had to take out some
tests involving predicates from string and float which are not
yet implemented)
library/math.m:
Added the ML_FLOAT_LN2 constant for Java:
Implement the following predicates for Java:
domain_checks/0
math__pi/1
math__e/1
math__ceiling/2
math__floor/2
math__round/2
math__sqrt_2/2
math__pow_2/3
math__exp/2 <-- also fixed a typo here
math__ln_2/2
math__log2_2/2
math__sin/2
math__cos/2
math__tan/2
math__asin_2/2
math__acos_2/2
math__atan/2
math__atan2/3
Implement the following predicates in Mercury:
math__sinh/2
math__cosh/2
math__tanh/2
Estimated hours taken: 2
Branches: main
Begin porting the the library just to use C# as its foreign_proc
language.
library/array.m:
library/char.m:
library/exception.m:
library/float.m:
library/int.m:
library/math.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/std_util.m:
Trivial changes to convert MC++ to C#.
library/table_builtin.m:
Delete some unused MC++ functions.
Estimated hours taken: 24
Branches: main
Various fixes to make the Java back-end work better.
compiler/ml_code_gen.m:
Make sure that no module in the generated MLDS
tries to import itself.
Also, add some XXX comments about the handling of
model_semi foreign_procs for Java and IL.
compiler/ml_code_util.m:
Fix a bug with the handling of `top_unused' modes with `--det-copy-out'.
compiler/mlds_to_java.m:
Add an XXX comment about the problem with type names clashing
with constructor names.
Add an XXX comment about ignoring `pragma foreign_import'
and `pragma export' for Java.
Fix the code so that we handle `foreign_decl' and `foreign_code'
for Java properly -- previously, we were generating code for
`foreign_decl' in the wrong place, and `foreign_code' was just
ignored.
Handle procedures defined as `external' by calling `extern_Foo',
rather than generating a declaration with no body, because
Java syntax doesn't allow that.
Fix a bug where some names weren't getting mangled properly.
Fix some bugs where it was not generating correct package
names or module qualifiers for modules in the Mercury
standard library.
library/Mmakefile:
Add support for the `java' grade.
This involved adding new targets `javas' and `classes',
and making the main `library' target depend on these if
the grade is `java'.
library/builtin.m:
Add (stub) Java implementations of various builtins:
- the type_ctor_infos for the builtin types int, string, character
- builtin.unify/2 and builtin.compare/3
library/private_builtin.m:
Add (stub) Java implementations of various builtins:
- the type_ctor_info for private_builtin.type_info/1
- builtin_compare_int/3, builtin_compare_string/3,
builtin_strcmp/3
library/math.m:
- Fix a couple of bugs in the Mercury code for "log" and "log2".
library/std_util.m:
Provide a Java implementation for cc_multi_equal/2.
Avoid a compiler warning for the Mercury implementation
of semidet_succeed and semidet_fail.
library/store.m:
Rename the constructor for the `store/1' type,
to work around a bug in the Java back-end.
library/string.m:
Fix bugs in the Mercury implementation of string__contains_char
and string__split.
Provide a Java implementation of string__length.
library/type_desc.m:
Provide Java implementations of type_of/1 and has_type/2.
Provide (stub) implementations of the builtin types type_desc/0
and type_ctor_desc/0.
Estimated hours taken: 4
Branches: main
library/*.m:
Delete Mercury clauses that just call sorry/1.
I applied this change to all files except the following:
rtti_implementation.m (because in that case, there is no C
implementation) and profiling_builtin.m and table_builtin.m
(because new back-ends needn't support profiling or tabling;
the warnings with `--warn-stubs' for those would be just noise.)
library/array.m:
Provide C# code for the (in, array_uo) mode of array__copy/2,
by copying the code for the (array_ui, array_uo) mode.
library/math.m:
Provide Mercury implementations of some of the math functions.
Estimated hours taken: 20
Branches: main
The tag bootstrap_20020613_intermod can be used to get a compiler which
compiles this change.
configure.in:
Test that the option --bug-intermod-2002-06-13 exists. This signifies
that the a bug in intermodule optimization for predicates which are
defined as both mercury and foreign code clauses.
library/array.m:
library/benchmarking.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/deconstruct.m:
library/float.m:
library/gc.m:
library/int.m:
library/io.m:
library/library.m:
library/math.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/sparse_bitset.m:
library/std_util.m:
library/store.m:
library/table_builtin.m:
library/time.m:
library/type_desc.m:
Define a mercury version of every pragma foreign_proc.
Remove any foreign_procs which are not implemented yet.
Estimated hours taken: 0.2
Branches: main
library/*.m
Back out Pete's unreviewed change from yesterday.
It doesn't compile without a recent bug fix, but no
CVS tag was added.
Estimated hours taken: 16
Branches: main
Define a mercury version of every pragma foreign_proc, and remove any
foreign_procs which just throw an exception that the code is not implemented.
library/array.m:
library/benchmarking.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/deconstruct.m:
library/exception.m:
library/float.m:
library/gc.m:
library/int.m:
library/io.m:
library/library.m:
library/math.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/sparse_bitset.m:
library/std_util.m:
library/store.m:
library/string.m:
library/table_builtin.m:
library/time.m:
library/type_desc.m:
Define a mercury version of every pragma foreign_proc, and remove any
foreign_procs which just throw an exception that the code is not
implemented.