[m-rev.] Re: bootstrapping IL back-end (was: fix browser directory for non-C backends)

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 11 06:54:13 AEDT 2003


I got as far as building mercury_compile.exe,
and then ran into this one:

fjh$ cd ../samples/
<1 HERMES:~/ws/hermes/samples 06:33:20 2331>
fjh$ MERCURY_COMPILER=../compiler/mercury_compile.exe  mmc -v hello.m
% Parsing file `hello' and imported interfaces...
Uncaught Mercury exception:
Software Error: sorry, `io__file_modification_time_2' not implemented
for this target language (or compiler back-end).

Here is the patch that I am currently using.

cvs server: Diffing .
Index: Mmake.workspace
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.workspace,v
retrieving revision 1.11
diff -u -d -u -r1.11 Mmake.workspace
--- Mmake.workspace	5 Feb 2003 14:41:05 -0000	1.11
+++ Mmake.workspace	10 Feb 2003 19:52:05 -0000
@@ -126,6 +126,12 @@
 MCFLAGS +=	$(C_INCL_DIRS:-I%=--c-include-directory %)
 
 #
+# Work out the .NET directories
+#
+MERC_C_INCL_DIR = $(RUNTIME_DIR)
+MERC_DLL_DIR = $(LIBRARY_DIR)
+
+#
 # Work out which libraries to link with.
 # The $(shell) here is needed to allow the variable values in
 # ECHO_MERCURY_OPTIONS in Mmake.vars to be single-quoted when
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.353
diff -u -d -u -r1.353 configure.in
--- configure.in	10 Feb 2003 15:20:09 -0000	1.353
+++ configure.in	10 Feb 2003 19:52:05 -0000
@@ -496,7 +496,13 @@
 AC_PROG_CPP
 #-----------------------------------------------------------------------------#
 # Check for `-lm': some systems, e.g. MacOS X (Darwin), don't have it.
+# When cross-compiling from Cygwin to Mingw (and perhaps also on
+# native Mingw?), `-lm' exists, but it is not needed and in fact we must
+# not use it, because if we do then it causes cygwin1.dll to be linked in.
 AC_CHECK_LIB(m, sin, [MATH_LIB=-lm], [MATH_LIB=])
+case "$CC" in *"-mno-cygwin")
+	MATH_LIB=
+esac
 AC_SUBST(MATH_LIB)
 #-----------------------------------------------------------------------------#
 AC_MSG_CHECKING(for use of a Microsoft C compiler)
cvs server: Diffing analysis
cvs server: Diffing bindist
cvs server: Diffing boehm_gc
cvs server: Diffing boehm_gc/Mac_files
cvs server: Diffing boehm_gc/cord
cvs server: Diffing boehm_gc/cord/private
cvs server: Diffing boehm_gc/doc
cvs server: Diffing boehm_gc/include
cvs server: Diffing boehm_gc/include/private
cvs server: Diffing boehm_gc/tests
cvs server: Diffing browser
cvs server: Diffing bytecode
cvs server: Diffing compiler
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.65
diff -u -d -u -r1.65 Mmakefile
--- compiler/Mmakefile	5 Feb 2003 14:41:11 -0000	1.65
+++ compiler/Mmakefile	10 Feb 2003 19:52:05 -0000
@@ -219,21 +219,27 @@
 .PHONY: cs
 cs: 		mlds_to_gcc.c gcc.c
 
+
 #-----------------------------------------------------------------------------#
 
 # Add some additional dependencies, so that Mmake knows to remake the
 # compiler if one of the libraries changes.
 
+ifeq ($(findstring il,$(GRADE)),il)        
+# This line works around an Mmake bug: mmake doesn't record
+# dependencies properly with --transitive-intermodule-optimization
+%.il: opts
+else
 $(MC_PROG): ../main.$O
 $(MC_PROG): $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
 $(MC_PROG): $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
 $(MC_PROG): $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
 $(MC_PROG): $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A
 $(MC_PROG): $(ANALYSIS_DIR)/lib$(ANALYSIS_LIB_NAME).$A
-# Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
-# if in .gc(.prof) grade; GNU make does not support dynamic dependencies,
-# so just leave it out.
+# XXX should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
+# if in .gc(.prof) grade
 $(MC_PROG): $(GCC_MAIN_LIBS)
+endif
 
 $(MC_PROG)_init.c: $(UTIL_DIR)/mkinit
 
@@ -268,10 +274,12 @@
 os: $($(MC_PROG).os)
 cs: $($(MC_PROG).cs)
 ss: $($(MC_PROG).ss)
+opts: $($(MC_PROG).opts)
 else
 os: $(MC_PROG).os
 cs: $(MC_PROG).cs
 ss: $(MC_PROG).ss
+opts: $(MC_PROG).opts
 endif
 
 #-----------------------------------------------------------------------------#
Index: compiler/bytecode_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_data.m,v
retrieving revision 1.9
diff -u -d -u -r1.9 bytecode_data.m
--- compiler/bytecode_data.m	10 Jan 2003 05:12:19 -0000	1.9
+++ compiler/bytecode_data.m	10 Feb 2003 19:52:05 -0000
@@ -80,6 +80,7 @@
 
 :- implementation.
 
+:- import_module hlds.error_util.
 :- import_module char, require.
 
 output_string(Val) -->
@@ -289,6 +290,12 @@
 	
 	"
 ).
+float_to_float64_bytes(_FloatVal, _B0, _B1, _B2, _B3, _B4, _B5, _B6, _B7) :-
+	sorry(this_file, "float_to_float64_bytes for non-C target").
 
-%---------------------------------------------------------------------------%
+:- func this_file = string.
+this_file = "bytecode_data.m".
+
+:- end_module bytecode_data.
 
+%---------------------------------------------------------------------------%
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.272
diff -u -d -u -r1.272 mercury_compile.m
--- compiler/mercury_compile.m	10 Feb 2003 10:07:18 -0000	1.272
+++ compiler/mercury_compile.m	10 Feb 2003 19:52:05 -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 -u -r1.51 passes_aux.m
--- compiler/passes_aux.m	5 Feb 2003 14:41:14 -0000	1.51
+++ compiler/passes_aux.m	10 Feb 2003 19:52:05 -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/process_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/process_util.m,v
retrieving revision 1.7
diff -u -d -u -r1.7 process_util.m
--- compiler/process_util.m	22 Nov 2002 08:50:59 -0000	1.7
+++ compiler/process_util.m	10 Feb 2003 19:52:05 -0000
@@ -73,7 +73,7 @@
 :- implementation.
 
 :- import_module libs__globals, libs__options.
-:- import_module std_util.
+:- import_module std_util, require.
 
 build_with_check_for_interrupt(Build, Cleanup, Succeeded, Info0, Info) -->
 	setup_signal_handlers(MaybeSigIntHandler),
@@ -225,7 +225,7 @@
 :- pred check_for_signal(int::out, int::out,
 		io__state::di, io__state::uo) is det.
 
