Bug 131170

Summary: bmalloc
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: New BugsAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, barraclough, commit-queue, fpizlo, joepeck, kling, mhahnenberg, mrowe, ossy, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
archive
kling: review+
Patch none

Geoffrey Garen
Reported 2014-04-03 10:51:52 PDT
This is bmalloc. This is just the library; it isn't integrated into WebKit or build-webkit yet.
Attachments
archive (196.77 KB, application/octet-stream)
2014-04-03 10:52 PDT, Geoffrey Garen
kling: review+
Patch (5.82 KB, patch)
2014-04-07 17:45 PDT, Geoffrey Garen
no flags
Geoffrey Garen
Comment 1 2014-04-03 10:52:40 PDT
Created attachment 228521 [details] archive Uploading as a .zip because these are all new files.
WebKit Commit Bot
Comment 2 2014-04-03 10:55:57 PDT
Attachment 228521 [details] did not pass style-queue: Total errors found: 0 in 0 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andreas Kling
Comment 3 2014-04-03 15:50:24 PDT
Calls to mmap() should be tagged with VM_TAG_FOR_TCMALLOC_MEMORY (and someone should re-name that tag :|)
Sam Weinig
Comment 4 2014-04-03 16:56:42 PDT
(In reply to comment #3) > Calls to mmap() should be tagged with VM_TAG_FOR_TCMALLOC_MEMORY (and someone should re-name that tag :|) Or better yet, we should get a new tag for this.
Gavin Barraclough
Comment 5 2014-04-03 17:11:24 PDT
Mutex::isLocked() It looks like this function may return the wrong results – specifically if the mutux is unlocked & two threads try to read the value at the same time, then one may return true. Thread A: if (m_flag.test_and_set(std::memory_order_acquire)) return true; Thread B: if (m_flag.test_and_set(std::memory_order_acquire)) return true; Thread A: m_flag.clear(); return false;
Gavin Barraclough
Comment 6 2014-04-03 17:12:10 PDT
Oh, also, this project contains 25 tab characters. Please to be removing them and replacing with one hundred spaces.
Gavin Barraclough
Comment 7 2014-04-03 17:16:20 PDT
Surely INLINE & NO_INLINE could live in peace and harmony together sharing a header file? – I don't think they need one each.
Gavin Barraclough
Comment 8 2014-04-03 17:34:59 PDT
Style nit, "Sizes.h" is a mix of heap specific constants & stdlib-extra-esque helper functions (e.g. roundUpToMultipleOf). Some of the helper functions are depended on by stuff in the stdlib directory (which seems like a soft form of layering violation). I think it would be cleaner to split this header in two, keep the bmalloc specific constants under heap, & move the helper functions to a new header in the stdlib directory.
Geoffrey Garen
Comment 9 2014-04-03 18:14:12 PDT
Can I distribute the spaces how I like?
Geoffrey Garen
Comment 10 2014-04-03 18:31:27 PDT
(In reply to comment #3) > Calls to mmap() should be tagged with VM_TAG_FOR_TCMALLOC_MEMORY (and someone should re-name that tag :|) Fixed locally.
Geoffrey Garen
Comment 11 2014-04-03 18:37:46 PDT
(In reply to comment #5) > Mutex::isLocked() > > It looks like this function may return the wrong results – specifically if the mutux is unlocked & two threads try to read the value at the same time, then one may return true. Good point. I used to use this function for ASSERTs, in which case it's OK that one thread won't ASSERT, because the other thread will ASSERT, and then things will get synchronized right quick :). If I wanted to keep this function, maybe I should move the ASSERT into it, or rename it to "isLockedSloppy" or something like that. However, now that we have the "pass the lock to prove you have it" idiom, I guess I should just remove this function to avoid future foot-gunning. Fixed locally.
Geoffrey Garen
Comment 12 2014-04-03 18:39:55 PDT
(In reply to comment #6) > Oh, also, this project contains 25 tab characters. Please to be removing them and replacing with one hundred spaces. Fixed locally.
Geoffrey Garen
Comment 13 2014-04-03 18:41:26 PDT
(In reply to comment #7) > Surely INLINE & NO_INLINE could live in peace and harmony together sharing a header file? – I don't think they need one each. Bokay.
Geoffrey Garen
Comment 14 2014-04-03 18:43:51 PDT
Also: Added 2-clause BSD licenses to all files. Also: Renamed vmAlignment to superChunkSize.
Gavin Barraclough
Comment 15 2014-04-03 18:48:25 PDT
vmDeallocatePhysicalPages/vmAllocatePhysicalPages Should these also ASSERT that p is page aligned?
Geoffrey Garen
Comment 16 2014-04-03 18:50:40 PDT
(In reply to comment #8) > I think it would be cleaner to split this header in two, keep the bmalloc specific constants under heap, & move the helper functions to a new header in the stdlib directory. Fixed locally: std/Algorithm.h.
Geoffrey Garen
Comment 17 2014-04-03 18:56:36 PDT
(In reply to comment #15) > vmDeallocatePhysicalPages/vmAllocatePhysicalPages > > Should these also ASSERT that p is page aligned? Bokay. Fixed locally by adding a "vmValidate" function for pointers and sizes.
Gavin Barraclough
Comment 18 2014-04-04 00:30:56 PDT
Vector<T>::pop() never shrinks the capacity?
Geoffrey Garen
Comment 19 2014-04-04 09:38:36 PDT
(In reply to comment #18) > Vector<T>::pop() never shrinks the capacity? Nice. Fixed locally: Peak Memory: <geometric mean> 17,340kB 17,206kB ^ 1.01x smaller Memory at End: churn --parallel 480kB 452kB ^ 1.06x smaller list_allocate --parallel 1,480kB 1,392kB ^ 1.06x smaller tree_allocate --parallel 1,976kB 1,748kB ^ 1.13x smaller tree_churn --parallel 2,056kB 1,888kB ^ 1.09x smaller fragment_iterate --parallel 1,068kB 1,012kB ^ 1.06x smaller medium 8,344kB 5,488kB ^ 1.52x smaller medium --parallel 8,608kB 6,548kB ^ 1.31x smaller
Geoffrey Garen
Comment 20 2014-04-07 16:55:08 PDT
Committed revision 166893.
Geoffrey Garen
Comment 21 2014-04-07 17:45:50 PDT
Reopening to attach new patch.
Geoffrey Garen
Comment 22 2014-04-07 17:45:53 PDT
Geoffrey Garen
Comment 23 2014-04-07 17:47:27 PDT
Comment on attachment 228785 [details] Patch Oops! Wrong bug for this patch.
Csaba Osztrogonác
Comment 24 2014-04-08 03:26:14 PDT
You missed to add copyright and license to AsyncTask.cpp.
Geoffrey Garen
Comment 25 2014-04-08 12:27:05 PDT
(In reply to comment #24) > You missed to add copyright and license to AsyncTask.cpp. Thanks. That file is vestigial, so I've removed it.
Note You need to log in before you can comment on or make changes to this bug.