@@ -98,6 +98,13 @@ let output_seq sep f os (a:seq<_>) =
9898 output_ string os sep;
9999 f os e.Current
100100
101+ let output_array sep f os ( a : _ []) =
102+ if not ( Array.isEmpty a) then
103+ for iin 0 .. a.Length-2 do
104+ f os a.[ i]
105+ output_ string os sep
106+ f os( a.[ a.Length- 1 ])
107+
101108let output_parens f os a = output_ string os" (" ; f os a; output_ string os" )"
102109let output_angled f os a = output_ string os" <" ; f os a; output_ string os" >"
103110let output_bracks f os a = output_ string os" [" ; f os a; output_ string os" ]"
@@ -437,12 +444,12 @@ let output_option f os = function None -> () | Some x -> f os x
437444
438445let goutput_alternative_ref env os ( alt : IlxUnionAlternative ) =
439446 output_ id os alt.Name;
440- alt.FieldDefs|> Array.toList |> output_ parens( output _ seq " ," ( fun os fdef -> goutput_ typ env os fdef.Type)) os
447+ alt.FieldDefs|> output_ parens( output _ array " ," ( fun os fdef -> goutput_ typ env os fdef.Type)) os
441448
442449let goutput_curef env os ( IlxUnionRef ( _ , tref , alts , _ , _ )) =
443450 output_ string os" .classunion import" ;
444451 goutput_ tref env os tref;
445- output_ parens( output _ seq " ," ( goutput_ alternative_ ref env)) os( Array.toList alts)
452+ output_ parens( output _ array " ," ( goutput_ alternative_ ref env)) os alts
446453
447454let goutput_cuspec env os ( IlxUnionSpec ( IlxUnionRef ( _ , tref , _ , _ , _ ), i )) =
448455 output_ string os" class /* classunion */" ;
@@ -477,7 +484,7 @@ let goutput_custom_attr env os (attr: ILAttribute) =
477484 output_ custom_ attr_ data os data
478485
479486let goutput_custom_attrs env os ( attrs : ILAttributes ) =
480- List .iter( fun attr -> goutput_ custom_ attr env os attr; output_ string os" \n " ) attrs.AsList
487+ Array .iter( fun attr -> goutput_ custom_ attr env os attr; output_ string os" \n " ) attrs.AsArray
481488
482489let goutput_fdef _tref env os ( fd : ILFieldDef ) =
483490 output_ string os" .field"
@@ -704,7 +711,7 @@ let rec goutput_instr env os inst =
704711 goutput_ dlocref env os( mkILArrTy( typ, shape));
705712 output_ string os" .ctor" ;
706713let rank = shape.Rank
707- output_ parens( output _ seq " ," ( goutput_ typ env)) os( Array.toList ( Array. create( rank) EcmaMscorlibILGlobals.typ_ Int32) )
714+ output_ parens( output _ array " ," ( goutput_ typ env)) os( Array.create( rank) EcmaMscorlibILGlobals.typ_ Int32)
708715| I_ stelem_ any( shape, dt) ->
709716if shape= ILArrayShape.SingleDimensionalthen
710717 output_ string os" stelem.any" ; goutput_ typ env os dt
@@ -713,7 +720,9 @@ let rec goutput_instr env os inst =
713720 goutput_ dlocref env os( mkILArrTy( dt, shape));
714721 output_ string os" Set" ;
715722let rank = shape.Rank
716- output_ parens( output_ seq" ," ( goutput_ typ env)) os( Array.toList( Array.create( rank) EcmaMscorlibILGlobals.typ_ Int32) @ [ dt])
723+ let arr = Array.create( rank+ 1 ) EcmaMscorlibILGlobals.typ_ Int32
724+ arr.[ rank] <- dt
725+ output_ parens( output_ array" ," ( goutput_ typ env)) os arr
717726| I_ ldelem_ any( shape, tok) ->
718727if shape= ILArrayShape.SingleDimensionalthen
719728 output_ string os" ldelem.any" ; goutput_ typ env os tok
@@ -724,7 +733,7 @@ let rec goutput_instr env os inst =
724733 goutput_ dlocref env os( mkILArrTy( tok, shape));
725734 output_ string os" Get" ;
726735let rank = shape.Rank
727- output_ parens( output _ seq " ," ( goutput_ typ env)) os( Array.toList ( Array. create( rank) EcmaMscorlibILGlobals.typ_ Int32) )
736+ output_ parens( output _ array " ," ( goutput_ typ env)) os( Array.create( rank) EcmaMscorlibILGlobals.typ_ Int32)
728737| I_ ldelema( ro,_, shape, tok) ->
729738if ro= ReadonlyAddressthen output_ string os" readonly." ;
730739if shape= ILArrayShape.SingleDimensionalthen
@@ -736,7 +745,7 @@ let rec goutput_instr env os inst =
736745 goutput_ dlocref env os( mkILArrTy( tok, shape));
737746 output_ string os" Address" ;
738747let rank = shape.Rank
739- output_ parens( output _ seq " ," ( goutput_ typ env)) os( Array.toList ( Array. create( rank) EcmaMscorlibILGlobals.typ_ Int32) )
748+ output_ parens( output _ array " ," ( goutput_ typ env)) os( Array.create( rank) EcmaMscorlibILGlobals.typ_ Int32)
740749
741750| I_ box tok-> output_ string os" box" ; goutput_ typ env os tok
742751| I_ unbox tok-> output_ string os" unbox" ; goutput_ typ env os tok
@@ -890,7 +899,7 @@ let splitTypeLayout = function
890899let goutput_fdefs tref env os ( fdefs : ILFieldDefs ) =
891900 List.iter( fun f -> ( goutput_ fdef tref env) os f; output_ string os" \n " ) fdefs.AsList
892901let goutput_mdefs env os ( mdefs : ILMethodDefs ) =
893- List .iter( fun f -> ( goutput_ mdef env) os f; output_ string os" \n " ) mdefs.AsList
902+ Array .iter( fun f -> ( goutput_ mdef env) os f; output_ string os" \n " ) mdefs.AsArray
894903let goutput_pdefs env os ( pdefs : ILPropertyDefs ) =
895904 List.iter( fun f -> ( goutput_ pdef env) os f; output_ string os" \n " ) pdefs.AsList
896905