Commit Graph

14 Commits

Author SHA1 Message Date
Peter Wang
0ae65de577 Pack consecutive enumeration arguments in discriminated union types into a
Branches: main

Pack consecutive enumeration arguments in discriminated union types into a
single word to reduce cell sizes.  Argument packing is only enabled on C
back-ends with low-level data, and reordering arguments to improve
opportunities for packing is not yet attempted.  The RTTI implementations for
other back-ends will need to be updated, but that is best left until after any
argument reordering change.

Modules which import abstract enumeration types are notified so by writing
declarations of the form:

	:- type foo where type_is_abstract_enum(NumBits).

into the interface file for the module which defines the type.


compiler/prog_data.m:
	Add an `arg_width' argument to constructor arguments.

	Replace `is_solver_type' by `abstract_type_details', with an extra
	option for abstract exported enumeration types.

compiler/handle_options.m:
compiler/options.m:
	Add an internal option `--allow-argument-packing'.

compiler/make_hlds_passes.m:
	Determine whether and how to pack enumeration arguments, updating the
	`arg_width' fields of constructor arguments before constructors are
	added to the HLDS.

compiler/mercury_to_mercury.m:
compiler/modules.m:
	Write `where type_is_abstract_enum(NumBits)' to interface files
	for abstract exported enumeration types.

compiler/prog_io_type_defn.m:
	Parse `where type_is_abstract_enum(NumBits)' attributes on type
	definitions.

compiler/arg_pack.m:
compiler/backend_libs.m:
	Add a new module.  This mainly contains a predicate which packs rvals
	according to arg_widths, which is used by both LLDS and MLDS back-ends.

compiler/ml_unify_gen.m:
compiler/unify_gen.m:
	Take argument packing into account when generating code for
	constructions and deconstructions.  Only a relatively small part of the
	compiler actually needs to understand argument packing.  The rest works
	at the HLDS level with constructor arguments and variables, or at the
	LLDS and MLDS levels with structure fields.

compiler/code_info.m:
compiler/var_locn.m:
	Add assign_field_lval_expr_to_var and
	var_locn_assign_field_lval_expr_to_var.

	Allow more kinds of rvals in assign_cell_arg.  I do not know why it was
	previously restricted, except that the other kinds of rvals were not
	encountered as cell arguments before.

compiler/mlds.m:
	We can now rely on the compiler to pack arguments in the
	mlds_decl_flags type instead of doing it manually.  A slight downside
	is that though the type is packed down to a single word cell, it will
	still incur a memory allocation per cell.  However, I did not notice
	any difference in compiler speed.

compiler/rtti.m:
compiler/rtti_out.m:
	Add and output a new field for MR_DuFunctorDesc instances, which, if
	any arguments are packed, points to an array of MR_DuArgLocn.  Each
	array element describes the offset in the cell at which the argument's
	value is held, and which bits of the word it occupies.  In the more
	common case where no arguments are packed, the new field is simply
	null.

compiler/rtti_to_mlds.m:
	Generate the new field to MR_DuFunctorDesc.

compiler/structure_reuse.direct.choose_reuse.m:
	For now, prevent structure reuse reusing a dead cell which has a
	different constructor to the new cell.  The code to determine whether a
	dead cell will hold the arguments of a new cell with a different
	constructor will need to be updated to account for argument packing.

compiler/type_ctor_info.m:
	Bump RTTI version number.

	Conform to changes.

compiler/add_type.m:
compiler/check_typeclass.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/erl_rtti.m:
compiler/hlds_data.m:
compiler/hlds_out_module.m:
compiler/intermod.m:
compiler/make_tags.m:
compiler/mlds_to_gcc.m:
compiler/opt_debug.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/special_pred.m:
compiler/type_constraints.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/xml_documentation.m:
	Conform to changes.

	Reduce code duplication in classify_type_defn.

compiler/hlds_goal.m:
	Clarify a comment.

