Kaydet (Commit) 77f1f220 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

iOS arm64 C++/UNO bridge WIP

Change-Id: I786cc64fc814c755ba215898026365af26b56205
üst 836abd39
......@@ -13,6 +13,9 @@ 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
......@@ -23,6 +26,9 @@ sub gen_arm ($$)
printf (" b _privateSnippetExecutor\n");
printf (" .long %#08x\n", $funIndex);
printf (" .long %d\n", $vtableOffset);
if ($funIndex & 0x80000000) {
printf ("#endif\n");
}
}
sub gen_x86 ($$$)
......@@ -41,8 +47,8 @@ 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, as such or with the 0x80000000 bit set\n");
printf ("// (to indicate that a hidden parameter (arm64: x8) is used for returning large values)\n");
printf ("// - the function index (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");
......@@ -92,7 +98,9 @@ foreach my $funIndex (0 .. $nFunIndexes-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')
{
......
......@@ -49,22 +49,36 @@ _privateSnippetExecutor:
_privateSnippetExecutor:
// _privateSnippetExecutor is jumped to from each of the
// codeSnippet_* generated by generate-snippets.pl
// Store potential args in general purpose registers
stp x6, x7, [sp, #-16]!
stp x4, x5, [sp, #-16]!
stp x2, x3, [sp, #-16]!
stp x0, x1, [sp, #-16]!
// Store potential args in floating point/SIMD registers
stp d6, d7, [sp, #-16]!
stp d4, d5, [sp, #-16]!
stp d2, d3, [sp, #-16]!
stp d0, d1, [sp, #-16]!
// First argument to cpp_vtable_call: The x15 set up in the codeSnippet instance
mov x0, x15
// Store x8 (potential pointer to return value storage) and lr
stp x8, lr, [sp, #-16]!
// Second argument: The pointer to all the above
mov x1, sp
bl _cpp_vtable_call
ldp x8, lr, [sp, #0]
add sp, sp, #80
add sp, sp, #144
ret lr
#else
// i386 code, for the simulator
.text
.align 1, 0x90
......
......@@ -152,7 +152,7 @@ void callVirtualMethod(
sal_uInt64 x0;
sal_uInt64 x1;
__asm__ __volatile__
__asm__ __volatile__
(
" ldp x0, x1, %[pgpr_0]\n"
" ldp x2, x3, %[pgpr_2]\n"
......
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