diff options
Diffstat (limited to 'xpcom/reflect')
-rw-r--r-- | xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp | 12 | ||||
-rw-r--r-- | xpcom/reflect/xptcall/md/unix/xptcstubs_asm_loongarch64.S | 1 | ||||
-rw-r--r-- | xpcom/reflect/xptinfo/xptcodegen.py | 21 |
3 files changed, 14 insertions, 20 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/. diff --git a/xpcom/reflect/xptinfo/xptcodegen.py b/xpcom/reflect/xptinfo/xptcodegen.py index 9dd54a6f07..67860ca1f2 100644 --- a/xpcom/reflect/xptinfo/xptcodegen.py +++ b/xpcom/reflect/xptinfo/xptcodegen.py @@ -330,30 +330,11 @@ def link_to_cpp(interfaces, fd, header_fd): ) ) - def is_type_reflectable(type): - # All native types end up getting tagged as void*, or as wrapper types around void* - if type["tag"] == "TD_VOID": - return False - if type["tag"] in ("TD_ARRAY", "TD_LEGACY_ARRAY"): - return is_type_reflectable(type["element"]) - return True - - def is_method_reflectable(method): - if "hidden" in method["flags"]: - return False - - for param in method["params"]: - # Reflected methods can't use non-reflectable types. - if not is_type_reflectable(param["type"]): - return False - - return True - def lower_method(method, ifacename, builtinclass): methodname = "%s::%s" % (ifacename, method["name"]) isSymbol = "symbol" in method["flags"] - reflectable = is_method_reflectable(method) + reflectable = "hidden" not in method["flags"] if not reflectable and builtinclass: # Hide the parameters of methods that can't be called from JS and |