[m-dev.] for review: The .NET MSIL backend.

Tyson Dowd trd at cs.mu.OZ.AU
Sat Oct 14 12:01:01 AEDT 2000


Here's the last incremental diff.  I'm about to do some final testing
that I didn't break the compiler, then I'll commit.

diff -u mlds_to_il.m mlds_to_il.m
--- mlds_to_il.m
+++ mlds_to_il.m
@@ -469,7 +469,6 @@
 					extends_nothing, implements([]),
 					[ConstructorILDefn | ILDefns])]
 			; 
-				Entity = mlds__class(ClassDefn),
 				ClassType = mlds__struct
 			->
 				list__map(defn_to_class_decl, Defns, ILDefns),
@@ -1336,8 +1335,7 @@
 unaryop_to_il(box(Type), _, Instrs) -->
 	{ ILType = mlds_type_to_ilds_type(Type) },
 	{ already_boxed(ILType) ->
-		Instrs = node([isinst(ilds__type([], 
-			class([mscorlib_name, "System", "Object"])))])
+		Instrs = node([isinst(il_generic_type)])
 	;
 		Instrs = node([call(convert_to_object(ILType))])
 		% XXX can't just use box, because it requires a pointer to
@@ -2211,7 +2209,7 @@
 simple_type_to_value_class_name(refany) = _ :-
 	error("no value class name for refany").
 simple_type_to_value_class_name(class(Name)) = VCName :-
-	( Name = [mscorlib_name, "System", "String"] ->
+	( Name = il_string_class_name ->
 		VCName = "String"
 	;
 		error("unknown class name")
@@ -2246,14 +2244,13 @@
 	simple_type(int32), [il_string_type, il_string_type]).
 
 :- func il_string_class_name = ilds__class_name.
-il_string_class_name = [mscorlib_name, "System", "String"].
+il_string_class_name = il_system_name(["String"]).
 
 :- func il_string_simple_type = simple_type.
 il_string_simple_type = class(il_string_class_name).
 
 :- func il_string_type = ilds__type.
-il_string_type = ilds__type([], class([mscorlib_name, "System", "String"])).
-
+il_string_type = ilds__type([], il_string_simple_type).
 
 %-----------------------------------------------------------------------------%
 %
@@ -2266,7 +2263,7 @@
 :- func il_generic_simple_type = simple_type.
 il_generic_simple_type = class(il_generic_class_name).
 
-il_generic_class_name = [mscorlib_name, "System", "Object"].
+il_generic_class_name = il_system_name(["Object"]).
 
 %-----------------------------------------------------------------------------%
 %
@@ -2308,8 +2305,16 @@
 
 %-----------------------------------------------------------------------------
 
-:- func mscorlib_name = string. 
-mscorlib_name = "mscorlib".
+	% qualifiy a name with "[mscorlib]System."
+:- func il_system_name(ilds__class_name) = ilds__class_name.
+il_system_name(Name) = 
+	[il_system_assembly_name, il_system_namespace_name | Name].
+
+:- func il_system_assembly_name = string.
+il_system_assembly_name = "mscorlib".
+
+:- func il_system_namespace_name = string.
+il_system_namespace_name = "System".
 
 %-----------------------------------------------------------------------------
 
diff -u compiler/notes/compiler_design.html compiler/notes/compiler_design.html
--- compiler/notes/compiler_design.html
+++ compiler/notes/compiler_design.html
@@ -25,7 +25,7 @@
 
 The main job of the compiler is to translate Mercury into C, although it
 can also translate (subsets of) Mercury to some other languages: Goedel,
-Mercury bytecode (for a planned bytecode interpreter), MS IL (for the
+Mercury bytecode (for a planned bytecode interpreter), MSIL (for the
 Microsoft .NET platform) and RL (the Aditi Relational Language).
 
 <p>

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list