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

Commit5bfd9fc

Browse files
dsymeTIHan
authored andcommitted
[RFCs FS-1051, FS-1052, FS-1053] support for span, readonly refs, byref-like structs (dotnet#4888)
* initial support for span, readonly refs, byref-like structs* fix proto build* make proto work with previous FSharp.Core* make proto work with previous FSharp.Core* update baselines* integrate code cleanup* integrate code cleanup* integrate code cleanup* integrate code cleanup* fix build* fix build* implicit deref of byref returns* add tests for Memory, ReadOnlySpan and ReadOnlyMemory* fix tests* simplify diff* simplify diff* remove duplicate error messages* fix build* test updates* fix build* fix build* update baselines* fix uses of NativePtr.toByRef* switch to inference using byref pointer capabilities* fix proto build* update baselines, byref extension methods* fix test errors* emit in,out,modreq attributes correctly* update tests* fix build* fix build* fix tests* fix tests* get it right silly boy* fix test* minor cleanup* add more tests* clarify overloading behaviour + test case* fix build break* fix build of tests* update tests* add more tests* byref fixes* updates for subsumption calls, error message, assign-to-return-byref* test updates, implicit deref on byref return for normal functions* update baseline* improve debug formatting, better error message on implicit deref, improve error messages* add more tests for recursive functions* update baselines* fix baselines* updates for new test cases* updates for new test cases* test updates and byref-to-byreflike* deal with 'M() <- expr'* restrict addresses of immutable top-level things* fix IsByRefLike on struct* update tests* fix test* fix test* improve check for no-return-of-struct-field-addresses* fix test case
1 parente21c296 commit5bfd9fc

File tree

90 files changed

+6856
-2747
lines changed

Some content is hidden

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

90 files changed

+6856
-2747
lines changed

‎DEVGUIDE.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ To do this, build the non-buildfromsource version of FSharp.Compiler.Private (sr
223223

224224
.\build net40
225225
copy /y src\fsharp\FSharp.Compiler.Private\obj\release\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private\
226-
227226

228227
####Configuring proxy server
229228

‎packages.config‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
<packageid="Microsoft.FSharp.TupleSample"version="1.0.0-alpha-161121"/>
3939
<packageid="Microsoft.VSSDK.BuildTools"version="15.1.192" />
4040

41+
<!-- Testing Span-->
42+
<packageid="System.Memory"version="4.5.0-rc1" />
43+
<packageid="System.Runtime.CompilerServices.Unsafe"version="4.5.0-rc1" />
44+
<packageid="NETStandard.Library.NETFramework"version="2.0.0-preview2-25405-01" />
45+
4146
<!-- Annoyingly the build of FSharp.Compiler.Server.Shared references a Visual Studio-specific attribute-->
4247
<!-- That DLL is logically part of the F# Compiler and F# Interactive but is shipped as part of the Visual F# IDE Tools-->
4348
<packageid="Microsoft.VisualStudio.Shell.Immutable.10.0"version="10.0.30319"targetFramework="net46" />

‎src/absil/il.fs‎

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Microsoft.FSharp.Compiler.AbstractIL.IL
88

99

1010
openSystem
11+
openSystem.Diagnostics
1112
openSystem.IO
1213
openSystem.Collections
1314
openSystem.Collections.Generic
@@ -568,7 +569,7 @@ type ILBoxity =
568569
| AsValue
569570

570571
// IL type references have a pre-computed hash code to enable quick lookup tables during binary generation.
571-
[<CustomEquality; CustomComparison>]
572+
[<CustomEquality; CustomComparison; StructuredFormatDisplay("{DebugText}")>]
572573
typeILTypeRef=
573574
{ trefScope:ILScopeRef
574575
trefEnclosing:string list
@@ -637,11 +638,15 @@ type ILTypeRef =
637638
membertref.QualifiedName=
638639
tref.AddQualifiedNameExtension(tref.BasicQualifiedName)
639640

641+
/// For debugging
642+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
643+
memberx.DebugText= x.ToString()
644+
645+
/// For debugging
640646
overridex.ToString()= x.FullName
641647

642648

643-
and
644-
[<StructuralEquality; StructuralComparison>]
649+
and [<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
645650
ILTypeSpec=
646651
{ tspecTypeRef:ILTypeRef
647652
/// The type instantiation if the type is generic.
@@ -671,9 +676,13 @@ and
671676

672677
memberx.FullName=x.TypeRef.FullName
673678

679+
/// For debugging
680+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
681+
memberx.DebugText= x.ToString()
682+
674683
overridex.ToString()= x.TypeRef.ToString()+if isNil x.GenericArgsthen""else"<...>"
675684

676-
and [<RequireQualifiedAccess; StructuralEquality; StructuralComparison>]
685+
and [<RequireQualifiedAccess; StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
677686
ILType=
678687
| Void
679688
| ArrayofILArrayShape*ILType
@@ -740,6 +749,10 @@ and [<RequireQualifiedAccess; StructuralEquality; StructuralComparison>]
740749
match xwith
741750
| ILType.TypeVar_->true|_->false
742751

752+
/// For debugging
753+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
754+
memberx.DebugText= x.ToString()
755+
743756
overridex.ToString()= x.QualifiedName
744757

745758
and [<StructuralEquality; StructuralComparison>]
@@ -756,6 +769,7 @@ let mkILCallSig (cc, args, ret) = { ArgTypes=args; CallingConv=cc; ReturnType=re
756769

757770
letmkILBoxedType(tspec:ILTypeSpec)= tspec.TypeRef.AsBoxedType tspec
758771

772+
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
759773
typeILMethodRef=
760774
{ mrefParent:ILTypeRef
761775
mrefCallconv:ILCallingConv
@@ -783,26 +797,34 @@ type ILMethodRef =
783797
static memberCreate(a,b,c,d,e,f)=
784798
{ mrefParent= a;mrefCallconv=b;mrefName=c;mrefGenericArity=d; mrefArgs=e;mrefReturn=f}
785799

800+
/// For debugging
801+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
802+
memberx.DebugText= x.ToString()
803+
786804
overridex.ToString()= x.DeclaringTypeRef.ToString()+"::"+ x.Name+"(...)"
787805

788806

789-
[<StructuralEquality; StructuralComparison>]
807+
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
790808
typeILFieldRef=
791809
{ DeclaringTypeRef:ILTypeRef
792810
Name:string
793811
Type:ILType}
794812

813+
/// For debugging
814+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
815+
memberx.DebugText= x.ToString()
816+
795817
overridex.ToString()= x.DeclaringTypeRef.ToString()+"::"+ x.Name
796818

797-
[<StructuralEquality; StructuralComparison>]
819+
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
798820
typeILMethodSpec=
799821
{ mspecMethodRef:ILMethodRef
800822

801823
mspecDeclaringType:ILType
802824

803825
mspecMethodInst:ILGenericArgs}
804826

805-
static memberCreate(a,b,c)={ mspecDeclaringType=a; mspecMethodRef=b; mspecMethodInst=c}
827+
static memberCreate(a,b,c)={ mspecDeclaringType=a; mspecMethodRef=b; mspecMethodInst=c}
806828

807829
memberx.MethodRef= x.mspecMethodRef
808830

@@ -820,8 +842,13 @@ type ILMethodSpec =
820842

821843
memberx.FormalReturnType= x.MethodRef.ReturnType
822844

845+
/// For debugging
846+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
847+
memberx.DebugText= x.ToString()
848+
823849
overridex.ToString()= x.MethodRef.ToString()+"(...)"
824850

851+
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
825852
typeILFieldSpec=
826853
{ FieldRef:ILFieldRef
827854
DeclaringType:ILType}
@@ -832,6 +859,10 @@ type ILFieldSpec =
832859

833860
memberx.DeclaringTypeRef= x.FieldRef.DeclaringTypeRef
834861

862+
/// For debugging
863+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
864+
memberx.DebugText= x.ToString()
865+
835866
overridex.ToString()= x.FieldRef.ToString()
836867

837868
// --------------------------------------------------------------------
@@ -865,6 +896,7 @@ type ILSourceDocument =
865896

866897
memberx.File=x.sourceFile
867898

899+
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
868900
typeILSourceMarker=
869901
{ sourceDocument:ILSourceDocument
870902
sourceLine:int
@@ -889,6 +921,10 @@ type ILSourceMarker =
889921

890922
memberx.EndColumn=x.sourceEndColumn
891923

924+
/// For debugging
925+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
926+
memberx.DebugText= x.ToString()
927+
892928
overridex.ToString()= sprintf"(%d,%d)-(%d,%d)" x.Line x.Column x.EndLine x.EndColumn
893929

894930
typeILAttribElem=
@@ -912,11 +948,16 @@ type ILAttribElem =
912948

913949
typeILAttributeNamedArg=(string* ILType* bool* ILAttribElem)
914950

951+
[<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>]
915952
typeILAttribute=
916953
{ Method:ILMethodSpec
917954
Data:byte[]
918955
Elements:ILAttribElem list}
919956

957+
/// For debugging
958+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
959+
memberx.DebugText= x.ToString()
960+
920961
overridex.ToString()= x.Method.ToString()+"(...)"
921962

922963
[<NoEquality; NoComparison; Struct>]
@@ -1424,6 +1465,8 @@ type ILReturn =
14241465

14251466
memberx.CustomAttrs= x.CustomAttrsStored.GetCustomAttrs x.MetadataIndex
14261467

1468+
memberx.WithCustomAttrs(customAttrs)={ xwith CustomAttrsStored= storeILCustomAttrs customAttrs}
1469+
14271470
typeILOverridesSpec=
14281471
| OverridesSpecofILMethodRef*ILType
14291472

@@ -1475,6 +1518,7 @@ type ILGenericVariance =
14751518
| CoVariant
14761519
| ContraVariant
14771520

1521+
[<NoEquality; NoComparison; StructuredFormatDisplay("{DebugText}")>]
14781522
typeILGenericParameterDef=
14791523
{ Name:string
14801524
Constraints:ILTypes
@@ -1487,6 +1531,10 @@ type ILGenericParameterDef =
14871531

14881532
memberx.CustomAttrs= x.CustomAttrsStored.GetCustomAttrs x.MetadataIndex
14891533

1534+
/// For debugging
1535+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
1536+
memberx.DebugText= x.ToString()
1537+
14901538
overridex.ToString()= x.Name
14911539

14921540
typeILGenericParameterDefs= ILGenericParameterDef list
@@ -1665,7 +1713,7 @@ type ILMethodDefs(f : (unit -> ILMethodDef[])) =
16651713

16661714
memberx.FindByNameAndArity(nm,arity)= x.FindByName nm|> List.filter(fun x-> List.length x.Parameters= arity)
16671715

1668-
[<NoComparison; NoEquality>]
1716+
[<NoComparison; NoEquality; StructuredFormatDisplay("{DebugText}")>]
16691717
typeILEventDef(eventType: ILType option,name: string,attributes: EventAttributes,addMethod: ILMethodRef,removeMethod: ILMethodRef,fireMethod: ILMethodRef option,otherMethods: ILMethodRef list,customAttrsStored: ILAttributesStored,metadataIndex: int32)=
16701718

16711719
new(eventType,name,attributes,addMethod,removeMethod,fireMethod,otherMethods,customAttrs)=
@@ -1695,6 +1743,10 @@ type ILEventDef(eventType: ILType option, name: string, attributes: EventAttribu
16951743
memberx.IsSpecialName=(x.Attributes&&& EventAttributes.SpecialName)<>enum<_>(0)
16961744
memberx.IsRTSpecialName=(x.Attributes&&& EventAttributes.RTSpecialName)<>enum<_>(0)
16971745

1746+
/// For debugging
1747+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
1748+
memberx.DebugText= x.ToString()
1749+
16981750
overridex.ToString()="event"+ x.Name
16991751

17001752
[<NoEquality; NoComparison>]
@@ -1705,7 +1757,7 @@ type ILEventDefs =
17051757

17061758
memberx.LookupByName s=let(ILEvents t)= xin t.[s]
17071759

1708-
[<NoComparison; NoEquality>]
1760+
[<NoComparison; NoEquality; StructuredFormatDisplay("{DebugText}")>]
17091761
typeILPropertyDef(name: string,attributes: PropertyAttributes,setMethod: ILMethodRef option,getMethod: ILMethodRef option,callingConv: ILThisConvention,propertyType: ILType,init: ILFieldInit option,args: ILTypes,customAttrsStored: ILAttributesStored,metadataIndex: int32)=
17101762

17111763
new(name,attributes,setMethod,getMethod,callingConv,propertyType,init,args,customAttrs)=
@@ -1737,6 +1789,11 @@ type ILPropertyDef(name: string, attributes: PropertyAttributes, setMethod: ILMe
17371789

17381790
memberx.IsSpecialName=(x.Attributes&&& PropertyAttributes.SpecialName)<>enum<_>(0)
17391791
memberx.IsRTSpecialName=(x.Attributes&&& PropertyAttributes.RTSpecialName)<>enum<_>(0)
1792+
1793+
/// For debugging
1794+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
1795+
memberx.DebugText= x.ToString()
1796+
17401797
overridex.ToString()="property"+ x.Name
17411798

17421799
// Index table by name.
@@ -2469,7 +2526,7 @@ let tname_IntPtr = "System.IntPtr"
24692526
[<Literal>]
24702527
lettname_UIntPtr="System.UIntPtr"
24712528

2472-
[<NoEquality; NoComparison>]
2529+
[<NoEquality; NoComparison; StructuredFormatDisplay("{DebugText}")>]
24732530
// This data structure needs an entirely delayed implementation
24742531
typeILGlobals(primaryScopeRef)=
24752532

@@ -2514,6 +2571,11 @@ type ILGlobals(primaryScopeRef) =
25142571
memberx.typ_Double= m_typ_Double
25152572
memberx.typ_Bool= m_typ_Bool
25162573
memberx.typ_Char= m_typ_Char
2574+
2575+
/// For debugging
2576+
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
2577+
memberx.DebugText= x.ToString()
2578+
25172579
overridex.ToString()="<ILGlobals>"
25182580

25192581
letmkILGlobals primaryScopeRef= ILGlobals primaryScopeRef

‎src/absil/il.fsi‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ type ILReturn =
796796

797797
memberCustomAttrs:ILAttributes
798798

799+
memberWithCustomAttrs:customAttrs:ILAttributes->ILReturn
800+
799801
[<RequireQualifiedAccess>]
800802
type ILSecurityAction=
801803
| Request

‎src/absil/illib.fs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ module Array =
135135

136136
loop p l0
137137

138+
letexistsTrue(arr:bool[])=
139+
let recloop n=(n< arr.Length)&&(arr.[n]|| loop(n+1))
140+
loop0
138141

139142
letfindFirstIndexWhereTrue(arr:_[])p=
140143
let reclook lo hi=
@@ -263,6 +266,10 @@ module List =
263266
let recloop i xs=match xswith[]->false| h::t-> f i h|| loop(i+1) t
264267
loop0 xs
265268

269+
letexistsTrue(xs:bool list)=
270+
let recloop i xs=match xswith[]->false| h::t-> h|| loop(i+1) t
271+
loop0 xs
272+
266273
letlengthsEqAndForall2 p l1 l2=
267274
List.length l1= List.length l2&&
268275
List.forall2 p l1 l2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp