annotate dyncallback/dyncall_callback.c @ 542:a73a5cd50c19

- fix passing aggregate-by-val on x64/sysv: subaggr classification for aggr *arrays* was wrong (was problematic when there ware exactly 2 8bytes to be classified, potentially be passed via registers)
author Tassilo Philipp
date Mon, 02 May 2022 15:32:41 +0200
parents 71c884e610f0
children 0c8838766866
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 Package: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 Library: dyncallback
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 File: dyncallback/dyncall_callback.c
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 Description: Callback - Implementation back-end selector
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 License:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
9 Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 Tassilo Philipp <tphilipp@potion-studios.com>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 #include "../dyncall/dyncall_macros.h"
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
28 #include "../dyncall/dyncall_aggregate.h"
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
29
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 #if defined(DC__Arch_Intel_x86)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 #include "dyncall_callback_x86.c"
122
f63467916f98 - first draft of mips64 n64 callbacks, not everything working, though
cslag
parents: 0
diff changeset
33 #elif defined(DC__Arch_AMD64)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 #include "dyncall_callback_x64.c"
122
f63467916f98 - first draft of mips64 n64 callbacks, not everything working, though
cslag
parents: 0
diff changeset
35 #elif defined(DC__Arch_PPC32)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 #include "dyncall_callback_ppc32.c"
122
f63467916f98 - first draft of mips64 n64 callbacks, not everything working, though
cslag
parents: 0
diff changeset
37 #elif defined(DC__Arch_PPC64)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 #include "dyncall_callback_ppc64.c"
143
170cde9e2a83 - arm arm/thumb cleanup, sharing more files, directly
cslag
parents: 122
diff changeset
39 #elif defined(DC__Arch_ARM)
170cde9e2a83 - arm arm/thumb cleanup, sharing more files, directly
cslag
parents: 122
diff changeset
40 #include "dyncall_callback_arm32.c"
122
f63467916f98 - first draft of mips64 n64 callbacks, not everything working, though
cslag
parents: 0
diff changeset
41 #elif defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 #include "dyncall_callback_mips.c"
122
f63467916f98 - first draft of mips64 n64 callbacks, not everything working, though
cslag
parents: 0
diff changeset
43 #elif defined(DC__Arch_Sparc)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 #include "dyncall_callback_sparc32.c"
179
b11b0735b09f - renamings: sparc_v9 -> sparc64
cslag
parents: 143
diff changeset
45 #elif defined(DC__Arch_Sparc64)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 #include "dyncall_callback_sparc64.c"
122
f63467916f98 - first draft of mips64 n64 callbacks, not everything working, though
cslag
parents: 0
diff changeset
47 #elif defined(DC__Arch_ARM64)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 #include "dyncall_callback_arm64.c"
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
49 #else
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
50 #error unsupported platform
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
53
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
54 void dcbInitCallback(DCCallback* pcb, const DCsigchar* signature, DCCallbackHandler* handler, void* userdata)
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
55 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
56 dcbInitCallback2(pcb, signature, handler, userdata, NULL);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
57 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
58
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
59
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
60 DCCallback* dcbNewCallback(const DCsigchar* signature, DCCallbackHandler* handler, void* userdata)
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
61 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
62 return dcbNewCallback2(signature, handler, userdata, NULL);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
63 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
64
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
65
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
66 void dcbFreeCallback(DCCallback* pcb)
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
67 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
68 dcFreeWX(pcb, sizeof(DCCallback));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
69 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
70
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
71
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
72 void* dcbGetUserData(DCCallback* pcb)
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
73 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
74 return pcb->userdata;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
75 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 281
diff changeset
76