-check_for_signal(0::out, 0::out, _::di, _::uo).
+check_for_signal(0::out, 0::out, IO::di, IO::uo).
 
 :- pragma foreign_proc("C",
 	check_for_signal(Signalled::out, Signal::out, IO0::di, IO::uo),
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.73
diff -u -d -u -r1.73 stack_layout.m
--- compiler/stack_layout.m	15 Nov 2002 04:50:28 -0000	1.73
+++ compiler/stack_layout.m	10 Feb 2003 19:52:06 -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/top_level.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/top_level.m,v
retrieving revision 1.1
diff -u -d -u -r1.1 top_level.m
--- compiler/top_level.m	20 Mar 2002 12:37:29 -0000	1.1
+++ compiler/top_level.m	10 Feb 2003 19:52:06 -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.
 
 %-----------------------------------------------------------------------------%
cvs server: Diffing compiler/notes
cvs server: Diffing debian
cvs server: Diffing deep_profiler
cvs server: Diffing deep_profiler/notes
cvs server: Diffing doc
cvs server: Diffing extras
cvs server: Diffing extras/aditi
cvs server: Diffing extras/cgi
cvs server: Diffing extras/complex_numbers
cvs server: Diffing extras/complex_numbers/samples
cvs server: Diffing extras/complex_numbers/tests
cvs server: Diffing extras/concurrency
cvs server: Diffing extras/curs
cvs server: Diffing extras/curs/samples
cvs server: Diffing extras/curses
cvs server: Diffing extras/curses/sample
cvs server: Diffing extras/dynamic_linking
cvs server: Diffing extras/graphics
cvs server: Diffing extras/graphics/mercury_opengl
cvs server: Diffing extras/graphics/mercury_tcltk
cvs server: Diffing extras/graphics/samples
cvs server: Diffing extras/graphics/samples/calc
cvs server: Diffing extras/graphics/samples/maze
cvs server: Diffing extras/graphics/samples/pent
cvs server: Diffing extras/lazy_evaluation
cvs server: Diffing extras/lex
cvs server: Diffing extras/lex/samples
cvs server: Diffing extras/lex/tests
cvs server: Diffing extras/logged_output
cvs server: Diffing extras/moose
cvs server: Diffing extras/moose/samples
cvs server: Diffing extras/morphine
cvs server: Diffing extras/morphine/non-regression-tests
cvs server: Diffing extras/morphine/scripts
cvs server: Diffing extras/morphine/source
cvs server: Diffing extras/odbc
cvs server: Diffing extras/posix
cvs server: Diffing extras/quickcheck
cvs server: Diffing extras/quickcheck/tutes
cvs server: Diffing extras/references
cvs server: Diffing extras/references/samples
cvs server: Diffing extras/references/tests
cvs server: Diffing extras/stream
cvs server: Diffing extras/trailed_update
cvs server: Diffing extras/trailed_update/samples
cvs server: Diffing extras/trailed_update/tests
cvs server: Diffing extras/xml
cvs server: Diffing extras/xml/samples
cvs server: Diffing java
cvs server: Diffing java/library
cvs server: Diffing java/runtime
cvs server: Diffing library
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.105
diff -u -d -u -r1.105 Mmakefile
--- library/Mmakefile	5 Feb 2003 14:41:19 -0000	1.105
+++ library/Mmakefile	10 Feb 2003 19:52:06 -0000
@@ -222,7 +222,8 @@
 library_strong_name.sn:
 	sn -k library_strong_name.sn
 
-mercury.dll: copy_runtime_dlls lib$(STD_LIB_NAME) library_strong_name.sn
+mercury.dll: $($(STD_LIB_NAME).dlls) $($(STD_LIB_NAME).foreign_dlls) \
+		$(RUNTIME_DLLS) library_strong_name.sn
 	$(MS_AL) -v:0.0.0.0 -keyf:library_strong_name.sn -out:mercury.dll \
 		$($(STD_LIB_NAME).dlls) $($(STD_LIB_NAME).foreign_dlls) \
 		$(RUNTIME_DLLS) 
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.287
diff -u -d -u -r1.287 io.m
--- library/io.m	20 Jan 2003 12:23:08 -0000	1.287
+++ library/io.m	10 Feb 2003 19:52:07 -0000
@@ -2096,10 +2096,14 @@
 
 }").
 
-io__file_modification_time_2(_, _, _, _) -->
+io__file_modification_time_2(_FileName, Status, Msg, Time) -->
 	% This version is only used for back-ends for which there is no
 	% matching foreign_proc version.
-	{ private_builtin__sorry("io__file_modification_time_2") }.
+	{ Status = 0 },
+	{ Msg = "io__file_modification_time not implemented for this target "
+		++ "(or compiler back-end)" },
+	% This value will not be used
+	{ Time = rtti_implementation.unsafe_cast(0) }.
 
 %-----------------------------------------------------------------------------%
 
cvs server: Diffing profiler
cvs server: Diffing robdd
cvs server: Diffing runtime
cvs server: Diffing runtime/GETOPT
cvs server: Diffing runtime/machdeps
cvs server: Diffing samples
cvs server: Diffing samples/c_interface
cvs server: Diffing samples/c_interface/c_calls_mercury
cvs server: Diffing samples/c_interface/cplusplus_calls_mercury
cvs server: Diffing samples/c_interface/mercury_calls_c
cvs server: Diffing samples/c_interface/mercury_calls_cplusplus
cvs server: Diffing samples/c_interface/mercury_calls_fortran
cvs server: Diffing samples/c_interface/simpler_c_calls_mercury
cvs server: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs server: Diffing samples/diff
cvs server: Diffing samples/muz
cvs server: Diffing samples/rot13
cvs server: Diffing samples/solutions
cvs server: Diffing samples/tests
cvs server: Diffing samples/tests/c_interface
cvs server: Diffing samples/tests/c_interface/c_calls_mercury
cvs server: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs server: Diffing samples/tests/c_interface/mercury_calls_c
cvs server: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs server: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs server: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs server: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs server: Diffing samples/tests/diff
cvs server: Diffing samples/tests/muz
cvs server: Diffing samples/tests/rot13
cvs server: Diffing samples/tests/solutions
cvs server: Diffing samples/tests/toplevel
cvs server: Diffing scripts
cvs server: Diffing tests
cvs server: Diffing tests/benchmarks
cvs server: Diffing tests/debugger
cvs server: Diffing tests/debugger/declarative
cvs server: Diffing tests/dppd
cvs server: Diffing tests/general
cvs server: Diffing tests/general/accumulator
cvs server: Diffing tests/general/string_format
cvs server: Diffing tests/general/structure_reuse
cvs server: Diffing tests/grade_subdirs
cvs server: Diffing tests/hard_coded
cvs server: Diffing tests/hard_coded/exceptions
cvs server: Diffing tests/hard_coded/purity
cvs server: Diffing tests/hard_coded/sub-modules
cvs server: Diffing tests/hard_coded/typeclasses
cvs server: Diffing tests/invalid
cvs server: Diffing tests/invalid/purity
cvs server: Diffing tests/misc_tests
cvs server: Diffing tests/mmc_make
cvs server: Diffing tests/mmc_make/lib
cvs server: Diffing tests/recompilation
cvs server: Diffing tests/tabling
cvs server: Diffing tests/term
cvs server: Diffing tests/valid
cvs server: Diffing tests/warnings
cvs server: Diffing tools
cvs server: Diffing trace
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.36
diff -u -d -u -r1.36 Mmakefile
--- trace/Mmakefile	18 Oct 2002 04:16:18 -0000	1.36
+++ trace/Mmakefile	10 Feb 2003 19:52:07 -0000
@@ -125,8 +125,13 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: trace
+ifeq ($(findstring il,$(GRADE)),il)        
+# there is no tracing in the .NET backend
+trace:
+else
 trace: lib$(TRACE_LIB_NAME).$A lib$(TRACE_LIB_NAME).$(EXT_FOR_SHARED_LIB)
 trace: $(LIB_DLL_H) $(LIB_GLOBALS_H)
+endif
 
 lib$(TRACE_LIB_NAME)$(DLL_DEF_LIB).$A: $(OBJS)
 	rm -f lib$(TRACE_LIB_NAME)$(DLL_DEF_LIB).$A
cvs server: Diffing util
cvs server: Diffing vim
cvs server: Diffing vim/after
cvs server: Diffing vim/ftplugin
cvs server: Diffing vim/syntax
-- 
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