library/construct.m:
	Make `construct' pack arguments when necessary.

	Remove an old RTTI version number check as recommended in
	mercury_grade.h.

library/store.m:
	Deal with packed arguments in this module.

runtime/mercury_grade.h:
	Bump binary compatibility version number.

runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
	Bump RTTI version number.

	Add MR_DuArgLocn structure definition.

	Add a macro to unpack an argument as described by MR_DuArgLocn.

	Add a function to determine a cell's size, since the number of
	arguments is no longer correct.

runtime/mercury_deconstruct.c:
runtime/mercury_deconstruct.h:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_ml_arg_body.h:
runtime/mercury_ml_expand_body.h:
	Deal with packed arguments when deconstructing.

	Remove an old RTTI version number check as recommended in
	mercury_grade.h.

runtime/mercury_deep_copy_body.h:
	Deal with packed arguments when copying.

runtime/mercury_table_type_body.h:
	Deal with packed arguments in tabling.

runtime/mercury_dotnet.cs.in:
	Add DuArgLocn field to DuFunctorDesc. Argument packing is not enabled
	for the C# back-end yet so this is unused.

trace/mercury_trace_vars.c:
	Deal with packed arguments in MR_select_specified_subterm,
	use for the `hold' command.

java/runtime/DuArgLocn.java:
java/runtime/DuFunctorDesc.java:
	Add DuArgLocn field to DuFunctorDesc. Argument packing is not enabled
	for the Java back-end yet so this is unused.

extras/trailed_update/tr_store.m:
	Deal with packed arguments in this module (untested).

extras/trailed_update/samples/interpreter.m:
extras/trailed_update/tr_array.m:
	Conform to argument reordering in the array, map and other modules in
	previous changes.

tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/lco_pack_args.exp:
tests/hard_coded/lco_pack_args.m:
tests/hard_coded/pack_args.exp:
tests/hard_coded/pack_args.m:
tests/hard_coded/pack_args_copy.exp:
tests/hard_coded/pack_args_copy.m:
tests/hard_coded/pack_args_intermod1.exp:
tests/hard_coded/pack_args_intermod1.m:
tests/hard_coded/pack_args_intermod2.m:
tests/hard_coded/pack_args_reuse.exp:
tests/hard_coded/pack_args_reuse.m:
tests/hard_coded/store_ref.exp:
tests/hard_coded/store_ref.m:
tests/invalid/Mmakefile:
tests/invalid/where_abstract_enum.err_exp:
tests/invalid/where_abstract_enum.m:
tests/tabling/Mmakefile:
tests/tabling/pack_args_memo.exp:
tests/tabling/pack_args_memo.m:
	Add new test cases.

tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
	Add constructors with packed arguments to these cases.

tests/invalid/where_direct_arg.err_exp:
	Update expected output.
2011-07-05 03:34:39 +00:00
Peter Wang
2209caecea The direct argument functor change added the constant MR_SECTAG_NONE_DIRECT_ARG
Branches: main

The direct argument functor change added the constant MR_SECTAG_NONE_DIRECT_ARG
in some places but not others, breaking deconstruct on C# and Java back-ends.

compiler/mlds_to_gcc.m:
java/runtime/Sectag_Locn.java:
library/rtti_implementation.m:
runtime/mercury_dotnet.cs.in:
	Add missing constants.
2011-06-27 06:40:36 +00:00
Peter Wang
a28023f3db Implement thread-local mutables for C# backend correctly.
Branches: main

Implement thread-local mutables for C# backend correctly.
A child thread automatically inherits the values of thread-local
mutables from the thread that spawned it.

runtime/mercury_dotnet.cs.in:
        Add a `ThreadLocalMutables' class that implements inheritable
        thread-local mutables, using the same technique as for C grades.

library/thread.m:
        Make newly spawned threads copy the values of thread-local mutables
        from the parent thread.

compiler/make_hlds_passes.m:
        Update the C# mutable transformation to use the methods in the
        `ThreadLocalMutables' class.

compiler/prog_mutable.m:
        Describe the C# thread-local mutable transformation.
2010-10-28 03:16:32 +00:00
Peter Wang
ec98a3b076 Reduce some memory allocations on the C# backend.
Branches: main

Reduce some memory allocations on the C# backend.

compiler/mlds_to_cs.m:
        Use `out' parameters to handle multiple outputs instead of returning an
        array of objects.

        Hoist method pointers to static class members, then use those instead
        of creating new delegate instances at run time.

        Delete some unused code.

compiler/mlds.m:
        Work around a problem with the `store_at_ref_type'.

