Bug 66203 - WTF does not have a balanced tree implementation that would be suitable for use in a memory allocator
Summary: WTF does not have a balanced tree implementation that would be suitable for u...
Status: RESOLVED DUPLICATE of bug 66363
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-13 20:09 PDT by Filip Pizlo
Modified: 2011-08-16 23:41 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2011-08-13 20:09:03 PDT
WTF has an AVL tree implementation, but it does not allow for the removal of specific nodes - only the removal of keys.  Hence, if the user wishes to remove a specific node, which may have a key equal to any number of other nodes in the tree, then the AVLTree code is not particularly useful.  Furthermore, AVL trees are somewhat less efficient than red-black trees, so it would be preferable to have a red-black tree instead.  WebCore has a red-black tree implementation (PODRedBlackTree), but it internally manages nodes and assumes that it is fine to copy one node into another.  Hence, if a pointer to a node is also placed into other data structures, then PODRedBlackTree operations may lead to the pointers being invalidated.  As well, PODRedBlackTree makes it impossible to place a node inside of the free space that it would represent, if a red-black tree was used for free space management.

WTF should have a red-black tree implementation that allows the user to decide how nodes are allocated, ensures that pointers into nodes in the tree remain valid regardless of operations on other nodes in the tree, and allows for specific nodes to be removed instead of just removal by key.
Comment 1 Gavin Barraclough 2011-08-13 22:24:35 PDT
We generally don't accept patches that only check in unused code.  As such, if this bug intends to just check in the tree unused, I'm afraid it is likely to be r-'ed. :-(
Comment 2 Filip Pizlo 2011-08-13 22:26:46 PDT
(In reply to comment #1)
> We generally don't accept patches that only check in unused code.  As such, if this bug intends to just check in the tree unused, I'm afraid it is likely to be r-'ed. :-(

Tests don't count?
Comment 3 Filip Pizlo 2011-08-16 23:40:43 PDT
Closing this since

*** This bug has been marked as a duplicate of bug 66363 ***
Comment 4 Filip Pizlo 2011-08-16 23:41:45 PDT
(In reply to comment #3)
> Closing this since
> 
> *** This bug has been marked as a duplicate of bug 66363 ***

Closing this since it is a work-in-progress prerequisite of bug 66363.  It would be better to have a single patch in this case, rather than smaller patches that by themselves don't do anything.