Merge pull request #448 from mshinwell/sensible_num_args

GPR#448: Add Proc.max_arguments_without_passing_on_stack
master
Mark Shinwell 2016-02-08 15:26:49 +01:00
commit 67342f4686
9 changed files with 26 additions and 3 deletions

View File

@ -76,6 +76,8 @@ let masm =
Linux's dynamic loader also destroys r10.
*)
let max_arguments_for_tailcalls = 10
let int_reg_name =
match Config.ccomp_type with
| "msvc" ->

View File

@ -180,6 +180,8 @@ let not_supported ofs = fatal_error "Proc.loc_results: cannot call"
remaining args on stack.
Return values in r0...r7 or d0...d15. *)
let max_arguments_for_tailcalls = 8
let single_regs arg = Array.map (fun arg -> [| arg |]) arg
let ensure_single_regs res =
Array.map (function

View File

@ -140,6 +140,8 @@ let not_supported ofs = fatal_error "Proc.loc_results: cannot call"
remaining args on stack.
Return values in r0...r15 or d0...d15. *)
let max_arguments_for_tailcalls = 16
let loc_arguments arg =
calling_conventions 0 15 100 115 outgoing arg
let loc_parameters arg =

View File

@ -139,6 +139,9 @@ let incoming ofs = Incoming ofs
let outgoing ofs = Outgoing ofs
let not_supported ofs = fatal_error "Proc.loc_results: cannot call"
(* Six arguments in integer registers plus eight in global memory. *)
let max_arguments_for_tailcalls = 14
let loc_arguments arg =
calling_conventions 0 5 100 99 outgoing arg
let loc_parameters arg =

View File

@ -174,6 +174,8 @@ let ensure_single_regs res =
| _ -> failwith "Proc.ensure_single_regs")
res
let max_arguments_for_tailcalls = 8
let loc_arguments arg =
let (loc, ofs) =
calling_conventions 0 7 100 112 outgoing 0 false (single_regs arg)

View File

@ -37,6 +37,14 @@ val loc_external_arguments: Reg.t array array -> Reg.t array array * int
val loc_external_results: Reg.t array -> Reg.t array
val loc_exn_bucket: Reg.t
(* The maximum number of arguments of an OCaml to OCaml function call for
which it is guaranteed there will be no arguments passed on the stack.
(Above this limit, tail call optimization may be disabled.)
N.B. The values for this parameter in the backends currently assume
that no unboxed floats are passed using the OCaml calling conventions.
*)
val max_arguments_for_tailcalls : int
(* Maximal register pressures for pre-spilling *)
val safe_register_pressure: Mach.operation -> int
val max_register_pressure: Mach.operation -> int array

View File

@ -125,6 +125,8 @@ let incoming ofs = Incoming ofs
let outgoing ofs = Outgoing ofs
let not_supported ofs = fatal_error "Proc.loc_results: cannot call"
let max_arguments_for_tailcalls = 5
let loc_arguments arg =
calling_conventions 0 4 100 103 outgoing 0 arg
let loc_parameters arg =

View File

@ -133,6 +133,8 @@ let incoming ofs = Incoming ofs
let outgoing ofs = Outgoing ofs
let not_supported ofs = fatal_error "Proc.loc_results: cannot call"
let max_arguments_for_tailcalls = 10
let loc_arguments arg =
calling_conventions 6 15 100 105 outgoing arg
let loc_parameters arg =

View File

@ -26,9 +26,9 @@ module Backend = struct
let size_int = Arch.size_int
let big_endian = Arch.big_endian
(* CR mshinwell: this needs tying through to [Proc], although it may
necessitate the introduction of a new field in that module. *)
let max_sensible_number_of_arguments = 9
let max_sensible_number_of_arguments =
(* The "-1" is to allow for a potential closure environment parameter. *)
Proc.max_arguments_for_tailcalls - 1
end
let backend = (module Backend : Backend_intf.S)