Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5724850

Browse files
committed
integrate master
2 parentsaf018f8 +1105511 commit5724850

File tree

73 files changed

+1124
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1124
-334
lines changed

‎build.cmd‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,7 @@ goto :eof
633633
:havemsbuild
634634
set_nrswitch=/nr:false
635635

636-
setmsbuildflags=%_nrswitch% /nologo
637-
REM set msbuildflags=%_nrswitch% /nologo
636+
setmsbuildflags=%_nrswitch% /nologo /clp:Summary /v:minimal
638637
set_ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
639638
ifnotexist%_ngenexe%echo Error: Could not find ngen.exe.&&goto :failure
640639

‎src/absil/il.fs‎

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,25 @@ type ILAttribElem =
950950

951951
typeILAttributeNamedArg=(string* ILType* bool* ILAttribElem)
952952

953-
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
954-
typeILAttribute=
955-
{ Method:ILMethodSpec
956-
Data:byte[]
957-
Elements:ILAttribElem list}
953+
[<RequireQualifiedAccess; StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
954+
typeILAttribute=
955+
| Encodedofmethod:ILMethodSpec*data:byte[]*elements:ILAttribElemlist
956+
| Decodedofmethod:ILMethodSpec*fixedArgs:ILAttribElemlist*namedArgs:ILAttributeNamedArglist
957+
958+
memberx.Method=
959+
match xwith
960+
| Encoded(method,_,_)
961+
| Decoded(method,_,_)-> method
962+
963+
memberx.Elements=
964+
match xwith
965+
| Encoded(_,_, elements)-> elements
966+
| Decoded(_, fixedArgs, namedArgs)-> fixedArgs@(namedArgs|> List.map(fun(_,_,_,e)-> e))
967+
968+
memberx.WithMethod(method:ILMethodSpec)=
969+
match xwith
970+
| Encoded(_, data, elements)-> Encoded(method, data, elements)
971+
| Decoded(_, fixedArgs, namedArgs)-> Decoded(method, fixedArgs, namedArgs)
958972

959973
/// For debugging
960974
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
@@ -3575,21 +3589,30 @@ let encodeCustomAttrNamedArg ilg (nm, ty, prop, elem) =
35753589
yield! encodeCustomAttrString nm
35763590
yield! encodeCustomAttrValue ilg ty elem|]
35773591

3578-
letmkILCustomAttribMethRef(ilg:ILGlobals)(mspec:ILMethodSpec,fixedArgs:list<_>,namedArgs:list<_>)=
3592+
letencodeCustomAttrArgs(ilg:ILGlobals)(mspec:ILMethodSpec)(fixedArgs:list<_>)(namedArgs:list<_>)=
35793593
letargtys= mspec.MethodRef.ArgTypes
3580-
letargs=
3581-
[|yield![|0x01uy;0x00uy;|]
3582-
for(argty, fixedArg)in Seq.zip argtys fixedArgsdo
3583-
yield! encodeCustomAttrValue ilg argty fixedArg
3584-
yield! u16AsBytes(uint16 namedArgs.Length)
3585-
for namedArgin namedArgsdo
3586-
yield! encodeCustomAttrNamedArg ilg namedArg|]
3587-
{ Method= mspec
3588-
Data= args
3589-
Elements= fixedArgs@(namedArgs|> List.map(fun(_,_,_,e)-> e))}
3590-
3591-
letmkILCustomAttribute ilg(tref,argtys,argvs,propvs)=
3592-
mkILCustomAttribMethRef ilg(mkILNonGenericCtorMethSpec(tref, argtys), argvs, propvs)
3594+
[|yield![|0x01uy;0x00uy;|]
3595+
for(argty, fixedArg)in Seq.zip argtys fixedArgsdo
3596+
yield! encodeCustomAttrValue ilg argty fixedArg
3597+
yield! u16AsBytes(uint16 namedArgs.Length)
3598+
for namedArgin namedArgsdo
3599+
yield! encodeCustomAttrNamedArg ilg namedArg|]
3600+
3601+
letencodeCustomAttr(ilg:ILGlobals)(mspec:ILMethodSpec,fixedArgs:list<_>,namedArgs:list<_>)=
3602+
letargs= encodeCustomAttrArgs ilg mspec fixedArgs namedArgs
3603+
ILAttribute.Encoded(mspec, args, fixedArgs@(namedArgs|> List.map(fun(_,_,_,e)-> e)))
3604+
3605+
letmkILCustomAttribMethRef(ilg:ILGlobals)(mspec:ILMethodSpec,fixedArgs:list<_>,namedArgs:list<_>)=
3606+
encodeCustomAttr ilg(mspec, fixedArgs, namedArgs)
3607+
3608+
letmkILCustomAttribute ilg(tref,argtys,argvs,propvs)=
3609+
encodeCustomAttr ilg(mkILNonGenericCtorMethSpec(tref, argtys), argvs, propvs)
3610+
3611+
letgetCustomAttrData(ilg:ILGlobals)cattr=
3612+
match cattrwith
3613+
| ILAttribute.Encoded(_, data,_)-> data
3614+
| ILAttribute.Decoded(mspec, fixedArgs, namedArgs)->
3615+
encodeCustomAttrArgs ilg mspec fixedArgs namedArgs
35933616

