WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
212190
Add more Bitmap methods.
https://bugs.webkit.org/show_bug.cgi?id=212190
Summary
Add more Bitmap methods.
Mark Lam
Reported
2020-05-20 23:56:27 PDT
Specifically, setEachNthBit - sets every Nth bit starting at a specified start bit operator= - assignment operator|= - bit or and assignment operator&= - bit and and assignment operator^= - bit xor and assignment
Attachments
proposed patch.
(23.57 KB, patch)
2020-05-21 00:02 PDT
,
Mark Lam
rmorisset
: review+
Details
Formatted Diff
Diff
patch for landing.
(16.48 KB, patch)
2020-05-21 14:36 PDT
,
Mark Lam
rmorisset
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-05-20 23:56:56 PDT
<
rdar://problem/63481333
>
Mark Lam
Comment 2
2020-05-21 00:02:26 PDT
Created
attachment 399939
[details]
proposed patch.
Sam Weinig
Comment 3
2020-05-21 10:54:00 PDT
What do you plan to do with these?
Mark Lam
Comment 4
2020-05-21 11:01:04 PDT
(In reply to Sam Weinig from
comment #3
)
> What do you plan to do with these?
I'm exploring implementing a MarkedBlock FreeList using Bitmap instead of a linked list of FreeCells. For that purpose, computation of which block atoms are free is done using bit math on Marked bits, NewlyAllocated bits, and some other mask. The setEachNthBit() method is needed to make the other mask.
Robin Morisset
Comment 5
2020-05-21 11:45:46 PDT
Comment on
attachment 399939
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=399939&action=review
r=me, with a couple of suggestions for the tests.
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1001 > + {
Is this block just the same as the one above except for s/size/smallsize/g ? If so, is it possible to make it an helper function to avoid the repetition?
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1093 > + temp.set(i, (randomNumber() > 0.5));
I am not sure that a random number in a test is a great idea. It sounds like a recipe for flakiness/non-reproducibility.
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1102 > + Bitmap<smallSize, WordType> smallTemp;
Same comment as above, maybe try merging the tests for smallSize and for size with a helper function.
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1113 > + smallTemp.set(i, (randomNumber() > 0.5));
see my comment above, I think it might be nicer to bake somewhere (at the top of the file?) an array with the random-looking values, instead of drawing them truly randomly at each execution.
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1427 > + // 1 & 0
typo: & instead of ^
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1434 > + // 1 & 1
ditto.
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1506 > + // 1 & 0
ditto.
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1513 > + // 1 & 1
ditto.
Mark Lam
Comment 6
2020-05-21 12:44:06 PDT
Comment on
attachment 399939
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=399939&action=review
>> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1001 >> + { > > Is this block just the same as the one above except for s/size/smallsize/g ? > If so, is it possible to make it an helper function to avoid the repetition?
Not identical because of the different data sets used. Also I don't have predetermined data sets for the smallSize case. So, I'm using randomNumber to generate them in some of the cases below where needed. I can look into refactoring this.
>> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:1427 >> + // 1 & 0 > > typo: & instead of ^
Thanks fixed.
Mark Lam
Comment 7
2020-05-21 14:36:32 PDT
Created
attachment 399981
[details]
patch for landing.
Robin Morisset
Comment 8
2020-05-21 14:43:21 PDT
Comment on
attachment 399981
[details]
patch for landing. View in context:
https://bugs.webkit.org/attachment.cgi?id=399981&action=review
Thanks for improving the tests!
> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:29 > +#include <wtf/RandomNumber.h>
No longer needed.
Mark Lam
Comment 9
2020-05-21 14:44:33 PDT
Comment on
attachment 399981
[details]
patch for landing. View in context:
https://bugs.webkit.org/attachment.cgi?id=399981&action=review
>> Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:29 >> +#include <wtf/RandomNumber.h> > > No longer needed.
Will remove.
Mark Lam
Comment 10
2020-05-21 15:14:11 PDT
Thanks for the reviews. Landed in
r262030
: <
http://trac.webkit.org/r262030
>.
Michael Catanzaro
Comment 11
2020-05-27 10:53:46 PDT
This introduced a nice GCC warning spam: In file included from DerivedSources/JavaScriptCore/unified-sources/UnifiedSource-f0a787a9-2.cpp:5: /home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp:194:16: warning: implicitly-declared ‘constexpr WTF::Bitmap<4>::Bitmap(const WTF::Bitmap<4>&)’ is deprecated [-Wdeprecated-copy] 194 | return result; | ^~~~~~ because: DerivedSources/ForwardingHeaders/wtf/Bitmap.h:480:13: note: because ‘WTF::Bitmap<4>’ has user-provided ‘void WTF::Bitmap<bitmapSize, WordType>::operator=(const WTF::Bitmap<bitmapSize, WordType>&) [with long unsigned int bitmapSize = 4; WordType = unsigned int]’ 480 | inline void Bitmap<bitmapSize, WordType>::operator=(const Bitmap& other) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ To avoid the warning, we should either (a) remove the copy assignment operator, or (b) add a copy constructor. Either way would be fine, but in this case I'd prefer (a) because I don't think the new copy assignment operator is needed. It uses a loop to manually copy the bits of the sole member variable, a std::array, but a default copy of the array would be equivalent, right?
Michael Catanzaro
Comment 12
2020-05-27 11:26:58 PDT
(In reply to Michael Catanzaro from
comment #11
)
> This introduced a nice GCC warning spam:
Created:
bug #212421
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