@@ -1231,6 +1231,7 @@ function compilecache_path(pkg::PkgId, cache::TOMLCache)::String
1231
1231
crc = _crc32c (unsafe_string (JLOptions (). image_file), crc)
1232
1232
crc = _crc32c (unsafe_string (JLOptions (). julia_bin), crc)
1233
1233
crc = _crc32c (get_preferences_hash (pkg. uuid, cache), crc)
1234
+ crc = _crc32c (isdebug (), crc)
1234
1235
project_precompile_slug = slug (crc, 5 )
1235
1236
abspath (cachepath, string (entryfile, " _" , project_precompile_slug, " .ji" ))
1236
1237
end
@@ -1358,6 +1359,8 @@ function parse_cache_header(f::IO)
1358
1359
end
1359
1360
totbytes -= 4 + 4 + n2 + 8
1360
1361
end
1362
+ julia_debug = Bool (read (f, UInt8))
1363
+ totbytes -= 1
1361
1364
prefs_hash = read (f, UInt64)
1362
1365
totbytes -= 8
1363
1366
@assert totbytes == 12 " header of cache file appears to be corrupt"
@@ -1372,7 +1375,7 @@ function parse_cache_header(f::IO)
1372
1375
build_id = read (f, UInt64) # build id
1373
1376
push! (required_modules, PkgId (uuid, sym) => build_id)
1374
1377
end
1375
- return modules, (includes, requires), required_modules, srctextpos, prefs_hash
1378
+ return modules, (includes, requires), required_modules, srctextpos, prefs_hash, julia_debug
1376
1379
end
1377
1380
1378
1381
function parse_cache_header (cachefile:: String ; srcfiles_only:: Bool = false )
@@ -1381,21 +1384,21 @@ function parse_cache_header(cachefile::String; srcfiles_only::Bool=false)
1381
1384
! isvalid_cache_header (io) && throw (ArgumentError (" Invalid header in cache file $cachefile ." ))
1382
1385
ret = parse_cache_header (io)
1383
1386
srcfiles_only || return ret
1384
- modules, (includes, requires), required_modules, srctextpos, prefs_hash = ret
1387
+ modules, (includes, requires), required_modules, srctextpos, prefs_hash, julia_debug = ret
1385
1388
srcfiles = srctext_files (io, srctextpos)
1386
1389
delidx = Int[]
1387
1390
for (i, chi) in enumerate (includes)
1388
1391
chi. filename ∈ srcfiles || push! (delidx, i)
1389
1392
end
1390
1393
deleteat! (includes, delidx)
1391
- return modules, (includes, requires), required_modules, srctextpos, prefs_hash
1394
+ return modules, (includes, requires), required_modules, srctextpos, prefs_hash, julia_debug
1392
1395
finally
1393
1396
close (io)
1394
1397
end
1395
1398
end
1396
1399
1397
1400
function cache_dependencies (f:: IO )
1398
- defs, (includes, requires), modules, srctextpos, prefs_hash = parse_cache_header (f)
1401
+ defs, (includes, requires), modules, srctextpos, prefs_hash, julia_debug = parse_cache_header (f)
1399
1402
return modules, map (chi -> (chi. filename, chi. mtime), includes) # return just filename and mtime
1400
1403
end
1401
1404
@@ -1410,7 +1413,7 @@ function cache_dependencies(cachefile::String)
1410
1413
end
1411
1414
1412
1415
function read_dependency_src (io:: IO , filename:: AbstractString )
1413
- modules, (includes, requires), required_modules, srctextpos, prefs_hash = parse_cache_header (io)
1416
+ modules, (includes, requires), required_modules, srctextpos, prefs_hash, julia_debug = parse_cache_header (io)
1414
1417
srctextpos == 0 && error (" no source-text stored in cache file" )
1415
1418
seek (io, srctextpos)
1416
1419
return _read_dependency_src (io, filename)
@@ -1481,9 +1484,9 @@ function get_preferences(uuid::UUID, cache::TOMLCache = TOMLCache();
1481
1484
# Fall back to default value of "no preferences".
1482
1485
return Dict {String,Any} ()
1483
1486
end
1484
- get_preferences_hash (uuid:: UUID , cache:: TOMLCache = TOMLCache ()) = UInt64 (hash (julia_debug, hash ( get_preferences (uuid, cache) )))
1487
+ get_preferences_hash (uuid:: UUID , cache:: TOMLCache = TOMLCache ()) = UInt64 (hash (get_preferences (uuid, cache)))
1485
1488
get_preferences_hash (m:: Module , cache:: TOMLCache = TOMLCache ()) = get_preferences_hash (PkgId (m). uuid, cache)
1486
- get_preferences_hash (:: Nothing , cache:: TOMLCache = TOMLCache ()) = UInt64 (hash (julia_debug, hash ( Dict {String,Any} () )))
1489
+ get_preferences_hash (:: Nothing , cache:: TOMLCache = TOMLCache ()) = UInt64 (hash (Dict {String,Any} ()))
1487
1490
1488
1491
1489
1492
# returns true if it "cachefile.ji" is stale relative to "modpath.jl"
@@ -1496,7 +1499,7 @@ function stale_cachefile(modpath::String, cachefile::String, cache::TOMLCache)
1496
1499
@debug " Rejecting cache file $cachefile due to it containing an invalid cache header"
1497
1500
return true # invalid cache file
1498
1501
end
1499
- modules, (includes, requires), required_modules, srctextpos, prefs_hash = parse_cache_header (io)
1502
+ modules, (includes, requires), required_modules, srctextpos, prefs_hash, julia_debug = parse_cache_header (io)
1500
1503
id = isempty (modules) ? nothing : first (modules). first
1501
1504
modules = Dict {PkgId, UInt64} (modules)
1502
1505
@@ -1572,6 +1575,11 @@ function stale_cachefile(modpath::String, cachefile::String, cache::TOMLCache)
1572
1575
end
1573
1576
1574
1577
if isa (id, PkgId)
1578
+ curr_debug = isdebug ()
1579
+ if julia_debug != curr_debug
1580
+ @debug " Rejecting cache file $cachefile because julia debug mode does not match"
1581
+ return true
1582
+ end
1575
1583
curr_prefs_hash = get_preferences_hash (id. uuid, cache)
1576
1584
if prefs_hash != curr_prefs_hash
1577
1585
@debug " Rejecting cache file $cachefile because preferences hash does not match 0x$(string (prefs_hash, base= 16 )) != 0x$(string (curr_prefs_hash, base= 16 )) "
0 commit comments