compiler/handle_options.m:
        Update comment about the options which are used for C#.

runtime/mercury_dotnet.cs.in:
        Declare `MethodPtrN_rM' delegates, where N is the number of input
        arguments and M is the number of output arguments.

library/rtti_implementation.m:
        Conform to changes.
2010-10-14 05:00:05 +00:00
Peter Wang
6538ecbba3 Implement module finalisation by registering predicates with the
Branches: main

compiler/mlds_to_cs.m:
        Implement module finalisation by registering predicates with the
        `System.AppDomain.CurrentDomain.ProcessExit' event.

library/builtin.m:
runtime/mercury_dotnet.cs.in:
        Fix problems with deep copying TypeCtorInfo_Struct instances, which
        due to a recent change could have a pointer to a TypeInfo_Struct
        which points to itself.

        Mark the offending field with the [NonSerialized] attribute and make
        the `deep_copy' implementation ignore fields with the attribute.

tests/hard_coded/loop_inv_test.m:
tests/hard_coded/loop_inv_test1.m:
        Make these tests work in C#.
2010-10-13 02:42:03 +00:00
Peter Wang
dc15c336f9 Optimisations for the C# backend.
Branches: main

Optimisations for the C# backend.

compiler/ml_switch_gen.m:
        Allow generating of "direct-mapped" string switches in C#.

        Delete some obsolete lines.

compiler/mlds_to_cs.m:
library/builtin.m:
        Use pre-allocated constants when boxing `comparison_result' values.
        This substantially reduces the number of short-lived objects being
        created.

        String comparisons were changed to use the `String.CompareOrdinal'
        in the library previously; we missed a spot in compiler.

library/io.m:
        Use a cached value of `System.Environment.NewLine' in mercury_getc,
        as it is faster.

runtime/mercury_dotnet.cs.in:
        Keep an instance of a TypeInfo_Struct created from a
        TypeCtorInfo_Struct, so it can be reused if the same
        TypeCtorInfo_Struct needs to be "cast" to TypeInfo_Struct again.
2010-10-12 05:04:28 +00:00
Peter Wang
ea6a590462 Add overloads of `TypeInfo_Struct.maybe_new' so the C# and Java
Branches: main

java/runtime/TypeInfo_Struct.java:
runtime/mercury_dotnet.cs.in:
        Add overloads of `TypeInfo_Struct.maybe_new' so the C# and Java
        compilers can pick the more appropriate version at compile time,
        as they know the type of the argument.

        Simplify the code.
2010-10-08 03:29:48 +00:00
Peter Wang
fd76da59ff Add support for the csharp' grade to mmc --make', and make it possible to
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.
2010-09-30 07:23:36 +00:00
Peter Wang
417151ca01 Improve the C# backend.
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.
2010-09-23 05:32:01 +00:00
Peter Wang
57f9013259 Start a C# backend, adapted from mlds_to_java.m.
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.
2010-09-16 00:39:12 +00:00
Peter Ross
e51e59a904 Move the using declaration to the beginning of the file.
runtime/mercury_dotnet.cs.in:
	Move the using declaration to the beginning of the file.
2004-08-02 14:30:15 +00:00
Fergus Henderson
5b7dec3741 Add work-around for GNU Portable.NET C# compiler bug.
Estimated hours taken: 0.25
Branches: main

runtime/mercury_dotnet.cs.in:
	Add work-around for GNU Portable.NET C# compiler bug.
2004-07-26 00:44:36 +00:00
Peter Ross
5fab9cc10a Implement io__set_environment_variable in C#.
Estimated hours taken: 1.5
Branches: main

Implement io__set_environment_variable in C#.

library/io.m:
	Call mercury.runtime.PInovke._putenv to set the environment
	variable.

runtime/mercury_dotnet.cs.in:
	Use pinvoke to call the Posix function _putenv.
	This is defined in the runtime, rather than io.m because at a
	later date we will need to use configure to select the correct
	putenv for different platforms.
2003-11-14 10:56:14 +00:00
Peter Ross
8f7a0a75e0 Add this missing file.
Estimated hours taken: 0.1
Branches: main

runtime/mercury_dotnet.cs.in:
	Add this missing file.
2003-11-13 15:15:39 +00:00