summaryrefslogtreecommitdiffstats
path: root/xpcom/reflect/xptcall
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /xpcom/reflect/xptcall
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/reflect/xptcall')
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp12
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcstubs_asm_loongarch64.S1
2 files changed, 13 insertions, 0 deletions
diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
index 39a6b406f4..d66f300649 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
@@ -164,6 +164,18 @@ NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
vtable = *reinterpret_cast<vtable_func **>(that);
func = vtable[methodIndex];
+/* !!! IMPORTANT !!!
+ * In the case of paramCount = 0 (and also some other cases in practice but
+ * the compiler doesn't know about them), the stack_space is not initialized.
+ * Reading the stack_space is technically undefined behavior, but practically,
+ * the values we read from there only matter to the called function when they
+ * are initialized.
+ * The asm volatile block makes the compiler ignore that the stack_space
+ * may not be initialized, avoiding it optimizing away e.g. the first loop
+ * test in invoke_copy_to_stack.
+ */
+ asm volatile(";");
+
return func(that, stack_space[base_size * 2 - 3],
stack_space[base_size * 2 - 2],
stack_space[base_size * 2 - 1]);
diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_loongarch64.S b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_loongarch64.S
index ae4e0cf73f..7dd6e3e1cd 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_loongarch64.S
+++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_loongarch64.S
@@ -1,3 +1,4 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.