WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
27051
Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled
https://bugs.webkit.org/show_bug.cgi?id=27051
Summary
Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled
Norbert Leser
Reported
2009-07-07 18:39:02 PDT
Created
attachment 32410
[details]
Code patch for Registerfile ccp and h RegisterFile constructor currently throws #error when both MMAP and VIRTUALALLOC conditions fail. On any platform that does not provide these features (for instance, Symbian), the fallback should be regular malloc (or fastMalloc). Memory allocation with fastMalloc functionally equivalent in this case, even though it may have certain drawbacks such as lack of dynamic pre-allocation. This should be the general, preferred way of fixing the issue, as opposed to introducing conditional code block for platform Symbian.
Attachments
Code patch for Registerfile ccp and h
(2.14 KB, patch)
2009-07-07 18:39 PDT
,
Norbert Leser
eric
: review-
Details
Formatted Diff
Diff
Update of patch file for bug #27051
(2.60 KB, patch)
2009-08-26 12:48 PDT
,
Norbert Leser
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Maciej Stachowiak
Comment 1
2009-07-09 20:13:09 PDT
Comment on
attachment 32410
[details]
Code patch for Registerfile ccp and h I'll have to check into whether this works - I don't remember whether there are special alignment or lazy commit requirements. But I also noticed that PLATFORM(SYMBIAN) uses fastMalloc in place of VM allocation inside Collector.cpp. That's definitely bugus - the GC counts on the guaranteed alignment provided by vm_map, VirtualAlloc and posix_memalign. Failing to meet the alignment requirements will lead to random crashes. If Symbian has no way to get aligned memory chunks, it needs to do a trick to fix up the alignment, like the mmap() code path.
Norbert Leser
Comment 2
2009-08-05 11:18:02 PDT
(In reply to
comment #1
)
> (From update of
attachment 32410
[details]
) > I'll have to check into whether this works - I don't remember whether there are > special alignment or lazy commit requirements. > > But I also noticed that PLATFORM(SYMBIAN) uses fastMalloc in place of VM > allocation inside Collector.cpp. That's definitely bugus - the GC counts on the > guaranteed alignment provided by vm_map, VirtualAlloc and posix_memalign. > Failing to meet the alignment requirements will lead to random crashes. If > Symbian has no way to get aligned memory chunks, it needs to do a trick to fix > up the alignment, like the mmap() code path.
Maciej, did you have a chance, in the meantime, to verify whether there are special requirements for alignment, etc? I could not find any just by looking at the code, and we are running my patch here for a while already without seeing any impact. It would be great if we can resolve this issue soon. If you can point me to alignment issues, I could easily submit my initial code that mimics alignment via fastMalloc() but otherwise it would certainly be cleaner to leave that overhead out and just implement my patch as is.
Geoffrey Garen
Comment 3
2009-08-12 10:57:45 PDT
(In reply to
comment #1
)
> (From update of
attachment 32410
[details]
) > I'll have to check into whether this works - I don't remember whether there are > special alignment or lazy commit requirements.
The code depends on lazy commit to avoid wasting memory, but not for correctness.
Eric Seidel (no email)
Comment 4
2009-08-17 18:28:51 PDT
Comment on
attachment 32410
[details]
Code patch for Registerfile ccp and h I think this needs a comment in the code indicating that this is not the preferred method. That platforms should provide instead an allocator which provides lazy commit. I'm assuming for the moment that there are no alignment requirements. If there are, this patch is invalid for other reasons. Please track down othermaciej or ggaren over irc for the alignment requirements. I'm ready to r+ a change with an added comment about how fastMalloc does not lazy commit and that platforms should instead provide a better allocator.
Geoffrey Garen
Comment 5
2009-08-25 11:06:20 PDT
> I'm assuming for the moment that there are no alignment requirements. If there > are, this patch is invalid for other reasons.
The only alignment requirement I know of is that the buffer must be aligned to sizeof(Register).
Norbert Leser
Comment 6
2009-08-26 12:48:33 PDT
Created
attachment 38633
[details]
Update of patch file for
bug #27051
Added comment in code about drawbacks of this alternate branch, as suggested by Eric. Confirmed in the meantime with Maciej and Geoffrey that there are no specific alignment requirements.
Eric Seidel (no email)
Comment 7
2009-09-02 02:35:52 PDT
Comment on
attachment 38633
[details]
Update of patch file for
bug #27051
Seems OK to me. No one else has voiced further objections so r+.
Eric Seidel (no email)
Comment 8
2009-09-02 02:49:41 PDT
Comment on
attachment 38633
[details]
Update of patch file for
bug #27051
Clearing flags on attachment: 38633 Committed
r47959
: <
http://trac.webkit.org/changeset/47959
>
Eric Seidel (no email)
Comment 9
2009-09-02 02:49:50 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug