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

Commit7f7f488

Browse files
ncaveKevinRansom
authored andcommitted
ExportedTypes optimization (#3959)
1 parentc9eb89c commit7f7f488

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

‎src/absil/ilread.fs‎

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3206,50 +3206,50 @@ and seekReadManifestResources ctxt () =
32063206
yield r])
32073207

32083208

3209-
andseekReadNestedExportedTypes ctxt parentIdx=
3209+
andseekReadNestedExportedTypes ctxt(exported:_ array)(nested:Lazy<_array>)parentIdx=
32103210
mkILNestedExportedTypesLazy
32113211
(lazy
3212-
[for i=1to ctxt.getNumRows TableNames.ExportedTypedo
3213-
let(flags,_tok,nameIdx,namespaceIdx,implIdx)= seekReadExportedTypeRow ctxt i
3214-
ifnot(isTopTypeDef flags)then
3215-
let(TaggedIndex(tag,idx))= implIdx
3216-
//let isTopTypeDef = (idx = 0 || tag <> i_ExportedType)
3217-
//if not isTopTypeDef then
3218-
match tagwith
3219-
| tagwhen tag= i_ExportedType&& idx= parentIdx->
3220-
letnm= readBlobHeapAsTypeName ctxt(nameIdx, namespaceIdx)
3221-
yield
3222-
{ Name=nm
3223-
Access=(match typeAccessOfFlags flagswith ILTypeDefAccess.Nested n-> n|_-> failwith"non-nested access for a nested type described as being in an auxiliary module")
3224-
Nested=seekReadNestedExportedTypes ctxt i
3225-
CustomAttrs=seekReadCustomAttrs ctxt(TaggedIndex(hca_ExportedType, i))}
3226-
|_->()])
3227-
3212+
nested.Force().[parentIdx-1]
3213+
|> List.map(fun i->
3214+
let(flags,_tok,nameIdx,namespaceIdx,_implIdx)= exported.[i-1]
3215+
{ Name= readBlobHeapAsTypeName ctxt(nameIdx, namespaceIdx)
3216+
Access=(match typeAccessOfFlags flagswith
3217+
| ILTypeDefAccess.Nested n-> n
3218+
|_-> failwith"non-nested access for a nested type described as being in an auxiliary module")
3219+
Nested= seekReadNestedExportedTypes ctxt exported nested i
3220+
CustomAttrs= seekReadCustomAttrs ctxt(TaggedIndex(hca_ExportedType, i))}
3221+
))
3222+
32283223
andseekReadTopExportedTypes ctxt()=
32293224
mkILExportedTypesLazy
32303225
(lazy
3231-
letres= ref[]
3232-
for i=1to ctxt.getNumRows TableNames.ExportedTypedo
3233-
let(flags,_tok,nameIdx,namespaceIdx,implIdx)= seekReadExportedTypeRow ctxt i
3234-
if isTopTypeDef flagsthen
3235-
let(TaggedIndex(tag,_idx))= implIdx
3236-
3237-
// the nested types will be picked up by their enclosing types
3238-
if tag<> i_ExportedTypethen
3239-
letnm= readBlobHeapAsTypeName ctxt(nameIdx, namespaceIdx)
3240-
3241-
letscoref= seekReadImplAsScopeRef ctxt implIdx
3242-
3243-
letentry=
3244-
{ ScopeRef=scoref
3245-
Name=nm
3246-
IsForwarder=((flags&&&0x00200000)<>0)
3247-
Access=typeAccessOfFlags flags
3248-
Nested=seekReadNestedExportedTypes ctxt i
3249-
CustomAttrs=seekReadCustomAttrs ctxt(TaggedIndex(hca_ExportedType, i))}
3250-
res:= entry::!res
3251-
done
3252-
List.rev!res)
3226+
letnumRows= ctxt.getNumRows TableNames.ExportedType
3227+
letexported=[|for iin1..numRows-> seekReadExportedTypeRow ctxt i|]
3228+
3229+
// add each nested type id to their parent's children list
3230+
letnested=lazy(
3231+
letnested=[|for_iin1..numRows->[]|]
3232+
for i=1to numRowsdo
3233+
let(flags,_,_,_,TaggedIndex(tag,idx))= exported.[i-1]
3234+
ifnot(isTopTypeDef flags)&&(tag= i_ExportedType)then
3235+
nested.[idx-1]<- i:: nested.[idx-1]
3236+
nested)
3237+
3238+
// return top exported types
3239+
[for i=1to numRowsdo
3240+
let(flags,_tok,nameIdx,namespaceIdx,implIdx)= exported.[i-1]
3241+
let(TaggedIndex(tag,_idx))= implIdx
3242+
3243+
// if not a nested type
3244+
if(isTopTypeDef flags)&&(tag<> i_ExportedType)then
3245+
yield
3246+
{ ScopeRef= seekReadImplAsScopeRef ctxt implIdx
3247+
Name= readBlobHeapAsTypeName ctxt(nameIdx, namespaceIdx)
3248+
IsForwarder=((flags&&&0x00200000)<>0)
3249+
Access= typeAccessOfFlags flags
3250+
Nested= seekReadNestedExportedTypes ctxt exported nested i
3251+
CustomAttrs= seekReadCustomAttrs ctxt(TaggedIndex(hca_ExportedType, i))}
3252+
])
32533253

32543254
#if!FX_NO_PDB_READER
32553255
letgetPdbReader opts infile=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp