alignement stack frames a 16 octets sur powerpc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5607 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
be5cd6de3e
commit
0c39583400
|
@ -29,18 +29,18 @@ open Emitaux
|
|||
(* Layout of the stack *)
|
||||
|
||||
(* In the TOC-based model:
|
||||
The bottom 24 bytes of the stack are reserved at all times
|
||||
The bottom 32 bytes of the stack are reserved at all times
|
||||
for a standard linkage area.
|
||||
In this area, the word at offset +20 is used by glue code and others to
|
||||
save the TOC register.
|
||||
The bottom two words are used as temporaries and for trap frames.
|
||||
The stack is kept 8-aligned.
|
||||
The stack is kept 16-aligned.
|
||||
In the absolute-address model:
|
||||
No reserved space at the bottom of the stack.
|
||||
The stack is kept 8-aligned. *)
|
||||
The stack is kept 16-aligned. *)
|
||||
|
||||
let stack_linkage_area = if toc then 24 else 0
|
||||
let trap_frame_size = if toc then 24 else 8
|
||||
let stack_linkage_area = if toc then 32 else 0
|
||||
let trap_frame_size = if toc then 32 else 16
|
||||
|
||||
let stack_offset = ref 0
|
||||
|
||||
|
@ -50,7 +50,7 @@ let frame_size () =
|
|||
!stack_offset + (* Trap frame, outgoing parameters *)
|
||||
4 * num_stack_slots.(0) + 8 * num_stack_slots.(1) + (* Local variables *)
|
||||
(if !contains_calls then 4 else 0) in (* The return address *)
|
||||
Misc.align size 8
|
||||
Misc.align size 16
|
||||
|
||||
let slot_offset loc cls =
|
||||
match loc with
|
||||
|
|
|
@ -128,10 +128,10 @@ let calling_conventions
|
|||
ofs := !ofs + size_float
|
||||
end
|
||||
done;
|
||||
let final_ofs = if toc && !ofs > 0 then !ofs + 24 else !ofs in
|
||||
(loc, Misc.align final_ofs 8)
|
||||
(* Keep stack 8-aligned.
|
||||
Under PowerOpen, keep a free 24 byte linkage area at the bottom
|
||||
let final_ofs = if toc && !ofs > 0 then !ofs + 32 else !ofs in
|
||||
(loc, Misc.align final_ofs 16)
|
||||
(* Keep stack 16-aligned.
|
||||
Under PowerOpen, keep a free 32 byte linkage area at the bottom
|
||||
if we need to stack-allocate some arguments. *)
|
||||
|
||||
let incoming ofs = Incoming ofs
|
||||
|
@ -185,7 +185,7 @@ let poweropen_external_conventions first_int last_int
|
|||
end;
|
||||
int := !int + 2
|
||||
done;
|
||||
(loc, Misc.align !ofs 8) (* Keep stack 8-aligned *)
|
||||
(loc, Misc.align !ofs 16) (* Keep stack 16-aligned *)
|
||||
|
||||
let loc_external_arguments =
|
||||
match Config.system with
|
||||
|
|
|
@ -240,7 +240,7 @@
|
|||
lwz 29, 4(1)
|
||||
mtlr 0
|
||||
lwz 2, 20(1)
|
||||
addi 1, 1, 24
|
||||
addi 1, 1, 32
|
||||
# Branch to handler
|
||||
blr
|
||||
|
||||
|
@ -295,9 +295,9 @@ L..102:
|
|||
stfd 30, -96(1)
|
||||
stfd 31, -88(1)
|
||||
# Allocate and link stack frame
|
||||
stwu 1, -280(1)
|
||||
stwu 1, -288(1)
|
||||
# Set up a callback link
|
||||
addi 1, 1, -24
|
||||
addi 1, 1, -32
|
||||
lwz 9, L..caml_bottom_of_stack(2)
|
||||
lwz 10, L..caml_last_return_address(2)
|
||||
lwz 12, L..caml_gc_regs(2)
|
||||
|
@ -311,7 +311,7 @@ L..102:
|
|||
bl L..103
|
||||
b L..104
|
||||
L..103:
|
||||
addi 1, 1, -24
|
||||
addi 1, 1, -32
|
||||
lwz 9, L..caml_exception_pointer(2)
|
||||
mflr 0
|
||||
lwz 29, 0(9)
|
||||
|
@ -339,7 +339,7 @@ L..105:
|
|||
# Pop the trap frame, restoring caml_exception_pointer
|
||||
lwz 9, 4(1)
|
||||
lwz 10, L..caml_exception_pointer(2)
|
||||
addi 1, 1, 24
|
||||
addi 1, 1, 32
|
||||
stw 9, 0(10)
|
||||
# Pop the callback link, restoring the global variables
|
||||
L..106:
|
||||
|
@ -352,12 +352,12 @@ L..106:
|
|||
stw 7, 0(10)
|
||||
stw 8, 0(11)
|
||||
stw 9, 0(12)
|
||||
addi 1, 1, 24
|
||||
addi 1, 1, 32
|
||||
# Update allocation pointer
|
||||
lwz 11, L..young_ptr(2)
|
||||
stw 31, 0(11)
|
||||
# Deallocate stack frame
|
||||
addi 1, 1, 280
|
||||
addi 1, 1, 288
|
||||
# Restore callee-save registers
|
||||
lwz 13, -76(1)
|
||||
lwz 14, -72(1)
|
||||
|
|
|
@ -221,7 +221,7 @@ raise_caml_exception:
|
|||
lwz 0, 0(1)
|
||||
lwz 29, 4(1)
|
||||
mtlr 0
|
||||
addi 1, 1, 8
|
||||
addi 1, 1, 16
|
||||
/* Branch to handler */
|
||||
blr
|
||||
|
||||
|
@ -291,7 +291,7 @@ caml_start_program:
|
|||
bl .L103
|
||||
b .L104
|
||||
.L103:
|
||||
addi 1, 1, -8
|
||||
addi 1, 1, -16
|
||||
mflr 0
|
||||
stw 0, 0(1)
|
||||
Loadglobal(11, caml_exception_pointer, 11)
|
||||
|
@ -310,7 +310,7 @@ caml_start_program:
|
|||
/* Pop the trap frame, restoring caml_exception_pointer */
|
||||
lwz 9, 4(1)
|
||||
Storeglobal(9, caml_exception_pointer, 11)
|
||||
addi 1, 1, 8
|
||||
addi 1, 1, 16
|
||||
/* Pop the callback link, restoring the global variables */
|
||||
.L106:
|
||||
lwz 9, 0(1)
|
||||
|
|
|
@ -221,7 +221,7 @@ _raise_caml_exception:
|
|||
lwz r0, 0(r1)
|
||||
lwz r29, 4(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 8
|
||||
addi r1, r1, 16
|
||||
/* Branch to handler */
|
||||
blr
|
||||
|
||||
|
@ -290,7 +290,7 @@ L102:
|
|||
bl L103
|
||||
b L104
|
||||
L103:
|
||||
addi r1, r1, -8
|
||||
addi r1, r1, -16
|
||||
mflr r0
|
||||
stw r0, 0(r1)
|
||||
Loadglobal r11, _caml_exception_pointer, r11
|
||||
|
@ -309,7 +309,7 @@ L105:
|
|||
/* Pop the trap frame, restoring caml_exception_pointer */
|
||||
lwz r9, 4(r1)
|
||||
Storeglobal r9, _caml_exception_pointer, r11
|
||||
addi r1, r1, 8
|
||||
addi r1, r1, 16
|
||||
/* Pop the callback link, restoring the global variables */
|
||||
L106:
|
||||
lwz r9, 0(r1)
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
#define Mark_scanned(sp, retaddr) (*((long *)((sp) - 4)) = (retaddr) | 1)
|
||||
#define Mask_already_scanned(retaddr) ((retaddr) & ~1)
|
||||
#ifdef SYS_aix
|
||||
#define Trap_frame_size 24
|
||||
#define Trap_frame_size 32
|
||||
#else
|
||||
#define Trap_frame_size 8
|
||||
#define Trap_frame_size 16
|
||||
#endif
|
||||
#define Callback_link(sp) ((struct caml_context *)((sp) + Trap_frame_size))
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue