mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 02:21:22 +00:00
[RTL] Use LastEntryInSegment to speed up RtlpFindAndCommitPages. CORE-14588
This commit is contained in:
parent
771f7d3f95
commit
10d23614d3
1 changed files with 14 additions and 9 deletions
|
@ -665,6 +665,10 @@ RtlpFindAndCommitPages(PHEAP Heap,
|
||||||
/* Calculate first and last entries */
|
/* Calculate first and last entries */
|
||||||
FirstEntry = (PHEAP_ENTRY)Address;
|
FirstEntry = (PHEAP_ENTRY)Address;
|
||||||
|
|
||||||
|
LastEntry = Segment->LastEntryInSegment;
|
||||||
|
if (!(LastEntry->Flags & HEAP_ENTRY_LAST_ENTRY) ||
|
||||||
|
LastEntry + LastEntry->Size != FirstEntry)
|
||||||
|
{
|
||||||
/* Go through the entries to find the last one */
|
/* Go through the entries to find the last one */
|
||||||
if (PreviousUcr)
|
if (PreviousUcr)
|
||||||
LastEntry = (PHEAP_ENTRY)((ULONG_PTR)PreviousUcr->Address + PreviousUcr->Size);
|
LastEntry = (PHEAP_ENTRY)((ULONG_PTR)PreviousUcr->Address + PreviousUcr->Size);
|
||||||
|
@ -676,6 +680,7 @@ RtlpFindAndCommitPages(PHEAP Heap,
|
||||||
ASSERT(LastEntry->Size != 0);
|
ASSERT(LastEntry->Size != 0);
|
||||||
LastEntry += LastEntry->Size;
|
LastEntry += LastEntry->Size;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ASSERT((LastEntry + LastEntry->Size) == FirstEntry);
|
ASSERT((LastEntry + LastEntry->Size) == FirstEntry);
|
||||||
|
|
||||||
/* Unmark it as a last entry */
|
/* Unmark it as a last entry */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue