diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-03-19 12:25:40 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-03-19 12:25:40 +0000 |
commit | d764ce59da90198eeaefcb18d8735e4ec370f008 (patch) | |
tree | 739c7b98aadca971ac9b99ea5dd6e2148ae4fcb7 /bridges | |
parent | e2c31d6c4f0f5771bd76ec2355b5d83b0f8d80e1 (diff) |
INTEGRATION: CWS sb15 (1.3.4); FILE MERGED
2004/02/16 17:45:28 khendricks 1.3.4.1: add in MacOSX flushCode with nce batched flushing
just like PPC Linux
also fixed build.lst depdendencies so that cpp_shared done first
so MacOSX and PPC Linux are good to go
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx | 58 |
1 files changed, 17 insertions, 41 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx index e4a2a94714b1..334a8111dd85 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cpp2uno.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: hr $ $Date: 2004-03-09 12:11:51 $ + * last change: $Author: obo $ $Date: 2004-03-19 13:25:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -551,34 +551,6 @@ static void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** gpreg } -//__________________________________________________________________________________________________ - -// FIXME: this is overkill, we should flush the data caches and invalidate -// the instruction caches in loop and then do the sync, isync at the end - -void flush_icache(unsigned char *addr) -{ - __asm__ volatile ( - "dcbf 0,%0;" - "sync;" - "icbi 0,%0;" - "sync;" - "isync;" - : : "r"(addr) : "memory"); -} - - -void flush_range(unsigned char * addr1, int size) -{ -#define MIN_LINE_SIZE 32 - int i; - for (i = 0; i < size; i += MIN_LINE_SIZE) - flush_icache(addr1+i); - flush_icache(addr1+size-1); -} - - - int const codeSnippetSize = 136; unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, @@ -695,6 +667,18 @@ unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, } +#define MIN_LINE_SIZE 32 + +void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const * bptr, unsigned char const * eptr) +{ + unsigned char * eaddr = (unsigned char *) eptr + MIN_LINE_SIZE + 1; + for ( unsigned char * addr = (unsigned char *) bptr; addr < eaddr; addr += MIN_LINE_SIZE) { + __asm__ volatile ( "dcbf 0,%0;" "icbi 0,%0;" : : "r"(addr) : "memory"); + } + __asm__ volatile ( "sync;" "isync;" : : : "memory"); +} + + void ** bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(char * block) { return reinterpret_cast< void ** >(block) + 2; @@ -721,7 +705,6 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( // fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset); // fflush(stderr); - unsigned char * ncode; for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); @@ -730,15 +713,12 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: *slots++ = code; - ncode = codeSnippet( + code = codeSnippet( code, functionOffset++, vtableOffset, bridges::cpp_uno::shared::isSimpleType( reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( member)->pAttributeTypeRef)); - flush_range(code,codeSnippetSize); - code = ncode; - // Setter: if (!reinterpret_cast< @@ -746,22 +726,18 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( member)->bReadOnly) { *slots++ = code; - ncode = codeSnippet(code, functionOffset++, vtableOffset, true); - flush_range(code,codeSnippetSize); - code = ncode; + code = codeSnippet(code, functionOffset++, vtableOffset, true); } break; case typelib_TypeClass_INTERFACE_METHOD: *slots++ = code; - ncode = codeSnippet( + code = codeSnippet( code, functionOffset++, vtableOffset, bridges::cpp_uno::shared::isSimpleType( reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( member)->pReturnTypeRef)); - flush_range(code,codeSnippetSize); - code = ncode; break; default: |