Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions main/bridges/source/cpp_uno/msvc_win64_x86-64/call.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
; to you under the Apache License, Version 2.0 (the
; "License"); you may not use this file except in compliance
; with the License. You may obtain a copy of the License at
;
;
; http://www.apache.org/licenses/LICENSE-2.0
;
;
; Unless required by applicable law or agreed to in writing,
; software distributed under the License is distributed on an
; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
; KIND, either express or implied. See the License for the
; specific language governing permissions and limitations
; under the License.
;
;


typelib_TypeClass_VOID equ 0
Expand Down Expand Up @@ -79,7 +79,7 @@ privateSnippetExecutor PROC FRAME
sub rsp, 48
.ENDPROLOG

; 4th param: sal_uInt64 *pRegisterReturn
; 4th param: sal_uInt64 *pRegisterReturn
lea r9, -8[rbp]

; 3rd param: sal_Int32 nVtableOffset
Expand Down Expand Up @@ -183,7 +183,7 @@ populateArgumentRegisters:

.ENDPROLOG


callMethod:
; Find the method pointer
mov rax, 16[rbp]
Expand Down
19 changes: 12 additions & 7 deletions main/bridges/source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**************************************************************
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*************************************************************/


Expand Down Expand Up @@ -301,13 +301,18 @@ extern "C" typelib_TypeClass cpp_vtable_call(

if ( pInterface )
{
::uno_any_construct( reinterpret_cast<uno_Any *>( pCallStack[1] ),
// pCallStack is "ret addr, this, [ret *], params", so the
// hidden return buffer is [2]; [1] is `this`. Writing the
// Any to [1] overwrote the proxy object and left the
// caller's return buffer untouched, so the caller then
// destructed an uninitialised Any.
::uno_any_construct( reinterpret_cast<uno_Any *>( pCallStack[2] ),
&pInterface, pTD, cpp_acquire );

pInterface->release();
TYPELIB_DANGER_RELEASE( pTD );

reinterpret_cast<void **>( pRegisterReturn )[0] = pCallStack[1];
reinterpret_cast<void **>( pRegisterReturn )[0] = pCallStack[2];
eRet = typelib_TypeClass_ANY;
break;
}
Expand Down Expand Up @@ -366,7 +371,7 @@ unsigned char * codeSnippet(
// rsp+08 +----------------------------+ -------
// | return address |
// rsp--> +----------------------------+
//
//
//

// When it doubt about correctness,
Expand Down
19 changes: 9 additions & 10 deletions main/bridges/source/cpp_uno/msvc_win64_x86-64/except.cxx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**************************************************************
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*************************************************************/


Expand Down Expand Up @@ -486,7 +486,7 @@ ExceptionInfos::~ExceptionInfos() throw ()
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE( "> freeing exception infos... <\n" );
#endif

MutexGuard aGuard( _aMutex );
for ( t_string2PtrMap::const_iterator iPos( _allRaiseInfos.begin() );
iPos != _allRaiseInfos.end(); ++iPos )
Expand Down Expand Up @@ -608,7 +608,7 @@ int mscx_filterCppException(
// handle only C++ exceptions:
if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
return EXCEPTION_CONTINUE_SEARCH;

#if _MSC_VER < 1300 // MSVC -6
bool rethrow = (pRecord->NumberParameters < 4 ||
pRecord->ExceptionInformation[ 2 ] == 0);
Expand All @@ -633,7 +633,7 @@ int mscx_filterCppException(
// rethrow: handle only C++ exceptions:
if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
return EXCEPTION_CONTINUE_SEARCH;

if (pRecord->NumberParameters == 4 &&
// pRecord->ExceptionInformation[ 0 ] == MSVC_magic_number &&
pRecord->ExceptionInformation[ 1 ] != 0 &&
Expand All @@ -655,7 +655,7 @@ int mscx_filterCppException(
baseAddress + pType->_pTypeInfo )->_m_d_name,
RTL_TEXTENCODING_ASCII_US ) );
OUString aUNOname( toUNOname( aRTTIname ) );

typelib_TypeDescription * pExcTypeDescr = 0;
typelib_typedescription_getByName(
&pExcTypeDescr, aUNOname.pData );
Expand Down Expand Up @@ -699,7 +699,7 @@ int mscx_filterCppException(
#endif
typelib_typedescription_release( pExcTypeDescr );
}

return EXCEPTION_EXECUTE_HANDLER;
}
}
Expand All @@ -719,4 +719,3 @@ int mscx_filterCppException(
}

#pragma pack(pop)

18 changes: 12 additions & 6 deletions main/bridges/source/cpp_uno/msvc_win64_x86-64/uno2cpp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,34 @@ static void cpp_call(
uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
pThis->getBridge()->getUno2Cpp() );

// pCppArgs[nPos] is the alloca(8) temp above, i.e. a POINTER to the
// converted value -- the value is *pCppArgs[nPos]. Using
// &pCppArgs[nPos] would read the array slot instead, passing the
// temp's address as the argument. (That form is correct only in the
// complex/ref branch below, where the pointer IS the argument.)
switch (pParamTypeDescr->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
*pStack++ = *(sal_uInt64*)&pCppArgs[nPos];
*pStack++ = *(sal_uInt64*)pCppArgs[nPos];
break;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
*pStack++ = *(sal_uInt32*)&pCppArgs[nPos];
*pStack++ = *(sal_uInt32*)pCppArgs[nPos];
break;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
case typelib_TypeClass_CHAR:
*pStack++ = *(sal_uInt16*)&pCppArgs[nPos];
*pStack++ = *(sal_uInt16*)pCppArgs[nPos];
break;
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
*pStack++ = *(sal_uInt8*)&pCppArgs[nPos];
*pStack++ = *(sal_uInt8*)pCppArgs[nPos];
break;
case typelib_TypeClass_FLOAT:
case typelib_TypeClass_DOUBLE:
*pStack++ = *(sal_uInt64*)&pCppArgs[nPos]; // verbatim!
*pStack++ = *(sal_uInt64*)pCppArgs[nPos]; // verbatim!
break;
default:
break;
Expand Down Expand Up @@ -164,7 +169,8 @@ static void cpp_call(
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
*pStack++ = *(sal_uInt64*)&pCppArgs[nPos];
// here the POINTER is the argument (complex value passed by ref)
*pStack++ = (sal_uInt64)pCppArgs[nPos];
}
}

Expand Down