Bug 34601 - [BREWMP] Port Heap::allocateBlock and Heap::freeBlock
Summary: [BREWMP] Port Heap::allocateBlock and Heap::freeBlock
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 33564
  Show dependency treegraph
 
Reported: 2010-02-04 09:56 PST by Kwang Yul Seo
Modified: 2010-08-11 05:38 PDT (History)
0 users

See Also:


Attachments
Patch (3.50 KB, patch)
2010-02-04 10:02 PST, Kwang Yul Seo
abarth: review-
Details | Formatted Diff | Diff
Moved the advance logic from Heap::allocate to CollectorBitmap::advanceToNextPossibleFreeCell. (2.12 KB, patch)
2010-05-26 13:58 PDT, Nathan Lawrence
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kwang Yul Seo 2010-02-04 09:56:27 PST
Use fastMalloc to allocate 64KB aligned memory because BREW has neither VirtualAlloc nor mmap. There is no way to allocate aligned memory in BREW.
Comment 1 Kwang Yul Seo 2010-02-04 10:02:35 PST
Created attachment 48154 [details]
Patch

This is not a space-efficient way to allocate aligned memory. Any suggestion to improve this?
Comment 2 Eric Seidel (no email) 2010-03-05 14:22:27 PST
Comment on attachment 48154 [details]
Patch

I don't understand why m_rawMemoryMap is needed.

Isn't the conversion from requested address to real address always the same?
Comment 3 Adam Barth 2010-03-09 07:32:51 PST
Comment on attachment 48154 [details]
Patch

I would have called addressAligned alignedAddress, but that's just a nit.

To answer Eric's question, the two are different in the case were fastMalloc returns an unaligned address because

+    addressAligned &= BLOCK_MASK;

changes the address.

This patch is horribly memory inefficient.  It seems to cause JavaScript use about twice as much memory as necessary.  I'd recommend finding another strategy to allocate aligned addresses.
Comment 4 Nathan Lawrence 2010-05-26 13:58:59 PDT
Created attachment 57131 [details]
Moved the advance logic from Heap::allocate to CollectorBitmap::advanceToNextPossibleFreeCell.
Comment 5 Nathan Lawrence 2010-05-26 14:02:10 PDT
Comment on attachment 57131 [details]
Moved the advance logic from Heap::allocate to CollectorBitmap::advanceToNextPossibleFreeCell.

sorry, wrong bug.
Comment 6 Kwang Yul Seo 2010-08-11 05:38:57 PDT
This patch is no longer necessary as Heap::allocateBlock and Heap::freeBlock are changed to use AlignedMemoryAllocator.