RESOLVED FIXED210028
ensureStillAliveHere can take the value in any location
https://bugs.webkit.org/show_bug.cgi?id=210028
Summary ensureStillAliveHere can take the value in any location
Keith Miller
Reported 2020-04-05 08:56:17 PDT
ensureStillAliveHere can take the value in any location
Attachments
Patch (1.54 KB, patch)
2020-04-05 08:58 PDT, Keith Miller
no flags
Patch for landing (2.25 KB, patch)
2020-04-05 09:25 PDT, Keith Miller
no flags
Patch for landing (2.25 KB, patch)
2020-04-05 10:27 PDT, Keith Miller
no flags
Keith Miller
Comment 1 2020-04-05 08:58:41 PDT
Mark Lam
Comment 2 2020-04-05 09:22:53 PDT
Comment on attachment 395509 [details] Patch r=me. Please also fix the variant in JSValue too.
Keith Miller
Comment 3 2020-04-05 09:25:24 PDT
Created attachment 395511 [details] Patch for landing
Keith Miller
Comment 4 2020-04-05 09:25:49 PDT
(In reply to Mark Lam from comment #2) > Comment on attachment 395509 [details] > Patch > > r=me. Please also fix the variant in JSValue too. Ah, I missed that one. Done.
Mark Lam
Comment 5 2020-04-05 09:31:56 PDT
Actually, I think the “clobbers memory” declaration is needed. Otherwise,the compiler can optimize the whole asm statement away. https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html “Note, however, that if the code that follows the asm statement makes no use of any of the output operands, the GCC optimizers may discard the asm statement as unneeded (see Volatile).” I think :memory takes care of this.
Keith Miller
Comment 6 2020-04-05 09:34:07 PDT
(In reply to Mark Lam from comment #5) > Actually, I think the “clobbers memory” declaration is needed. > Otherwise,the compiler can optimize the whole asm statement away. > > https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html > “Note, however, that if the code that follows the asm statement makes no use > of any of the output operands, the GCC optimizers may discard the asm > statement as unneeded (see Volatile).” > > I think :memory takes care of this. That's what the volatile does. https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile GCC’s optimizers sometimes discard asm statements if they determine there is no need for the output variables. Also, the optimizers may move code out of loops if they believe that the code will always return the same result (i.e. none of its input values change between calls). Using the volatile qualifier disables these optimizations.
Mark Lam
Comment 7 2020-04-05 09:35:39 PDT
Comment on attachment 395511 [details] Patch for landing Nevermind. https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile “ Using the volatile qualifier disables these optimizations. asm statements that have no output operands, including asm goto statements, are implicitly volatile.”
EWS
Comment 8 2020-04-05 09:57:23 PDT
Patch 395511 does not build
Keith Miller
Comment 9 2020-04-05 10:27:54 PDT
Created attachment 395516 [details] Patch for landing
EWS
Comment 10 2020-04-05 11:23:32 PDT
Committed r259554: <https://trac.webkit.org/changeset/259554> All reviewed patches have been landed. Closing bug and clearing flags on attachment 395516 [details].
Radar WebKit Bug Importer
Comment 11 2020-04-05 11:24:12 PDT
Yusuke Suzuki
Comment 12 2020-04-05 16:08:23 PDT
I think this is not correct. This needs to be a compiler-fence and "memory" is used to make it so. e.g. WTF::compilerFence. 241 // Just a compiler fence. Has no effect on the hardware, but tells the compiler 242 // not to move things around this call. Should not affect the compiler's ability 243 // to do things like register allocation and code motion over pure operations. 244 inline void compilerFence() 245 { 246 #if OS(WINDOWS) && !COMPILER(GCC_COMPATIBLE) 247 _ReadWriteBarrier(); 248 #else 249 asm volatile("" ::: "memory"); 250 #endif 251 }
Yusuke Suzuki
Comment 13 2020-04-05 16:25:24 PDT
Note You need to log in before you can comment on or make changes to this bug.