35943617
letMscorlibScopeRef= ILScopeRef.Assembly(ILAssemblyRef.Create("mscorlib", None, Some ecmaPublicKey,true, None, None))
35953618
letEcmaMscorlibILGlobals= mkILGlobals MscorlibScopeRef
@@ -3758,7 +3781,10 @@ type ILTypeSigParser(tstring : string) =
37583781
ILAttribElem.Type(Some(ilty))
37593782

37603783
letdecodeILAttribData(ilg:ILGlobals)(ca:ILAttribute)=
3761-
letbytes= ca.Data
3784+
match cawith
3785+
| ILAttribute.Decoded(_, fixedArgs, namedArgs)-> fixedArgs, namedArgs
3786+
| ILAttribute.Encoded(_, bytes,_)->
3787+
37623788
letsigptr=0
37633789
letbb0,sigptr= sigptr_get_byte bytes sigptr
37643790
letbb1,sigptr= sigptr_get_byte bytes sigptr
@@ -3947,7 +3973,7 @@ and refs_of_token s x =
39473973
| ILToken.ILMethod mr-> refs_of_mspec s mr
39483974
| ILToken.ILField fr-> refs_of_fspec s fr
39493975

3950-
andrefs_of_custom_attr sx= refs_of_mspec sx.Method
3976+
andrefs_of_custom_attr s(cattr:ILAttribute)= refs_of_mspec scattr.Method
39513977

39523978
andrefs_of_custom_attrs s(cas:ILAttributes)= List.iter(refs_of_custom_attr s) cas.AsList
39533979
andrefs_of_varargs s tyso= Option.iter(refs_of_tys s) tyso

‎src/absil/il.fsi‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,12 +752,22 @@ type ILAttribElem =
752752
/// Named args: values and flags indicating if they are fields or properties.
753753
typeILAttributeNamedArg= string* ILType* bool* ILAttribElem
754754

755-
/// Custom attributes. See 'decodeILAttribData' for a helper to parse the byte[]
756-
/// to ILAttribElem's as best as possible.
755+
/// Custom attribute.
757756
typeILAttribute=
758-
{ Method:ILMethodSpec
759-
Data:byte[]
760-
Elements:ILAttribElem list}
757+
/// Attribute with args encoded to a binary blob according to ECMA-335 II.21 and II.23.3.
758+
/// 'decodeILAttribData' is used to parse the byte[] blob to ILAttribElem's as best as possible.
759+
| Encodedofmethod:ILMethodSpec*data:byte[]*elements:ILAttribElemlist
760+
761+
/// Attribute with args in decoded form.
762+
| Decodedofmethod:ILMethodSpec*fixedArgs:ILAttribElemlist*namedArgs:ILAttributeNamedArglist
763+
764+
/// Attribute instance constructor.
765+
memberMethod:ILMethodSpec
766+
767+
/// Decoded arguments. May be empty in encoded attribute form.
768+
memberElements:ILAttribElem list
769+
770+
memberWithMethod:method:ILMethodSpec->ILAttribute
761771

762772
[<NoEquality; NoComparison; Struct>]
763773
type ILAttributes=
@@ -1679,6 +1689,8 @@ val mkILCustomAttribute:
16791689
ILAttributeNamedArg list(* named args: values and flags indicating if they are fields or properties*)
16801690
-> ILAttribute
16811691

1692+
val getCustomAttrData: ILGlobals-> ILAttribute-> byte[]
1693+
16821694
val mkPermissionSet: ILGlobals-> ILSecurityAction*(ILTypeRef*(string* ILType* ILAttribElem) list) list-> ILSecurityDecl
16831695

