[Libreoffice-commits] core.git: 2 commits - bridges/source
jan Iversen
jani at libreoffice.org
Thu Feb 15 17:02:52 UTC 2018
bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx | 14 ++
bridges/source/cpp_uno/gcc3_ios/except.cxx | 2
bridges/source/cpp_uno/gcc3_ios/generate-snippets.pl | 114 +++++++++++++++++++
bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx | 3
4 files changed, 130 insertions(+), 3 deletions(-)
New commits:
commit f563a81000ce43e95e117229b72228386077f94e
Author: jan Iversen <jani at libreoffice.org>
Date: Thu Feb 15 18:00:33 2018 +0100
iOS, add old snippet script.
We need to check if the script generated the same code always.
Looks like nFunIndexes is never changed.
Change-Id: Ic247cccbf1e4a75e6a0acf5807fdcf84bfcf4cb3
diff --git a/bridges/source/cpp_uno/gcc3_ios/generate-snippets.pl b/bridges/source/cpp_uno/gcc3_ios/generate-snippets.pl
new file mode 100755
index 000000000000..a8548836fef3
--- /dev/null
+++ b/bridges/source/cpp_uno/gcc3_ios/generate-snippets.pl
@@ -0,0 +1,114 @@
+#!/usr/bin/perl -w # -*- tab-width: 4; indent-tabs-mode: nil; cperl-indent-level: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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/.
+#
+
+my $nFunIndexes = 8;
+my $nVtableOffsets = 4;
+
+sub gen_arm ($$)
+{
+ my ($funIndex, $vtableOffset) = @_;
+ if ($funIndex & 0x80000000) {
+ printf ("#ifndef __arm64\n");
+ }
+ printf ("codeSnippet_%08x_%d:\n", $funIndex, $vtableOffset);
+ printf ("#ifdef __arm\n");
+ # Note: pc is the address of instruction being executed plus 8
+ printf (" mov ip, pc\n");
+ printf ("#else\n");
+ printf (" adr x15, .+8\n");
+ printf ("#endif\n");
+ printf (" b _privateSnippetExecutor\n");
+ printf (" .long %#08x\n", $funIndex);
+ printf (" .long %d\n", $vtableOffset);
+ if ($funIndex & 0x80000000) {
+ printf ("#endif\n");
+ }
+}
+
+sub gen_x86 ($$$)
+{
+ my ($funIndex, $vtableOffset, $executor) = @_;
+ printf ("codeSnippet_%08x_%d_%s:\n", $funIndex, $vtableOffset, $executor);
+ printf (" movl \$%#08x, %%eax\n", $funIndex);
+ printf (" movl \$%d, %%edx\n", $vtableOffset);
+ printf (" jmp _privateSnippetExecutor%s\n", $executor);
+}
+
+printf (".text\n");
+
+printf ("#if defined(__arm) || defined(__arm64)\n");
+
+printf ("\n");
+printf ("// Each codeSnippetX function stores into ip (arm64: x15) an address and branches to _privateSnippetExecutor\n");
+printf ("// The address is that following the branch instruction, containing two 32-bit ints:\n");
+printf ("// - the function index, which for 32-bit can have the 0x80000000 bit set\n");
+printf ("// to indicate that a hidden parameter is used for returning large values\n");
+printf ("// - the vtable offset\n");
+printf ("\n");
+
+printf (" .align 4\n");
+printf ("\n");
+
+foreach my $funIndex (0 .. $nFunIndexes-1)
+{
+ foreach my $vtableOffset (0 .. $nVtableOffsets-1)
+ {
+ gen_arm ($funIndex, $vtableOffset);
+ gen_arm ($funIndex|0x80000000, $vtableOffset);
+ }
+}
+
+printf ("#else\n");
+printf (" .align 1, 0x90\n");
+
+foreach my $funIndex (0 .. $nFunIndexes-1)
+{
+ foreach my $vtableOffset (0 .. $nVtableOffsets-1)
+ {
+ foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
+ {
+ gen_x86 ($funIndex, $vtableOffset, $executor);
+ gen_x86 ($funIndex|0x80000000, $vtableOffset, $executor);
+ }
+ }
+ }
+
+printf ("#endif\n");
+
+printf (" .globl _nFunIndexes\n");
+printf ("_nFunIndexes:\n");
+printf (" .long %d\n", $nFunIndexes);
+
+printf (" .globl _nVtableOffsets\n");
+printf ("_nVtableOffsets:\n");
+printf (" .long %d\n", $nVtableOffsets);
+
+printf (" .globl _codeSnippets\n");
+printf ("_codeSnippets:\n");
+
+foreach my $funIndex (0 .. $nFunIndexes-1)
+{
+ foreach my $vtableOffset (0 .. $nVtableOffsets-1)
+ {
+ printf ("#if defined(__arm) || defined(__arm64)\n");
+ printf (" .long codeSnippet_%08x_%d - _codeSnippets\n", $funIndex, $vtableOffset);
+ printf ("#ifndef __arm64\n");
+ printf (" .long codeSnippet_%08x_%d - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset);
+ printf ("#endif\n");
+ printf ("#else\n");
+ foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
+ {
+ printf (" .long codeSnippet_%08x_%d_%s - _codeSnippets\n", $funIndex, $vtableOffset, $executor);
+ printf (" .long codeSnippet_%08x_%d_%s - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset, $executor);
+ }
+ printf ("#endif\n");
+ }
+}
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
commit 4b86076d5efc2e416181cc4c9e56b21870121892
Author: jan Iversen <jani at libreoffice.org>
Date: Thu Feb 15 17:57:47 2018 +0100
iOS, update to original files
Update to old files (from Tor in 2013) to prepare for generate.
Change-Id: I832a242b7b91179e9c269fa9e48a1698aa2f2a66
diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index 762dbdc8db76..0ca1401ba960 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -17,6 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#ifdef __arm64
+
+// For iOS devices (64-bit ARM). Originally a copy of
+// ../gcc3_linux_arm/cpp2uno.cxx.
+
+// No attempts at factoring out the large amounts of more or less
+// common code in this, cpp2uno-arm.cxx and cpp2uno-i386.cxx have been
+// done. Which is sad. But then the whole bridges/source/cpp_uno is
+// full of copy/paste. So I continue in that tradition...
+
#include <com/sun/star/uno/RuntimeException.hpp>
#include <sal/log.hxx>
#include <uno/data.h>
@@ -29,7 +39,6 @@
#include "share.hxx"
-#ifdef __arm64
extern "C" {
extern int nFunIndexes, nVtableOffsets;
extern int codeSnippets[];
@@ -290,6 +299,7 @@ namespace
}
}
+
static typelib_TypeClass cpp_mediate( sal_Int32 nFunctionIndex,
sal_Int32 nVtableOffset,
void ** pCallStack,
@@ -544,6 +554,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
}
return code;
}
+
#endif
@@ -553,4 +564,5 @@ void bridges::cpp_uno::shared::VtableFactory::flushCode(
// No dynamic code generation so nothing to flush
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_ios/except.cxx b/bridges/source/cpp_uno/gcc3_ios/except.cxx
index 17b95473f92c..1d1eeccd97ae 100644
--- a/bridges/source/cpp_uno/gcc3_ios/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/except.cxx
@@ -143,7 +143,7 @@ static OUString toUNOname( char const * p )
class RTTI
{
- typedef std::unordered_map< OUString, std::type_info * > t_rtti_map;
+ typedef std::unordered_map< OUString, std::type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx
index 6d2c82fbe0d4..7915fa7a9513 100644
--- a/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#ifdef __arm64
+
#include <com/sun/star/uno/RuntimeException.hpp>
#include "bridge.hxx"
@@ -28,7 +30,6 @@
using namespace ::com::sun::star::uno;
-#ifdef __arm64
namespace arm
{
bool is_hfa_struct(const typelib_TypeDescription * type)
More information about the Libreoffice-commits
mailing list