[m-rev.] for review: MLDS back-end: generate closure layouts

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Mar 2 00:49:55 AEDT 2002


On 28-Feb-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> I'm not going to commit this until I solve the second XXX below.

Fixed.  Relative diff follows.  I will also repost a new full diff.

--- CHANGES10.orig	Sat Mar  2 00:44:26 2002
+++ CHANGES10	Sat Mar  2 00:45:49 2002
@@ -30,7 +30,9 @@
 	a var_name, and counts references via data_addr_consts,
 	and to change the code for ml_decl_is_static_const so that
 	it just checks for `data(_)' rather than `data(var(_))'.
-	XXX These fixes apparently don't solve the problem :-(
+
+compiler/rtti_to_mlds.m:
+	Mark RTTI definitions as `final', and document why.
 
 compiler/ml_optimize.m:
 	Update to reflect the interface changes in ml_util.m.

diff -u compiler/ml_code_util.m compiler/ml_code_util.m
--- compiler/ml_code_util.m
+++ compiler/ml_code_util.m
@@ -1672,6 +1672,8 @@
 
 	% Return the declaration flags appropriate for an
 	% initialized local static constant.
+	% Note that rtti_decl_flags, in rtti_to_mlds.m,
+	% must be the same as this apart from the access.
 	%
 ml_static_const_decl_flags = MLDS_DeclFlags :-
 	Access = local,
diff -u compiler/ml_unify_gen.m compiler/ml_unify_gen.m
--- compiler/ml_unify_gen.m
+++ compiler/ml_unify_gen.m
@@ -762,8 +762,14 @@
 			module_info_name(ModuleInfo, ModuleName),
 			RttiData = pseudo_type_info(Pseudo),
 			rtti_data_to_name(RttiData, RttiTypeId, RttiName),
-			MLDS_Defns = rtti_data_list_to_mlds(ModuleInfo,
-				[RttiData]) ++ MLDS_Defns0
+			RttiDefns0 = rtti_data_list_to_mlds(ModuleInfo,
+				[RttiData]),
+			% rtti_data_list_to_mlds assumes that the result
+			% will be at file scope, but here we're generating it
+			% as a local, so we need to convert the access
+			% to `local'
+			RttiDefns = list__map(convert_to_local, RttiDefns0),
+			MLDS_Defns = RttiDefns ++ MLDS_Defns0
 		),
 		MLDS_ModuleName = mercury_module_name_to_mlds(ModuleName),
 		ArgRval = const(data_addr_const(data_addr(MLDS_ModuleName,
@@ -772,6 +778,11 @@
 	),
 	CastArgRval = unop(box(ArgType), ArgRval),
 	ArgInit = init_obj(CastArgRval).
+
+:- func convert_to_local(mlds__defn) = mlds__defn.
+convert_to_local(mlds__defn(Name, Context, Flags0, Body)) =
+		mlds__defn(Name, Context, Flags, Body) :-
+	Flags = set_access(Flags0, local).
 
 :- pred ml_stack_layout_construct_tvar_vector(module_info::in,
 	mlds__var_name::in, prog_context::in, map(tvar, set(layout_locn))::in,
only in patch2:
--- compiler/rtti_to_mlds.m	25 Jan 2002 08:22:53 -0000	1.24
+++ compiler/rtti_to_mlds.m	1 Mar 2002 13:41:02 -0000
@@ -101,6 +101,8 @@
 
 
 	% Return the declaration flags appropriate for an rtti_data.
+	% Note that this must be the same as ml_static_const_decl_flags,
+	% except for the access, so that ml_decl_is_static_const works.
 	%
 :- func rtti_data_decl_flags(bool) = mlds__decl_flags.
 rtti_data_decl_flags(Exported) = MLDS_DeclFlags :-
@@ -111,7 +113,7 @@
 	),
 	PerInstance = one_copy,
 	Virtuality = non_virtual,
-	Finality = overridable,
+	Finality = final,
 	Constness = const,
 	Abstractness = concrete,
 	MLDS_DeclFlags = init_decl_flags(Access, PerInstance,
-- 
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