-
Notifications
You must be signed in to change notification settings - Fork 803
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
[WIP] [Prototype] Compilation Model #6947
Changes from 118 commits
c1fd46f
81a9c1a
e2a5f50
2061cd5
0924776
fa60f57
15d14ac
0884798
376dc9c
62fe0a9
83d96a6
fc64d85
237373b
ec28602
ad8b592
ce0d080
1735bb9
189d136
b914749
822cb91
746e5c5
e1b35b8
3ba03e5
b741573
e6a2811
44abaf7
3e92acf
8a788f5
b6f71bb
cd17ac5
0af56c0
a33cb07
5359060
b23ab3a
1c84701
ccc10b4
3eefc05
89b8e81
4680819
a2bf0de
a2a57ee
b8d7b41
d3ca155
2782cdb
e89b3a5
1b974dc
3d10c0f
360305f
cdca0f4
e196383
bcf5fa2
2fe75b2
54e837a
63ff627
554509b
7ce5473
1fe313a
95a83db
43c9451
e04ad9c
c56fd92
b829ea1
5714d8e
17d2d7c
69aa252
66327ef
ef2941c
8a660e8
1fc907e
0af0882
56af78d
45a964e
158eecb
0dc1db3
6b8d83a
35776b8
691fa83
bc4274c
327d28c
a91bb3e
520e819
a82bdeb
b910770
261bc6a
f8b4537
738e781
a4e6d61
cdf3829
db0fd47
9a37314
5959823
c1cd8f8
cf4e74d
3d5f5fb
b770e26
13c2299
f493f61
355d15b
a9c8bcd
b7ff046
6d31fe1
2ff68d3
6d76abf
bdefdce
4527c27
e88df55
0b4bf64
ec7035c
600c422
4d8c893
f89ea36
10d7863
1273570
f5d4a63
ff3975b
6654f2a
dd843b6
7baff46
fbcb1d0
4856788
77eac42
4d2f6e6
d9eeddb
b389fd9
928d863
94348bd
5e19937
5a83810
53870a9
81b449b
96d306b
28b094b
0246281
9875ee2
e516130
1efadc5
ea6ea88
962a83b
6152c3e
48d53f3
56cf7ca
d57667f
5172983
1d064eb
3a4d101
7c5a936
28ee798
3539701
acd4f9f
4d838b9
d5216d3
cbb806c
04d188f
ab1847b
01ea2b9
62c9340
d580324
b43a3ee
2f91fa7
bd9285b
22d6a84
7c3ba97
7b463d5
f8e67d6
9cd3f5a
d36469e
dcd020f
d1c383b
7004d9b
5fbf2cd
f84a72c
5d52c5a
d775016
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -894,45 +894,52 @@ let mkCacheInt32 lowMem _inbase _nm _sz = | |
if lowMem then (fun f x -> f x) else | ||
let cache = ref null | ||
let count = ref 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be a |
||
let gate = obj () | ||
#if STATISTICS | ||
addReport (fun oc -> if !count <> 0 then oc.WriteLine ((_inbase + string !count + " "+ _nm + " cache hits"): string)) | ||
#endif | ||
fun f (idx: int32) -> | ||
let cache = | ||
match !cache with | ||
| null -> cache := new Dictionary<int32, _>(11) | ||
| _ -> () | ||
!cache | ||
match cache.TryGetValue idx with | ||
| true, res -> | ||
incr count | ||
res | ||
| _ -> | ||
let res = f idx | ||
cache.[idx] <- res | ||
res | ||
lock gate (fun () -> | ||
let cache = | ||
match !cache with | ||
| null -> cache := new Dictionary<int32, _>(11) | ||
| _ -> () | ||
!cache | ||
let mutable res = Unchecked.defaultof<_> | ||
let ok = cache.TryGetValue(idx, &res) | ||
if ok then | ||
incr count | ||
res | ||
else | ||
let res = f idx | ||
cache.[idx] <- res | ||
res | ||
) | ||
|
||
let mkCacheGeneric lowMem _inbase _nm _sz = | ||
if lowMem then (fun f x -> f x) else | ||
let cache = ref null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be good to |
||
let count = ref 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be good to |
||
let gate = obj () | ||
#if STATISTICS | ||
addReport (fun oc -> if !count <> 0 then oc.WriteLine ((_inbase + string !count + " " + _nm + " cache hits"): string)) | ||
#endif | ||
fun f (idx :'T) -> | ||
let cache = | ||
match !cache with | ||
| null -> cache := new Dictionary<_, _>(11 (* sz: int *) ) | ||
| _ -> () | ||
!cache | ||
match cache.TryGetValue idx with | ||
| true, v -> | ||
incr count | ||
v | ||
| _ -> | ||
let res = f idx | ||
cache.[idx] <- res | ||
res | ||
lock gate (fun () -> | ||
let cache = | ||
match !cache with | ||
| null -> cache := new Dictionary<_, _>(11 (* sz: int *) ) | ||
| _ -> () | ||
!cache | ||
match cache.TryGetValue idx with | ||
| true, v -> | ||
incr count | ||
v | ||
| _ -> | ||
let res = f idx | ||
cache.[idx] <- res | ||
res | ||
) | ||
|
||
//----------------------------------------------------------------------- | ||
// Polymorphic general helpers for searching for particular rows. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace FSharp.Compiler.Compilation | ||
|
||
open FSharp.Compiler.Ast | ||
open FSharp.Compiler.ErrorLogger | ||
|
||
type internal FSharpErrorSeverity = FSharp.Compiler.SourceCodeServices.FSharpErrorSeverity | ||
type internal CompilationErrorLogger = FSharp.Compiler.SourceCodeServices.CompilationErrorLogger | ||
type internal CompilationGlobalsScope = FSharp.Compiler.SourceCodeServices.CompilationGlobalsScope | ||
type internal ParseResult = ParsedInput option * (PhasedDiagnostic * FSharpErrorSeverity) [] | ||
type internal SymbolEnv = FSharp.Compiler.SourceCodeServices.SymbolEnv | ||
type internal InternalFSharpSymbol = FSharp.Compiler.SourceCodeServices.FSharpSymbol | ||
type internal InternalFSharpSymbolUse = FSharp.Compiler.SourceCodeServices.FSharpSymbolUse | ||
type internal FSharpSourceTokenizer = FSharp.Compiler.SourceCodeServices.FSharpSourceTokenizer | ||
type internal FSharpTokenizerLexState = FSharp.Compiler.SourceCodeServices.FSharpTokenizerLexState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be a
mutable
?