Title: [272330] trunk/Source/_javascript_Core
Revision
272330
Author
[email protected]
Date
2021-02-03 10:40:55 -0800 (Wed, 03 Feb 2021)

Log Message

[AppleWin 32bit][LLInt] LLIntData.h(104) : warning C4172: returning address of local variable or temporary: id
https://bugs.webkit.org/show_bug.cgi?id=220714

Reviewed by Mark Lam.

This patch fixes LLInt build when ENABLE(COMPUTED_GOTO_OPCODES) is false.

* llint/LLIntData.h:
(JSC::LLInt::getOpcode):
(JSC::LLInt::getOpcodeWide16):
(JSC::LLInt::getOpcodeWide32):
(JSC::LLInt::getOpcodeAddress):
(JSC::LLInt::getOpcodeWide16Address):
(JSC::LLInt::getOpcodeWide32Address):
(JSC::LLInt::getCodePtr):
(JSC::LLInt::getWide16CodePtr):
(JSC::LLInt::getWide32CodePtr):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (272329 => 272330)


--- trunk/Source/_javascript_Core/ChangeLog	2021-02-03 18:39:04 UTC (rev 272329)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-02-03 18:40:55 UTC (rev 272330)
@@ -1,3 +1,23 @@
+2021-02-03  Yusuke Suzuki  <[email protected]>
+
+        [AppleWin 32bit][LLInt] LLIntData.h(104) : warning C4172: returning address of local variable or temporary: id
+        https://bugs.webkit.org/show_bug.cgi?id=220714
+
+        Reviewed by Mark Lam.
+
+        This patch fixes LLInt build when ENABLE(COMPUTED_GOTO_OPCODES) is false.
+
+        * llint/LLIntData.h:
+        (JSC::LLInt::getOpcode):
+        (JSC::LLInt::getOpcodeWide16):
+        (JSC::LLInt::getOpcodeWide32):
+        (JSC::LLInt::getOpcodeAddress):
+        (JSC::LLInt::getOpcodeWide16Address):
+        (JSC::LLInt::getOpcodeWide32Address):
+        (JSC::LLInt::getCodePtr):
+        (JSC::LLInt::getWide16CodePtr):
+        (JSC::LLInt::getWide32CodePtr):
+
 2021-02-02  Ross Kirsling  <[email protected]>
 
         Completion value of a finally block should not be ignored if completion is abrupt

Modified: trunk/Source/_javascript_Core/llint/LLIntData.h (272329 => 272330)


--- trunk/Source/_javascript_Core/llint/LLIntData.h	2021-02-03 18:39:04 UTC (rev 272329)
+++ trunk/Source/_javascript_Core/llint/LLIntData.h	2021-02-03 18:40:55 UTC (rev 272330)
@@ -60,9 +60,12 @@
     friend Opcode* opcodeMap();
     friend Opcode* opcodeMapWide16();
     friend Opcode* opcodeMapWide32();
-    friend const Opcode& getOpcode(OpcodeID);
-    friend const Opcode& getOpcodeWide16(OpcodeID);
-    friend const Opcode& getOpcodeWide32(OpcodeID);
+    friend Opcode getOpcode(OpcodeID);
+    friend Opcode getOpcodeWide16(OpcodeID);
+    friend Opcode getOpcodeWide32(OpcodeID);
+    friend const Opcode* getOpcodeAddress(OpcodeID);
+    friend const Opcode* getOpcodeWide16Address(OpcodeID);
+    friend const Opcode* getOpcodeWide32Address(OpcodeID);
     template<PtrTag tag> friend MacroAssemblerCodePtr<tag> getCodePtr(OpcodeID);
     template<PtrTag tag> friend MacroAssemblerCodePtr<tag> getWide16CodePtr(OpcodeID);
     template<PtrTag tag> friend MacroAssemblerCodePtr<tag> getWide32CodePtr(OpcodeID);
@@ -96,7 +99,7 @@
     return g_opcodeMapWide32;
 }
 
-inline const Opcode& getOpcode(OpcodeID id)
+inline Opcode getOpcode(OpcodeID id)
 {
 #if ENABLE(COMPUTED_GOTO_OPCODES)
     return g_opcodeMap[id];
@@ -105,7 +108,7 @@
 #endif
 }
 
-inline const Opcode& getOpcodeWide16(OpcodeID id)
+inline Opcode getOpcodeWide16(OpcodeID id)
 {
 #if ENABLE(COMPUTED_GOTO_OPCODES)
     return g_opcodeMapWide16[id];
@@ -115,7 +118,7 @@
 #endif
 }
 
-inline const Opcode& getOpcodeWide32(OpcodeID id)
+inline Opcode getOpcodeWide32(OpcodeID id)
 {
 #if ENABLE(COMPUTED_GOTO_OPCODES)
     return g_opcodeMapWide32[id];
@@ -125,6 +128,24 @@
 #endif
 }
 
