Author: tkreuzer Date: Sat Oct 11 12:40:24 2014 New Revision: 64664
URL: http://svn.reactos.org/svn/reactos?rev=64664&view=rev Log: [RTL/NTOSKRNL] Rename AVL tree functions with macros when included from Mm. This is necessary since the compiler might chose to not inline these functions (and does so on MSVC debug builds) yet only generate one instance of the function, where 2 different versions are required. This caused RtlAvlTree functions to fail on MSVC builds, since they were calling the functions compiled for Mm AVL trees!
Modified: trunk/reactos/lib/rtl/avlsupp.c trunk/reactos/ntoskrnl/mm/ARM3/miavl.h
Modified: trunk/reactos/lib/rtl/avlsupp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/avlsupp.c?rev=64664... ============================================================================== --- trunk/reactos/lib/rtl/avlsupp.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/avlsupp.c [iso-8859-1] Sat Oct 11 12:40:24 2014 @@ -96,7 +96,7 @@
FORCEINLINE VOID -RtlPromoteAvlTreeNode(IN PRTL_BALANCED_LINKS Node) +RtlpPromoteAvlTreeNode(IN PRTL_BALANCED_LINKS Node) { PRTL_BALANCED_LINKS ParentNode, SuperParentNode; PRTL_BALANCED_LINKS *SwapNode1, *SwapNode2; @@ -139,7 +139,7 @@ if (RtlBalance(ChildNode) == Balance) { /* This performs the rotation described in Knuth A8-A10 for Case 1 */ - RtlPromoteAvlTreeNode(ChildNode); + RtlpPromoteAvlTreeNode(ChildNode);
/* The nodes are now balanced */ RtlSetBalance(ChildNode, RtlBalancedAvlTree); @@ -155,8 +155,8 @@ RtlLeftChildAvl(ChildNode) : RtlRightChildAvl(ChildNode);
/* Do the double-rotation described in Knuth A8-A10 for Case 2 */ - RtlPromoteAvlTreeNode(SubChildNode); - RtlPromoteAvlTreeNode(SubChildNode); + RtlpPromoteAvlTreeNode(SubChildNode); + RtlpPromoteAvlTreeNode(SubChildNode);
/* Was the sub-child sharing the same balance as the node? */ if (RtlBalance(SubChildNode) == Balance) @@ -194,7 +194,7 @@ * The case that remains is that the child was already balanced, so this is * This is the rotation required for Case 3 in Knuth A8-A10 */ - RtlPromoteAvlTreeNode(ChildNode); + RtlpPromoteAvlTreeNode(ChildNode);
/* Now the child has the opposite weight of the node */ RtlSetBalance(ChildNode, -Balance);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miavl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miavl.h?re... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miavl.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miavl.h [iso-8859-1] Sat Oct 11 12:40:24 2014 @@ -28,9 +28,30 @@ #define PRTL_BALANCED_LINKS PMMADDRESS_NODE #define MI_ASSERT(x) ASSERT(x)
+/* We need to rename the functions to prevent conflicts when not inlined! */ +#define RtlpFindAvlTableNodeOrParent MiFindAvlTableNodeOrParent +#define RtlpPromoteAvlTreeNode MiPromoteAvlTreeNode +#define RtlpRebalanceAvlTreeNode MiRebalanceAvlTreeNode +#define RtlpInsertAvlTreeNode MiInsertAvlTreeNode +#define RtlpDeleteAvlTreeNode MiDeleteAvlTreeNode + +/* These are implementation specific */ +#define RtlpCopyAvlNodeData MiCopyAvlNodeData +#define RtlpAvlCompareRoutine MiAvlCompareRoutine +#define RtlSetParent MiSetParent +#define RtlSetBalance MiSetBalance +#define RtlBalance MiBalance +#define RtlParentAvl MiParentAvl +#define RtlRightChildAvl MiRightChildAvl +#define RtlLeftChildAvl MiLeftChildAvl +#define RtlIsLeftChildAvl MiIsLeftChildAvl +#define RtlIsRightChildAvl MiIsRightChildAvl +#define RtlInsertAsLeftChildAvl MiInsertAsLeftChildAvl +#define RtlInsertAsRightChildAvl MiInsertAsRightChildAvl + FORCEINLINE VOID -RtlpCopyAvlNodeData(IN PRTL_BALANCED_LINKS Node1, +MiCopyAvlNodeData(IN PRTL_BALANCED_LINKS Node1, IN PRTL_BALANCED_LINKS Node2) { Node1->u1.Parent = Node2->u1.Parent; @@ -40,7 +61,7 @@
FORCEINLINE RTL_GENERIC_COMPARE_RESULTS -RtlpAvlCompareRoutine(IN PRTL_AVL_TABLE Table, +MiAvlCompareRoutine(IN PRTL_AVL_TABLE Table, IN PVOID Buffer, IN PVOID UserData) { @@ -62,7 +83,7 @@
FORCEINLINE VOID -RtlSetParent(IN PRTL_BALANCED_LINKS Node, +MiSetParent(IN PRTL_BALANCED_LINKS Node, IN PRTL_BALANCED_LINKS Parent) { Node->u1.Parent = (PRTL_BALANCED_LINKS)((ULONG_PTR)Parent | (Node->u1.Balance & 0x3)); @@ -70,7 +91,7 @@
FORCEINLINE VOID -RtlSetBalance(IN PRTL_BALANCED_LINKS Node, +MiSetBalance(IN PRTL_BALANCED_LINKS Node, IN SCHAR Balance) { Node->u1.Balance = Balance; @@ -78,56 +99,49 @@
FORCEINLINE SCHAR -RtlBalance(IN PRTL_BALANCED_LINKS Node) +MiBalance(IN PRTL_BALANCED_LINKS Node) { return (SCHAR)Node->u1.Balance; }
FORCEINLINE PRTL_BALANCED_LINKS -RtlParentAvl(IN PRTL_BALANCED_LINKS Node) +MiParentAvl(IN PRTL_BALANCED_LINKS Node) { return (PRTL_BALANCED_LINKS)((ULONG_PTR)Node->u1.Parent & ~3); }
FORCEINLINE -BOOLEAN -RtlIsRootAvl(IN PRTL_BALANCED_LINKS Node) -{ - return (RtlParentAvl(Node) == Node); -} - -FORCEINLINE PRTL_BALANCED_LINKS -RtlRightChildAvl(IN PRTL_BALANCED_LINKS Node) +MiRightChildAvl(IN PRTL_BALANCED_LINKS Node) { return Node->RightChild; }
FORCEINLINE PRTL_BALANCED_LINKS -RtlLeftChildAvl(IN PRTL_BALANCED_LINKS Node) +MiLeftChildAvl(IN PRTL_BALANCED_LINKS Node) { return Node->LeftChild; }
FORCEINLINE BOOLEAN -RtlIsLeftChildAvl(IN PRTL_BALANCED_LINKS Node) +MiIsLeftChildAvl(IN PRTL_BALANCED_LINKS Node) { return (RtlLeftChildAvl(RtlParentAvl(Node)) == Node); }
FORCEINLINE BOOLEAN -RtlIsRightChildAvl(IN PRTL_BALANCED_LINKS Node) +MiIsRightChildAvl(IN PRTL_BALANCED_LINKS Node) { return (RtlRightChildAvl(RtlParentAvl(Node)) == Node); }
FORCEINLINE VOID -RtlInsertAsLeftChildAvl(IN PRTL_BALANCED_LINKS Parent, +MiInsertAsLeftChildAvl(IN PRTL_BALANCED_LINKS Parent, IN PRTL_BALANCED_LINKS Node) { Parent->LeftChild = Node; @@ -136,7 +150,7 @@
FORCEINLINE VOID -RtlInsertAsRightChildAvl(IN PRTL_BALANCED_LINKS Parent, +MiInsertAsRightChildAvl(IN PRTL_BALANCED_LINKS Parent, IN PRTL_BALANCED_LINKS Node) { Parent->RightChild = Node;