aboutsummaryrefslogtreecommitdiff
path: root/libffi/src/ia64
diff options
context:
space:
mode:
authorHans Boehm <hans_boehm@hp.com>2002-04-08 23:59:13 +0000
committerHans Boehm <hans_boehm@hp.com>2002-04-08 23:59:13 +0000
commit648067063216a57c82ade9271b9a26164bd7f5c1 (patch)
tree7c59c47afdf8cf05abdaf92fb7b67a0eb61cbf9c /libffi/src/ia64
parentcf274a5bcfa92cd5288ad85e0961813fd569719c (diff)
* src/java_raw_api.c (ffi_java_raw_size): Handle FFI_TYPE_DOUBLE
correctly. * src/ia64/unix.S: Add unwind information. Fix comments. Save sp in a way that's compatible with unwind info. (ffi_call_unix): Correctly restore sp in all cases. * src/ia64/ffi.c: Add, fix comments. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@52048 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi/src/ia64')
-rw-r--r--libffi/src/ia64/ffi.c9
-rw-r--r--libffi/src/ia64/unix.S35
2 files changed, 34 insertions, 10 deletions
diff --git a/libffi/src/ia64/ffi.c b/libffi/src/ia64/ffi.c
index 4da6dd361d0..4338d34c4b0 100644
--- a/libffi/src/ia64/ffi.c
+++ b/libffi/src/ia64/ffi.c
@@ -35,7 +35,7 @@
/* type long enough to hold an entire register. For now we use double. */
typedef double float80;
-/* The stack layout at call to ffi_prep_regs. Other_args will remain */
+/* The stack layout at call to ffi_prep_args. Other_args will remain */
/* on the stack for the actual call. Everything else we be transferred */
/* to registers and popped by the assembly code. */
@@ -123,7 +123,8 @@ static bool is_homogeneous_fp_aggregate(ffi_type * type, int n,
}
/* ffi_prep_args is called by the assembly routine once stack space
- has been allocated for the function's arguments. Returns nonzero
+ has been allocated for the function's arguments. It fills in
+ the arguments in the structure referenced by stack. Returns nonzero
if fp registers are used for arguments. */
static bool
@@ -463,7 +464,7 @@ ffi_prep_incoming_args_UNIX(struct ia64_args *args, void **rvalue,
*/
/* ffi_closure_UNIX is an assembly routine, which copies the register */
-/* state into s struct ia64_args, and the invokes */
+/* state into a struct ia64_args, and then invokes */
/* ffi_closure_UNIX_inner. It also recovers the closure pointer */
/* from its fake gp pointer. */
void ffi_closure_UNIX();
@@ -473,7 +474,7 @@ void ffi_closure_UNIX();
#endif
void
ffi_closure_UNIX_inner (ffi_closure *closure, struct ia64_args * args)
-/* Hopefully declarint this as a varargs function will force all args */
+/* Hopefully declaring this as a varargs function will force all args */
/* to memory. */
{
// this is our return value storage
diff --git a/libffi/src/ia64/unix.S b/libffi/src/ia64/unix.S
index c0ca516be7f..e599268c721 100644
--- a/libffi/src/ia64/unix.S
+++ b/libffi/src/ia64/unix.S
@@ -42,13 +42,24 @@
#define FLOAT_SZ 8 /* in-memory size of fp operands */
+/* Allocate an ia64_args structure on the stack; call ffi_prep_args */
+/* to fill it in with argument values; copy those to the real */
+/* registers, leaving overflow arguments on the stack. Then call fn */
+/* and move the result from registers into *raddr. */
+ .pred.safe_across_calls p1-p5,p16-p63
.text
.align 16
- .global ffi_call_unix#
- .proc ffi_call_unix#
+ .global ffi_call_unix
+ .proc ffi_call_unix
ffi_call_unix:
- alloc loc0=ar.pfs,6,5,8,0
+ .prologue
+ .save ar.pfs,r38 /* loc0 */
+ alloc loc0=ar.pfs,6,6,8,0
+ .save rp,loc1
mov loc1=b0;
+ .vframe loc5
+ mov loc5=sp;
+ .body
sub sp=sp,bytes
mov loc4=r1 /* Save gp */
ld8 r8=[callback],8 /* code address of callback */
@@ -104,7 +115,7 @@ fp_done:
;;
ld8 r1=[fn] /* Set up gp */
mov b6=r8;;
- br.call.sptk.many b0 = b6 /* call ffi_prep_args */
+ br.call.sptk.many b0 = b6 /* call fn */
/* Handle return value. */
cmp.eq p6,p0=0,raddr
@@ -126,6 +137,7 @@ fp_done:
(p8) stfs [raddr]=f8
(p9) stfd [raddr]=f8
;;
+ .label_state 1
(p6) br.cond.dpnt.few handle_float_hfa
(p7) br.cond.dpnt.few handle_double_hfa
br done
@@ -151,9 +163,13 @@ done:
mov r1=loc4 /* Restore gp */
mov ar.pfs = loc0
mov b0 = loc1
+ .restore sp
+ mov sp = loc5
br.ret.sptk.many b0
handle_double_hfa:
+ .body
+ .copy_state 1
/* Homogeneous floating point array of doubles is returned in */
/* registers f8-f15. Save one at a time to return area. */
and flags=0xf,flags /* Retrieve size */
@@ -242,13 +258,19 @@ shfa2: add loc3=1*4,raddr
.endp ffi_call_unix
+ .pred.safe_across_calls p1-p5,p16-p63
.text
.align 16
.global ffi_closure_UNIX
.proc ffi_closure_UNIX
ffi_closure_UNIX:
- alloc loc0=ar.pfs,8,2,2,0
+ .prologue
+ .save ar.pfs,r40 /* loc0 */
+ alloc loc0=ar.pfs,8,3,2,0
+ .save rp,loc1
mov loc1=b0
+ .vframe loc2
+ mov loc2=sp
/* Retrieve closure pointer and real gp. */
mov out0=gp
add gp=16,gp
@@ -295,7 +317,8 @@ ffi_closure_UNIX:
;;
mov b0=loc1
mov ar.pfs=loc0
- add sp=BASIC_ARGS_SZ,sp
+ .restore sp
+ mov sp=loc2
br.ret.sptk.many b0
.endp ffi_closure_UNIX