Skip to content
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

fix bug with double lookup of cache #447

Merged
merged 1 commit into from
Oct 16, 2015
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/fsharp/InternalCollections.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ type internal AgedLookup<'TKey,'TValue when 'TValue : not struct>(keepStrongly:i

let TryGetKeyValueImpl(data,key) =
match TryPeekKeyValueImpl(data,key) with
| Some(_, value) as result ->
// If the result existed, move it to the top of the list.
result,Promote (data,key,value)
| Some(key', value) as result ->
// If the result existed, move it to the end of the list (more likely to keep it)
result,Promote (data,key',value)
| None -> None,data

/// Remove weak entries from the list that have been collected
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/vs/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
/// Parses the source file and returns untyped AST
member bc.ParseFileInProject(filename:string, source,options:FSharpProjectOptions) =
match locked (fun () -> parseFileInProjectCache.TryGet (filename, source, options)) with
| Some res -> async.Return res
| Some parseResults -> async.Return parseResults
| None ->
// Try this cache too (which might contain different entries)
let cachedResults = locked (fun () -> parseAndCheckFileInProjectCache.TryGet((filename,source,options)))
Expand All @@ -2365,7 +2365,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun

// Try the caches again - it may have been filled by the time this operation runs
match locked (fun () -> parseFileInProjectCache.TryGet (filename, source, options)) with
| Some res -> res
| Some parseResults -> parseResults
| None ->
let cachedResults = locked (fun () -> parseAndCheckFileInProjectCache.TryGet((filename,source,options)))
match cachedResults with
Expand Down