Skip to content

Commit a555801

Browse files
committed
runtime: Exclude hidden patterns from getting added to flattened tree
1 parent 4bf84d9 commit a555801

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/include/pl/pattern_language.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ namespace pl {
428428

429429
std::map<u64, std::vector<std::shared_ptr<ptrn::Pattern>>> m_patterns;
430430
std::atomic<bool> m_flattenedPatternsValid = false;
431-
std::map<u64, wolv::container::IntervalTree<ptrn::Pattern*, u64, 5>> m_flattenedPatterns;
431+
std::map<u64, wolv::container::IntervalTree<ptrn::Pattern*, u64, 8>> m_flattenedPatterns;
432432
std::thread m_flattenThread;
433433
std::vector<std::function<void(PatternLanguage&)>> m_cleanupCallbacks;
434434
std::vector<std::shared_ptr<core::ast::ASTNode>> m_currAST;

lib/source/pl/pattern_language.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,14 @@ namespace pl {
555555
if (this->m_aborted)
556556
return;
557557

558+
if (pattern->getVisibility() == ptrn::Visibility::Hidden || pattern->getVisibility() == ptrn::Visibility::HighlightHidden)
559+
continue;
560+
558561
if (auto staticArray = dynamic_cast<ptrn::PatternArrayStatic*>(pattern.get()); staticArray != nullptr) {
559562
if (staticArray->getEntryCount() > 0 && staticArray->getEntry(0)->getChildren().empty()) {
563+
if (this->m_aborted)
564+
return;
565+
560566
const auto address = staticArray->getOffset();
561567
const auto size = staticArray->getSize();
562568
sectionTree.insert({ address, address + size - 1 }, staticArray);
@@ -572,6 +578,9 @@ namespace pl {
572578
if (child->getSize() == 0)
573579
continue;
574580

581+
if (child->getVisibility() == ptrn::Visibility::Hidden || child->getVisibility() == ptrn::Visibility::HighlightHidden)
582+
continue;
583+
575584
sectionTree.insert({ address, address + child->getSize() - 1 }, child);
576585
}
577586
}

0 commit comments

Comments
 (0)