Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KDevelop
KDevelop
Commits
a1865644
Commit
a1865644
authored
Jul 13, 2022
by
Milian Wolff
Browse files
Cleanup: Remove CacheEntry in PersistentSymbolTable
Instead give better names to the typedefs and use them directly.
parent
9a28e06d
Pipeline
#205512
canceled with stage
in 4 minutes and 54 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
kdevplatform/language/duchain/persistentsymboltable.cpp
View file @
a1865644
...
...
@@ -87,14 +87,6 @@ struct RecursiveImportCacheRepository {
}
};
struct
CacheEntry
{
using
Data
=
KDevVarLengthArray
<
IndexedDeclaration
>
;
using
DataHash
=
QHash
<
TopDUContext
::
IndexedRecursiveImports
,
Data
>
;
DataHash
m_hash
;
};
}
DEFINE_LIST_MEMBER_HASH
(
PersistentSymbolTableItem
,
declarations
,
IndexedDeclaration
)
class
PersistentSymbolTableItem
...
...
@@ -187,6 +179,8 @@ public:
const
PersistentSymbolTableItem
&
m_item
;
};
using
CachedDeclarations
=
KDevVarLengthArray
<
IndexedDeclaration
>
;
using
CachedDeclarationsByImports
=
QHash
<
TopDUContext
::
IndexedRecursiveImports
,
CachedDeclarations
>
;
using
Declarations
=
ConstantConvenientEmbeddedSet
<
IndexedDeclaration
,
IndexedDeclarationHandler
>
;
using
CachedIndexedRecursiveImports
=
Utils
::
StorableSet
<
IndexedTopDUContext
,
IndexedTopDUContextIndexConversion
,
RecursiveImportCacheRepository
,
true
>
;
...
...
@@ -200,12 +194,13 @@ class PersistentSymbolTableRepo : public ItemRepository<PersistentSymbolTableIte
using
ItemRepository
::
ItemRepository
;
public:
QHash
<
IndexedQualifiedIdentifier
,
Cache
Entry
>
declarationsCache
;
QHash
<
IndexedQualifiedIdentifier
,
Cache
dDeclarationsByImports
>
declarationsCache
;
// We cache the imports so the currently used nodes are very close in memory, which leads to much better CPU cache
// utilization
QHash
<
TopDUContext
::
IndexedRecursiveImports
,
CachedIndexedRecursiveImports
>
importsCache
;
};
}
template
<
>
class
ItemRepositoryFor
<
PersistentSymbolTable
>
...
...
@@ -395,13 +390,13 @@ void PersistentSymbolTable::visitFilteredDeclarations(const IndexedQualifiedIden
if
(
declarations
.
dataSize
()
>
MinimumCountForCache
)
{
// Do visibility caching
auto
&
cached
=
repo
.
declarationsCache
[
id
];
auto
cacheIt
=
cached
.
m_hash
.
constFind
(
visibility
);
if
(
cacheIt
!=
cached
.
m_hash
.
constEnd
())
{
auto
cacheIt
=
cached
.
constFind
(
visibility
);
if
(
cacheIt
!=
cached
.
constEnd
())
{
return
FilteredDeclarationIterator
(
Declarations
::
Iterator
(
cacheIt
->
constData
(),
cacheIt
->
size
(),
-
1
),
cachedImports
);
}
auto
insertIt
=
cached
.
m_hash
.
insert
(
visibility
,
{});
auto
insertIt
=
cached
.
insert
(
visibility
,
{});
auto
&
cache
=
*
insertIt
;
{
auto
cacheVisitor
=
[
&
cache
](
const
IndexedDeclaration
&
decl
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment