logic: generate indexer commands on demand to reduce shared memory consumption

* implemented task for sending IndexerCommands to shared memory on demand
* SourceGroups now return IndexerCommandProviders instead of just a list of indexer commands. This way information can be stored in a compressed format
* merged IndexerCommandCxxEmpty and IndexerCommandCxxCdb
* moved sorting of indexer commands by file size from IndexerCommandList to TaskFillIndexerCommandQueue
* removed obsolete IndexerCommandList class
* wait for IndexerCommandQueue to be filled before starting the indexers
* restart finished indexer processes while indexerCommandQueue is still running
* restart indexer threads as long as there are indexer commands to process
* removed Blackboard::getMutex() and added an atomic update() method
This commit is contained in:
mlangkabel
2018-09-10 12:40:30 +02:00
parent 92a19869e7
commit 9998855527
77 changed files with 2156 additions and 1244 deletions
+2 -30
View File
@@ -8,8 +8,7 @@
#include <llvm/Option/ArgList.h>
#include <llvm/Support/TargetSelect.h>
#include "data/indexer/IndexerCommandCxxCdb.h"
#include "data/indexer/IndexerCommandCxxEmpty.h"
#include "data/indexer/IndexerCommandCxx.h"
#include "data/parser/cxx/ASTActionFactory.h"
#include "data/parser/cxx/CanonicalFilePathCache.h"
#include "data/parser/cxx/CxxCompilationDatabaseSingle.h"
@@ -139,7 +138,7 @@ CxxParser::CxxParser(std::shared_ptr<ParserClient> client, std::shared_ptr<FileR
llvm::InitializeNativeTargetAsmParser();
}
void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxxCdb> indexerCommand)
void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxx> indexerCommand)
{
clang::tooling::CompileCommand compileCommand;
compileCommand.Filename = utility::encodeToUtf8(indexerCommand->getSourceFilePath().wstr());
@@ -158,20 +157,6 @@ void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxxCdb> indexerCommand)
runTool(&compilationDatabase, indexerCommand->getSourceFilePath());
}
void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxxEmpty> indexerCommand)
{
clang::tooling::CompileCommand compileCommand;
compileCommand.Filename = utility::encodeToUtf8(indexerCommand->getSourceFilePath().wstr());
compileCommand.Directory = utility::encodeToUtf8(indexerCommand->getWorkingDirectory().wstr());
compileCommand.CommandLine = prependSyntaxOnlyToolArgs(appendFilePath(
getCommandlineArguments(indexerCommand),
utility::encodeToUtf8(indexerCommand->getSourceFilePath().wstr())
));
CxxCompilationDatabaseSingle compilationDatabase(compileCommand);
runTool(&compilationDatabase, indexerCommand->getSourceFilePath());
}
void CxxParser::buildIndex(const std::wstring& fileName, std::shared_ptr<TextAccess> fileContent, std::vector<std::wstring> compilerFlags)
{
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache =
@@ -262,19 +247,6 @@ std::vector<std::string> CxxParser::getCommandlineArgumentsEssential(
return args;
}
std::vector<std::string> CxxParser::getCommandlineArguments(std::shared_ptr<IndexerCommandCxxEmpty> indexerCommand) const
{
std::vector<std::string> args = getCommandlineArgumentsEssential(
indexerCommand->getCompilerFlags(), indexerCommand->getSystemHeaderSearchPaths(), indexerCommand->getFrameworkSearchPaths()
);
// Set language standard
std::string standard = "-std=" + indexerCommand->getLanguageStandard();
args.push_back(standard);
return args;
}
std::shared_ptr<CxxDiagnosticConsumer> CxxParser::getDiagnostics(const FilePath& sourceFilePath, std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, bool logErrors) const
{
llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> options = new clang::DiagnosticOptions();