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.