Title: [280761] trunk/Source/_javascript_Core
Revision
280761
Author
[email protected]
Date
2021-08-07 15:40:24 -0700 (Sat, 07 Aug 2021)

Log Message

Fix ODR violations in JSC
https://bugs.webkit.org/show_bug.cgi?id=228876

Patch by Michael Catanzaro <[email protected]> on 2021-08-07
Reviewed by Yusuke Suzuki.

When built with LTO enabled, GCC will warn about violations of C++'s one-definition rule.
JSC currently has two violations. The first is JSC::SpeciesConstructResult, which has two
different declarations, one in ArrayPrototype.cpp and the other in
JSArrayBufferPrototype.cpp. I decided to change the version in ArrayPrototype.cpp to make
the declarations match.

The next problem is JSC::SignalContext. We have two different versions of this struct, one
in VMTraps.cpp and the other in SigillCrashAnalyzer.cpp. In this case, I decided to change
the one in VMTraps.cpp from JSC::SignalContext to JSC::VMTraps::SignalContext.

* runtime/ArrayPrototype.cpp:
* runtime/VMTraps.cpp:
(JSC::VMTraps::tryInstallTrapBreakpoints):
* runtime/VMTraps.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (280760 => 280761)


--- trunk/Source/_javascript_Core/ChangeLog	2021-08-07 21:38:59 UTC (rev 280760)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-08-07 22:40:24 UTC (rev 280761)
@@ -1,3 +1,25 @@
+2021-08-07  Michael Catanzaro  <[email protected]>
+
+        Fix ODR violations in JSC
+        https://bugs.webkit.org/show_bug.cgi?id=228876
+
+        Reviewed by Yusuke Suzuki.
+
+        When built with LTO enabled, GCC will warn about violations of C++'s one-definition rule.
+        JSC currently has two violations. The first is JSC::SpeciesConstructResult, which has two
+        different declarations, one in ArrayPrototype.cpp and the other in
+        JSArrayBufferPrototype.cpp. I decided to change the version in ArrayPrototype.cpp to make
+        the declarations match.
+
+        The next problem is JSC::SignalContext. We have two different versions of this struct, one
+        in VMTraps.cpp and the other in SigillCrashAnalyzer.cpp. In this case, I decided to change
+        the one in VMTraps.cpp from JSC::SignalContext to JSC::VMTraps::SignalContext.
+
+        * runtime/ArrayPrototype.cpp:
+        * runtime/VMTraps.cpp:
+        (JSC::VMTraps::tryInstallTrapBreakpoints):
+        * runtime/VMTraps.h:
+
 2021-08-07  Keith Miller  <[email protected]>
 
         for-in should only emit one loop in bytecode

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (280760 => 280761)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2021-08-07 21:38:59 UTC (rev 280760)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2021-08-07 22:40:24 UTC (rev 280761)
@@ -198,7 +198,7 @@
         && globalObject->arraySpeciesWatchpointSet().stateOnJSThread() == IsWatched;
 }
 
-enum class SpeciesConstructResult {
+enum class SpeciesConstructResult : uint8_t {
     FastPath,
     Exception,
     CreatedObject

Modified: trunk/Source/_javascript_Core/runtime/VMTraps.cpp (280760 => 280761)


--- trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2021-08-07 21:38:59 UTC (rev 280760)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2021-08-07 22:40:24 UTC (rev 280761)
@@ -47,7 +47,7 @@
 
 #if ENABLE(SIGNAL_BASED_VM_TRAPS)
 
-struct SignalContext {
+struct VMTraps::SignalContext {
 private:
     SignalContext(PlatformRegisters& registers, MacroAssemblerCodePtr<PlatformRegistersPCPtrTag> trapPC)
         : registers(registers)
@@ -84,8 +84,8 @@
         return false;
     return stackBounds.contains(frame);
 }
-    
-void VMTraps::tryInstallTrapBreakpoints(SignalContext& context, StackBounds stackBounds)
+
+void VMTraps::tryInstallTrapBreakpoints(VMTraps::SignalContext& context, StackBounds stackBounds)
 {
     // This must be the initial signal to get the mutator thread's attention.
     // Let's get the thread to break at invalidation points if needed.

Modified: trunk/Source/_javascript_Core/runtime/VMTraps.h (280760 => 280761)


--- trunk/Source/_javascript_Core/runtime/VMTraps.h	2021-08-07 21:38:59 UTC (rev 280760)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.h	2021-08-07 22:40:24 UTC (rev 280761)
@@ -221,7 +221,10 @@
     JS_EXPORT_PRIVATE void fireTrap(Event);
     void handleTraps(BitField mask = AsyncEvents);
 
-    void tryInstallTrapBreakpoints(struct SignalContext&, StackBounds);
+#if ENABLE(SIGNAL_BASED_VM_TRAPS)
+    struct SignalContext;
+    void tryInstallTrapBreakpoints(struct VMTraps::SignalContext&, StackBounds);
+#endif
 
 private:
     VM& vm() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to