annotate dyncallback/dyncall_args_ppc64.c @ 544:111236b31c75

- C++ non-trivial aggregate-by-value handling: * dyncallback support for dcbArgAggr() * better doc
author Tassilo Philipp
date Tue, 31 May 2022 18:25:13 +0200
parents 71c884e610f0
children 2562c89d5bb5
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_args_ppc64.c
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 Description: Callback's Arguments VM - Implementation for ppc64
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: 83
diff changeset
9 Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>,
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 83
diff changeset
10 2022 Tassilo Philipp <tphilipp@potion-studios.com>
0
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 #include "dyncall_args_ppc64.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 DCint dcbArgInt (DCArgs* p) { return (DCint) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 DCuint dcbArgUInt (DCArgs* p) { return (DCuint) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 DCulonglong dcbArgULongLong(DCArgs* p) { return (DCulonglong) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 DClonglong dcbArgLongLong(DCArgs* p)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 DClonglong value;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 if (p->ireg_count < 8) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 value = p->ireg_data[p->ireg_count++];
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 } else {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 value = *( (long long*) p->stackptr );
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 p->stackptr += sizeof(long long);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 return value;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 DClong dcbArgLong (DCArgs* p) { return (DClong) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 DCulong dcbArgULong (DCArgs* p) { return (DCulong) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 DCchar dcbArgChar (DCArgs* p) { return (DCchar) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 DCuchar dcbArgUChar (DCArgs* p) { return (DCuchar) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 DCshort dcbArgShort (DCArgs* p) { return (DCshort) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 DCushort dcbArgUShort (DCArgs* p) { return (DCushort)dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 DCbool dcbArgBool (DCArgs* p) { return (DCbool) dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 DCpointer dcbArgPointer (DCArgs* p) { return (DCpointer)dcbArgLongLong(p); }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53
83
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
54 DCdouble dcbArgDouble (DCArgs* p)
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
55 {
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 DCdouble result;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 if (p->freg_count < 13) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 result = p->freg_data[p->freg_count++];
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 if (p->ireg_count < 8) {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 p->ireg_count++;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 } else {
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 result = * ( (double*) p->stackptr );
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 p->stackptr += sizeof(double);
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 return result;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70
83
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
71 DCfloat dcbArgFloat (DCArgs* p)
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
72 {
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
73 DCfloat result;
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
74
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
75 #if defined(DC__Endian_BIG)
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
76 struct sf { DCfloat f_pad; DCfloat f; } sf;
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
77 #else /* Endian_LITTLE */
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
78 struct sf { DCfloat f; DCfloat f_pad; } sf;
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
79 #endif
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80
83
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
81 if (p->freg_count < 13) {
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
82 result = (float)p->freg_data[p->freg_count++];
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
83 if (p->ireg_count < 8) {
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
84 p->ireg_count++;
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
85 }
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
86 } else {
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
87 sf = * ( (struct sf*) p->stackptr );
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
88 result = sf.f;
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
89 }
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
90
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
91 p->stackptr += sizeof(double);
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
92 return result;
54930a037e8a - PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents: 0
diff changeset
93 }
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 83
diff changeset
94
544
111236b31c75 - C++ non-trivial aggregate-by-value handling:
Tassilo Philipp
parents: 533
diff changeset
95 DCpointer dcbArgAggr (DCArgs* p, DCpointer target) { /* @@@AGGR not impl */ }
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 83
diff changeset
96 void dcbReturnAggr (DCArgs *args, DCValue *result, DCpointer ret) { /* @@@AGGR not impl */ }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 83
diff changeset
97