Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 committed Jul 4, 2024
1 parent 43bcb29 commit 88721e0
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions src/Compiler/AbstractIL/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -878,10 +878,10 @@ let hfmCompare (TaggedIndex(t1: HasFieldMarshalTag, idx1)) (TaggedIndex(t2: HasF
elif idx1 > idx2 then 1
else compare t1.Tag t2.Tag

let tomdCompare (TaggedIndex(t1: TypeOrMethodDefTag, idx1)) (TaggedIndex(t2: TypeOrMethodDefTag, idx2)) =
if idx1 < idx2 then -1
elif idx1 > idx2 then 1
else compare t1.Tag t2.Tag
let inline tomdCompare (t1: TaggedIndex<TypeOrMethodDefTag>) (t2: TaggedIndex<TypeOrMethodDefTag>) =
if t1.index < t2.index then -1
elif t1.index > t2.index then 1
else compare t1.tag t2.tag

let simpleIndexCompare (idx1: int) (idx2: int) = compare idx1 idx2

Expand Down Expand Up @@ -2239,11 +2239,16 @@ and seekReadNestedTypeDefs (ctxt: ILMetadataReader) tidx =
and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numTypars tidx =
seekReadIndexedRows (
ctxt.getNumRows TableNames.InterfaceImpl,
seekReadInterfaceImplRow ctxt mdv,
fst,
simpleIndexCompare tidx,
id,
id,
(fun i ->
let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl i
let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr
simpleIndexCompare tidx _tidx),
isSorted ctxt TableNames.InterfaceImpl,
(snd >> seekReadTypeDefOrRef ctxt numTypars AsObject [])
(fun i ->
let _, intfIdx = seekReadInterfaceImplRow ctxt mdv i
seekReadTypeDefOrRef ctxt numTypars AsObject [] intfIdx)
)

and seekReadGenericParams ctxt numTypars (a, b) : ILGenericParameterDefs =
Expand All @@ -2253,12 +2258,13 @@ and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numTypars, a, b)) =
let (ctxt: ILMetadataReader) = getHole ctxtH
let mdv = ctxt.mdfile.GetView()

let key = TaggedIndex(a, b)
let pars =
seekReadIndexedRows (
ctxt.getNumRows TableNames.GenericParam,
seekReadGenericParamRow ctxt mdv,
(fun (_, _, _, tomd, _) -> tomd),
tomdCompare (TaggedIndex(a, b)),
tomdCompare key,
isSorted ctxt TableNames.GenericParam,
(fun (gpidx, seq, flags, _, nameIdx) ->
let flags = int32 flags
Expand Down Expand Up @@ -2290,11 +2296,16 @@ and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numTypars, a, b)) =
and seekReadGenericParamConstraints (ctxt: ILMetadataReader) mdv numTypars gpidx =
seekReadIndexedRows (
ctxt.getNumRows TableNames.GenericParamConstraint,
seekReadGenericParamConstraintRow ctxt mdv,
fst,
simpleIndexCompare gpidx,
id,
id,
(fun i ->
let mutable addr = ctxt.rowAddr TableNames.GenericParamConstraint i
let pidx = seekReadUntaggedIdx TableNames.GenericParam ctxt mdv &addr
simpleIndexCompare gpidx pidx),
isSorted ctxt TableNames.GenericParamConstraint,
(snd >> seekReadTypeDefOrRef ctxt numTypars AsObject [])
(fun i ->
let _, constraintIdx = seekReadGenericParamConstraintRow ctxt mdv i
seekReadTypeDefOrRef ctxt numTypars AsObject [] constraintIdx)
)

and seekReadTypeDefAsType (ctxt: ILMetadataReader) boxity (ginst: ILTypes) idx =
Expand Down

0 comments on commit 88721e0

Please # to comment.