Estimated hours taken: 6
Branches: main
library/string.m:
Implement string__append_list and various formatting functions
in C#.
Implement a very simple (and incomplete) conversion of printf style
formatting to .NET formatting. It is probably a better idea to
implement printf formatting in Mercury in future, as neither
.NET nor Java provides printf.
runtime/mercury_mcpp.cpp:
Add some code to manipulate Mercury lists in the low-level data
representation.
Estimated hours taken: 20
Branches: main
Implement exceptions in the .NET backend.
(sorry, model_det exceptions only at the moment).
compiler/mlds_to_il.m:
Wrap two exception handlers around the Mercury code -- one that
prints out any uncaught user exceptions (Mercury exceptions,
that is) using ML_report_uncaught_exception, and one that
catches any system exceptions (anything else) and prints them
using the system exception printing mechanism.
library/exception.m:
Implement exceptions in C#.
try and catch call try_impl and catch_impl, which by default
call builtin_trd and builtin_catch, but we provide a
foreign_proc definition that implements them in C# on the .NET
backend.
We also implement ML_call_goal in Mercury, renaming the
hand-coded versions appropriately.
library/math.m:
Throw domain_error(string) for domain errors.
runtime/mercury_mcpp.cpp:
Fix the implementation of mercury.runtime.Exception -- now we
store the Mercury exception so you can retrieve it later.
Create a new class for Mercury runtime system exceptions, which
are generated by SORRY and fatal_error. We can't expect to
print these exceptions using ML_report_uncaught_exception (at
the moment ML_report_uncaught_exception generates such
exceptions!) so we print them as normal .NET exceptions instead.
Estimated hours taken: 14
Branches: main
compiler/mlds_to_il.m:
Add tuple to this list of hand-coded type_infos (so that we look
in the cpp code module to find the type_info).
library/builtin.m:
Add a type_ctor_info for tuple.
library/std_util.m:
Call into rtti.m to compare type_infos.
runtime/mercury_il.il:
Add some IL code to get the type_ctor_info from a type_info.
(It's hard to write this code in MC++ or C#, and there seems to
be a bug in the IL interface that stops me writing IL
foreign_proc for it at the moment).
runtime/mercury_il.il:
Add helper functions to get the function pointers for tuple
compare and unify procedures.
runtime/mercury_mcpp.cpp:
runtime/mercury_mcpp.h:
Add tuple to the type_ctor_rep.
runtime/mercury_type_info.h:
Mention that changes in the type_ctor_rep might require changes
in mercury_mcpp.{h,cpp}.
Estimated hours taken: 10
Branches: main
The MC++ interface for functions is buggy.
This change generates errors in most cases where a function is
implemented in MC++, and removes all the occurances of such functions
from the library.
compiler/mlds_to_il.m:
Abort if a function is implemented in MC++. We don't catch the
case of functions that return int, as it is difficult to be sure
this isn't just a semidet predicate (which works and is used).
However this catches a lot of cases where we were silently
generating bad code so it is better than nothing.
library/Mmakefile:
Add flags to control debugging (commented out for the moment).
Move the .NET flags together.
library/builtin.m:
library/float.m:
library/io.m:
library/math.m:
library/sparse_bitset.m:
library/std_util.m:
library/string.m:
Implement functions in C#, as functions don't work when a
foreign_proc is MC++.
This fixes several latent bugs in the library.
runtime/Mmakefile:
Add support for debugging (commented out for the moment).
runtime/mercury_mcpp.cpp:
Add code to manipulate low level data structures (so we can do
this from C# as well as MC++).
Estimated hours taken: 2
Branches: main
library/builtin.m:
library/private_builtin.m:
library/sparse_bitset.m:
library/string.m:
Change calls to mercury::runtime::convert to System::Covert.
Use __box instead of mercury::runtime::Convert::ToObject
runtime/Mmakefile:
Add a rule to remove the DOTNET_DLLS for clean_local.
runtime/mercury_il.il:
Remove ConvertImpl class, use unbox and ldobj instead of ToInt32.
runtime/mercury_mcpp.cpp:
Remove Convert class.
runtime/mercury_mcpp.h:
Use __box instead of mercury::runtime::Convert::ToObject
scripts/Mmake.rules:
Put the local include directory before the installed one when
compiling with MC++.
Also fix the rule for .cpp.dll to be the same as the subdir
rule.
Estimated hours taken: 5
Branches: main
Updates to the runtime and library for .NET backend.
These changes mean the runtime and library will no longer work for Beta 1.
If you want to use Beta 1, you will have to use mercury 0.10.x.
library/.cvsignore:
Add .cpp .dll and .il files.
runtime/.cvsignore:
Add .dll files.
library/Mmakefile:
Add an assembly search patch to the MS_CLFLAGS
Work around bugs in the assembly cache installer by generating one
big .il file for the library.
Generate a strong name file and use it.
library/array.m:
Update the code to work correctly -- the MC++ compiler is now a bit
stricter about type casts.
library/exception.m:
Stop using an enum and use #defines -- the enum has stopped working.
(I don't have time to figure out why just now).
library/float.m:
library/math.m:
Some of the mathematical functions have changed names.
library/io.m:
Use an ascii encoder to generate ASCII output by default.
Without this we get Unicode UTF output, and it seems to like to
insert a BOM (byte-order-mark) which means Hello World doesn't work
anymore.
Add a stream reader and writer to the MercuryFileStruct.
library/library_strong_name.sn:
The strong name for this library.
runtime/mercury_il.il:
Insert .publickeytoken to identify the mercury assembly and mscorlib.
Add ['mscorlib'] assembly refs to System.Object and ['mercury'] for
mercury code.
Use box and unbox instructions instead of our hand-hacked boxing
classes. Remove the old conversion classes.
Add a missing return to mercury.Init::init_runtime()
runtime/mercury_mcpp.cpp:
Minor fix: s/Exception/System.Exception/
runtime/mercury_mcpp.h:
Fix the definition of MR_Array.
Use array syntax for macros that manipulate arrays.
Estimated hours taken: 1
Get floating point working in the .NET backend.
compiler/mlds_to_il.m:
Implement the floating point operations.
runtime/mercury_il.il:
runtime/mercury_mcpp.cpp:
Add code for boxing and unboxing floats.
Estimated hours taken: 10
This change makes univ a user-defined type (in std_util.m) rather than
a builtin type.
The rationale for this is that the code for builtin types needs to be
maintained by hand when the execution model is changed (eg introducing
a new backend), but code for user defined types is modified implicitly.
Note that the semantics of deconstruct/4 have changed. See the NEWS file
for details.
NEWS:
Document the changed semantics of deconstruct/4.
browser/browse.m:
Fix the calls to deconstruct/4 to reflect the changed semantics
of deconstruct.
library/io.m:
Remove the special handling of univ for io__write.
Fix the calls to deconstruct/4 to reflect the changed semantics
of deconstruct.
library/private_builtin.m:
Implement typed_unify and typed_compare in terms of type_of and
unsafe_type_cast instead of univ, so that preds/funcs operating
on univs can be implemented in terms of typed_unify.
Add a new impure predicate var/1 which succeeds/fails depending on the
instantiation of its argument. This is used to implement bidirectional
predicates that require different code for different modes
(cf type_to_univ/2).
This is *not* mentioned in the NEWS file because it should only
be used by implementors. (Well, actually, anyone who wants to do
bidirectional code involving existential types may need it, but
we don't exactly want to encourage its use ;-).
library/std_util.m:
Implement univ/0 as a user-defined type rather than a hand coded
builtin type.
Removed the foreign language code to implement the operations on
univs (include unify/2 and compare/3).
The implementations of deconstruct, et al, now call back to Mercury
to construct/deconstruct univs, so the code of these has changed.
Note that there has been an implicit change in the semantics of
deconstruct/4, which had non-orthogonal handling of univ inputs.
It now handles them orthogonally: deconstruct of a univ yields the
functor "univ_cons" and its one argument which will be the wrapped
value. The non-orthogonal behaviour wasn't documented before, so
deconstruct/4 now behaves as its documentation describes it.
library/term.m:
Fix the call to deconstruct/4 to reflect the changed semantics
of deconstruct.
runtime/mercury.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_mcpp.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.h:
runtime/mercury_unify_compare_body.h:
Remove declarations and definitions for univ since it is now a
user level type rather than a builtin type.
trace/mercury_trace_declarative.h:
trace/mercury_trace_external.h:
trace/mercury_trace_internal.h:
Replace the hand-coded constructions of univs with call backs
to ML_construct_univ.
Estimated hours taken: 200
First implementation of the standard library in managed C++.
configure.in:
Autodetect the .NET SDK, and set MS_DOTNET_SDK_DIR based on it.
Find the IL assembler, and set ILASM.
compiler/inlining.m:
Turn off inlining of pragma_foreign_code with the IL backend.
compiler/mlds_to_c.m:
Add a comment questioning the foreign language interfacing still to be
done in this backend, and remove the "inline target code" from
this list (since it has been completed).
compiler/mlds_to_il.m:
Generate code for :- external. We generate a forwarding
function to the expected implementation in
<modulename>__c_code.cpp
Rename all the classes to use MixedCase, and to put them in the
mercury.runtime namespace.
compiler/mlds_to_ilasm.m:
Don't use the System or mercury namespaces by default.
Change the names of the runtime cpp files to mercury_mcpp.dll
and mercury_il.dll.
Use c_util to output unops and binops.
doc/user_guide.texi:
Document MS_CL_NOASM, MS_CLFLAGS and EXTRA_MS_CLFLAGS.
library/*.m:
Rename pragma c_code as pragma foreign_code("C", ...).
Add pragma foreign_code for MC++.
Only a fraction of the predicates are implemented, everything
else simply throws and exception when called.
Implementations of predicates marked with :- external are
provided as pragma foreign_code, but are commented out.
library/Mmakefile:
runtime/Mmakefile:
Add targets for building the dlls for the library.
runtime/mercury_mcpp.cpp:
runtime/mercury_mcpp.h:
Implementation of the runtime.
runtime/mercury_il.il:
This file mainly implements things that can't be written in
managed C++ (e.g. function pointers).
scripts/Mmake.rules:
scripts/Mmake.vars.in:
Add rules for generating .dlls and .exes from .ils and .cpps.