From: Aleksey Bragin Date: Thu, 17 Feb 2011 22:29:49 +0000 (+0000) Subject: [RTL/DPH] X-Git-Tag: ReactOS-0.3.13~234 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=708dbb878c84fabe8e497c9772a3aa97dfce618f [RTL/DPH] - Various fixes: set NodeToAllocate member of the heap root so it could be used lated in AVL allocation routine, initialize the AvailableAllocation list. - Comment out biased pointer checks for now, and fix biasing the AdjacencyEntry pointer (spotted by rafalh). svn path=/trunk/; revision=50773 --- diff --git a/reactos/lib/rtl/heappage.c b/reactos/lib/rtl/heappage.c index 18415466680..be1b18b69b3 100644 --- a/reactos/lib/rtl/heappage.c +++ b/reactos/lib/rtl/heappage.c @@ -434,6 +434,7 @@ RtlpDphPlaceOnBusyList(PDPH_HEAP_ROOT DphRoot, PDPH_HEAP_BLOCK DphNode) PVOID AddressUserData; /* Add it to the AVL busy nodes table */ + DphRoot->NodeToAllocate = DphNode; AddressUserData = RtlInsertElementGenericTableAvl(&DphRoot->BusyNodesTable, &DphNode->pUserAllocation, sizeof(ULONG_PTR), @@ -518,8 +519,8 @@ RtlpDphRemoveFromAvailableList(PDPH_HEAP_ROOT DphRoot, PDPH_HEAP_BLOCK Node) { /* Make sure Adjacency list pointers are biased */ - ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Flink)); - ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Blink)); + //ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Flink)); + //ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Blink)); /* Remove it from the list */ RemoveEntryList(&Node->AvailableEntry); @@ -529,8 +530,8 @@ RtlpDphRemoveFromAvailableList(PDPH_HEAP_ROOT DphRoot, DphRoot->nAvailableAllocationBytesCommitted -= Node->nVirtualBlockSize; /* Remove bias from the AdjacencyEntry pointer */ - POINTER_REMOVE_BIAS(Node->AdjacencyEntry.Flink); - POINTER_REMOVE_BIAS(Node->AdjacencyEntry.Blink); + Node->AdjacencyEntry.Flink = (PLIST_ENTRY)POINTER_REMOVE_BIAS(Node->AdjacencyEntry.Flink); + Node->AdjacencyEntry.Blink = (PLIST_ENTRY)POINTER_REMOVE_BIAS(Node->AdjacencyEntry.Blink); } VOID NTAPI @@ -720,8 +721,8 @@ RtlpDphSearchAvailableMemoryListForBestFit(PDPH_HEAP_ROOT DphRoot, } /* Make sure Adjacency list pointers are biased */ - ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Flink)); - ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Blink)); + //ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Flink)); + //ASSERT(IS_BIASED_POINTER(Node->AdjacencyEntry.Blink)); return Node; } @@ -997,7 +998,6 @@ RtlpDphAllocateNodeForTable(IN PRTL_AVL_TABLE Table, /* Get pointer to the containing heap root record */ DphRoot = CONTAINING_RECORD(Table, DPH_HEAP_ROOT, BusyNodesTable); pBlock = DphRoot->NodeToAllocate; - ASSERT(pBlock == (PDPH_HEAP_BLOCK)(Table+1)); // FIXME: Delete once confirmed DphRoot->NodeToAllocate = NULL; ASSERT(pBlock); @@ -1348,6 +1348,7 @@ RtlpPageHeapCreate(ULONG Flags, DphRoot->Seed = PerfCounter.LowPart; RtlInitializeCriticalSection(DphRoot->HeapCritSect); + InitializeListHead(&DphRoot->AvailableAllocationHead); /* Create a normal heap for this paged heap */ DphRoot->NormalHeap = RtlCreateHeap(Flags, NULL, TotalSize, CommitSize, NULL, (PRTL_HEAP_PARAMETERS)-1);