Skip to content

Re-Implemented ILBinaryReader with System.Reflection.Metadata #8081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
382aabf
Initial SRM impl commit
TIHan Jan 2, 2020
538ef81
Fixing up generic arg
TIHan Jan 2, 2020
5c0c719
TODOs are finished, minus the original reader TODOs
TIHan Jan 3, 2020
960fef7
No asserts but still does not work
TIHan Jan 3, 2020
57cebd5
Fixed some crashes. Still crashing on parameters
TIHan Jan 3, 2020
6808a97
Still not working
TIHan Jan 3, 2020
0a54fa7
Fixed getter/setter
TIHan Jan 3, 2020
8b20a8c
Added isCachingEnabled
TIHan Jan 3, 2020
ecf7f29
Use GenericParameterCount for sanity
TIHan Jan 3, 2020
ed9a03e
make error msg better
TIHan Jan 3, 2020
2b3cb2a
Hopefully making a better decoder
TIHan Jan 3, 2020
87696ec
Fixing build
TIHan Jan 3, 2020
5eb0bac
Fixing build again
TIHan Jan 3, 2020
d89ae96
Resovling signature type kind for typeref
TIHan Jan 3, 2020
44d95c1
Assume boxed is an enum for decoding
TIHan Jan 3, 2020
1bfa452
Fixed resources
TIHan Jan 3, 2020
90dae83
Fixing up resource reading
TIHan Jan 3, 2020
f5ab26a
Fixing variance
TIHan Jan 3, 2020
813f986
Trying to fix generics
TIHan Jan 3, 2020
34287c0
Use mkILCallingConv
TIHan Jan 3, 2020
b47f250
Use scope local
TIHan Jan 3, 2020
1a80436
Determine typar count
TIHan Jan 3, 2020
4d42ab0
Using rawTypeKind
TIHan Jan 3, 2020
b15bf73
We have a type var offset issue
TIHan Jan 3, 2020
87e9322
Still trying to fix some generics
TIHan Jan 3, 2020
046e5dd
Still trying to fix type params
TIHan Jan 4, 2020
abd6387
Fixed native type
TIHan Jan 4, 2020
03cb359
Type params not working
TIHan Jan 4, 2020
1fe4ede
Some refactoring
TIHan Jan 5, 2020
c6e0c91
Fixed more issues with generic params
TIHan Jan 5, 2020
de65691
Fixed type ref enclosing name
TIHan Jan 5, 2020
daa3601
Fixed calling convention
TIHan Jan 5, 2020
f451c6f
Remove LRU cache
TIHan Jan 5, 2020
be0c4c1
Added copyright
TIHan Jan 5, 2020
41f38f8
Fixed property conv
TIHan Jan 5, 2020
aa42a48
Fixing value type in sigs
TIHan Jan 5, 2020
e1ed686
Caching more and reducing some allocations
TIHan Jan 5, 2020
b2fd7df
Merge remote-tracking branch 'upstream/master' into refactor/srm
TIHan Jan 5, 2020
085944e
Trying to fix labels
TIHan Jan 5, 2020
8a24885
Trying to fix stuff
TIHan Jan 5, 2020
33e7589
Hopefully fixes build
TIHan Jan 5, 2020
4d9e65d
Fixes on member reference
TIHan Jan 6, 2020
a3db32e
Fixed methspec reading
TIHan Jan 6, 2020
84a8012
Merge remote-tracking branch 'upstream/master' into refactor/srm
TIHan Jan 6, 2020
7b59f3f
Merge branch 'refactor/srm' of github.com:tihan/visualfsharp into ref…
TIHan Jan 6, 2020
9583050
Trying to get the mapping right for code labels
TIHan Jan 7, 2020
9dbf866
Merge remote-tracking branch 'upstream/master' into refactor/srm
TIHan Jan 14, 2020
12f34b4
Cleaning up diff
TIHan Jan 14, 2020
3da029f
Fixed bug where we read box instructions as unbox instructions
TIHan Jan 14, 2020
d50ff30
We need to recreate a type spec
TIHan Jan 14, 2020
7854df2
Merge remote-tracking branch 'upstream/master' into refactor/srm
TIHan Jan 15, 2020
6e09637
Merging with master
TIHan Jan 15, 2020
3b3cfcc
Merged with main
TIHan Oct 9, 2020
5dddde2
Fixing type parameters
TIHan Oct 9, 2020
0db824e
Fixed type parameters part 2
TIHan Oct 9, 2020
df33012
Remove cache
TIHan Oct 9, 2020
dab14ab
Trying to fix it
TIHan Oct 10, 2020
f991b73
Temporarily turn off caching
TIHan Oct 10, 2020
6e9b04d
Trying to get tests to pass
TIHan Oct 11, 2020
76ad9a3
Trying to get tests to pass
TIHan Oct 11, 2020
a9ed47a
Trying to get tests to pass
TIHan Oct 11, 2020
a916c30
Trying to get tests to pass
TIHan Oct 11, 2020
8d12107
Trying to get tests to pass
TIHan Oct 11, 2020
a5a91ab
remove comment
TIHan Oct 11, 2020
c074515
enabling cache
TIHan Oct 11, 2020
33be155
Trying to pass tests
TIHan Oct 11, 2020
98cb388
Fixing a few things
TIHan Oct 12, 2020
2a4c49a
better
TIHan Oct 12, 2020
a7ac632
Fixing stuff
TIHan Oct 12, 2020
67bbf6a
Revert
TIHan Oct 12, 2020
e45ec06
Fixed a minor issue
TIHan Oct 12, 2020
1ed43f4
Trying to fix it
TIHan Oct 13, 2020
982385f
Prefetching image
TIHan Oct 13, 2020
9d0758d
Remove that
TIHan Oct 13, 2020
204486b
Fixing tests
TIHan Oct 13, 2020
a49d436
Faster
TIHan Oct 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/absil/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2736,6 +2736,8 @@ let isILObjectTy ilg ty = isILBoxedBuiltInTy ilg ty tname_Object

