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:
@@ -4,7 +4,7 @@
|
||||
|
||||
std::vector<std::shared_ptr<IndexerBase>> LanguagePackageJava::instantiateSupportedIndexers() const
|
||||
{
|
||||
return {
|
||||
return {
|
||||
std::make_shared<IndexerJava>()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ IndexerCommandType IndexerCommandJava::getStaticIndexerCommandType()
|
||||
|
||||
IndexerCommandJava::IndexerCommandJava(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::string& languageStandard,
|
||||
const std::wstring& languageStandard,
|
||||
const std::vector<FilePath>& classPath
|
||||
)
|
||||
: IndexerCommand(sourceFilePath)
|
||||
@@ -38,7 +38,7 @@ size_t IndexerCommandJava::getByteSize(size_t stringSize) const
|
||||
return size;
|
||||
}
|
||||
|
||||
std::string IndexerCommandJava::getLanguageStandard() const
|
||||
std::wstring IndexerCommandJava::getLanguageStandard() const
|
||||
{
|
||||
return m_languageStandard;
|
||||
}
|
||||
@@ -64,9 +64,9 @@ QJsonObject IndexerCommandJava::doSerialize() const
|
||||
classPathArray.append(QString::fromStdWString(classPath.wstr()));
|
||||
}
|
||||
jsonObject["class_path"] = classPathArray;
|
||||
}
|
||||
}
|
||||
{
|
||||
jsonObject["language_standard"] = QString::fromStdString(m_languageStandard);
|
||||
jsonObject["language_standard"] = QString::fromStdWString(m_languageStandard);
|
||||
}
|
||||
|
||||
return jsonObject;
|
||||
|
||||
@@ -16,13 +16,13 @@ public:
|
||||
|
||||
IndexerCommandJava(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::string& languageStandard,
|
||||
const std::wstring& languageStandard,
|
||||
const std::vector<FilePath>& classPath);
|
||||
|
||||
virtual IndexerCommandType getIndexerCommandType() const override;
|
||||
virtual size_t getByteSize(size_t stringSize) const override;
|
||||
|
||||
std::string getLanguageStandard() const;
|
||||
std::wstring getLanguageStandard() const;
|
||||
|
||||
void setClassPath(std::vector<FilePath> classPath);
|
||||
std::vector<FilePath> getClassPath() const;
|
||||
@@ -31,7 +31,7 @@ protected:
|
||||
QJsonObject doSerialize() const override;
|
||||
|
||||
private:
|
||||
const std::string m_languageStandard;
|
||||
const std::wstring m_languageStandard;
|
||||
std::vector<FilePath> m_classPath;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ class IndexerJava: public Indexer<IndexerCommandJava>
|
||||
{
|
||||
public:
|
||||
virtual ~IndexerJava();
|
||||
|
||||
virtual std::shared_ptr<IntermediateStorage> doIndex(std::shared_ptr<IndexerCommandJava> indexerCommand);
|
||||
};
|
||||
|
||||
|
||||
@@ -87,12 +87,12 @@ void JavaParser::buildIndex(std::shared_ptr<IndexerCommandJava> indexerCommand)
|
||||
|
||||
void JavaParser::buildIndex(const FilePath& filePath, std::shared_ptr<TextAccess> textAccess)
|
||||
{
|
||||
buildIndex(filePath, "10", "", textAccess);
|
||||
buildIndex(filePath, L"10", "", textAccess);
|
||||
}
|
||||
|
||||
void JavaParser::buildIndex(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::string& languageStandard,
|
||||
const std::wstring& languageStandard,
|
||||
const std::string& classPath,
|
||||
std::shared_ptr<TextAccess> textAccess)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ void JavaParser::buildIndex(
|
||||
m_id,
|
||||
m_currentFilePath.str(),
|
||||
fileContent,
|
||||
languageStandard,
|
||||
utility::encodeToUtf8(languageStandard),
|
||||
classPath,
|
||||
verbose
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
private:
|
||||
void buildIndex(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::string& languageStandard,
|
||||
const std::wstring& languageStandard,
|
||||
const std::string& classPath,
|
||||
std::shared_ptr<TextAccess> textAccess);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ std::set<FilePath> SourceGroupJava::getAllSourceFilePaths() const
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
const std::string languageStandard = getSourceGroupSettingsJava()->getJavaStandard();
|
||||
const std::wstring languageStandard = getSourceGroupSettingsJava()->getJavaStandard();
|
||||
|
||||
std::vector<FilePath> classPath = getClassPath();
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ std::set<FilePath> SourceGroupJavaSonargraph::getAllSourceFilePaths() const
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
|
||||
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user