+
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+inline const Opcode* getOpcodeAddress(OpcodeID id)
+{
+    return &g_opcodeMap[id];
+}
+
+inline const Opcode* getOpcodeWide16Address(OpcodeID id)
+{
+    return &g_opcodeMapWide16[id];
+}
+
+inline const Opcode* getOpcodeWide32Address(OpcodeID id)
+{
+    return &g_opcodeMapWide32[id];
+}
+#endif
+
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getCodePtrImpl(const Opcode opcode, const void* opcodeAddress)
 {
@@ -137,22 +158,37 @@
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getCodePtr(OpcodeID opcodeID)
 {
-    const Opcode& opcode = getOpcode(opcodeID);
-    return getCodePtrImpl<tag>(opcode, &opcode);
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+    const Opcode* opcode = getOpcodeAddress(opcodeID);
+    return getCodePtrImpl<tag>(*opcode, opcode);
+#else
+    static_assert(!ENABLE(ARM64E));
+    return getCodePtrImpl<tag>(getOpcode(opcodeID), nullptr);
+#endif
 }
 
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getWide16CodePtr(OpcodeID opcodeID)
 {
-    const Opcode& opcode = getOpcodeWide16(opcodeID);
-    return getCodePtrImpl<tag>(opcode, &opcode);
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+    const Opcode* opcode = getOpcodeWide16Address(opcodeID);
+    return getCodePtrImpl<tag>(*opcode, opcode);
+#else
+    static_assert(!ENABLE(ARM64E));
+    return getCodePtrImpl<tag>(getOpcodeWide16(opcodeID), nullptr);
+#endif
 }
 
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getWide32CodePtr(OpcodeID opcodeID)
 {
-    const Opcode& opcode = getOpcodeWide32(opcodeID);
-    return getCodePtrImpl<tag>(opcode, &opcode);
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+    const Opcode* opcode = getOpcodeWide32Address(opcodeID);
+    return getCodePtrImpl<tag>(*opcode, opcode);
+#else
+    static_assert(!ENABLE(ARM64E));
+    return getCodePtrImpl<tag>(getOpcodeWide32(opcodeID), nullptr);
+#endif
 }
 
 template<PtrTag tag>
@@ -206,7 +242,7 @@
 
 #if ENABLE(WEBASSEMBLY)
 
-inline const Opcode& getOpcode(WasmOpcodeID id)
+inline Opcode getOpcode(WasmOpcodeID id)
 {
 #if ENABLE(COMPUTED_GOTO_OPCODES)
     return g_opcodeMap[numOpcodeIDs + id];
@@ -215,7 +251,7 @@
 #endif
 }
 
-inline const Opcode& getOpcodeWide16(WasmOpcodeID id)
+inline Opcode getOpcodeWide16(WasmOpcodeID id)
 {
 #if ENABLE(COMPUTED_GOTO_OPCODES)
     return g_opcodeMapWide16[numOpcodeIDs + id];
@@ -225,7 +261,7 @@
 #endif
 }
 
-inline const Opcode& getOpcodeWide32(WasmOpcodeID id)
+inline Opcode getOpcodeWide32(WasmOpcodeID id)
 {
 #if ENABLE(COMPUTED_GOTO_OPCODES)
     return g_opcodeMapWide32[numOpcodeIDs + id];
@@ -235,25 +271,57 @@
 #endif
 }
 
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+inline const Opcode* getOpcodeAddress(WasmOpcodeID id)
+{
+    return &g_opcodeMap[numOpcodeIDs + id];
+}
+
+inline const Opcode* getOpcodeWide16Address(WasmOpcodeID id)
+{
+    return &g_opcodeMapWide16[numOpcodeIDs + id];
+}
+
+inline const Opcode* getOpcodeWide32Address(WasmOpcodeID id)
+{
+    return &g_opcodeMapWide32[numOpcodeIDs + id];
+}
+#endif
+
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getCodePtr(WasmOpcodeID opcodeID)
 {
-    const Opcode& opcode = getOpcode(opcodeID);
-    return getCodePtrImpl<tag>(opcode, &opcode);
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+    const Opcode* opcode = getOpcodeAddress(opcodeID);
+    return getCodePtrImpl<tag>(*opcode, opcode);
+#else
+    static_assert(!ENABLE(ARM64E));
+    return getCodePtrImpl<tag>(getOpcode(opcodeID), nullptr);
+#endif
 }
 
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getWide16CodePtr(WasmOpcodeID opcodeID)
 {
-    const Opcode& opcode = getOpcodeWide16(opcodeID);
-    return getCodePtrImpl<tag>(opcode, &opcode);
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+    const Opcode* opcode = getOpcodeWide16Address(opcodeID);
+    return getCodePtrImpl<tag>(*opcode, opcode);
+#else
+    static_assert(!ENABLE(ARM64E));
+    return getCodePtrImpl<tag>(getOpcodeWide16(opcodeID), nullptr);
+#endif
 }
 
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getWide32CodePtr(WasmOpcodeID opcodeID)
 {
-    const Opcode& opcode = getOpcodeWide32(opcodeID);
-    return getCodePtrImpl<tag>(opcode, &opcode);
+#if ENABLE(COMPUTED_GOTO_OPCODES)
+    const Opcode* opcode = getOpcodeWide32Address(opcodeID);
+    return getCodePtrImpl<tag>(*opcode, opcode);
+#else
+    static_assert(!ENABLE(ARM64E));
+    return getCodePtrImpl<tag>(getOpcodeWide32(opcodeID), nullptr);
+#endif
 }
 
 template<PtrTag tag>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to