Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.

Commit 81838cb

Browse files
committed
Don't hold the cache lock while computing the manifest hash for the current object
1 parent e25b61a commit 81838cb

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

clcache.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,28 +1470,29 @@ def processDirect(cache, objectFile, compiler, cmdLine, sourceFile):
14701470
manifestSection = cache.manifestRepository.section(manifestHash)
14711471
with cache.lock:
14721472
manifest = manifestSection.getManifest(manifestHash)
1473-
if manifest is not None:
1474-
# NOTE: command line options already included in hash for manifest name
1475-
includesContentHash = ManifestRepository.getIncludesContentHashForFiles(
1476-
[expandBasedirPlaceholder(include, baseDir) for include in manifest.includeFiles])
1477-
cachekey = manifest.includesContentToObjectMap.get(includesContentHash)
1478-
if cachekey is not None:
1473+
if manifest is not None:
1474+
# NOTE: command line options already included in hash for manifest name
1475+
includesContentHash = ManifestRepository.getIncludesContentHashForFiles(
1476+
[expandBasedirPlaceholder(include, baseDir) for include in manifest.includeFiles])
1477+
cachekey = manifest.includesContentToObjectMap.get(includesContentHash)
1478+
if cachekey is not None:
1479+
with cache.lock:
14791480
if cache.compilerArtifactsRepository.section(cachekey).hasEntry(cachekey):
14801481
return processCacheHit(cache, objectFile, cachekey)
1481-
else:
1482-
postProcessing = lambda compilerResult: postprocessObjectEvicted(
1483-
cache, objectFile, cachekey, compilerResult)
1484-
else:
1485-
postProcessing = lambda compilerResult: postprocessHeaderChangedMiss(
1486-
cache, objectFile, manifestSection, manifest, manifestHash, includesContentHash, compilerResult)
1482+
1483+
postProcessing = lambda compilerResult: postprocessObjectEvicted(
1484+
cache, objectFile, cachekey, compilerResult)
14871485
else:
1488-
origCmdLine = cmdLine
1489-
stripIncludes = False
1490-
if '/showIncludes' not in cmdLine:
1491-
cmdLine = ['/showIncludes'] + origCmdLine
1492-
stripIncludes = True
1493-
postProcessing = lambda compilerResult: postprocessNoManifestMiss(
1494-
cache, objectFile, manifestSection, manifestHash, baseDir, sourceFile, compilerResult, stripIncludes)
1486+
postProcessing = lambda compilerResult: postprocessHeaderChangedMiss(
1487+
cache, objectFile, manifestSection, manifest, manifestHash, includesContentHash, compilerResult)
1488+
else:
1489+
origCmdLine = cmdLine
1490+
stripIncludes = False
1491+
if '/showIncludes' not in cmdLine:
1492+
cmdLine = ['/showIncludes'] + origCmdLine
1493+
stripIncludes = True
1494+
postProcessing = lambda compilerResult: postprocessNoManifestMiss(
1495+
cache, objectFile, manifestSection, manifestHash, baseDir, sourceFile, compilerResult, stripIncludes)
14951496

14961497
compilerResult = invokeRealCompiler(compiler, cmdLine, captureOutput=True)
14971498
compilerResult = postProcessing(compilerResult)

0 commit comments

Comments
 (0)