File tree 1 file changed +14
-3
lines changed 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 150
150
string (h, " .jls" ))
151
151
end
152
152
153
+ struct OnDiskCacheEntry
154
+ src:: MethodInstance
155
+ cfg:: CompilerConfig
156
+ asm
157
+ end
158
+
153
159
@noinline function actual_compilation (cache:: AbstractDict , src:: MethodInstance , world:: UInt ,
154
160
cfg:: CompilerConfig , compiler:: Function , linker:: Function )
155
161
job = CompilerJob (src, cfg, world)
176
182
ondisk_hit = true
177
183
try
178
184
@debug " Loading compiled kernel" job path
179
- asm = deserialize (path)
185
+ entry = deserialize (path):: OnDiskCacheEntry
186
+ if entry. src == src && entry. cfg == cfg
187
+ asm = entry. asm
188
+ else
189
+ @warn " Cache missmatch" src cfg entry
190
+ end
180
191
catch ex
181
192
@warn " Failed to load compiled kernel" job path exception= (ex, catch_backtrace ())
182
193
end
196
207
@static if VERSION >= v " 1.11.0-"
197
208
if ! ondisk_hit && path != = nothing && disk_cache ()
198
209
@debug " Writing out on-disk cache" job path
199
- # TODO : Do we want to serialize some more metadata to make sure the asm matches?
200
210
tmppath, io = mktemp (;cleanup= false )
201
- serialize (io, asm)
211
+ entry = OnDiskCacheEntry (src, cfg, asm)
212
+ serialize (io, entry)
202
213
close (io)
203
214
# atomic move
204
215
mkpath (dirname (path))
You can’t perform that action at this time.
0 commit comments