[m-rev.] more .NET fixes/work-arounds (not committed)
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Feb 13 19:53:41 AEDT 2003
The change to stack_layout.m is for review by Zoltan.
The following changes are needed for the .NET back-end.
I'm not planning to commit any of these at the moment,
because they are too hacky, but these (or similar)
patches need to be applied if you want to try bootstrapping
the compiler in grade `il'. Of course they are not yet
sufficient to make it bootstrap...
----------
Various changes to get things to work in grade `il'.
compiler/stack_layout.m:
Implement concat_strings in Mercury.
(XXX FIXME Why was this ever implemented in C anyway?
Should we just delete the C version?)
compiler/passes_aux.m:
Provide Mercury clauses as alternatives to C foreign_proc code
for `use_win32'. XXX FIXME currently this is hard-coded (to true).
compiler/top_level.m:
compiler/mercury_compile.m:
XXX FIXME work-around a bug with the Mercury compiler's .NET back-end:
Define `main' in toplevel.m, rather than in `mercury_compile.m',
because the .NET back-end assumes that `main' will be defined in
the top-level module.
XXX This is not the right fix, because it makes `main', `io.*',
and `top_level.mercury_compile.*' visible in all the child modules
of `toplevel.m', which is not desirable.
Workspace: /home/fjh/ws/hermes
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.73
diff -u -d -r1.73 stack_layout.m
--- compiler/stack_layout.m 15 Nov 2002 04:50:28 -0000 1.73
+++ compiler/stack_layout.m 13 Feb 2003 08:38:58 -0000
@@ -151,6 +151,11 @@
%---------------------------------------------------------------------------%
+% This version is only used if there is no matching foreign_proc version.
+% XXX why is this implemented in C anyway? Why not just use Mercury?
+concat_string_list(StringsList, _Len, String) :-
+ String = string__append_list(StringsList).
+
:- pred stack_layout__concat_string_list(list(string)::in, int::in,
string::out) is det.
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.272
diff -u -d -r1.272 mercury_compile.m
--- compiler/mercury_compile.m 10 Feb 2003 10:07:18 -0000 1.272
+++ compiler/mercury_compile.m 13 Feb 2003 08:38:58 -0000
@@ -18,8 +18,8 @@
:- import_module io, list.
-:- pred main(io__state, io__state).
-:- mode main(di, uo) is det.
+:- pred real_main(io__state, io__state).
+:- mode real_main(di, uo) is det.
% main(Args).
:- pred main(list(string), io__state, io__state).
@@ -121,7 +121,7 @@
%-----------------------------------------------------------------------------%
-main -->
+real_main -->
gc_init,
% All messages go to stderr
@@ -170,6 +170,9 @@
%-----------------------------------------------------------------------------%
:- pred gc_init(io__state::di, io__state::uo) is det.
+
+% This version is only used if there is no matching foreign_proc version.
+gc_init --> [].
:- pragma foreign_proc("C",
gc_init(_IO0::di, _IO::uo),
Index: compiler/passes_aux.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/passes_aux.m,v
retrieving revision 1.51
diff -u -d -r1.51 passes_aux.m
--- compiler/passes_aux.m 5 Feb 2003 14:41:14 -0000 1.51
+++ compiler/passes_aux.m 13 Feb 2003 08:38:58 -0000
@@ -644,6 +644,10 @@
SUCCESS_INDICATOR = 0;
#endif
").
+% The following clause is only used if there is no matching foreign_proc.
+% XXX you may need to manually uncomment the right one!
+use_win32 :- semidet_succeed.
+%use_win32 :- semidet_fail.
maybe_report_sizes(HLDS) -->
globals__io_lookup_bool_option(statistics, Statistics),
Index: compiler/top_level.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/top_level.m,v
retrieving revision 1.1
diff -u -d -r1.1 top_level.m
--- compiler/top_level.m 20 Mar 2002 12:37:29 -0000 1.1
+++ compiler/top_level.m 13 Feb 2003 08:38:58 -0000
@@ -27,6 +27,14 @@
:- include_module mercury_compile.
+:- use_module io.
+:- use_module top_level.mercury_compile.
+:- pred main(io.state::di, io.state::uo) is det.
+
+:- implementation.
+
+main --> top_level.mercury_compile.real_main.
+
:- end_module top_level.
%-----------------------------------------------------------------------------%
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list