[Libreoffice] Please run an instrumented LO for me (patch included)

Tor Lillqvist tlillqvist at novell.com
Tue Aug 9 21:36:18 PDT 2011


In the iOS porting effort one problematic thing is the dynamic code generation used in the C++/UNO bridge. Some experimentation would indicate, however, that in "normal" use of LO very few kinds of "snippets" are actually generated, so it would be trivial to just pre-generate a sufficient static set of assembly source code snippets using a short shell script or whatever. (Especially as for iOS there won't be any Java, Python, or binary extension support, or support of Basic macros in documents, so the set of potentially generated code snippets is fixed a priori, even if it might be tedious to exactly find out the whole set.)

(It is the App Store rules that as far as I understand prevent the support for arbitrary scripts loaded from the outside in any app, including Basic code in documents. As for dynamic code generation, I don't know if the OS prevents it (mprotect() etc), or whether this too is "just" an enforced rule. Anyway, my goal for the iOS porting effort is that the code could potentially be used in an app distributed on the App Store. I am not interested in the jailbreaking scene.)

So, I would want some empirical data... Could you please add logging output code as below to the codeSnippet() function in the cpp2uno part of the C++/UNO bridge for your platform, and run some representative use cases of LO without using any extensions or macros in documents, but otherwise with complex things going on, sort the stderr output dropping duplicates (sort -u), and post as a followup, thanks.

Below is diff for MacOSX (which I know compiles and works), and x86-64 Linux (which I don't have time right now to test (leaving on a short trip with the family in an hour), but it should be trivial to fix in case there is a typo)...

Cheers,
--tml

diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx
index 2ceb0bb..6a26bd3 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx
@@ -438,6 +438,17 @@ unsigned char * codeSnippet(
         = ((unsigned char *) exec) - p - sizeof (sal_Int32);
     p += sizeof (sal_Int32);
     OSL_ASSERT(p - code <= codeSnippetSize);
+    fprintf(stderr,
+            "==> codeSnippet to %s, functionIndex=%d%s, vtableOffset=%d\n",
+            (exec == privateSnippetExecutorGeneral ? "General" :
+             (exec == privateSnippetExecutorVoid ? "Void" :
+              (exec == privateSnippetExecutorHyper ? "Hyper" :
+               (exec == privateSnippetExecutorFloat ? "Float" :
+                (exec == privateSnippetExecutorDouble ? "Double" :
+                 (exec == privateSnippetExecutorClass ? "Class" :
+                  "???")))))),
+            (functionIndex & ~0x80000000), (functionIndex & 0x80000000) ? "|0x80000000":"", vtableOffset);
+    fflush(stderr);
     return code + codeSnippetSize;
 }

diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
index c9b5185..c8d45a7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -434,6 +434,11 @@ unsigned char * codeSnippet( unsigned char * code,
     // jmpq *%r11
     *reinterpret_cast<sal_uInt32 *>( code + 20 ) = 0x00e3ff49;

+    fprintf(stderr,
+            "==> codeSnippet to privateSnippetExecutor, functionIndex=%d%s, vtableOffset=%d\n",
+            nFunctionIndex), (bHasHiddenParam) ? "|0x80000000":"", nVtableOffset);
+    fflush(stderr);
+
     return code + codeSnippetSize;
 }





More information about the LibreOffice mailing list