let isILStringTy ilg ty = isILBoxedBuiltInTy ilg ty tname_String

let isILTypeTy ilg ty = isILBoxedBuiltInTy ilg ty tname_Type

let isILTypedReferenceTy ilg ty = isILValueBuiltInTy ilg ty tname_TypedReference

let isILSByteTy ilg ty = isILValueBuiltInTy ilg ty tname_SByte
Expand Down Expand Up @@ -3799,7 +3801,7 @@ type ILTypeSigParser (tstring : string) =
// Since we're only reading valid IL, we assume that the signature is properly formed
// For type parameters, if the type is non-local, it will be wrapped in brackets ([])
// Still needs testing with jagged arrays and byref parameters
member private x.ParseType() =
member x.ParseType() =

// Does the type name start with a leading '['? If so, ignore it
// (if the specialization type is in another module, it will be wrapped in bracket)
Expand Down Expand Up @@ -3898,6 +3900,11 @@ type ILTypeSigParser (tstring : string) =
let ilty = x.ParseType()
ILAttribElem.Type (Some ilty)

type ILType with

static member Parse assemblyQualifiedName =
(ILTypeSigParser assemblyQualifiedName).ParseType()

let decodeILAttribData (ilg: ILGlobals) (ca: ILAttribute) =
match ca with
| ILAttribute.Decoded (_, fixedArgs, namedArgs) -> fixedArgs, namedArgs
Expand Down Expand Up @@ -3975,10 +3982,11 @@ let decodeILAttribData (ilg: ILGlobals) (ca: ILAttribute) =
parseElems (v :: acc) (n-1) sigptr
let elems, sigptr = parseElems [] n sigptr
ILAttribElem.Array (elemTy, elems), sigptr
| ILType.Boxed _
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably remove this since I might have fixed it.

| ILType.Value _ -> (* assume it is an enumeration *)
let n, sigptr = sigptr_get_i32 bytes sigptr
ILAttribElem.Int32 n, sigptr
| _ -> failwith "decodeILAttribData: attribute data involves an enum or System.Type value"
| x -> failwithf "decodeILAttribData: attribute data involves an enum or System.Type value - boxity: %A type: %A" x.Boxity x
let rec parseFixed argtys sigptr =
match argtys with
[] -> [], sigptr
Expand Down
4 changes: 4 additions & 0 deletions src/absil/il.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ and

member QualifiedName: string

static member Parse: assemblyQualifiedName: string -> ILType

and [<StructuralEquality; StructuralComparison>]
ILCallingSignature =
{ CallingConv: ILCallingConv
Expand Down Expand Up @@ -1838,6 +1840,7 @@ val mkILCustomAttrsFromArray: ILAttribute[] -> ILAttributes
val storeILCustomAttrs: ILAttributes -> ILAttributesStored
val mkILCustomAttrsReader: (int32 -> ILAttribute[]) -> ILAttributesStored
val emptyILCustomAttrs: ILAttributes
val emptyILCustomAttrsStored: ILAttributesStored
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to put all these smaller changes in a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that makes sense. Less changes outside ilread.fs the better.


val mkILSecurityDecls: ILSecurityDecl list -> ILSecurityDecls
val emptyILSecurityDecls: ILSecurityDecls
Expand Down Expand Up @@ -1981,6 +1984,7 @@ val isILIntPtrTy: ILGlobals -> ILType -> bool
val isILUIntPtrTy: ILGlobals -> ILType -> bool
val isILBoolTy: ILGlobals -> ILType -> bool
val isILCharTy: ILGlobals -> ILType -> bool
val isILTypeTy: ILGlobals -> ILType -> bool
val isILTypedReferenceTy: ILGlobals -> ILType -> bool
val isILDoubleTy: ILGlobals -> ILType -> bool
val isILSingleTy: ILGlobals -> ILType -> bool
Expand Down
Loading