Skip to content
Success

Changes

Summary

  1. Revised passing of arguments to external C functions (commit: 9fcb295) (details)
  2. ARM64 back-end: support the iOS/macOS ABI for calling external C functions (commit: ed8f3b4) (details)
  3. Changes entry for #9752 (commit: cc25fc9) (details)
Commit 9fcb295b980daf56b78b4c6788e885b950eac7e6 by xavier.leroy
Revised passing of arguments to external C functions

Introduce the type Cmm.exttype to precisely describe arguments to
external C functions, especially unboxed numerical arguments.

Annotate Cmm.Cextcall with the types of the arguments (Cmm.exttype list).
An empty list means "all arguments have default type XInt".

Annotate Mach.Iextcall with the type of the result (Cmm.machtype)
and the types of the arguments (Cmm.exttype list).

Change (slightly) the API for describing calling conventions in Proc:
- loc_external_arguments now takes a Cmm.exttype list,
  in order to know more precisely the types of the arguments.
- loc_arguments, loc_parameters, loc_results, loc_external_results
  now take a Cmm.machype instead of an array of pseudoregisters.
  (Only the types of the pseudoregisters mattered anyway.)

Update the implementations of module Proc accordingly, in every port.

Introduce a new overridable method in Selectgen, insert_move_extcall_arg,
to produce the code that moves an argument of an external C function
to the locations returned by Proc.loc_external_arguments.

Revise the selection of external calls accordingly
(method emit_extcall_args in Selectgen).
(commit: 9fcb295)
The file was modifiedasmcomp/amd64/proc.ml (diff)
The file was modifiedasmcomp/arm64/proc.ml (diff)
The file was modifiedasmcomp/arm64/emit.mlp (diff)
The file was modifiedasmcomp/selectgen.ml (diff)
The file was modifiedasmcomp/proc.mli (diff)
The file was modifiedasmcomp/printcmm.ml (diff)
The file was modifiedasmcomp/afl_instrument.ml (diff)
The file was modifiedasmcomp/cmmgen.ml (diff)
The file was modifiedasmcomp/mach.mli (diff)
The file was modifiedasmcomp/arm64/arch.ml (diff)
The file was modifiedasmcomp/selectgen.mli (diff)
The file was modifiedtestsuite/tools/parsecmm.mly (diff)
The file was modifiedasmcomp/amd64/selection.ml (diff)
The file was modifiedasmcomp/arm/selection.ml (diff)
The file was modifiedasmcomp/i386/selection.ml (diff)
The file was modifiedasmcomp/riscv/proc.ml (diff)
The file was modified.depend (diff)
The file was modifiedasmcomp/cmm.ml (diff)
The file was modifiedasmcomp/arm64/reload.ml (diff)
The file was modifiedasmcomp/i386/proc.ml (diff)
The file was modifiedasmcomp/s390x/proc.ml (diff)
The file was modifiedasmcomp/cmm.mli (diff)
The file was modifiedasmcomp/cmm_helpers.ml (diff)
The file was modifiedasmcomp/arm64/selection.ml (diff)
The file was modifiedasmcomp/power/proc.ml (diff)
The file was modifiedasmcomp/arm/proc.ml (diff)
The file was modifiedasmcomp/mach.ml (diff)
The file was modifiedasmcomp/spacetime_profiling.ml (diff)
The file was modifiedasmcomp/reg.ml (diff)
The file was modifiedasmcomp/printcmm.mli (diff)
The file was modifiedasmcomp/reg.mli (diff)
Commit ed8f3b427cd20bb968e8059d6b9b4cf537ce3bcc by xavier.leroy
ARM64 back-end: support the iOS/macOS ABI for calling external C functions

Unboxed arguments of type `int32` that are passed on the stack
are passed in 32-bit words instead of 64-bit words as in the AAPCS64 ABI.

To support this, we introduce a new specific operation, `Imove32`,
that compiles down to 32-bit moves or 32-bit stack loads or 32-bit
stack stores.

In the Selection pass, method `insert_move_extcall_arg`,
we generate `Imove32` instructions when required, i.e. if the
argument is an unboxed `int32` and needs to be passed on stack.

We then update `Proc.loc_external_arguments` to use 32-bit stack words
for `int32` arguments.
(commit: ed8f3b4)
The file was modifiedasmcomp/arm64/proc.ml (diff)
The file was modifiedasmcomp/arm64/arch.ml (diff)
The file was modifiedasmcomp/arm64/selection.ml (diff)
The file was modifiedChanges (diff)