[Webkit-unassigned] [Bug 66363] The executable allocator makes it difficult to free individual chunks of executable memory

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 8 23:06:13 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=66363


Filip Pizlo <fpizlo at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #106079|0                           |1
        is obsolete|                            |
 Attachment #106079|review?, commit-queue?      |
               Flag|                            |
 Attachment #106842|                            |review?
               Flag|                            |




--- Comment #35 from Filip Pizlo <fpizlo at apple.com>  2011-09-08 23:06:12 PST ---
Created an attachment (id=106842)
 --> (https://bugs.webkit.org/attachment.cgi?id=106842&action=review)
the patch - replaced the red black tree with one based on PODRedBlackTree

This replaces the RedBlackTree with one based on PODRedBlackTree.

It shares no code with the one from MIT that the previous patch had, so the license issues should be entirely side-stepped.

I could not use PODRedBlackTree directly because that tree does things that I do not want, and lacks features that I need:

- PODRedBlackTree removes nodes by copying one node over another one.  MetaAllocator needs to be able to hold references to nodes in the tree, and expects that these pointers remain valid until MetaAllocator deletes those nodes itself.  Hence, I needed to change the PODRedBlackTree's removal method to move y into z's position rather than copying the contents of y into z.

- PODRedBlackTree calls virtual methods all over the place to support features that WebCore needs.  I don't need these features, and I don't want virtual calls.  The MetaAllocator is designed to be decently fast, and so it avoids virtual calls inside the hot paths.

- PODRedBlackTree has additional features to support partial ordering.  I don't need these features at all.

- PODRedBlackTree allocates nodes internally and presents an API that does not expose nodes.  MetaAllocator wants to be able to allocate nodes itself, and is carefully written to not allocate (or free) any nodes in the common case - it simply moves a node from one place to another in the tree.

I thought about combining PODRedBlackTree and my RedBlackTree into a common implementation, with features to specialize as needed.  This would be doable.

Pro: one less tree in the code base.

Con: the code for the tree becomes more complex, because users of PODRedBlackTree and MetaAllocator require significantly different functionality and make different assumptions about the inner workings.

I ultimately decided that the cons of combining the trees into one outweighed the pros.  Mainly, my thinking is that the tree logic itself is unlikely to be ever modified - so having two copies does not increase maintenance burden.  But the interface that the tree presents is likely to be modified - so having two simple implementations of that interface seems better than having one much more complex one that mixes the requirements of WebCore and the JSC JIT.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list