summaryrefslogtreecommitdiffstats
path: root/xpcom/reflect/xptcall/md/unix
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 09:03:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 09:03:11 +0000
commitdd5097e155f5380998ee81a7afb1a241df5df770 (patch)
tree13860e4bbb3aba054d735643c3d3cf651de11e36 /xpcom/reflect/xptcall/md/unix
parentAdding upstream version 115.11.0esr. (diff)
downloadfirefox-esr-dd5097e155f5380998ee81a7afb1a241df5df770.tar.xz
firefox-esr-dd5097e155f5380998ee81a7afb1a241df5df770.zip
Adding upstream version 115.12.0esr.upstream/115.12.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/reflect/xptcall/md/unix')
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp12
1 files changed, 12 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]);