mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[RTL] Use LastEntryInSegment to speed up RtlpFindAndCommitPages. CORE-14588
This commit is contained in:
parent
c4f736e8f4
commit
52f103c85b
1 changed files with 14 additions and 9 deletions
|
@ -665,16 +665,21 @@ RtlpFindAndCommitPages(PHEAP Heap,
|
||||||
/* Calculate first and last entries */
|
/* Calculate first and last entries */
|
||||||
FirstEntry = (PHEAP_ENTRY)Address;
|
FirstEntry = (PHEAP_ENTRY)Address;
|
||||||
|
|
||||||
/* Go through the entries to find the last one */
|
LastEntry = Segment->LastEntryInSegment;
|
||||||
if (PreviousUcr)
|
if (!(LastEntry->Flags & HEAP_ENTRY_LAST_ENTRY) ||
|
||||||
LastEntry = (PHEAP_ENTRY)((ULONG_PTR)PreviousUcr->Address + PreviousUcr->Size);
|
LastEntry + LastEntry->Size != FirstEntry)
|
||||||
else
|
|
||||||
LastEntry = &Segment->Entry;
|
|
||||||
|
|
||||||
while (!(LastEntry->Flags & HEAP_ENTRY_LAST_ENTRY))
|
|
||||||
{
|
{
|
||||||
ASSERT(LastEntry->Size != 0);
|
/* Go through the entries to find the last one */
|
||||||
LastEntry += LastEntry->Size;
|
if (PreviousUcr)
|
||||||
|
LastEntry = (PHEAP_ENTRY)((ULONG_PTR)PreviousUcr->Address + PreviousUcr->Size);
|
||||||
|
else
|
||||||
|
LastEntry = &Segment->Entry;
|
||||||
|
|
||||||
|
while (!(LastEntry->Flags & HEAP_ENTRY_LAST_ENTRY))
|
||||||
|
{
|
||||||
|
ASSERT(LastEntry->Size != 0);
|
||||||
|
LastEntry += LastEntry->Size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ASSERT((LastEntry + LastEntry->Size) == FirstEntry);
|
ASSERT((LastEntry + LastEntry->Size) == FirstEntry);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue