RESOLVED FIXED 183416
Make it possible to randomize register allocation
https://bugs.webkit.org/show_bug.cgi?id=183416
Summary Make it possible to randomize register allocation
Filip Pizlo
Reported 2018-03-07 14:30:32 PST
Patch forthcoming.
Attachments
the patch (6.44 KB, patch)
2018-03-07 14:31 PST, Filip Pizlo
keith_miller: review+
Filip Pizlo
Comment 1 2018-03-07 14:31:36 PST
Created attachment 335224 [details] the patch
EWS Watchlist
Comment 2 2018-03-07 14:36:12 PST
Attachment 335224 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/b3/air/AirCode.cpp:79: More than one command on the same line [whitespace/newline] [4] ERROR: Source/JavaScriptCore/b3/air/AirCode.cpp:80: More than one command on the same line [whitespace/newline] [4] Total errors found: 2 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Keith Miller
Comment 3 2018-03-07 14:41:30 PST
Comment on attachment 335224 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=335224&action=review > Source/JavaScriptCore/b3/air/AirCode.cpp:62 > + Vector<Reg> volatileRegs; Why not call this callerSaveRegs? Is it to avoid typo bugs? > Source/JavaScriptCore/b3/air/AirCode.cpp:65 > all.exclude(RegisterSet::stackRegisters()); I think the wasm bug might be that you are not excluding the pinned registers?
Keith Miller
Comment 4 2018-03-07 14:43:09 PST
Comment on attachment 335224 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=335224&action=review >> Source/JavaScriptCore/b3/air/AirCode.cpp:65 >> all.exclude(RegisterSet::stackRegisters()); > > I think the wasm bug might be that you are not excluding the pinned registers? Nvm, I don't think this is the issue. Ignore me.
Keith Miller
Comment 5 2018-03-07 14:43:37 PST
r=me.
Filip Pizlo
Comment 6 2018-03-08 09:03:07 PST
(In reply to Keith Miller from comment #3) > Comment on attachment 335224 [details] > the patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=335224&action=review > > > Source/JavaScriptCore/b3/air/AirCode.cpp:62 > > + Vector<Reg> volatileRegs; > > Why not call this callerSaveRegs? Is it to avoid typo bugs? Yeah. I don't really know what the best terminology is, but I have often used "volatile" versus "callee-save", because it's easier to distinguish the two. > > > Source/JavaScriptCore/b3/air/AirCode.cpp:65 > > all.exclude(RegisterSet::stackRegisters()); > > I think the wasm bug might be that you are not excluding the pinned > registers? Nah. This is just about order. The pinned regs will get excluded anyway.
Filip Pizlo
Comment 7 2018-03-08 09:12:16 PST
Radar WebKit Bug Importer
Comment 8 2018-03-08 09:30:59 PST
Darin Adler
Comment 9 2018-03-10 17:40:39 PST
Comment on attachment 335224 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=335224&action=review > Source/WTF/wtf/MathExtras.h:534 > +template<typename VectorType, typename RandomFunc> > +void shuffleVector(VectorType& vector, size_t size, const RandomFunc& randomFunc) > +{ > + for (size_t i = 0; i + 1 < size; ++i) > + std::swap(vector[i], vector[i + randomFunc(size - i)]); > +} Why doesn’t this use std::random_shuffle?
Keith Miller
Comment 10 2018-03-12 10:08:49 PDT
(In reply to Darin Adler from comment #9) > Comment on attachment 335224 [details] > the patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=335224&action=review > > > Source/WTF/wtf/MathExtras.h:534 > > +template<typename VectorType, typename RandomFunc> > > +void shuffleVector(VectorType& vector, size_t size, const RandomFunc& randomFunc) > > +{ > > + for (size_t i = 0; i + 1 < size; ++i) > > + std::swap(vector[i], vector[i + randomFunc(size - i)]); > > +} > > Why doesn’t this use std::random_shuffle? According to http://en.cppreference.com/w/cpp/algorithm/random_shuffle, std::random_shuffle is deprecated in C++14 and removed in C++17 so it probably doesn't make sense to use it. We could use std::shuffle but that has a really obnoxious API...
Note You need to log in before you can comment on or make changes to this bug.