[m-rev.] Re: for review: various mlds_to_il fixes

Peter Ross peter.ross at miscrit.be
Fri Jul 13 20:07:47 AEST 2001


Here is a slight update to the change.

--- mlds_to_il.m
+++ mlds_to_il.m
@@ -1049,3 +1049,17 @@
-	{ Type = ilds__type(_Mods, '[]'(ElemType0, _Bounds)) ->
-		ElemType = ElemType0,
-		ElemType = ilds__type(_ElemMods, ElemSimpleType)
+	( { Type = ilds__type(_Mods, '[]'(ElemType, _Bounds)) } ->
+		{ ElemType = ilds__type(_ElemMods, ElemSimpleType) },
+		{ AllocInstrs = node([ldc(int32, i(list__length(InitList))), 
+			newarr(ElemType)]) },
+		{ AddInitializer = 
+			(pred(Init::in, X0 - Tree0::in, (X0 + 1) - Tree::out,
+					in, out) is det -->
+				data_initializer_to_instrs(ElemType,
+						Init, ATree1, ITree1),
+				{ Tree = tree(tree(Tree0, node(
+						[dup, ldc(int32, i(X0))])), 
+					tree(tree(ATree1, ITree1), 
+						node([stelem(ElemSimpleType)]
+					))) }
+			) },
+		list__foldl2(AddInitializer, InitList,
+				0 - empty, _ - InitInstrs)
@@ -1053,16 +1067,5 @@
-		unexpected(this_file, "non array type")
-	},
-	{ AllocInstrs = node([ldc(int32, i(list__length(InitList))), 
-		newarr(ElemType)]) },
-	{ AddInitializer = 
-		(pred(Init::in, X0 - Tree0::in, (X0 + 1) - Tree::out,
-				in, out) is det -->
-			data_initializer_to_instrs(ElemType,
-					Init, ATree1, ITree1),
-			{ Tree = tree(tree(Tree0, node(
-					[dup, ldc(int32, i(X0))])), 
-				tree(tree(ATree1, ITree1), 
-					node([stelem(ElemSimpleType)]
-				))) }
-		) },
-	list__foldl2(AddInitializer, InitList, 0 - empty, _ - InitInstrs).
+			% XXX Revert to the old behaviour when we are
+			% not being passed an array type.
+		data_initializer_to_instrs(Type, init_struct(InitList),
+				AllocInstrs, InitInstrs)
+	).
--------------------------------------------------------------------------
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