... and make {input,output}_stream synonyms for them, rather than vice versa.
library/io.m:
As above.
library/bitmap.m:
library/dir.m:
library/io.primitives_read.m:
library/io.stream_db.m:
library/io.text_read.m:
library/mercury_term_lexer.m:
library/stream.string_writer.m:
Conform to the change above.
tests/hard_coded/stream_string_writer_types.exp:
Expect the new type_ctor for text streams.
This reduces the size of io.m a bit. The other reason for moving the
code is to allow modules that occur in a dependency cycle with io.m
to read results from io.error_util.trans_opt, whereas they may have
been prevented from reading io.trans_opt.
library/io.m:
library/io.error_util.m:
Move is_error, throw_on_error and other similar predicates to a
new undocumented submodule of io.m.
Also move the support functions/predicates used by those predicates.
Make io.make_io_error_from_system_error and
io.make_io_error_from_windows_error call the implementations in
io.error_util.m.
library/MODULES_UNDOC:
library/library.m:
List the new submodule as undocumented.
library/benchmarking.m:
library/bitmap.m:
library/dir.m:
library/io.call_system.m:
library/io.file.m:
Import the new submodule.
library/io.m:
Move make_io_error_from_system_error to public interface.
Add make_io_error_from_windows_error.
Rename is_maybe_win32_error to is_error_maybe_win32.
Make it take an argument to indicate whether the error is a Win32
error code.
Make make_io_error_from_maybe_win32_error (an internal predicate)
take an argument to indicate whether the error is a Win32
error code.
library/dir.m:
Conform to changes.
NEWS:
Announce recent system error related changes.
Make the following improvements to dir.m for Java and C#.
The changes to throwing more specific exception types is because
the exception objects can now be inspected by the user through io.m.
make_directory [C#]:
Delete redundant check for an existing file of the same name
as the directory to be created.
make_directory [Java]:
Throw more specific exception.
Capitalise first letter in error messages.
make_single_directory [C#]:
make_single_directory [Java]:
Delete redundant check for an existing file of the same name
as the directory to be created.
Delete unnecessary check for attempt create root directory.
Throw more specific exceptions and improve error messages.
open [Java]:
Throw more specific exception.
Implement the error handling proposals from February 2022 on the
mercury-users list, and August 2022 on the mercury-reviews list.
We add io.system_error to the public interface of io.m
and document what its foreign representation is for each backend.
We allow io.error to optionally contain an io.system_error value,
and provide predicates to retrieve the io.system_error from an io.error.
The user may then inspect the system error via foreign code.
We also provide a predicate that takes an io.error and returns a name
for the system error it contains (if any). This makes it relatively easy
for Mercury programs to check for specific error conditions.
By returning platform-specific (actually, implementation-dependent)
error names, we are pushing the responsibility of mapping strings to
error conditions onto the application programmer. On the other hand, it
is not practical for us to map all possible system-specific error codes
to some common set of values. We could do it for a small set of common
error codes/exceptions, perhaps.
The standard library will construct io.error values containing
io.system_errors. However, we do not yet provide a facility for user
code to do the same.
library/io.m:
Move io.system_error to the public interface.
Change the internal representation of io.error to support containing
a io.system_error. An io.system_error may originate from an errno
value or a Windows system error code; the constructor distinguishes
those cases.
Add predicates to retrieve a system_error from io.error.
Add predicate to return the name of the system error in an io.error.
Replace make_err_msg with make_io_error_from_system_error.
Replace make_maybe_win32_err_msg with
make_io_error_from_maybe_win32_error.
Delete ML_make_err_msg and ML_make_win32_err_msg macros.
browser/listing.m:
library/bitmap.m:
library/dir.m:
library/io.call_system.m:
library/io.environment.m:
library/io.file.m:
library/io.text_read.m:
mdbcomp/program_representation.m:
Conform to changes.
Leave comments for followup work.
tools/generate_errno_name:
tools/generate_windows_error_name:
Add scripts to generate mercury_errno_name.c and
mercury_windows_error_name.c.
runtime/Mmakefile:
runtime/mercury_errno_name.c:
runtime/mercury_errno_name.h:
runtime/mercury_windows_error_name.c:
runtime/mercury_windows_error_name.h:
Add MR_errno_name() and MR_win32_error_name() functions,
used by io.m to convert error codes to string names.
tests/hard_coded/null_char.exp:
Update expected output.
library/io.file.m:
library/io.m:
Move two sections of io.m, the "file handling predicates" section
and the "handling temporary files" section to the new submodule io.file.m.
Leave behind in io.m "forwarding predicates", predicates that do nothing
except call the moved predicates in io.file.m, to provide backward
compatibility. But do mark the forwarding predicates as obsolete,
to tell people to update their (at their leisure, since the obsoleteness
warning can be turned off).
Also leave behind in io.m the definitions of the two types used
by some parameters of some of the moved predicates. Document the reason
why this is done.
library/MODULES_DOC:
List the new module among the documented modules.
NEWS:
Announce the changes.
browser/browse.m:
browser/interactive_query.m:
browser/listing.m:
compiler/analysis.file.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_util.m:
compiler/handle_options.m:
compiler/make.build.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/parse_module.m:
compiler/passes_aux.m:
compiler/prog_event.m:
compiler/recompilation.check.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
library/dir.m:
mdbcomp/program_representation.m:
ssdb/ssdb.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
In two modules, add a #include of fcntl.h in C code. These modules contain
C code that needs this #include, but until now, they got it via a copy
in an automatically generated C header file of a foreign_decl pragma
in io.m that contained that #include. This diff moves that foreign_decl
to io.file.m, removing that crutch.
tests/debugger/browser_test.m:
tests/hard_coded/bit_buffer_test.m:
tests/hard_coded/bitmap_test.m:
tests/hard_coded/construct_bug.m:
tests/hard_coded/dir_fold.m:
tests/hard_coded/dir_test.m:
tests/hard_coded/read_binary_int16.m:
tests/hard_coded/read_binary_int32.m:
tests/hard_coded/read_binary_int64.m:
tests/hard_coded/read_binary_uint16.m:
tests/hard_coded/read_binary_uint32.m:
tests/hard_coded/read_binary_uint64.m:
tests/hard_coded/read_bitmap_size.m:
tests/hard_coded/remove_file.m:
tests/hard_coded/write_binary.m:
tests/hard_coded/write_binary_int8.m:
tests/hard_coded/write_binary_multibyte_int.m:
tests/hard_coded/write_binary_uint8.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
In the Mercury standard library, every exported predicate or function
has (or at least *should* have) a comment that documents it, including
the meanings of its arguments. About 35-40% of these modules put `'s
(left and right quotes) around the names of the variable representing
those arguments. Some tried to do it consistently (though there were spots
with unquoted or half quoted names), while some did it only a few places.
This is inconsistent: we should either do it everywhere, or nowhere.
This diff makes it nowhere, because
- this is what the majority of the standard library modules do;
- this is what virtually all of the modules in the compiler, profiler,
deep_profiler etc directories do;
- typing all those quotes when adding new predicates in modules that
follow this convention is a pain in the ass; and because
- on many modern terminals, `' looks non-symmetrical and weird.
Likewise, the comment explaining a predicate often started with
% `predname(arguments)' returns ...
This diff deletes these quotes as well, since they add nothing useful.
This diff does leave in place quotes around code fragments, both terms
and goals, where this helps delineate the boundaries of that fragment.
library/dir.m:
Add a new predicate general_foldl2. Unlike foldl2 and recursive_foldl2,
this predicate can be asked to keep going after finding errors,
in which case it will return a structured description of those errors.
To make this possible, generalize the infrastructure shared by foldl2,
recursive_foldl2 and now general_foldl2.
NEWS:
Announce the new predicate.
compiler/module_cmds.m:
Use the new predicate instead of recursive_foldl2 when looking for
.class files to build Java archives from. Doing so means that when
e.g. bootcheck runs several test cases at the same time in the same
directory, the traversal in one test case will NOT stop when a different
test case deletes one of its .class files between the time the first test
case has read a directory, and the time it gets around to processing those
entries. Instead, general_foldl2 will simply return an error description
in each such case. If an error description is for a file that is not
relevant to the current test case, we will now ignore it.
This should eliminate many spurious test case failures in Java grades
that were caused by such interference between test cases. Unfortunately,
spurious test failures still happen for other reasons :-(
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.
The result returned by strerror() may be locale dependent. Treating it as a
constant function as the standard library currently does is incorrect. Fix
this by requiring all access to strerror() (or its Windows equivalent) to be
made via the I/O state.
library/io.m:
Change predicates that access strerror() to take an I/O state pair.
library/dir.m:
Conform to the above change.
Delete unnecessary module qualification.
mdbcomp/program_representation.m:
Conform to the above change.
library/dir.m:
As above, previously this just threw a string on a brace mismatch.
tests/hard_coded/brace.m:
Replace the use of '__' as a module qualifier.
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.
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.
library/bimap.m:
library/bitmap.m:
library/calendar.m:
library/char.m:
library/cord.m:
library/deconstruct.m:
library/diet.m:
library/dir.m:
library/eqvclass.m:
library/map.m:
library/pprint.m:
library/pqueue.m:
library/stream.string_writer.m:
library/term_conversion.m:
library/time.m:
library/type_desc.m:
library/version_array.m:
library/version_array2d.m:
library/version_bitmap.m:
library/version_hash_table.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most of these modules, either the order of the declarations
or the order of the definitions made sense, and I changed the other
to match. In a few modules, neither made sense, so I changed *both*
to an order that *does* make sense (i.e. it has related predicates
together).
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style, give some auxiliary
(non-exported) predicates better names, or delete some unneeded module
qualifications.
In some places, have the function form of a procedure forward
the work to the predicate form, instead of vice versa, where this is
more natural (usually because it allows the use of state variables).
However, this is the only kind of "algorithmic" change in this diff;
the rest is just moving code around.
library/dir.m:
Account for the difference between opendir and FindFirstFile APIs
(i.e. FindFirstFile returns the first entry immediately) in the
dir.stream abstraction. Simplify the Mercury code that uses it.
Make Erlang dir.stream be a handle type like other backends, freeing
the Mercury code from threading !Dir around.
Move logic from foreign procs to Mercury code.
Improve error messages from Java `dir.open'.
Keep header includes and type definitions from leaking into .mh
files. Fixes Mantis bug #346.
Delete obsolete code.
library/io.m:
Note that io.system_error sometimes takes on Win32 error values.
Remove I/O state arguments on `make_err_msg' and
`make_maybe_win32_err_msg'.
Remove `was_error' argument from `ML_maybe_make_err_msg' and
`ML_maybe_make_win32_err_msg' macros, and rename the macros.
Simplify the macros using `MR_allocate_aligned_string_msg' instead of
`MR_offset_incr_hp_atomic_msg'.
Add `is_maybe_win32_error'.
Write `is_error' and `is_maybe_win32_error' in terms of `make_err_msg'
and `make_maybe_win32_err_msg'.
Add `thread_safe' attributes to some `make_err_msg' implementations.
Delete obsolete foreign exported predicates.
library/dir.m:
Simplify `current_directory' implementations. Avoid calling back
into Mercury from foreign code.
Separate out a code path `make_directory_including_parents' from
`make_directory', for C# and Java backends to override instead of
overriding `make_directory' directly. Avoid calling back into Mercury
from foreign code.
Delete the Erlang override of `make_directory'; just use the generic
implementation.
Simplify `make_single_directory'. Avoid calling back into Mercury
from foreign code.
Reduce use of bare ints between Mercury and foreign procs.
Fix `read_entry' using outdated Dir0 variable instead of Dir.
Catch exceptions in Java `read_entry_2'.
Delete many obsolete foreign exported predicates.
mdbcomp/program_representation.m:
Conform to change.
fixup read_entry
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.
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.
The directory stream was not closed if dir.open succeeded in opening
the directory, but failing to read the first entry (which may be as
simple as an empty directory).
The directory stream was also not closed when dir.foldl2_process_dir2
returns an error value.
library/dir.m:
As above.
tests/hard_coded/Mmakefile:
tests/hard_coded/dir_fold.exp:
tests/hard_coded/dir_fold.m:
Add regression test.
NEWS:
Announce change.
Branches: main, 12.08
Fix errors checking for a trailing slash in dir./ and
dir.is_dotnet_root_directory which would throw an exception if the
last codepoint in the tested path consists of multiple code units.
This fixes bug #269.
library/dir.m:
As above.
Branches: main
Remove deprecated modules and (most) deprecated procedures from the standard
library. (The remaining deprecated procedures probably need to stick around
for at least another release in order to give people time to adapt their code.)
library/dir.m:
library/list.m:
library/stack.m:
library/string.m:
library/type_desc.m:
Delete obsolete procedures.
library/svarray.m:
library/svbag.m:
library/svbimap.m:
library/sveqvclass.m:
library/svmap.m:
library/svmulti_map.m:
library/svqueue.m:
library/svset.m:
library/svvarset.m:
Delete these modules, they are no longer required since the
original predicates now have their arguments in the state-variable
friendly order.
library/library.m:
Delete the above modules.
compiler/frameopt.m:
compiler/par_loop_control.m:
compiler/rbmm.region_transformation.m:
browser/browser_test.m:
extras/windows_installer_generator/wix_gui.m:
samples/ultra_sub.m:
tests/hard_coded/rnd.m:
tests/hard_coded/type_spec_ho_term.m:
tests/hard_coded/xmlable_test.m:
Conform to the above changes.
Branches: main, 11.07
Support Unicode file paths and environments on Windows with C back-ends.
This works by calling the wide-character versions of functions,
e.g. _wfopen instead of fopen. To do so we have to convert between the
internal string representation (UTF-8) and that used by the Windows API
(UTF-16).
library/io.m:
Add functions to convert between the string representations.
Call Unicode-aware Windows functions in io.open_input, etc.
Call Unicode-aware functions in io.file_modification_time,
io.file_type, io.check_file_accessibility, io.file_id, io.make_temp,
io.remove_file, io.rename_file.
Call Unicode-aware function in io.call_system.
Call Unicode-aware functions in io.get_environment_var,
io.set_environment_var.
library/dir.m:
Call Unicode-aware functions in dir.current_directory,
dir.make_single_directory and fold predicates.
Branches: main, 11.07
Avoid problems with the inclusion of windows.h in the runtime and a few
standard library modules. By default, windows.h includes a lot of other
header files, some of which conflict with other parts of the Windows API.
Such a conflict occurs with G12 tcp module where the inclusion of winsock2.h
conflicts with the inclusion of winsock.h by windows.h. We can avoid this by
defining the macro WIN32_LEAN_AND_MEAN. It causes winsock.h and some other
headers not to be included by windows.h. (Should the other headers actually be
required -- the Mercury runtime and standard library do not require them --
then they will need to be included separately.)
To make this (and other workarounds for silly things in windows.h) possible
this change adds wrapper header for windows.h to the runtime. We now use
this wrapper header throughout the rest of the system rather than including
windows.h directly.
runtime/mercury_windows.h:
Add a wrapper around windows.h that allows us to control
how windows.h is included in a consistent manner.
Define WIN32_LEAN_AND_MEAN in order to avoid problems
with code that uses winsock2.h.
runtime/Mmakefile:
Include the new header.
runtime/mercury_memory.c:
runtime/mercury_memory_handlers.h
runtime/mercury_memory_zones.c:
runtime/mercury_timing.c:
library/dir.m:
library/io.m:
library/time.m:
Include mercury_windows.h rather than directly including
windows.h.
Branches: main, 11.07 (maybe)
Avoid warnings from MSVC concerning assignments from uninitialized variables.
These assignments arise due to the assignment of the initial I/O state to the
final I/O state in foreign_proc bodies. In low-level C grades this leads to
code like the following:
{
MR_Word IO0;
MR_Word IO;
...
IO = IO0;
}
Even though IO is itself unused, MSVC still emits a warning about the
assignment (many hundreds of warnings when the io module is opt-imported).
To avoid this, use don't-care variables for the I/O state in foreign procs
and don't include references to the I/O state in their bodies at all.
(We already did this in some places but not others.)
library/benchmarking.m:
library/dir.m:
library/io.m:
library/par_builtin.m:
library/stm_builtin.m:
library/thread.semaphore.m:
library/time.m:
compiler/make.util.m:
compiler/process_util.m:
Make the above change.
Delete the MR_update_io macro that is defined in a couple of spots.
library/io.m:
Unrelated change: s/MR_CONSERVATIVE_GC/MR_BOEHM_GC/ in a spot
since the former does not imply the later and the code that is
protecting is Boehm GC specific.
tests/debugger/poly_io_retry2.m:
Conform the the above change.
Branches: main
Implement a new form of memory profiling, which tells the user what memory
is being retained during a program run. This is done by allocating an extra
word before each cell, which is used to "attribute" the cell to an
allocation site. The attribution, or "allocation id", is an address to an
MR_AllocSiteInfo structure generated by the Mercury compiler, giving the
procedure, filename and line number of the allocation, and the type
constructor and arity of the cell that it allocates.
The user must manually instrument the program with calls to
`benchmarking.report_memory_attribution', which forces a GC and summarises
the live objects on the heap using the attributions. The mprof tool is
extended with a new mode to parse and present that data.
Objects which are unattributed (e.g. by hand-written C code which hasn't
been updated) are still accounted for, but show up in profiles as "unknown".
Currently this profiling mode only works in conjunction with the Boehm
garbage collector, though in principle it can work with any memory allocator
for which we can access a list of the live objects. Since term size
profiling relies on the same technique of using an extra word per memory
cell, the two profiling modes are incompatible.
The output from `mprof -s' looks like this:
------ [1] some label ------
cells words cumul procedure / type (location)
14150 38872 total
* 1949/ 13.8% 4872/ 12.5% 12.5% <predicate `parser.parse_rest/7' mode 0>
975/ 6.9% 1950/ 5.0% list.list/1 (parser.m:502)
487/ 3.4% 1948/ 5.0% term.term/1 (parser.m:501)
487/ 3.4% 974/ 2.5% term.const/0 (parser.m:501)
* 1424/ 10.1% 4272/ 11.0% 23.5% <predicate `parser.parse_simple_term_2/6' mode 0>
708/ 5.0% 2832/ 7.3% term.term/1 (parser.m:643)
708/ 5.0% 1416/ 3.6% term.const/0 (parser.m:643)
...
boehm_gc/alloc.c:
boehm_gc/include/gc.h:
boehm_gc/misc.c:
boehm_gc/reclaim.c:
Add a callback function to be called for every live object after a GC.
Add a function to write out the GC_size_map array.
compiler/layout.m:
Define the alloc_site_info type which is equivalent to the
MR_AllocSiteInfo C structure.
Add alloc_site_array as a kind of "layout" array.
compiler/llds.m:
Add allocation sites to `cfile' structure.
Replace TypeMsg argument (which was also for profiling) on `incr_hp'
instructions by an allocation site identifier.
Add a new foreign_proc_component for allocation site ids.
compiler/code_info.m:
compiler/global_data.m:
compiler/proc_gen.m:
Keep the set of allocation sites in the code_info and global_data
structures.
compiler/unify_gen.m:
Add allocation sites to LLDS allocation instructions.
compiler/layout_out.m:
compiler/llds_out_file.m:
compiler/llds_out_instr.m:
Output MR_AllocSiteInfo arrays in generated C files.
Output code to register the MR_AllocSiteInfo array with the Mercury
runtime.
Output allocation site ids for memory allocation instructions.
compiler/llds_out_util.m:
Add allocation sites to llds_out_info.
compiler/pragma_c_gen.m:
compiler/ml_foreign_proc_gen.m:
Generate a macro MR_ALLOC_ID which resolves to an allocation site
structure, for every foreign_proc whose C code contains the string
"MR_ALLOC_ID". This is to be used by hand-written C code which
allocates memory.
MR_PROC_LABELs are retained for backwards compatibility. Though
they were introduced for profiling, they seem to have been co-opted
for printf-debugging since then.
compiler/ml_global_data.m:
Add allocation site structures to the MLDS global data.
compiler/mlds.m:
compiler/ml_unify_gen.m:
Add allocation site id to `new_object' instruction.
compiler/mlds_to_c.m:
Output allocation site arrays and allocation ids in high-level C code.
Output a call to register the allocation site array with the Mercury
runtime.
Delete an unused predicate.
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/mercury_compile_llds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_util.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/use_local_vars.m:
compiler/var_locn.m:
Conform to changes.
compiler/pickle.m:
compiler/prog_event.m:
compiler/timestamp.m:
Conform to changes in memory allocation macros.
library/benchmarking.m:
Add the `report_memory_attribution' instrumentation predicates.
Conform to changes to MR_memprof_record.
library/array.m:
library/bit_buffer.m:
library/bitmap.m:
library/construct.m:
library/deconstruct.m:
library/dir.m:
library/io.m:
library/mutvar.m:
library/store.m:
library/string.m:
library/thread.semaphore.m:
library/version_array.m:
Use attributed memory allocation throughout the standard library so
that objects don't show up in the memory profile as "unknown".
Replace MR_PROC_LABEL by MR_ALLOC_ID.
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
Replace MR_PROC_LABEL by MR_ALLOC_ID.
profiler/Mercury.options:
profiler/globals.m:
profiler/mercury_profile.m:
profiler/options.m:
profiler/output.m:
profiler/snapshots.m:
Add a new mode to `mprof' to parse and present the data from
`Prof.Snapshots' files.
Add options for the new profiling mode.
profiler/process_file.m:
Fix a typo.
runtime/mercury_conf_param.h:
#define MR_MPROF_PROFILE_MEMORY_ATTRIBUTION if memory profiling
is enabled and we are using Boehm GC.
runtime/mercury.h:
Make MR_new_object take an allocation id argument.
Conform to changes in memory allocation macros.
runtime/mercury_memory.c:
runtime/mercury_memory.h:
runtime/mercury_types.h:
Define MR_AllocSiteInfo.
Add memory allocation functions and macros which take into the
account the additional word necessary for the new profiling mode.
These should be used in preferences to the raw memory allocation
functions wherever possible so that objects do not show up in the
profile as "unknown".
Add analogues of realloc/free which take into account the offset
introduced by the attribution word.
Add function versions of the MR_new_object macros, which can't be
written in standard C. They are only used when necessary.
Add built-in allocation site ids, to be used in the runtime and
other hand-written code when context-specific ids are unavailable.
runtime/mercury_heap.h:
Make MR_tag_offset_incr_hp_msg and MR_tag_offset_incr_hp_atomic_msg
allocate an extra word when memory attribution is desired, and store
the allocation id there.
Similarly for MR_create{1,2,3}_msg.
Replace proclabel arguments in allocation macros by alloc_id
arguments.
Replace MR_hp_alloc_atomic by MR_hp_alloc_atomic_msg. It was only
used for boxing floats.
Conform to change to MR_new_object macro.
runtime/mercury_bootstrap.h:
Delete obsolete macro hp_alloc_atomic.
runtime/mercury_heap_profile.c:
runtime/mercury_heap_profile.h:
Add the code to summarise the live objects on the Boehm GC heap and
writes out the data to `Prof.Snapshots', for display by mprof.
Don't store the procedure name in MR_memprof_record: the procedure
address is enough and faster to compare.
runtime/mercury_prof.c:
Finish and close the `Prof.Snapshots' file when the program
terminates.
Conform to changes in MR_memprof_record.
runtime/mercury_misc.h:
Add a macro to expand to the name of the allocation sites array
in LLDS grades.
runtime/mercury_bitmap.c:
runtime/mercury_bitmap.h:
Pass allocation id through bitmap allocation functions.
Delete unused function MR_string_to_bitmap.
runtime/mercury_string.h:
Add MR_make_aligned_string_copy_msg.
Make string allocation macros take allocation id arguments.
runtime/mercury.c:
runtime/mercury_array_macros.h:
runtime/mercury_context.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_dlist.c:
runtime/mercury_engine.c:
runtime/mercury_float.h:
runtime/mercury_hash_table.c:
runtime/mercury_ho_call.c:
runtime/mercury_label.c:
runtime/mercury_prof_mem.c:
runtime/mercury_stacks.c:
runtime/mercury_stm.c:
runtime/mercury_string.c:
runtime/mercury_thread.c:
runtime/mercury_trace_base.c:
runtime/mercury_trail.c:
runtime/mercury_type_desc.c:
runtime/mercury_type_info.c:
runtime/mercury_wsdeque.c:
Use attributed memory allocation throughout the runtime so that
objects don't show up in the profile as "unknown".
runtime/mercury_memory_zones.c:
Attribute memory zones to the Mercury runtime.
runtime/mercury_tabling.c:
runtime/mercury_tabling.h:
Use attributed memory allocation macros for tabling structures.
Delete unused MR_table_realloc_* and MR_table_copy_bytes macros.
runtime/mercury_deep_copy_body.h:
Try to retain the original attribution word when copying values.
runtime/mercury_ml_expand_body.h:
Conform to changes in memory allocation macros.
runtime/mercury_tags.h:
Replace proclabel arguments by alloc_id arguments in allocation macros.
runtime/mercury_wrapper.c:
If memory attribution is enabled, tell Boehm GC that pointers may be
displaced by an extra word.
trace/mercury_trace.c:
trace/mercury_trace_tables.c:
Conform to changes in memory allocation macros.
extras/net/tcp.m:
extras/solver_types/library/any_array.m:
extras/trailed_update/tr_array.m:
Conform to changes in memory allocation macros.
doc/user_guide.texi:
Document the new profiling mode.
doc/reference_manual.texi:
Update a commented out example.
Branches: main
Change the argument order of predicates in the set_bbbtree, set_ordlist, and
set_unordlist modules to (1) make them conducive to the use of state variable
notation and (2) make them consistent with the other modules that implement the
set ADT.
This change will break existing code that uses these modules, but such uses
should (and if Mercury and G12 are anything to go by, are) quite rare.
Group function clauses together with the clauses for the corresponding
predicates.
library/set_bbbtree.m:
library/set_ordlist.m:
library/set_unordlist.m:
As above.
Reorder the clauses in the set_ordlist module as the existing
order corresponds in no way to the order of declarations in
the module interface.
library/set.m:
tests/general/set_test.m:
Conform to the above changes.
library/dir.m:
Group predicate and function clauses together.
NEWS:
Announce the above changes.
Branches: main
Mark procedures whose names use the suffix "_det" to indicate that the procedure
is a det version of a semidet procedure of the same name (modulo the suffix) as
obsolete. The versions that use "det_" as a prefix should be used instead.
(The latter naming scheme is the one in general use throughout the standard
library.)
library/dir.m:
library/list.m:
library/stack.m:
As above.
Add versions with the "det_" suffix where they were not already
present.
Group function definitions together with the corresponding
predicate definition.
library/cord.m:
library/erlang_rtti_implementation.m:
library/io.m:
library/string.m:
compiler/*.m:
browser/declarative_execution.m:
browser/declarative_tree.m:
ssdb/ssdb.m:
Conform to the above changes.
library/Mercury.options:
Delete a setting for a deleted module.
NEWS:
Announce this change.
Branches: main
compiler/mlds_to_cs.m:
Output #pragmas to disable warnings for C# we generate.
Restore warnings for handwritten code.
library/Mmakefile:
Delete an unnecessary line.
library/array.m:
library/dir.m:
library/io.m:
library/thread.m:
library/version_array.m:
ssdb/ssdb.m:
Make some of the remaining warnings from the C# compiler go away.
Branches: main
library/io.m:
Always use UTF-8 encoding without byte-order marks, for text streams.
Do not use `System.Encoding.Default', which could be an 8-bit character
encoding or UTF-8 with BOM.
Rename `ML_file_encoding_kind' to `ML_line_ending_kind'.
Delete unused predicate `io.write_bytes_2'.
library/rtti_implementation.m:
library/type_desc.m:
Implement comparison of pseudo_type_infos.
Implement deconstruction of foreign enums.
library/benchmarking.m:
Partially implement `report_stats' in C#, and make
`report_full_memory_stats' not abort.
library/string.m:
Make `c_pointer_to_string' handle null pointers in C#.
Implement C# version of `semidet_from_rev_char_list'.
library/thread.m:
Add C# implementations of `can_spawn' and `yield'.
library/dir.m:
Delete unneeded foreign_exports.
Branches: main
Add support for the `csharp' grade to `mmc --make', and make it possible to
install the `csharp' grade with `mmake install'.
Also some miscellaneous fixes.
configure.in:
Require a recent enough bootstrap compiler that recognises C# as a
language for `pragma foreign_type'.
Mmakefile:
Use `mmc --make' to install the standard library in csharp grade.
aclocal.m4:
Search for the Mono C# compiler `gmcs', which is required for generics
at this time. Prefer it over the DotGNU C# compiler, which I have not
tested.
Search for `mono'. If found, it will be used in shell scripts to
launch executables generated via the csharp backend.
Remove "MS_" prefixes on the variables MS_CSC and MS_ILASM, which are
not Microsoft-specific. More importantly, it should be less likely to
make the mistake of adding an extra underscore to CSCFLAGS and
ILASMFLAGS.
README.DotNet:
Conform to variable renamings.
compiler/compile_target_code.m:
Add new linked target types `csharp_executable', `java_launcher' and
`erlang_launcher', instead of overloading `executable'.
Link with `mer_std.dll' and other libraries when generating C#
executables. There is no `mer_rt.dll'.
Pass "/debug" to the C# compiler if `--target-debug' is set.
Create a shell script to launch the executable if necessary.
Delete an unused predicate `standard_library_directory_option'.
compiler/file_names.m:
`.cs' and `.cs_date' are grade-dependent.
compiler/handle_options.m:
Force `.exe' as the executable file extension in csharp grades.
Make the `erlang' grade component imply the same options as MLDS
grades.
compiler/make.m:
Classify executable target types based on the compilation target.
compiler/make.module_target.m:
Handle `mmc --grade csharp --make <target>.dll'.
compiler/make.program_target.m:
Install library DLLs in csharp grades.
Make clean targets remove files for csharp grades.
Conform to changes.
compiler/make.util.m:
Add a stub foreign type.
Conform to changes.
compiler/module_cmds.m:
Factor out code to generate the shell scripts which launch programs
compiled in Java, Erlang and C# grades.
compiler/options.m:
Add `cli_interpreter' option to remember the name of the program which
should be used to run CLI (.NET) programs.
Add C#-related options to the help message.
compiler/options_file.m:
Remove "MS_" prefixes on MS_ILASM_FLAGS and MS_CSC_FLAGS, and remove
the extra underscore before "FLAGS". In all uses of the variables,
they were spelt without the extra underscore.
doc/user_guide.texi:
Document options and file types related to the C# grade.
library/Mmakefile:
Pass `mercury_dotnet.cs' to the C# compiler when building the standard
library. Suppress some warnings.
Allow stubs in this directory for csharp grade.
Conform to variable renamings.
library/builtin.m:
Uncomment foreign language pragmas for C#.
Handle null values in C# implementation of `deep_copy'.
library/private_builtin.m:
library/string.m:
Compare strings by ordinals in C#, instead of culture-specific rules.
Although the latter is allowed according to the documentation, it is
likely to slower, and cause confusion when porting between backends.
Handle negative index in string.set_char.
library/rtti_implementation.m:
Uncomment foreign language pragmas for C#.
`System.Type.GetType' only searches the current executing assembly or
in mscorlib for a type. As we have to be able to find types in other
assemblies (e.g. mer_std.dll or user DLLs), explicitly search through
a list of assemblies.
library/thread.semaphore.m:
Uncomment foreign language pragmas for C#.
Fix missing class qualification.
library/array.m:
library/bitmap.m:
library/bool.m:
library/dir.m:
library/exception.m:
library/io.m:
library/mutvar.m:
library/par_builtin.m:
library/region_builtin.m:
library/store.m:
library/thread.m:
library/time.m:
library/univ.m:
library/version_array.m:
Uncomment foreign language pragmas for C#.
mdbcomp/rtti_access.m:
Add type and procedure stubs.
runtime/mercury_dotnet.cs.in:
Override `Equals(object)' methods in `TypeCtorInfo_Struct' and
`TypeInfo_Struct' classes. This requires we override `GetHashCode' as
well.
Handle nulls arguments to `Equals' methods as is the expected behaviour.
Override `ToString' in `TypeCtorInfo_Struct' to produce more useful
output during debugging.
scripts/Mercury.config.in:
Record the configured CLI_INTERPRETER and pass that to the compiler as
a flag.
Conform to variable renamings.
scripts/Mmake.vars.in:
Pass value of CSCFLAGS from Mmake through to `mmc --make'.
Conform to variable renamings.
scripts/Mercury.config.bootstrap.in:
scripts/Mmake.rules:
Conform to variable renaming.
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Canonicalise high-level code, high-level-data, C# target code to the
`csharp' grade.
Handle erlang grades like other grades.
scripts/prepare_install_dir.in:
Copy `.cs' files from the runtime directory when preparing an install
directory.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
trace/Mmakefile:
Do as other non-C grades in this directory.
Conform to variable renamings.
tests/hard_coded/foreign_enum_dummy.m:
tests/hard_coded/sub-modules/non_word_mutable.m:
tests/hard_coded/sub-modules/sm_exp_bug.m:
Make these tests work in C#.
tests/mmc_make/Mmakefile:
Update a regular expression to account for `mmc --make' writing
"Making rebuild.exe" on platforms where the .exe suffix is not normally
used.
tests/mmc_make/complex_test.exp2:
Add alternative output (minor difference in floating point precision).
tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
tests/general/structure_reuse/Mmakefile:
tests/hard_coded/Mmakefile:
tests/hard_coded/sub-modules/Mmakefile:
tests/par_conj/Mmakefile:
tests/stm/Mmakefile:
Disable some tests in the csharp grade.
tests/invalid/Mmakefile:
Disable some tests in the csharp grade.
Enable a test which should work in java grades.
tests/valid/Mmakefile:
Do as other non-C grades in this directory.
When testing the csharp grade in this directory, produce only the C#
target files for now.
tests/run_one_test:
Don't compress a failing test case executable when the executable is
actually only a shell script.
Branches: main
Improve the C# backend.
C# foreign types remain commented out so as not to force an upgrade of the
bootstrap compiler yet.
compiler/handle_options.m:
Enable static ground cells for C# backend.
compiler/ml_global_data.m:
Make fields of static vector structures have `public' access.
Local access doesn't make sense.
Use structs to hold vector common data in C#.
Conform to changes.
compiler/ml_proc_gen.m:
Enable use_common_cells on C#.
Conform to changes.
compiler/mlds.m:
Rename `finality' to `overridability'. The `final' keyword in Java
has multiple meanings, so avoid that word. Use the word `sealed'
to describe classes or virtual methods which cannot be overridden,
which is the keyword in C#.
compiler/ml_switch_gen.m:
Remember the types of mlconst_foreign constants. In the C# backend a
foreign enum value needs to be cast to the right type. For some
reason, there was a field already which could be used for this purpose
but was only ever set to mlds_native_int_type.
compiler/ml_type_gen.m:
Replace ml_gen_final_member_decl_flags with
ml_gen_const_member_decl_flags. Return flags with the `sealed' flag
unset, as that wouldn't make sense for member variables.
Remember the type in mlconst_foreign.
compiler/ml_unify_gen.m:
Remember the type in mlconst_foreign.
compiler/mlds_to_cs.m:
Support static data in C#.
Support foreign enumerations.
Use the `default(T)' operator to initialise certain types of variables,
particularly user-defined types, which the Mercury compiler may not
know enumeration defined in another module, i.e. a value type, which
cannot be initialised with `null'.
Remove the requirement to add mark foreign types which are of value
types with the "valuetype" prefix.
compiler/mlds_to_java.m:
Write out the `final' keyword when either the `sealed' or `const' flags
are set.
Conform to changes.
compiler/rtti_to_mlds.m:
RTTI data doesn't need the `sealed' flag set.
compiler/ml_code_util.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/ml_elim_nested.m:
Conform to changes.
library/builtin.m:
Export `comparison_result' to C# foreign code.
Fix `deep_copy' for arrays.
library/bitmap.m:
library/pretty_printer.m:
library/store.m:
library/version_array.m:
library/version_hash_table.m:
Implement these modules for C#.
library/io.m:
library/dir.m:
Implement `dir.current_directory' for C#.
library/exception.m:
Implement `catch_impl' for multi and nondet predicates.
library/rtti_implementation.m:
Implement `get_typeclass_info_from_term' for C#.
library/string.m:
Fix `string.set_char' for C#.
library/time.m:
Delete now-unnecessary "valuetype" prefix on foreign type.
library/type_desc.m:
Implement `make_type' for C#.
runtime/mercury_dotnet.cs.in:
Collapse equivalences when comparing TypeInfo_Structs for equality.
tests/hard_coded/Mmakefile:
Disable some tests in C# grade.
tests/hard_coded/ee_dummy.m:
tests/hard_coded/ee_valid_test.m:
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/exported_foreign_enum.m:
tests/hard_coded/export_test.m:
tests/hard_coded/external_unification_pred.m:
tests/hard_coded/float_gv.m:
tests/hard_coded/foreign_enum_dummy.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_name_mutable.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/hash_table_test.m:
tests/hard_coded/impure_init_and_final.m:
tests/hard_coded/intermod_poly_mode_2.m:
tests/hard_coded/loop_inv_test1.m:
tests/hard_coded/loop_inv_test.m:
tests/hard_coded/multimode.m:
tests/hard_coded/pragma_export.m:
tests/hard_coded/pragma_foreign_export.m:
tests/hard_coded/redoip_clobber.m:
tests/hard_coded/trace_goal_4.m:
tests/hard_coded/uc_export_enum.m:
tests/hard_coded/user_compare.m:
tests/hard_coded/write_xml.m:
Make these test cases work on C#.
tests/hard_coded/deep_copy.exp3:
tests/hard_coded/expand.exp3:
tests/hard_coded/float_reg.exp3:
Add expected results for C#.
tests/hard_coded/string_strip.exp2:
Update this result, which was not updated when the test case changed
previously.
Branches: main
Start a C# backend, adapted from mlds_to_java.m.
Some `pragma foreign_*' declarations are commented out in this change because
no bootstrap compiler will yet accept "C#" in the language specification.
The compiler already supported C# foreign_procs for the IL backend, but the IL
backend and this new backend do not agree on naming and calling conventions so
the changes to the existing C# foreign_procs will further break the IL backend.
Nobody cares.
Only tested so far with Mono on Linux.
compiler/mlds_to_cs.m:
New module. In the CVS Attic there exists an obsolete file named
mlds_to_csharp.m (replaced by mlds_to_managed.m) which we don't want to
conflict with.
For C# we need to know if a `pragma foreign_type' is a value or
reference type. Currently this is done by accepting a fake keyword
`valuetype' before the type name, like for IL.
compiler/ml_backend.m:
compiler/mercury_compile.m:
compiler/mercury_compile_mlds_back_end.m:
Hook up the C# backend.
compiler/globals.m:
Add `target_csharp' as a target language.
compiler/options.m:
Add `--csharp' and `--csharp-only' options and their synonyms.
compiler/handle_options.m:
Handle `target_csharp' like `target_java', except for features which
are still to be implemented.
compiler/add_pragma.m:
Allow C# as a `pragma foreign_export' language.
Allow C# for `pragma foreign_export_enum'.
Conform to changes.
compiler/hlds_data.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
Accept C# as a language for `pragma foreign_type'.
Accept `csharp' as the name of a grade in trace parameters.
compiler/make_hlds_passes.m:
Reuse most of the code for implementing mutables on Java for C#.
compiler/mlds.m:
Add a new MLDS target language, `ml_target_csharp'.
Conform to changes.
compiler/ml_foreign_proc_gen.m:
Generate foreign_procs for C#.
compiler/foreign.m:
Update predicates to support C# targets.
compiler/c_util.m:
Make `quote_string' use hexadecimal escapes in C# string literals.
compiler/parse_tree.m:
compiler/java_names.m:
Add C# equivalents for predicates in this module. `java_names' is a
misleading module name, but the predicates for C# and Java share some
code and may possibly be combined in the future.
compiler/rtti.m:
Add predicates to return the names of RTTI structures in C#.
compiler/simplify.m:
Handle the trace parameter `grade(csharp)'.
compiler/compile_target_code.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
Add some support for building of executables and libraries with
`--target csharp'.
compiler/ml_global_data.m:
compiler/ml_optimize.m:
compiler/ml_proc_gen.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/granularity.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/lambda.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_util.m:
compiler/ml_disj_gen.m:
compiler/mlds_to_c.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/modules.m:
compiler/pragma_c_gen.m:
compiler/prog_foreign.m:
compiler/special_pred.m:
compiler/write_deps_file.m:
Conform to changes.
library/builtin.m:
library/rtti_implementation.m:
library/type_desc.m:
Implement RTTI procedures for the new backend, which uses a high-level
data representation (like the Java backend). The existing C# code was
designed for the IL backend, which used a low-level representation of
the RTTI data structures.
Most (if not all) of the the "new" code is exactly the same as the Java
versions, with only syntactic changes.
Rename the C# class `void_0' to `Void_0' to match the naming convention
used by mlds_to_cs.m.
library/array.m:
Update the existing C# code to work with the new backend.
Use `object[]' as the type of all array of non-primitive types.
The problem is one we encountered on the Java backend: when creating a
new array based on the type of a single element, we don't know whether
the new array should contain elements of the class or superclass.
library/bool.m:
Export `bool' constants to C#.
library/exception.m:
Update the existing C# code to work with the new backend.
Move the `mercury.runtime.Exception' C# class to mercury_dotnet.cs.
library/float.m:
Add C# implementations of `is_nan' and `is_inf'.
library/list.m:
Add methods for manipulating lists from hand-written C# code.
library/string.m:
Add C# implementations of string procedures which were missing.
library/dir.m:
library/io.m:
library/library.m:
Update the existing C# code to work with the new backend.
library/private_builtin.m:
Update the existing C# code to work with the new backend.
Delete the static constants which are duplicated in mercury_dotnet.cs.
The mlds_to_cs.m will emit references to the constants in the latter
only.
library/backjump.m:
library/bitmap.m:
library/mutvar.m:
library/par_builtin.m:
library/region_builtin.m:
library/store.m:
library/thread.m:
library/thread.semaphore.m:
library/time.m:
library/univ.m:
Make these modules compile with the C# backend.
runtime/mercury_dotnet.cs.in:
Add RTTI classes to the `mercury.runtime' namespace, equivalent to
those on the Java backend.
Use enumerations `MR_TYPECTOR_REP_*' and `MR_SECTAG_*' constants so we
can switch on them.
Add the `UnreachableDefault' exception class.
Hide old classes which are unused with the new backend behind
#ifdef !MR_HIGHLEVEL_DATA.
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.
Branches: main
These changes allow `mmc --make' to work when built in the Java grade.
compiler/make.util.m:
Implement `get_real_milliseconds' for Java.
compiler/mercury_compile.m:
Report an error message if "mmc --arg-file" is called with extra
arguments, instead failing and reporting an non-obvious error message.
library/dir.m:
Allow `dir.foldl' to work in Java.
library/io.m:
Make `io.call_system' on Java run the command through "/bin/sh -c", to
mimic the behaviour on C backends (only if /bin/sh exists).
Branches: main
Some changes to the Java implementation of the standard library.
library/array.m:
Use System.arraycopy and java.util.Arrays.fill and avoid using
reflection to work with arrays in some places.
library/dir.m:
Implement dir.current_directory.
library/rtti_implementation.m:
Fix typos where expanded type_infos were not being used.
library/string.m:
Make string.c_pointer_to_string handle null pointers.
tests/hard_coded/sub-modules/Mmakefile:
Enable testing of java grade in this directory.
tests/hard_coded/sub-modules/non_word_mutable.m:
tests/hard_coded/sub-modules/sm_exp_bug.m:
Add Java foreign code.