Kaydet (Commit) 9540af1e authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Start of C++/UNO bridge for iOS simulator and device

Unlikely to work yet, but at least builds for the simulator.

We can not use dynamic code generation on iOS, so we use a fixed set
of code snippets, genertated by a Perl script. Experimentation seems
to indicate that a relatively small set of static code snippets should
be enough in simple use cases with no extensions (that we can't really
support on iOS anyway) and stuff.

Except for the static set of snippets the code mostly is, or will be,
an ifdefified combination of the gcc3_linux_arm and gcc3_macosx_intel
code. The ABI on iOS ARM devices should be quite close to that on
Linux ARM, knock on wood.
üst 2ba07916
......@@ -22,6 +22,7 @@ br bridges\source\cpp_uno\gcc3_linux_hppa nmake - u br_gcc3lh br_unotypes NULL
br bridges\source\cpp_uno\gcc3_linux_alpha nmake - u br_gcc3ll br_unotypes NULL
br bridges\source\cpp_uno\gcc3_macosx_intel nmake - u br_gcc3macoxi br_cppuno_shared br_unotypes br_inc NULL
br bridges\source\cpp_uno\gcc3_macosx_powerpc nmake - u br_gcc3macoxp br_cppuno_shared br_unotypes br_inc NULL
br bridges\source\cpp_uno\gcc3_ios_arm nmake - u br_gcc3iosr br_cppuno_shared br_unotypes br_inc NULL
br bridges\source\cpp_uno\cc50_solaris_sparc nmake - u br_cc50sols br_unotypes br_cppuno_shared br_inc NULL
br bridges\source\cpp_uno\cc5_solaris_sparc64 nmake - u br_cc5sols64 br_unotypes br_cppuno_shared br_inc NULL
br bridges\source\cpp_uno\cc50_solaris_intel nmake - u br_cc50soli br_unotypes br_cppuno_shared br_inc NULL
......
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/perl -w
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License or as specified alternatively below. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Initial Developer of the Original Code is
# Tor Lillqvist <tml@iki.fi>
# Portions created by the Initial Developer are Copyright (C) 2011 the
# Initial Developer. All Rights Reserved.
#
# For minor contributions see the git repository.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
my $nFunIndexes = 5;
my $nVtableOffsets = 1;
sub gen_arm ($$)
{
my ($funIndex, $vtableOffset) = @_;
printf ("codeSnippet%08x%d:\n", $funIndex, $vtableOffset);
printf ("\tmov ip, pc\n");
printf ("\tldr pc, [pc, #4]\n");
printf ("\t.long %#08x\n", $funIndex);
printf ("\t.long %d\n", $vtableOffset);
printf ("\t.long _privateSnippetExecutor\n");
}
sub gen_x86 ($$$)
{
my ($funIndex, $vtableOffset, $executor) = @_;
printf ("codeSnippet%08x%d%s:\n", $funIndex, $vtableOffset, $executor);
printf ("\tmovl %#08x, %%eax\n", $funIndex);
printf ("\tmovl \$%d, %%edx\n", $vtableOffset);
printf ("\tjmp _privateSnippetExecutor%s\n", $executor);
}
printf ("\t.text\n");
printf ("#ifdef __arm\n");
printf ("\t.align 4\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");
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 ("\t.globl _nFunIndexes\n");
printf ("_nFunIndexes:\n");
printf ("\t.long %d\n", $nFunIndexes);
printf ("\t.globl _nVtableOffsets\n");
printf ("_nVtableOffsets:\n");
printf ("\t.long %d\n", $nVtableOffsets);
printf ("\t.globl _codeSnippets\n");
printf ("_codeSnippets:\n");
foreach my $funIndex (0 .. $nFunIndexes-1)
{
foreach my $vtableOffset (0 .. $nVtableOffsets-1)
{
printf ("#ifdef __arm\n");
printf ("\t.long codeSnippet%08x%d\n", $funIndex, $vtableOffset);
printf ("\t.long codeSnippet%08x%d\n", $funIndex|0x80000000, $vtableOffset);
printf ("#else\n");
foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
{
printf ("\t.long codeSnippet%08x%d%s\n", $funIndex, $vtableOffset, $executor);
printf ("\t.long codeSnippet%08x%d%s\n", $funIndex|0x80000000, $vtableOffset, $executor);
}
printf ("#endif\n");
}
}
This diff is collapsed.
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
PRJ=..$/..$/..
PRJNAME=bridges
TARGET=gcc3_uno
LIBTARGET=no
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
.IF "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCIOSRgcc3"
.IF "$(cppu_no_leak)" == ""
CFLAGS += -DLEAK_STATIC_DATA
.ENDIF
CFLAGSNOOPT=-O0
SLOFILES= \
$(SLO)$/except.obj \
$(SLO)$/cpp2uno.obj \
$(SLO)$/uno2cpp.obj \
$(SLO)$/codesnippets.obj \
$(SLO)$/helper.obj
SHL1TARGET= $(TARGET)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1IMPLIB=i$(TARGET)
SHL1VERSIONMAP=..$/..$/bridge_exports.map
SHL1OBJS = $(SLOFILES)
SHL1LIBS = $(SLB)$/cpp_uno_shared.lib
SHL1RPATH = URELIB
SHL1STDLIBS= \
$(CPPULIB) \
$(SALLIB)
.ENDIF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
$(SLO)$/%.obj: %.S
$(CC) -c -o $(SLO)$/$(@:b).o $<
touch $@
codesnippets.S: generate-snippets.pl
$(PERL) generate-snippets.pl >$@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "uno/mapping.h"
#include <typeinfo>
#include <exception>
#include <cstddef>
namespace CPPU_CURRENT_NAMESPACE
{
bool isSimpleReturnType(typelib_TypeDescription * pTD, bool recursive = false);
void dummy_can_throw_anything( char const * );
// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
struct _Unwind_Exception
{
unsigned exception_class __attribute__((__mode__(__DI__)));
void * exception_cleanup;
unsigned private_1 __attribute__((__mode__(__word__)));
unsigned private_2 __attribute__((__mode__(__word__)));
} __attribute__((__aligned__));
struct __cxa_exception
{
::std::type_info *exceptionType;
void (*exceptionDestructor)(void *);
::std::unexpected_handler unexpectedHandler;
::std::terminate_handler terminateHandler;
__cxa_exception *nextException;
int handlerCount;
int handlerSwitchValue;
const unsigned char *actionRecord;
const unsigned char *languageSpecificData;
void *catchTemp;
void *adjustedPtr;
_Unwind_Exception unwindHeader;
};
extern "C" void *__cxa_allocate_exception(
std::size_t thrown_size ) throw();
extern "C" void __cxa_throw (
void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
};
extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
// -----
//==================================================================================================
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
//==================================================================================================
void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment