Estimated hours taken: 0.5
Branches: main
library/Mmakefile:
Fix a typo which meant that everything was always getting
compiled with --allow-stubs --no-warn-stubs.
library/sparse_bitset.m:
Use pragma type_spec declarations for predicate foldr_2/4;
the previous patch to this file deleted them for function foldr_2/3,
but the right fix was to move them to the corresponding predicate.
Estimated hours taken: 0.5
Branches: main
Removed a function declaration from the sparse_bitset implementation.
library/sparse_bitset.m:
Removed the function declaration for sparse_bitset.foldr_2/3 from the
implementation, since the function is not called by anything and
causes a compile warning.
Estimated hours taken: 0.5
Branches: main
Implement functional forms of some library predicates.
library/relation.m:
Implement the following functions:
relation__lookup_key_set_from/2
relation__lookup_key_set_to/2
Estimated hours taken: 4
Branches: main
Implement some library procedures for the Java back end.
library/dir.m:
Updated the imports so interface includes string and io, and altered
style to that of one import per line.
Defined the dir__stream foreign_type as an java.util.Iterator.
Implemented the following procedures in Java:
dir__directory_separator/0
can_implement_make_directory/0
dir__make_single_directory_2/5
dir__open_2/4
dir__close_2/5
dir__read_entry_2/6
java/runtime/VA_PseudoTypeInfo_Struct8.java:
This new file is a workaround which allows dir.m to successfully
compile in grade Java.
Estimated hours taken: 0.5
Branches: main
Rename rational.inverse/1 to rational.reciprocal/1. Export rational.reciprocal
from the rational module. This is a little cleaner than having to take the
reciprocal of a number by dividing one by it.
NEWS:
Mention this change.
library/rational.m:
Rename rational.inverse/1 to rational.reciprocal/1.
Export this predicate from the rational module.
tests/hard_coded/rational_test.m:
Perform this test using the reciprocal function from the library.
Delete the definition of inverse that was here.
Estimated hours taken: 0.1
Branches: main
library/map.m:
Bring this module up to date with respect to our coding guidelines:
use predmode syntax where relevant. There are no changes in algorithms.
Estimated hours taken: 5
Branches: main
Implement some library procedures for the Java back end.
library/array.m:
Implement the following procedures:
bounds_checks/0
array__init_2/3
array__make_empty_array/1
array__min/2
array__max/2
array__size/2
array__unsafe_lookup/3
array__unsafe_set/4
array__resize/4
array__shrink_2/3
array__copy/2
Estimated hours taken: 1
library/parser.m:
Extended parser__parse_rest//5 to handle backquoted operators with
module qualifiers so that e.g. (A `set.union` B) will
parse successfully.
doc/reference_manual.texi:
Documented the new syntax.
tests/hard_coded/backquoted_qualified_ops.m:
tests/hard_coded/backquoted_qualified_ops.exp:
tests/hard_coded/Mmakefile:
Test case added.
Estimated hours taken: 1
Branches: main
More code cleanups for the integer module. This does not change
any algorithms.
library/integer.m:
Use distinct variable names. e.g X and Y rather than X1 and X2
Fix indentation so it adheres more closely to what is specified
in the coding standards.
While converting a list of digits to string call error/1 if something
goes wrong rather than appending "Woops" to the string.
Replace calls to int__to_float/2 with calls to float__float/1.
Fix an incorrect reference in an error message.
Estimated hours taken: 2
Branches: main
library/relation.m:
Fix a bug in my last change which broke the Aditi tests;
the output of tsort was in reverse order.
tests/hard_coded/relation_test.m:
Add some more test cases.
Estimated hours taken: 12
Branches: main
Fix performance bugs in library/relation.m which caused
`mmc --generate-dependencies' to choke on large programs
(e.g. the compiler).
`mmc --generate-dependencies top_level' now takes
about 8 seconds on jupiter, compared to over a minute
before.
library/relation.m:
Use sparse_bitset for sets of relation_keys.
Rewrite relation__compose to use the indexing
in the relation structure, rather than just
doing a naive nested loop join.
Clean up and fix a bug in relation__is_dag.
Rewrite algorithms to avoid using to_sorted_list
on sparse_bitsets of relation keys; this is not
a cheap operation as it is with set.sets.
Use sparse_bitset.fold{l,r} instead where
possible.
library/sparse_bitset.m:
Add new functions to_set and from_set,
which convert between sparse_bitsets
and set.sets.
Add predicate versions of foldl and foldr with
the same modes as the list version.
compiler/modules.m:
Use sparse_bitset.foldl rather than sparse_bitset.to_sorted_list
followed by list.map.
profiler/propagate.m:
relation__dfsrev now takes a sparse_bitset(relation_key),
not set_bbbtree(relation_key).
library/map.m:
library/tree234.m:
Type specialize map__det_update for term.var and int.
NEWS:
Document new predicates and functions.
tests/hard_coded/relation_test.{m,exp}:
Test relation__is_dag.
Estimated hours taken: 0.3
Branches: main
This diff makes varset.m easier to read and to maintain, but contains no
changes in algorithms whatsoever.
library/varset.m:
Use predmode declarations and state variable syntax when appropriate.
Add field names to the varset structure, and use them to improve
readability.
Estimated hours taken: 1.5
Branches: main
Got string__format working for Java.
library/string.m:
Implement the following procedures:
char_list_remove_suffix/3
char_list_equal/2
Replaced all calls to list__remove_suffix/3 with the more
specialized char_list_remove_suffix/3.
This allows (for example) string__format to succeed in grade Java,
even though Unification has not yet been implemented.
Estimated hours taken: 1.5
Branches: main
Add some functions to the integer and rational modules.
Clean up the code in these modules so it adheres more closely to
our current coding standards.
NEWS:
Mention these changes.
library/integer.m:
Shift the constant functions integer.zero/0 and integer.one/0
back into the interface. According to the log they were deleted
because they were not sufficiently useful. In my view they
the symbolic names are preferable to writing them as integer(1)
and integer(0).
Add a function version of integer.pow/3.
Shift a large comment that concerns implementation details and
possible improvements to the module from the interface into the
implementation.
(This avoids it being included in the library reference manual).
Various code cleanups, in particular fix spacing and
indentation throughout.
library/rational.m:
Add function rational/1 that converts an int to a rational and
function from_integer/1 that does the same with an integer.
For consistency with the above add a function from_integers/2 and
deprecate the version rational_from_integers/2.
Remove the functions izero and ione from the implementation and
just call integer.zero/0 and integer.one/0 now that they are
exported from the integer module again.
Various code cleanups.
Estimated hours taken: 8
Branches: main
Implemented some library functions for the time library in java.
library/time.m:
Foreign type "time_t_rep" implemented as instances of "java.util.Date".
Implemented the following predicates in java:
time__c_time/3
time__time_t_is_invalid/1
time__c_difftime/3
time__c_localtime/10
time__c_gmtime/10
time__c_mktime/10
Estimated hours taken: 0.25
Branches: main
Bug fix for Java implementation of string library.
library/string.m:
Fixed an off-by-one error in unsafe_substring/4. The right bound was
set one character too high, which was causing
StringIndexOutOfBoundsExceptions.
Estimated hours taken: 0.1
Branches: main
Just added a comment to explain exception handling of Double.parseDouble()
library/string.m:
Comment appears here:
string__to_float/2
Estimated hours taken: 7
Branches: main
Implemented some library functions for the string library in java.
library/string.m:
Implemented the following predicates in java:
using_sprintf/0
string__lowlevel_float_to_string/2
string__to_float/2
string__unsafe_set_char/4
string__unsafe_substring/4
Created error messages for the following predicates:
(they should never be called except by C implementation)
int_length_modifer/0
native_format_float/2
native_format_int/2
native_format_string/2
native_format_char/2
Estimatetimated hours taken: 0.5
Branches: main
Implemented some library functions for the char library in java.
library/char.m:
Implemented the following predicates in java:
char__to_int/2
char__max_char_value/1
Estimated hours taken: 0.5
Branches: main
Implemented some library functions for the int library in java.
library/int.m:
Implemented the following predicates in java:
int__to_float/2
int__max_int/1
int__min_int/1
int__bits_per_int/1
Estimated hours taken: 4
Branches: main
Implement some library functions for the Java back-end.
library/float.m:
Implement the following predicates for Java:
domain_checks/0
float__ceiling_to_int/2
float__floor_to_int/2
float__round_to_int/2
float__truncate_to_int/2
float__hash/2 <-- also C# now checks for negatives
is_nan/1
is_inf/1
The following constants are now hard-coded in mercury for both Java and
.NET, which is ok since both language specifications conform to the
IEEE standard for double precision 64 bit floats:
float__max/1 <-- Java API actually provided this one
float__min/1
float__epsilon/1
float__radix/1
float__mantissa_digits/1
float__min_exponent/1
float__max_exponent/1
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: 1
Branches: main
More work on the Java back-end: ensure that it builds properly
without needing manual tweaking of symlinks.
library/Mmakefile:
Ensure that we create appropriate symlinks for building
tools/bootcheck:
Like the "java" directory into the stage 2 and 3 directories,
so that the symlinks created by stage*/library/Mmakefile won't be
dangling.
Estimated hours taken: 0.25
Branches: main
library/map.m:
Fix an XXX: define map__inverse_search using map__member, rather
than by converting the map to an assoc list and searching that.
This is simpler, and should be more efficient, since it avoids
unnecessary heap allocation.
Estimated hours taken: 6
Branches: main
More work on the Java back-end. The standard library now compiles
in grade `java', and hello world (the version using io__write_string,
and linked against the standard library in library/*.m, not the
hand-coded one in java/library/*.java) now works!
compiler/make_hlds.m:
Ignore `pragma type_spec' declarations for the Java back-end.
This works around a problem where javac was failing to compile
some of our generated code due to it overflowing limits on
file name length for the names of the .class files for some
nested classes.
compiler/mlds_to_java.m:
Add some comments. Add myself to the "main authors" list.
library/string.m:
Provide Java definitions of string__first_char and
string__unsafe_index. (These are needed for string.append,
which is used by private_builtin.sorry.)
library/io.m:
Provide Java definitions of io__write_{string,int,char,float}/3.
java/runtime/TypeCtorInfo_Struct.java:
Fix a cut-and-paste error.
java/runtime/TypeInfo_Struct.java:
Improve the implementation of the TypeInfo_Struct(Object)
constructor so that it doesn't throw exceptions during
the initialization of the standard library.
java/runtime/FA_TypeInfo_Struct1.java:
Make this type inherit from TypeInfo_Struct.
Estimated hours taken: 0.1
Branches: main
library/rtti_implementation.m:
Swap the order of some C# statements in typeinfo_is_variable/2
so that the line which can cause an exception occurs first.
Estimated hours taken: 0.25
Branches: main
library/io.m:
Fix an XXX about implemting io__get_stream_id directly as a
function. It dates back from when we couldn't generate
functions in MC++, which I fixed over a year ago.
Estimated hours taken: 10
Branches: main
Bug fixes for the Java back-end.
The standard library now almost compiles in grade java.
compiler/mlds_to_java.m:
Output Java foreign declarations before any other code,
to fix a problem with references to the TYPE_CTOR_REP
constants in library/private_builtin.m.
Fix some bugs where we were not being consistent about mangling
the module name when naming the classes used to simulate taking
procedure addresses. This bug broke Java compilation of library/char.m.
Fix some bugs where the compiler was getting confused about
which types map to array types in Java.
For MLDS casts that cast to type_info or pseudo_type_info,
generate Java constructor calls, not Java casts.
This fixes type errors in the generated Java code.
Simplify the code for hand_defined_type.
compiler/rtti.m:
Fix a bug in tc_rtti_name_java_type: map typeclass_infos to
the Java type "java.lang.Object[]", not "java.lang.Integer[]".
The latter didn't work because the elements which hold the method
addresses do not have type java.lang.Integer.
java/runtime/DuExistInfo.java:
java/runtime/NotagFunctorDesc.java:
Define constructors for these types.
java/runtime/TypeInfo_Struct.java:
Define some additional constructors for this type.
library/builtin.m:
Provide Java stub definitions of
- classes for the types func/0 and c_pointer/0;
- unify/compare preds for func, c_pointer, tuple, and void;
Define Java definitions for the additional modes of compare/3
(they just call the first mode).
library/exception.m:
Define Java versions of make_io_state and consume_io_state,
and Java stubs for throw_impl and catch_impl.
Change try_all so that it calls catch_impl, like try does,
rather than calling builtin_catch directly. This is needed
since the .NET and Java back-ends only define catch_impl,
not builtin_catch.
library/io.m:
Provide Java `pragma foreign_type' declarations for the types
array.array(T) and io.system_error. This is needed to avoid
compilation errors when building in grade `java'.
library/private_builtin.m:
Delete the Java definition of the type_info for type_info/1,
because that is generated automatically now,
after petdr's recent bug fix.
Provide Java stubs definitions of the unify/compare preds
for ref/1, heap_pointer/0, type_ctor_info, type_info,
base_typeclass_info, and typeclass_info.
Provide Java definition of dummy_var.
library/type_desc.m:
Provide Java stub definitions of
- classes for type_desc/0 and type_ctor_desc/0
- unify/compare preds for those types
library/store.m:
Define unification and comparison predicates for the store(S)
type. This is needed because the automatically generated ones
might not have the right semantics, but also because the Java
back-end generates some invalid code for the automatically
generated unification and compare predicates (the generated
code has some invalid references to "dummy_var").
Estimated hours taken: 2
Branches: main
Library fixes for the Java back-end.
library/builtin.m:
Provide stub definition of tuple_0 class.
Delete hand-coded type_ctor_info definitions for int, string,
and character, since these are now generated by the compiler
automatically (thanks to Pete's changes for the IL backend).
library/private_builtin.m:
Delete definitions of builtin_compare_int and builtin_compare_string,
for same reason as above.
Provide stub definition of type_ctor_info for type_info/1.
Fix some bugs with the MR_TYPECTOR_REP definitions.
library/io.m:
Provide Java `pragma foreign_type' declarations for the types
array.array(T) and io.system_error. This is needed to avoid
compilation errors when building in grade `java'.
Estimated hours taken: 0.25
Branches: main
NEWS:
library/multi_map.m:
Add predicates multi_map.to_flat_assoc_list
and multi_map.from_flat_assoc_list, which use
assoc_lists containing one element per key-value
pair, not one element per key and all its values.
Estimated hours taken: 0.5
Branches: main
library/array.m:
library/io.m:
Provide Java `pragma foreign_type' declarations for the types
array.array(T) and io.system_error. This is needed to avoid
compilation errors when building in grade `java'.
Estimated hours taken: 4
Branches: main
Rather than declare the builtin types as abstract types in builtin.m
special case their handling in the compiler to ensure that the
special preds and the type_ctor_infos are generated when needed.
compiler/type_util.m:
Add a utility predicate which returns the list of type_ctors
which represent types which are special builtins (ie they have no type
declaration, even an abstract one).
compiler/make_hlds.m:
Add the special preds for the special builtins if we are generating
the rtti for the builtins.
compiler/type_ctor_info.m:
Add type_ctor_infos for the special builtins if we are generating
the rtti for the builtins.
compiler/typecheck.m:
The special predicates for the special builtins don't require
typechecking.
library/builtin.m:
Remove the special builtins as they are no longer needed for
generating the type_ctor_infos for a type.
Estimated hours taken: 0.1
Branches: main
library/builtin.m:
Comment out the abstract type definitions of the builtin types
as they cause duplicate function definitions in the grade asm_fast.gc.
Estimated hours taken: 36
Branches: main
Get the compiler to generate the type_ctor_infos for all the types
which were previously defined by hand.
This change completes the removal of all the MC++ from the compiler.
compiler/make_hlds.m:
Remove the builtin qualifier from the builtin types, before
processing them.
compiler/mlds_to_il.m:
Remove the special code which handled those type_ctor_infos
which where defined in MC++.
compiler/special_pred.m:
Add a routine compiler_generated_rtti_for_the_builtins which
returns if the compiler generates RTTI for builtin types, or
they are hand-coded. It returns true for the non-C backends.
Change can_generate_special_pred_clauses_for_type so that it
returns true for the builtin types whose body is defined in
Mercury in private_builtin.m.
compiler/type_ctor_info.m:
Generate a type_ctor_info for the builtin types if needed.
compiler/unify_proc.m:
Generate calls to unification and comparison predicates defined
in private_builtin.m.
library/Mmakefile:
library/builtin.m:
library/private_builtin.m:
library/type_desc.m:
Remove the final MC++ code and rename some of the code to use
the name which the Mercury compiler generates.
Estimated hours taken: 3
Branches: main
Convert the last of the code in the library from MC++ to C#.
However the RTTI datastructures for the builtin types are still defined
in MC++, for the moment.
compiler/mlds_to_il.m:
Change the mangling so that for the names that need mangling
that aren't RTTI types we look for them in the C# module.
library/builtin.m:
library/private_builtin.m:
library/type_desc.m:
Convert all the code from MC++ to C#, and mark that the
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO macros need to be rewritten in
Mercury.
Estimated hours taken: 1.5
Branches: main
Implement io__set_environment_variable in C#.
library/io.m:
Call mercury.runtime.PInovke._putenv to set the environment
variable.
runtime/mercury_dotnet.cs.in:
Use pinvoke to call the Posix function _putenv.
This is defined in the runtime, rather than io.m because at a
later date we will need to use configure to select the correct
putenv for different platforms.
Estimated hours taken: 1
Branches: main
Add pragma terminates declarations to exception.builtin_throw/1,
exception.throw/1 and require.error/1.
The point of this change is to try and reduce the number of cases of
possible non-termination being reported in the standard library due to
calls to require.error/1 or exception.throw/1.
Ideally we would only need provide a terminates declaration for
builtin_throw/1 but in practice the structure of the module dependency graph
means that error/1 is marked as non-terminating and certain calls to throw/1
are also considered to be non-terminating.
library/exception.m:
Add pragma terminates declaration for builtin_throw/1 and
throw/1.
library/require.m:
Add pragma terminates declaration for error/1.