You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2026/06/05 14:41:07 UTC

(openoffice) branch AOO42X updated: Fix the macOS x86 bridge. Previous version was fragile.

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new 8cea46a37e Fix the macOS x86 bridge. Previous version was fragile.
8cea46a37e is described below

commit 8cea46a37e2ed549a4e680efeb12cffddec061b6
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Jun 5 10:38:17 2026 -0400

    Fix the macOS x86 bridge. Previous version was fragile.
---
 main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx | 10 ++++++++--
 main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx
index 0edad90673..e3e17c9566 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx
@@ -265,7 +265,8 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 	// fpreg:  [fpr params]
 	// ovrflw: [gpr or fpr params (properly aligned)]
 	void * pThis;
-	if ( nFunctionIndex & 0x80000000 )
+	bool bHasHiddenReturn = (nFunctionIndex & 0x80000000) != 0;
+	if ( bHasHiddenReturn )
 	{
 		nFunctionIndex &= 0x7fffffff;
 		pThis = gpreg[1];
@@ -338,6 +339,11 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 					eRet = typelib_TypeClass_VOID;
 					break;
 				case 0: // queryInterface() opt
+				// Only apply when hidden return is present:
+				//   gpreg[0]=ret, gpreg[1]=this, gpreg[2]=type
+				// Without hidden return gpreg[2] is not the type arg.
+					if ( !bHasHiddenReturn )
+						break;
 				{
 					typelib_TypeDescription * pTD = 0;
 					TYPELIB_DANGER_GET( &pTD, reinterpret_cast<Type *>( gpreg[2] )->getTypeLibType() );
@@ -437,7 +443,7 @@ extern "C" void privateSnippetExecutor( void )
 		"	movq	-136(%rbp), %xmm1\n"	// Return value (int case)
 		"	jmp	.Lfinish\n"
 		".Lfloat:\n"
-		"	movlpd	-144(%rbp), %xmm0\n"		// Return value (float/double case)
+		"	movsd	-144(%rbp), %xmm0\n"		// Return value (float/double case)
 		".Lfinish:\n"
 		"	addq	$160, %rsp\n"
 	);
diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx
index d102046aed..53e9af07e0 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx
@@ -151,7 +151,7 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
           "m" ( rax ), "m" ( rdx ), "m" ( xmm0 ), "m" ( xmm1 ),
           "m" (pCallStack) // dummy input to prevent the compiler from optimizing the alloca out
         : "rax", "rbx", "rcx", "rdx", "rdi", "rsi", "r8", "r9",
-          "r10", "r11", "r10", "r12", "r13", "r14", "r15", "rbx",
+          "r10", "r11", "r12", "r13", "r14", "r15",
           "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
     );