97 #if FFI_SIZEOF_JAVA_RAW == 8
98 case FFI_TYPE_UINT64:
99 case FFI_TYPE_SINT64:
100 case FFI_TYPE_DOUBLE:
101 *args = (void *)raw;
102 raw += 2;
103 break;
104 #endif
105
106 case FFI_TYPE_POINTER:
107 *args = (void*) &(raw++)->ptr;
108 break;
109
110 case FFI_TYPE_COMPLEX:
111 /* Not supported yet. */
112 abort();
113
114 default:
115 *args = raw;
116 raw +=
117 ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
118 }
119 }
120
121 #else /* WORDS_BIGENDIAN */
122
123 #if !PDP
124
125 /* then assume little endian */
126 for (i = 0; i < cif->nargs; i++, tp++, args++)
127 {
128 #if FFI_SIZEOF_JAVA_RAW == 8
129 switch((*tp)->type) {
130 case FFI_TYPE_UINT64:
131 case FFI_TYPE_SINT64:
132 case FFI_TYPE_DOUBLE:
133 *args = (void*) raw;
134 raw += 2;
135 break;
136 case FFI_TYPE_COMPLEX:
137 /* Not supported yet. */
138 abort();
139 default:
140 *args = (void*) raw++;
141 }
142 #else /* FFI_SIZEOF_JAVA_RAW != 8 */
143 *args = (void*) raw;
144 raw +=
145 ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
146 #endif /* FFI_SIZEOF_JAVA_RAW == 8 */
147 }
148
149 #else
150 #error "pdp endian not supported"
151 #endif /* ! PDP */
152
153 #endif /* WORDS_BIGENDIAN */
154 }
155
156 void
157 ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
158 {
159 unsigned i;
160 ffi_type **tp = cif->arg_types;
161
162 for (i = 0; i < cif->nargs; i++, tp++, args++)
163 {
164 switch ((*tp)->type)
165 {
217
218 #if FFI_SIZEOF_JAVA_RAW == 8
219 case FFI_TYPE_UINT64:
220 case FFI_TYPE_SINT64:
221 case FFI_TYPE_DOUBLE:
222 raw->uint = *(UINT64*) (*args);
223 raw += 2;
224 break;
225 #endif
226
227 case FFI_TYPE_POINTER:
228 (raw++)->ptr = **(void***) args;
229 break;
230
231 default:
232 #if FFI_SIZEOF_JAVA_RAW == 8
233 FFI_ASSERT(0); /* Should have covered all cases */
234 #else
235 memcpy ((void*) raw->data, (void*)*args, (*tp)->size);
236 raw +=
237 ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
238 #endif
239 }
240 }
241 }
242
243 #if !FFI_NATIVE_RAW_API
244
245 static void
246 ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
247 {
248 #if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8
249 switch (cif->rtype->type)
250 {
251 case FFI_TYPE_UINT8:
252 case FFI_TYPE_UINT16:
253 case FFI_TYPE_UINT32:
254 *(UINT64 *)rvalue <<= 32;
255 break;
256
257 case FFI_TYPE_SINT8:
|
97 #if FFI_SIZEOF_JAVA_RAW == 8
98 case FFI_TYPE_UINT64:
99 case FFI_TYPE_SINT64:
100 case FFI_TYPE_DOUBLE:
101 *args = (void *)raw;
102 raw += 2;
103 break;
104 #endif
105
106 case FFI_TYPE_POINTER:
107 *args = (void*) &(raw++)->ptr;
108 break;
109
110 case FFI_TYPE_COMPLEX:
111 /* Not supported yet. */
112 abort();
113
114 default:
115 *args = raw;
116 raw +=
117 FFI_ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
118 }
119 }
120
121 #else /* WORDS_BIGENDIAN */
122
123 #if !PDP
124
125 /* then assume little endian */
126 for (i = 0; i < cif->nargs; i++, tp++, args++)
127 {
128 #if FFI_SIZEOF_JAVA_RAW == 8
129 switch((*tp)->type) {
130 case FFI_TYPE_UINT64:
131 case FFI_TYPE_SINT64:
132 case FFI_TYPE_DOUBLE:
133 *args = (void*) raw;
134 raw += 2;
135 break;
136 case FFI_TYPE_COMPLEX:
137 /* Not supported yet. */
138 abort();
139 default:
140 *args = (void*) raw++;
141 }
142 #else /* FFI_SIZEOF_JAVA_RAW != 8 */
143 *args = (void*) raw;
144 raw +=
145 FFI_ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
146 #endif /* FFI_SIZEOF_JAVA_RAW == 8 */
147 }
148
149 #else
150 #error "pdp endian not supported"
151 #endif /* ! PDP */
152
153 #endif /* WORDS_BIGENDIAN */
154 }
155
156 void
157 ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
158 {
159 unsigned i;
160 ffi_type **tp = cif->arg_types;
161
162 for (i = 0; i < cif->nargs; i++, tp++, args++)
163 {
164 switch ((*tp)->type)
165 {
217
218 #if FFI_SIZEOF_JAVA_RAW == 8
219 case FFI_TYPE_UINT64:
220 case FFI_TYPE_SINT64:
221 case FFI_TYPE_DOUBLE:
222 raw->uint = *(UINT64*) (*args);
223 raw += 2;
224 break;
225 #endif
226
227 case FFI_TYPE_POINTER:
228 (raw++)->ptr = **(void***) args;
229 break;
230
231 default:
232 #if FFI_SIZEOF_JAVA_RAW == 8
233 FFI_ASSERT(0); /* Should have covered all cases */
234 #else
235 memcpy ((void*) raw->data, (void*)*args, (*tp)->size);
236 raw +=
237 FFI_ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
238 #endif
239 }
240 }
241 }
242
243 #if !FFI_NATIVE_RAW_API
244
245 static void
246 ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
247 {
248 #if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8
249 switch (cif->rtype->type)
250 {
251 case FFI_TYPE_UINT8:
252 case FFI_TYPE_UINT16:
253 case FFI_TYPE_UINT32:
254 *(UINT64 *)rvalue <<= 32;
255 break;
256
257 case FFI_TYPE_SINT8:
|