RESOLVED FIXED180514
Refactoring: Rename ScrambledPtr to Poisoned.
https://bugs.webkit.org/show_bug.cgi?id=180514
Summary Refactoring: Rename ScrambledPtr to Poisoned.
Mark Lam
Reported 2017-12-06 17:29:48 PST
Let's switch our nomenclature to "poisoning" instead of "scrambling" pointers. This allows us to use shorter names.
Attachments
proposed patch. (75.21 KB, patch)
2017-12-06 17:36 PST, Mark Lam
saam: review+
patch for landing + cmake build fix. (76.13 KB, patch)
2017-12-06 17:53 PST, Mark Lam
no flags
patch for landing + speculative fix for Windows. (76.13 KB, patch)
2017-12-06 19:37 PST, Mark Lam
no flags
patch for landing + 32-bit windows build fix. (76.25 KB, patch)
2017-12-06 20:34 PST, Mark Lam
no flags
patch for re-landing. (75.92 KB, patch)
2017-12-07 10:11 PST, Mark Lam
jfbastien: review+
Mark Lam
Comment 1 2017-12-06 17:36:10 PST
Created attachment 328665 [details] proposed patch.
EWS Watchlist
Comment 2 2017-12-06 17:40:40 PST
Attachment 328665 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:31: g_classInfoPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:32: g_masmPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 26 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 3 2017-12-06 17:53:57 PST
Created attachment 328669 [details] patch for landing + cmake build fix.
EWS Watchlist
Comment 4 2017-12-06 17:56:51 PST
Attachment 328669 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:31: g_classInfoPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:32: g_masmPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 5 2017-12-06 19:37:46 PST
Created attachment 328672 [details] patch for landing + speculative fix for Windows.
EWS Watchlist
Comment 6 2017-12-06 19:39:19 PST
Attachment 328672 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:31: g_classInfoPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:32: g_masmPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 7 2017-12-06 20:34:24 PST
Created attachment 328677 [details] patch for landing + 32-bit windows build fix.
EWS Watchlist
Comment 8 2017-12-06 20:38:21 PST
Attachment 328677 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:31: g_classInfoPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:32: g_masmPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 9 2017-12-06 22:10:51 PST
Thanks for the review. Landed in r225620: <http://trac.webkit.org/r225620>.
Radar WebKit Bug Importer
Comment 10 2017-12-06 22:11:23 PST
Michael Catanzaro
Comment 11 2017-12-07 08:28:41 PST
Comment on attachment 328677 [details] patch for landing + 32-bit windows build fix. View in context: https://bugs.webkit.org/attachment.cgi?id=328677&action=review > Source/WTF/wtf/Poisoned.h:44 > -template<typename T, uintptr_t& key, typename = std::enable_if_t<std::is_pointer<T>::value>> > -class ScrambledPtr { > +template<typename KeyType, KeyType key, typename T, typename = std::enable_if_t<std::is_pointer<T>::value>> > +class PoisonedImpl { Adding KeyType to the template parameters has broken the build with GCC 7. I don't know how to fix it, so I'm going to roll it out... sorry. I guess GCC 6 works, because EWS and all the bots are fine. In file included from ../../Source/JavaScriptCore/runtime/JSCPoisonedPtr.h:28:0, from ../../Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:29, from ../../Source/JavaScriptCore/interpreter/AbstractPC.h:28, from ../../Source/JavaScriptCore/interpreter/CallFrame.h:25, from ../../Source/JavaScriptCore/runtime/ClassInfo.h:25, from ../../Source/JavaScriptCore/runtime/Structure.h:28, from ../../Source/JavaScriptCore/bytecode/ArrayProfile.h:29, from ../../Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:28: ../../Source/WTF/wtf/Poisoned.h: In substitution of ‘template<uintptr_t& key, class T> using Poisoned = WTF::PoisonedImpl<const long unsigned int&, ((const long unsigned int&)key), T> [with uintptr_t& key = JSC::g_classInfoPoison; T = const JSC::ClassInfo*]’: ../../Source/JavaScriptCore/runtime/JSCPoisonedPtr.h:37:74: required from here ../../Source/WTF/wtf/Poisoned.h:122:56: error: ‘(const long unsigned int&)JSC::g_classInfoPoison’ is not a valid template argument for type ‘const long unsigned int&’ because it is not an object with linkage using Poisoned = PoisonedImpl<const uintptr_t&, key, T>; ^
Michael Catanzaro
Comment 12 2017-12-07 08:32:46 PST
Michael Catanzaro
Comment 13 2017-12-07 08:33:00 PST
Reopening
JF Bastien
Comment 14 2017-12-07 09:08:50 PST
Comment on attachment 328677 [details] patch for landing + 32-bit windows build fix. View in context: https://bugs.webkit.org/attachment.cgi?id=328677&action=review Here's a GCC 7 version without the bug: https://godbolt.org/g/zVx5fU extern "C" const unsigned bar; template<typename KeyType, KeyType key> struct FooImpl { unsigned boo(unsigned v) { return v ^ key; } }; template<const unsigned& key> using Foo = FooImpl<const unsigned&, key>; Foo<bar> foo; Same thing with the bug: https://godbolt.org/g/a9UYxD extern "C" unsigned bar; template<typename KeyType, KeyType key> struct FooImpl { unsigned boo(unsigned v) { return v ^ key; } }; template<unsigned& key> using Foo = FooImpl<const unsigned&, key>; Foo<bar> foo; > Source/JavaScriptCore/runtime/JSCPoisonedPtr.h:33 > +extern "C" JS_EXPORTDATA uintptr_t g_masmPoison; And const here. > Source/WTF/wtf/Poisoned.h:121 > +template<uintptr_t& key, typename T> key needs to be const here.
JF Bastien
Comment 15 2017-12-07 09:13:30 PST
Or you can drop the const entirely. It'll generate the same code: mov 0x0(%rip),%eax # 0 is a relocation to <bar> xor %edi,%eax
Mark Lam
Comment 16 2017-12-07 10:11:20 PST
Created attachment 328701 [details] patch for re-landing.
EWS Watchlist
Comment 17 2017-12-07 10:13:14 PST
Attachment 328701 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:31: g_classInfoPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp:32: g_masmPoison is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
JF Bastien
Comment 18 2017-12-07 10:17:36 PST
Comment on attachment 328701 [details] patch for re-landing. r=me
Mark Lam
Comment 19 2017-12-07 10:50:38 PST
Michael Catanzaro
Comment 20 2017-12-07 11:06:42 PST
It works, thanks JF!
Note You need to log in before you can comment on or make changes to this bug.