Skip to content

Commit

Permalink
Make small optimization for fetching resultSet once
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo committed Dec 22, 2023
1 parent 5b14fd0 commit 41ac398
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Bit Slicer/ZGSearchFunctions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1870,17 +1870,24 @@ static void _ZGSearchForIndirectPointerRecursively(const ZGPointerValueEntry *po
}
}

NSArray<NSValue *> *totalStaticSegmentRanges = searchData.totalStaticSegmentRanges;
NSValue *firstTotalStaticSegmentRangeValue = totalStaticSegmentRanges.firstObject;

uint16_t searchIndirectOffset = searchData->_indirectOffset;

__block NSUInteger resultSetIndex = initialResultSetIndex;
__block NSMutableData *currentResultSet = resultSets[resultSetIndex];
[searchResults enumerateWithCount:searchResultsCount removeResults:NO usingBlock:^(const void * _Nonnull searchResultData, BOOL * __unused _Nonnull stop) {
NSMutableData *currentResultSet = resultSets[resultSetIndex];

NSUInteger initialStaticMainResultSetLength = (levelIndex == 0) ? staticMainExecutableResultSet.length : 0;
NSUInteger initialStaticOtherLibraryResultSetLength = (levelIndex == 0) ? staticOtherLibrariesResultSet.length : 0;
NSUInteger initialStaticMainResultSetLength;
NSUInteger initialStaticOtherLibraryResultSetLength;
if (levelIndex == 0)
{
currentResultSet = resultSets[resultSetIndex];
initialStaticMainResultSetLength = staticMainExecutableResultSet.length;
initialStaticOtherLibraryResultSetLength = staticOtherLibrariesResultSet.length;
}
else
{
initialStaticMainResultSetLength = 0;
initialStaticOtherLibraryResultSetLength = 0;
}

// Extract base address for searching
ZGMemoryAddress baseAddress;
Expand Down

0 comments on commit 41ac398

Please sign in to comment.