[m-rev.] diff: disable closure layouts for non-C targets

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Mar 6 19:03:22 AEDT 2002


Estimated hours taken: 0.5
Branches: main

compiler/ml_closure_gen.m:
	Disable generation of closure layouts for non-C targets, since
	apparently this causes some problems with the IL back-end.

Workspace: /home/earth/fjh/ws-earth4/mercury
Index: compiler/ml_closure_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_closure_gen.m,v
retrieving revision 1.1
diff -u -d -r1.1 ml_closure_gen.m
--- compiler/ml_closure_gen.m	4 Mar 2002 07:31:35 -0000	1.1
+++ compiler/ml_closure_gen.m	6 Mar 2002 07:40:43 -0000
@@ -61,7 +61,7 @@
 
 :- implementation.
 
-:- import_module hlds_module.
+:- import_module hlds_module, prog_util.
 :- import_module code_model, pseudo_type_info, rtti.
 :- import_module ml_unify_gen, ml_call_gen, rtti_to_mlds.
 :- import_module type_util, mode_util, error_util.
@@ -100,9 +100,27 @@
 	% this is a static constant that holds information
 	% about how the structure of this closure.
 	%
-	ml_gen_closure_layout(PredId, ProcId, Context,
-		ClosureLayoutRval, ClosureLayoutType,
-		ClosureLayoutDecls),
+	=(MLGenInfo),
+	{ ml_gen_info_get_module_info(MLGenInfo, ModuleInfo) },
+	{ module_info_globals(ModuleInfo, Globals) },
+	{ globals__get_target(Globals, Target) },
+	( { Target = c } ->
+		ml_gen_closure_layout(PredId, ProcId, Context,
+			ClosureLayoutRval, ClosureLayoutType,
+			ClosureLayoutDecls)
+	;
+		% XXX for targets other than C, there are apparently some
+		% problems (type errors?) with the code generated for
+		% closure layouts, so just fill in a dummy value instead
+		{ mercury_private_builtin_module(PrivateBuiltinModule) },
+		{ MLDS_PrivateBuiltinModule = mercury_module_name_to_mlds(
+			PrivateBuiltinModule) },
+		{ ClosureLayoutType = mlds__class_type(
+			qual(MLDS_PrivateBuiltinModule,
+				"closure_layout"), 0, mlds__class) },
+		{ ClosureLayoutRval = const(null(ClosureLayoutType)) },
+		{ ClosureLayoutDecls = [] }
+	),
 
 	%
 	% Generate a wrapper function which just unboxes the

-- 
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