16841696
/// Making code.

‎src/absil/ilmorph.fs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,19 @@ let rec celem_ty2ty f celem =
136136
letcnamedarg_ty2ty f((nm,ty,isProp,elem):ILAttributeNamedArg)=
137137
(nm, f ty, isProp, celem_ty2ty f elem)
138138

139-
letcattr_ty2ty ilg fc=
139+
letcattr_ty2ty ilg f(c:ILAttribute)=
140140
letmeth= mspec_ty2ty(f,(fun _-> f)) c.Method
141141
// dev11 M3 defensive coding: if anything goes wrong with attribute decoding or encoding, then back out.
142142
if morphCustomAttributeDatathen
143143
try
144144
letelems,namedArgs= IL.decodeILAttribData ilg c
145145
letelems= elems|> List.map(celem_ty2ty f)
146146
letnamedArgs= namedArgs|> List.map(cnamedarg_ty2ty f)
147-
IL.mkILCustomAttribMethRef ilg(meth, elems, namedArgs)
148-
with_->
149-
{ cwith Method=meth}
147+
mkILCustomAttribMethRef ilg(meth, elems, namedArgs)
148+
with_->
149+
c.WithMethod(meth)
150150
else
151-
{ cwith Method=meth}
151+
c.WithMethod(meth)
152152

153153

154154
letcattrs_ty2ty ilg f(cs:ILAttributes)=

‎src/absil/ilprint.fs‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ let tyvar_generator =
3030
// Carry an environment because the way we print method variables
3131
// depends on the gparams of the current scope.
3232
typeppenv=
33-
{ ppenvClassFormals:int;
33+
{ ilGlobals:ILGlobals
34+
ppenvClassFormals:int;
3435
ppenvMethodFormals:int}
3536
letppenv_enter_method mgparams env=
3637
{envwith ppenvMethodFormals=mgparams}
3738
letppenv_enter_tdef gparams env=
3839
{envwith ppenvClassFormals=List.length gparams; ppenvMethodFormals=0}
39-
letmk_ppenv={ ppenvClassFormals=0; ppenvMethodFormals=0}
40+
letmk_ppenvilg={ilGlobals= ilg;ppenvClassFormals=0; ppenvMethodFormals=0}
4041
letdebug_ppenv= mk_ppenv
4142
letppenv_enter_modul env={ envwith ppenvClassFormals=0; ppenvMethodFormals=0}
4243

@@ -469,10 +470,11 @@ let output_basic_type os x =
469470
letoutput_custom_attr_data os data=
470471
output_string os" ="; output_parens output_bytes os data
471472

472-
letgoutput_custom_attr env os attr=
473+
letgoutput_custom_attr env os(attr:ILAttribute)=
473474
output_string os" .custom"
474475
goutput_mspec env os attr.Method
475-
output_custom_attr_data os attr.Data
476+
letdata= getCustomAttrData env.ilGlobals attr
477+
output_custom_attr_data os data
476478

477479
letgoutput_custom_attrs env os(attrs:ILAttributes)=
478480
List.iter(fun attr-> goutput_custom_attr env os attr; output_string os"\n") attrs.AsList
@@ -1029,19 +1031,19 @@ let goutput_manifest env os m =
10291031
output_string os" }\n"
10301032

10311033

1032-
letoutput_module_fragment_aux _refs osmodul=
1034+
letoutput_module_fragment_aux _refs os(ilg:ILGlobals)modul=
10331035
try
1034-
letenv= mk_ppenv
1036+
letenv= mk_ppenvilg
10351037
letenv= ppenv_enter_modul env
10361038
goutput_tdefsfalse([]) env os modul.TypeDefs;
10371039
goutput_tdefstrue([]) env os modul.TypeDefs;
10381040
with e->
10391041
output_string os"*** Error during printing :"; output_string os(e.ToString()); os.Flush();
10401042
reraise()
10411043

1042-
letoutput_module_fragment osmodul=
1044+
letoutput_module_fragment os(ilg:ILGlobals)modul=
10431045
letrefs= computeILRefs modul
1044-
output_module_fragment_aux refs os modul;
1046+
output_module_fragment_aux refs osilg modul
10451047
refs
10461048

10471049
letoutput_module_refs os refs=
@@ -1059,14 +1061,14 @@ let goutput_module_manifest env os modul =
10591061
output_string os"\n";
10601062
(output_option(goutput_manifest env)) os modul.Manifest
10611063

1062-
letoutput_module osmodul=
1064+
letoutput_module os(ilg:ILGlobals)modul=
10631065
try
10641066
letrefs= computeILRefs modul
1065-
letenv= mk_ppenv
1067+
letenv= mk_ppenvilg
10661068
letenv= ppenv_enter_modul env
10671069
output_module_refs os refs;
10681070
goutput_module_manifest env os modul;
1069-
output_module_fragment_aux refs os modul;
1071+
output_module_fragment_aux refs osilg modul;
10701072
with e->
10711073
output_string os"*** Error during printing :"; output_string os(e.ToString()); os.Flush();
10721074
raise e

‎src/absil/ilprint.fsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal
99
openSystem.IO
1010

1111
#if DEBUG
12-
valpublicoutput_module:TextWriter->ILModuleDef->unit
12+
valpublicoutput_module:TextWriter->ilg:ILGlobals->ILModuleDef->unit
1313
#endif
1414

‎src/absil/ilread.fs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,12 +2567,13 @@ and seekReadCustomAttr ctxt (TaggedIndex(cat, idx), b) =
25672567

25682568
andseekReadCustomAttrUncached ctxtH(CustomAttrIdx(cat,idx,valIdx))=
25692569
letctxt= getHole ctxtH
2570-
{ Method=seekReadCustomAttrType ctxt(TaggedIndex(cat, idx))
2571-
Data=
2570+
letmethod=seekReadCustomAttrType ctxt(TaggedIndex(cat, idx))
2571+
letdata=
25722572
match readBlobHeapOption ctxt valIdxwith
25732573
| Some bytes-> bytes
2574-
| None-> Bytes.ofInt32Array[||]
2575-
Elements=[]}
2574+
| None-> Bytes.ofInt32Array[||]
2575+
letelements=[]
2576+
ILAttribute.Encoded(method, data, elements)
25762577

25772578
andsecurityDeclsReader ctxtH tag=
25782579
mkILSecurityDeclsReader

‎src/absil/ilreflect.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,12 +1414,12 @@ let emitMethodBody cenv modB emEnv ilG _name (mbody: ILLazyMethodBody) =
14141414
| MethodBody.Native-> failwith"emitMethodBody: native"
14151415
| MethodBody.NotAvailable-> failwith"emitMethodBody: metadata only"
14161416

1417-
letconvCustomAttr cenv emEnv cattr=
1417+
letconvCustomAttr cenv emEnv(cattr:ILAttribute)=
14181418
letmethInfo=
14191419
match convConstructorSpec cenv emEnv cattr.Methodwith
14201420
|null-> failwithf"convCustomAttr:%+A" cattr.Method
14211421
| res-> res
1422-
letdata=cattr.Data
1422+
letdata=getCustomAttrData cenv.ilg cattr
14231423
(methInfo, data)
14241424

14251425
letemitCustomAttr cenv emEnv add cattr= add(convCustomAttr cenv emEnv cattr)

‎src/absil/ilwrite.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,8 +1382,9 @@ and GetMethodRefAsCustomAttribType cenv (mref:ILMethodRef) =
13821382
let recGetCustomAttrDataAsBlobIdx cenv(data:byte[])=
13831383
if data.Length=0then0else GetBytesAsBlobIdx cenv data
13841384

1385-
andGetCustomAttrRow cenv hca attr=
1385+
andGetCustomAttrRow cenv hca(attr:ILAttribute)=
13861386
letcat= GetMethodRefAsCustomAttribType cenv attr.Method.MethodRef
1387+
letdata= getCustomAttrData cenv.ilg attr
13871388
for elementin attr.Elementsdo
13881389
match elementwith
13891390
| ILAttribElem.Type(Some ty)when ty.IsNominal-> GetTypeRefAsTypeRefIdx cenv ty.TypeRef|> ignore
@@ -1393,7 +1394,7 @@ and GetCustomAttrRow cenv hca attr =
13931394
UnsharedRow
13941395
[| HasCustomAttribute(fst hca, snd hca);
13951396
CustomAttributeType(fst cat, snd cat);
1396-
Blob(GetCustomAttrDataAsBlobIdx cenvattr.Data)
1397+
Blob(GetCustomAttrDataAsBlobIdx cenvdata)
13971398
|]
13981399

13991400
andGenCustomAttrPass3Or4 cenv hca attr=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp