Skip to content
Merged
Changes from all commits
Commits
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
18 changes: 7 additions & 11 deletions src/absil/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2463,15 +2463,11 @@ and seekReadImplMap (ctxt: ILMetadataReader) nm midx =
and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start seqpoints =
let labelsOfRawOffsets = new Dictionary<_, _>(sz/2)
let ilOffsetsOfLabels = new Dictionary<_, _>(sz/2)
let tryRawToLabel rawOffset =
match labelsOfRawOffsets.TryGetValue rawOffset with
| true, v -> Some v
| _ -> None


let rawToLabel rawOffset =
match tryRawToLabel rawOffset with
| Some l -> l
| None ->
match labelsOfRawOffsets.TryGetValue rawOffset with
| true, l -> l
| _ ->
let lab = generateCodeLabel()
labelsOfRawOffsets.[rawOffset] <- lab
lab
Expand Down Expand Up @@ -2700,9 +2696,9 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s
// the start of the next instruction referred to by the raw offset.
let raw2nextLab rawOffset =
let isInstrStart x =
match tryRawToLabel x with
| None -> false
| Some lab -> ilOffsetsOfLabels.ContainsKey lab
match labelsOfRawOffsets.TryGetValue x with
| true, lab -> ilOffsetsOfLabels.ContainsKey lab
| _ -> false
if isInstrStart rawOffset then rawToLabel rawOffset
elif isInstrStart (rawOffset+1) then rawToLabel (rawOffset+1)
else failwith ("the bytecode raw offset "+string rawOffset+" did not refer either to the start or end of an instruction")
Expand Down