This diff does not implement the option itself. The reason is that we want
to turn it off in library/LIB_FLAGS.in, and we can do that only when the
installed compiler knows about the option. This diff is therefore the first
step in the two-step bootstrapping process.
compiler/options.m:
Add a new option --warn-stdlib-shadowing, which, after the bootstrapping
step, will cause the compiler to warn about module names that could be
confused with the name of a module in the Mercury standard library.
Add a new option, --output-stdlib-modules, that tools/bootcheck can use
to test whether the compiler's list of Mercury standard library modules
is complete.
Rename the option name output_class_dir to output_java_class_dir
(internally only, leaving the user-visible name unchanged), to fit in
with the names of options related to C#, which have csharp in the name.
compiler/op_mode.m:
Add a new op_mode for --output-stdlib-modules.
compiler/mercury_compile_main.m:
Implement the new op_mode, using new code in library/library.m.
Simplify some existing code.
library/library.m:
Add an exported but undocumented predicate that mercury_compile_main.m
can use to
- find a list of all the Mercury standard library modules, and
- find out for each whether it is documented or not.
Reimplement the existing exported-but-undocumented predicate
in terms of the new one.
library/Mmakefile:
Add mmake targets that check whether the contents of MODULES_DOC and
MODULES_UNDOC match the output of mmc --output-stdlib-modules.
tools/bootcheck:
Use the new mmake targets to do that check.
library/Mmakefile:
Delete check to stop installation when LIBRARY_INTERMODULE=no is set.
Users are unlikely to set that by accident, and it is useful for
developers to be able to make test installations without incurring
the cost of generating .opt and especially .trans_opt files for every
little change to the library.
... using an approach proposed by Peter, with an extra twist from Julien.
Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.
The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.
Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.
library/getopt.m:
library/getopt_io.m:
Make the changes described above.
library/Mmakefile:
Instead of building both getopt_io.m and getopt.m from getopt_template,
build getopt.m from getopt_io.m.
tools/bootcheck:
Delete references to getopt_template.
compiler/typecheck_errors.m:
When a type error involves one of the getopt/getopt_io predicates
whose interfaces are changed by this diff, tell the user about
how these changes could have caused the error, and thus what the
probable fix is.
compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
Use the updated getopt interface.
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Replace references to getopt_io.m with references to getopt.m.
tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
New test cases for the extra help
tests/invalid/Mmakefile:
Enable the new test cases.
library/Mmakefile:
Ensure that getopt.m and getopt_io.m are built in freshly checked out
workspaces before starting making the dependencies.
Include getopt_template as a source file when building the tags file.
tools/bootcheck:
Copy getopt_template to the stage 2 and 3 libraries, to allow
the rule for ensuring the existence of the tags file to work.
compiler/notes/c_coding_standard.html:
Describe module header comments just once, not twice.
Expand on what may be in such comments.
Fix some oversights. For example, until now we didn't say that
a developer needs git (!), and we didn't say where the definitions,
as opposed to declarations, of any global variables exported from
a module should go.)
Improve the wording of several explanations.
Make some lists of things into item lists.
Expand tabs.
compiler/notes/glossary.html:
Describe what HLDS, LLDS and MLDS mean in more detail.
compiler/notes/overall_design.html:
Delete the reference to the long-deleted analysis directory.
compiler/notes/allocation.html:
compiler/notes/reviews.html:
compiler/notes/upgrade_boehm_gc.html:
Fix indentation.
This should prevent bit rot in its code, such as that caused by the
move of the one_or_more type from list.m to one_or_more.m.
Mmakefile:
Add grade_lib to the list of directories to build, to the list of
directories in which dependencies are made, the list of directories
in which tags files are made, and the list of directories to clean.
Do not include the grade library in source distributions. In the
intended use case, the grade library modules that the compiler needs
will be present in the source distribution in the *compiler* directory.
Add mfilterjavac to the list of directories for tags files; its former
absence was an oversight.
Fix inconsistent indentation.
tools/bootcheck:
Build the grade library during stages 2 and 3. Compare its stage 2 and 3
versions as we do for other directories.
Put the commands that create stages 2 and 3 into recognizable blocks.
grade_lib/Mmakefile:
Add the targets needed by either by bootcheck or by the top level
Mmakefile.
Document the intended usage of the grade library.
grade_lib/.mgnuc_copts:
grade_lib/.mgnuc_opts:
Use the same .mgnu_*opts files as e.g. the profiler directory.
The common command sequence used by bootcheck to build the
stage 2 and 3 directories assumes their presence.
library/Mmakefile:
Make it clear that some rules previously separated by dividing lines
are actually related.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.
However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.
browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
When creating stage 3, the bootcheck builds, in each directory,
only the files that it wants to compare against their stage 2 versions.
This means that it wants to build all the .c, .cs or .java files,
which it does via the cs, css and javas mmake targets.
The correct definitions of the rules of these targets depends on
whether mmc --make is being used or not, so we need at least two
sets of definitions: one for mmc --make, and for no mmc --make,
and conditionally selecting the appropriate one. The latter definition
has the problem that it refers to mmake variables that are intended
to be defined in .dv files created by mmc --generate-dependencies,
but until that has been run, those mmake variables are undefined.
Until now, the only directories that had both the mmc --make
and the no mmc --make definitions were the ones needed to build
the compiler. Bootchecks in the csharp and java grades, which
always use --make make, got errors when they tried to build
the directories that bootcheck builds after the compiler:
the slice, profiler, deep_prof and mfilterjavac directories.
This diff ensures that all directories we build in bootcheck
get all both versions of the os, cs, css, and javas targets.
In fact, they get two subversions of the no mmc --make version:
one for use in the presence of .dv files, and one for use in their
absence. The latter just builds the .dv files and invokes mmake
again. This avoids one source of warnings about undefined mmake
variables.
To avoid another source, make the rules for tags files and their
proxies depends on *.m instead of mmake variables such as $(mcov.ms),
since this makes sense even before making dependencies. The only price
is that any untracked Mercury source files in the directory have to
either be given some other suffix, or moved somewhere else.
Where relevant, make the mtags invocation prefer the master versions
of files that are copied from the mdbcomp directory to other directories,
since this is the only writeable version.
Make the os and cs rules consistently NOT build the _init.[co] files.
The way we use those files in bootcheck, we never need them;
when we need them, the right target to give is the executable anyway.
In the slice directory, don't put mcov between mtc_union and mtc_diff.
Eliminate unnecessary duplication, e.g. of sources in rules.
Eliminate double negatives in conditionals.
Fix formatting.
Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Add "ft=make" to vim modelines. This is redundant for the files whose
names is Mmakefile, but it is needed for Mmake.common.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
Add the 'css' target for building the C# source files.
The parallel version of the runtime makes use of POSIX unnamed semaphores,
which do not exist on OS X (although annoyingly most of the relevant functions
*do* exist, they just don't do anything). This was originally a problem for
the low-level C version of the parallel runtime, but now affects both C
backends (i.e. it's currently impossible to use threads or parallel
conjunctions on OS X). The fix is to replace the use of POSIX unnamed
semaphores on OS X, with the semaphore implementation for libdispatch (which is
part of Grand Central Dispatch). Note that the .par grades are (presumably)
still broken in versions of OS X prior to 10.6 -- they'll now just fail to
compile rather than fail at runtime.
configure.ac:
runtime/mercury_conf.h.in:
Check whether libdispatch is present.
runtime/mercury_conf_param.h:
Define a macro that says whether we want to use libdispatch; always
define this macro on OS X. Using libdispatch (optionally) on other systems
is future work.
runtime/mercury_thread.{c,h}
Define the MercurySem type and its associated operations appropriately
when using libdispatch.
library/Mmakefile:
Recompile the thread and thread.semaphore if any of the runtime headers
that define the macros they use change.
The -install_name option broke building with mmake --use-mmake-make on
other operating systems.
browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
As above.
The install names for Mercury shared libraries in the system were not being set
when building using --use-mmc-make. The existing code in the Mmakefiles that
does this only works for mmake, not mmc --make.
browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
When using --use-mmc-make set up the options to set the dylib install
names in such a way that mmc --make can see them.
Don't hardcode the library names in the definitions that set the
library install names.
runtime/Mmakefile:
Always install the runtime header files, even in non-C grades.
Add a comment explaining why this needs to be done.
Update the comment describing where all the different versions of
the runtime live and how they are built.
Delete now-unused code for building the IL backend version of the
runtime.
compiler/Mmakefile:
Document the how we install the C# version of the compiler.
Add an XXX comment about a difference between Mono and .NET that
we don't yet handle when the compiler is built in the C# grade.
library/Mmakefile:
Delete code for cleaning up files generated by the IL backend.
compiler/format_call.m:
Fix typos, and update a comment about future work.
compiler/parse_string_format.m:
Use the right copyright.
library/Mmakefile:
Fix issues with spaces vs tabs, and tabstop settings.
Previously, we specialized calls to string.format and io.format only if
the format string specified no flags, widths, precisions or non-default
bases for any conversion. We now specialize calls to those predicates
regardless of the format string. To make this possible, we now have two
copies of the code to parse format strings.
library/string.parse_runtime.m:
This new module, carved out out library/string.format.m, contains
one of those copies. As the name suggests, this copy is used by
the runtime system.
compiler/parse_string_format.m:
This new module contains the other copy. As its location suggests,
this copy is used by the compiler. The separate copy is necessary
because the compiler's parsing needs are different from the runtime's.
The main reason for the separation is that the compiler needs to be
able to handle cases where widths and predicates are given by manifest
constants, as well as when they are given by the values of variables
at runtime (when the format string contains conversion specifiers
such as "%*d"). Having the runtime handle this extra complexity
would have inevitably increased the runtime's format string interpretation
overhead, which is undesirable.
The other reason is that compiler can afford to postprocess the result
of the parsing in order to avoid having to concatenate two or more
constant strings at runtime.
library/string.parse_util.m:
Types and predicates that are common to the library and compiler copies
of the format string parsing code.
compiler/format_call.m:
We used to check whether format strings match the supplied list
of values to be printed by invoking string.format on dummy inputs
of the supplied types, and seeing whether you got an exception.
We now call parse_string_format.m instead. Not only does this
avoid shenanigans with exceptions (which the deep profiler cannot
yet handle), but it also allows us to specialize all calls
to string.format and io.format. We therefore do so.
We used to specialize calls to io.format by creating a single string
to be printed (using the machinery needed to specialize calls to
string.format), and then printing that. This did unnecessary memory
allocations to hold the intermediate strings. We now simply print
each component one after the other, which avoids this overhead.
library/string.format.m:
Add versions of the predicates that print chars, strings, ints and floats
that are specialized to each possible situation about whether the caller
specifies a width and/or a precision. This means that format_call.m
doesn't have to generate code that allocates cells on the heap.
Remove the code that was moved to new submodules of string.m.
compiler/simplify_proc.m:
List the predicates in string.format.m that the compiler
may generate calls to in the list of such predicates that we maintain
to prevent dead_pred_elim from deleting them before format_call.m
gets a chance to do its work.
compiler/module_imports.m:
If the code of the module calls a predicate named "format" that
may refer to string.format or io.format, then implicitly import
the modules that contain the types and predicates that the code
generated by format_call.m will refer to. Note that since this
module_imports.m works on Mercury code that has not been module
qualified yet, we have to use a conservative approximation.
Reorganize the way we discover what library modules we have to
implicitly import. Instead of a separate boolean for each piece
of functionality that needs an implicit import, put them together
into a structure. Due to Peter's work on argument packing some
years back, this is now more efficient as well as more convenient
that passing around a bunch of booleans. Also switch to passing
around the structure as an accumulator, instead of having to do
bool.ors all over the place.
Since the code for computing the list of modules to be implicitly
imported can sometimes add a library module to the list twice,
sort that list and remove any duplicates.
To make this possible, remove the version of the main predicate
that appends the implicitly imported module names to a list of
module names passed by our caller, since we don't want to sort
THAT list of module names.
Give the remaining version of that predicate that does this
a name that better matches the names of related predicates.
compiler/modules.m:
Conform to the change in module_imports.m. Mark some suspicious code
with XXXs.
Remove some redundant comments.
compiler/options.m:
doc/user_guide.texi:
Add a new option that tells format_call.m what it should do
when it finds more than one problem with a format string: whether
it should print a message only for the first problem, or for all
the problems. (The default is the latter.)
library/MODULES_DOC:
A list of the all the Mercury source files in the library that
should be included in the user guide.
library/MODULES_UNDOC:
A list of the all the Mercury source files in the library that
should NOT be included in the user guide.
library/library.m:
Include the new publicly visible new submodule of string.m,
(string.parse_util). And both string.parse_util and string.parse_runtime
(which is NOT visible from outside string.m) to the list of modules
in the Mercury standard library.
Update the rules for where new library modules should be documented
to account for non-publically-visible submodules, which we haven't had
before. Document the need to include new modules in either MODULES_DOC
or MODULES_UNDOC.
mdbcomp/builtin_modules.m:
Provide convenient access for format_call.m to the names of the
submodules of string.m that it needs access to.
library/Mmakefile:
Add a new target, check_doc_undoc, which checks whether any source files
are missing from MODULES_DOC or MODULES_UNDOC.
doc/Mmakefile:
Read the list of modules to be documented from MODULES_DOC. This replaces
old code that tried to list all the undocumented modules, but missed one:
it referred to erlang_conf.m instead of erlang_builtin.m.
When creating the library documentation, filter out any lines that
contain the string NOTE_TO_IMPLEMENTORS. We now use this mechanism
to include reminders to implementors in what would otherwise be a
publically visible part of string.m.
tools/bootcheck:
Copy MODULES_DOC and MODULES_UNDOC to the stage 2 and 3 library
directories, since the check_doc_undoc target, which is invoked by
"make all" in the library directory, needs them.
compiler/hlds_out_module.m:
When dumping out the table of types, dump out discriminated union types
in a style that follows our recommended coding style.
When compiling the library directory, we used to get C compiler warnings
about assigning ints to pointers, because on many machines an int is 32 bits,
while pointers are 64. The problem was in robdd/bryant.c, which is bodily
robdd/robdd_conf.h.in:
New autoconfigured file that specifies what integer type to use
in robdd nodes (it is now given the typedef name MR_ROBDD_int),
and how many bits it has.
configure.ac:
Build robdd_conf.h from robdd_conf.h.in after gathering the info it needs.
robdd/bryant.[ch]:
Replace almost all uses of ints with MR_ROBDD_ints. The only exceptions
are the places where int is used as a bool, and where it is used
as a comparison result (where we need distinguish only between -1, 0, 1).
In places where MR_ROBDD_ints are printed out, print them with %ld
after casting them to long.
Replace the only use of unsigned long, in bitmasks, with MR_ROBDD_uint,
the unsigned version of MR_ROBDD_int. As far as I can tell, it always
should have been the same size as the signed ints (and on most 32 bit
architectures, it was, although by accident).
Note that bryant.c does NOT compile if e.g. MR_ROBDD_STATISTICS
is defined. However, that is not the fault of this diff; even the
version before this diff (from 2004!) had that problem.
Fix some obvious formatting issues.
Delete some functions that were declared but never called. (In fact,
one wasn't even defined :-()
library/Mmakefile:
Rebuild robdd.o if any of ../robdd/{bryant.[ch],robdd_conf.h} is modified.
browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
Delete .ss and .pic_ss targets.
These were only required for the GCC backend.
Estimated hours taken: 4
Branches: main, 11.07
The Microsoft C# compiler only accepts paths in the Windows format, so
add code to format file names depending on which host environment we are
compiling and which C# compiler we are using.
compiler/compile_target_code.m:
Convert to file names to use windows paths when required.
compiler/globals.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/options.m:
doc/user_guide.texi:
m4/mercury.m4:
scripts/Mercury.config.in:
Add code to determine the C# compiler type and pass it to the compiler.
library/Mmakefile:
We no longer need to detect if we are using csc as the compiler
will fix the posix path as part of mmc --make.
Branches: main
Avoid clutter when compiling.
library/LIB_FLAGS.in:
library/Mmakefile:
Set --profile-optimized in LIB_FLAGS rather than the
library Mmakefile.
use.
These changes mean that a normal installation with a deep profiling and a
low-level C parallel grade can be used for automatic parallelism.
compiler/options.m:
Rename --profile-for-implicit-parallelism to --profile-for-feedback.
--profile-for-implicit-parallelism is now retained as a synonym.
Enable --coverage-profiling by default, it is only checked if
--deep-profiling is enabled.
Make corrections to the commented-out documentation for the developer-only
coverage profiling options.
compiler/handle_options.m:
Conform to changes in options.m
Remove the set of options implied by --coverage-profiling since they're
already set correctly in options.m.
doc/user_guide.texi:
Added extra concept index declarations to entries for automatic parallelism
and feedback analysis.
Conform to changes in options.m
library/Mmakefile:
Compile the standard library with --profile-optimized
runtime/mercury_deep_profiling.c:
Always write out the Procrep.data file when writing out the Deep.data file.
runtime/mercury_wrapper.[ch]:
Remove the --deep-procrep-file MERCURY_OPTIONS option, it is now always
enabled. (In the future the procrep data may be included inside the
Deep.data file).
tools/bootcheck:
Remove the --deep-procrep-file option from the bootcheck script.
future is available and if it is reads the value and unlocks the future. We
can avoid the locking operation in many cases by testing if the future is
available before taking the lock. If the future is not available then take
the lock and re-test to see if the future is available.
To make this safe we now write the future's value before writing to the field
that says it's available, these two writes are stored in the correct order by
using an 'sfence' instruction.
runtime/mercury_par_builtin.m:
As above.
Also re-order the fields of the future structure, putting fut_value and
fut_signalled next to each other, they're more likely to be in te same
cache line this way.
library/Mmakefile:
Make par_builtin.o depend on mercury_par_builtin.h in the runtime.
Branches: main, 11.01
Make the standard library build in the csharp grade with the Microsoft C#
compiler.
library/Mmakefile:
Don't use Unix style paths with csc.
Branches: main, 11.01
A step towards getting the compiler to build in the java (and other non-C)
grade(s).
library/Mmakefile:
Don't make lib_std depend on Native.so (which is currently
unused) in the java grade.
The lib_std target for the java grade *does* need to be
defined if mmake --use-mmc-make is being used; not the
other way round.
browser/Mmakefile:
There is no "jars" target (and in any case the standard
top-level in this directory works.)
compiler/Mmakefile:
Bump the heap size for javac since the default is not
sufficient.
compiler/make.util.m:
compiler/md4.m:
compiler/pickle.m:
compiler/process_util.m:
compiler/prog_events.m:
Provide definitions of some predicates for the non-C backends.
Estimated hours taken: 1
Branches: main
library/Mmakefile:
Make a module list easier to modify.
library/array.m:
library/int.m:
Add predicates needed by g12.
NEWS:
Mention the new predicates.
Remove announcements of new modes for predicates which are themselves
new.
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
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, 10.04
Lift some assumptions that the only Java and Erlang grades are `java' and
`erlang'.
Finally use `--force-disable-ssdebug' instead of `--no-ssdb' to disable the
source-to-source debugging tranformation where required. The latter is
incorrect as it changes the grade, which disrupts the install path with `mmc
--make'.
library/Mmakefile:
scripts/Mercury.config.in:
scripts/Mmake.vars.in:
Remove the variable `INSTALL_JAVA_LIBRARY_DIR' as it assumes only one
Java grade is possible.
Don't use default `--java-classpath' options to add Mercury standard
libraries to the Java class path, for the same reason.
compiler/module_cmds.m:
Add a predicate to return the Mercury standard libraries needed for a
Java program as they are no longer listed in Mercury.config.
Add the Mercury standard libraries when creating the shell script to
launch Java programs.
compiler/compile_target_code.m:
Add the Mercury standard libraries when calling the Java compiler.
compiler/make.program_target.m:
Don't hard code `java' and `erlang' grades when installing library
grade files.
browser/MDB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Use `--force-disable-ssdebug' to disable the transform.
compiler/module_imports.m:
Don't implicitly import the `ssdb' module if `--force-disable-ssdebug'
is enabled.
compiler/handle_options.m:
Reset the `source_to_source_debug' option on encountering a `--grade'
option.
Branches: main
library/Mmakefile:
It appears that javac -Xmx256m still runs out of memory when building
the standard library in the java grade on 32-bit machines. Bump up the
maximum size to 512 MB for the standard library, but not in general.
README.Java:
Describe how to increase the memory limit with mmc --make.
Branches: main
library/Mmakefile:
Copy java/runtime directory rather than creating a symbolic link.
Under Cygwin, the symlink won't be understood by the Java compiler.
Branches: main
Use mmc --make to install Java grades. The makefile rules in library/Mmakefile
did not install .opt files into <prefix>/lib/mercury/ints/java. When
intermodule optimisation was enabled with a Java grade, the Mercury compiler
would read the .opt files from <prefix>/lib/mercury/ints, which could be from
*any* grade (they are only installed to work around problems with Mmake).
Mmakefile:
Force mmc --make to be used to install Java grades.
browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
Delete rules for building libraries in the Java grade with Mmake.
Move --no-libgrade options to *_FLAGS files.
library/Mmakefile:
Create the jmercury -> ../java symlink at the `mmake depend' step.
Pass -sourcepath . to javac so it can find the jmercury/runtime/*.java
files.
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Add --no-libgrade options so that mmc --make libFOO.install only
installs the main grade.
Add --no-java-classpath so that the .jar files from the installed
compiler aren't used.
Tell the Java compiler about .jar files that each directory depends on.
README.Java:
Remove a mention of Mmake with the java grade.
Estimated hours taken: 0.2
Branches: main
compiler/Mmakefile:
Fix an old bug. The action for the target "tags_file_exists", which is
implicitly remade whenever we rebuild the compiler, used to always
touch .compiler_tags. This led the "tags" target to believe that
the tags file (whose logical timestamp .compiler_tags represents)
is at least as new as all the .m files, causing it to not actually
remake the tags file, even when it should have.
We now touch .compiler_tags only when rebuilding the tags file.
*/Mmakefile:
Make the actions for tags follow the scheme in compiler/Mmakefile
where needed.
Branches: main
library/Mmakefile:
Fix a problem installing the java grade. As with other grades we need
to force the library.int3 file to be produced when installing the
library as some modules in the browser directory need it. This wasn't
a problem until the changes to get the java.ssdebug grade installing.
Estimated hours taken: 2
Branches: main
Get the java.ssdebug grade installing and compiling hello world.
Note that currently the jars for the java.ssdebug grade are installed in the
same location as the non-ssdebug jars. That's not a problem for now,
because the standard library currently has the ssdebug transformations
turned off when it's compiled in the ssdebug grade, so the java.ssdebug
jars are the same as the java jars. Changing it so that the java.ssdebug
jars are installed in a different location requires getting mmc to
adjust the classpath depending on the grade, which doesn't seem worth
it at this stage.
Also note that the interface files for the ssdb, browser and mdbcomp
libraries need to be installed in the ssdebug grade otherwise mmc
complains that it cannot find files like ssdb.m when compiling
a program. These interface files are currently only installed
when there is an ssdebug grade.
browser/MDB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Generate .module_dep files (needed to compile ssdebug transformed
programs).
browser/Mmakefile:
Build and install mer_browser.jar.
Install the interface files when in an ssdebug grade.
browser/browse.m:
Avoid a determinism warning.
browser/cterm.m:
browser/declarative_execution.m:
browser/listing.m:
Get this code compiling in java grades.
The "if (1 == 1)" before throwing an exception is to avoid
"unreachable code" errors from the Java compiler.
library/Mmakefile:
Mention that the ssdebug jars are installed in the
same spot as the non-ssdebug jars.
mdbcomp/Mmakefile:
Build and install mer_mdbcomp.jar.
Install the interface files when in an ssdebug grade.
mdbcomp/rtti_access.m:
Get this code compiling in Java grades.
scripts/Mercury.config.in:
Add the ssdb, mdbcomp and browser jars to the classpath.
If they are not installed they will just be ignored.
ssdb/Mmakefile:
Build and install mer_ssdb.jar.
Install the interface files when in an ssdebug grade.
ssdb/ssdb.m:
Get this code compiling in java grades.
Flush the output buffers after displaying the prompt so that
it's always displayed.
Branches: main
On the Java backend, use specialised MethodPtr interfaces so that when calling
a method pointer input arguments do not have to be passed via a temporary
array, for arities up to 15. For higher arities the temporary array is still
used.
java/runtime/MethodPtr.java:
java/runtime/MethodPtr1.java:
java/runtime/MethodPtr10.java:
java/runtime/MethodPtr11.java:
java/runtime/MethodPtr12.java:
java/runtime/MethodPtr13.java:
java/runtime/MethodPtr14.java:
java/runtime/MethodPtr15.java:
java/runtime/MethodPtr2.java:
java/runtime/MethodPtr3.java:
java/runtime/MethodPtr4.java:
java/runtime/MethodPtr5.java:
java/runtime/MethodPtr6.java:
java/runtime/MethodPtr7.java:
java/runtime/MethodPtr8.java:
java/runtime/MethodPtr9.java:
java/runtime/MethodPtrN.java:
Add specialised MethodPtr interfaces and MethodPtrN for any higher
arities.
compiler/mlds_to_java.m:
Make the code generator use the specialised MethodPtr interfaces.
library/Mmakefile:
Compile java/runtime/*.java files explicitly as some MethodPtr*.java
files won't be compiled implicitly when compiling the standard library.
library/exception.m:
java/runtime/Exception.java:
library/rtti_implementation.m:
Conform to changes.
Branches: main
Make the Java backend not use native code to implement any standard library
procedures. The only such procedures were related to benchmarking and timing,
which aren't very important so I just make a best effort using methods that
the Java standard library provides.
library/benchmarking.m:
Implement `benchmarking.report_stats' for Java as closely as possible
without native code. Add real time output.
Add `benchmarking.ML_initialise' to remember the time when the
program starts up.
compiler/mlds_to_java.m:
Make the main wrapper call `benchmarking.ML_initialise' at startup.
library/time.m:
Implement `time.clock', `time.times', `time.clocks_per_sec',
`time.clk_tck' as closely as possible without native code.
library/Mmakefile:
Comment out commands to build and install Native.so.
java/runtime/Native.c:
Even though this is not used any more, update the function names for
the "jmercury" package prefix.
README.Java:
Update section on unimplemented procedures.
Branches: main
Put all Mercury-generated Java classes into the package `jmercury' and
runtime classes into `jmercury.runtime'. The Mercury module hierarchy is
not reflected in the package name. We name sub-module classes using
their fully-qualified module names with `__' between components, e.g.
`bit_buffer.read' produces `class bit_buffer__read'.
As all generated Java code is in the same package we don't need to package
qualify identifiers, and we don't need the hack to avoid clashing package
and class names. It also makes it easier to write Java foreign code because
generated Java class names are easier to predict from Mercury module names.
The package names are not `mercury' and `mercury.runtime' because on
case-insensitive file systems we may end up with a `mercury' directory
that could be confused with the `Mercury' directory.
compiler/java_names.m:
Delete code related to mangling package names.
Remove the extra `mercury' prefix added to standard library module
names, as it is redundant with `jmercury'.
Change runtime package name.
compiler/mlds_to_java.m:
Make generated code follow the new packaging scheme.
Don't automatically import all runtime classes. It doesn't seem
necessary.
Update for new packaging scheme.
compiler/file_names.m:
Fix Java file paths for the new packaging scheme.
compiler/module_cmds.m:
compiler/rtti.m:
library/array.m:
library/backjump.m:
library/benchmarking.m:
library/bitmap.m:
library/builtin.m:
library/exception.m:
library/io.m:
library/library.m:
library/mutvar.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.m:
library/time.m:
library/type_desc.m:
java/runtime/*.java:
Rename package names.
Delete unnecessary package qualification.
compiler/mlds.m:
Add some XXXs to be fixed later.
library/Mmakefile:
Update for new packaging scheme.
Let mmake --use-mmc-make work in this directory.
Estimated hours taken: 3
Branches: main
Rename the runtime granularity control macros, variables and predicates.
Names of the runtime granularity control macros, variables and predicates are
now more descriptive and more consistent.
An alternative runtime granularity control predicate and macro is now
available, it considers the number of contexts and all sparks whereas the
original predicate and macro considers only the number of contexts and sparks
on the global queue.
A new predicate has been added to determine the number of worker threads that
the mercury runtime is configured to use.
library/par_builtin.m:
Renamed predicates.
Conform to changes in runtime/mercury_thread.h
Added the new predicates.
Removed some old foreign procedure attributes.
Addressed an XXX comment left by Zoltan.
runtime/mercury_context.c:
runtime/mercury_context.h:
Rename existing runtime granularity control variables and macros.
Add new runtime granularity control variable and macro.
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
Export MR_num_threads variable.
Make this variable an MR_Unsigned.
runtime/mercury_atomic_ops.c:
runtime/mercury_atomic_ops.h:
Introduce new atomic increment and decrement instructions. These are used
to count the number of local sparks created which is done outside of a
critical section.
library/Mmakefile:
Rebuild the par_builtin module when either runtime/mercury_context.h or
runtime/mercury_thread.h change.
compiler/granularity.m:
Conform to changes in runtime/mercury_context.h