diff options
| author | Guillaume Melquiond | 2021-03-25 14:32:27 +0100 |
|---|---|---|
| committer | Guillaume Melquiond | 2021-03-26 15:18:28 +0100 |
| commit | 6a6e58ea763d3bacda86056b6e7f404bf95ad45d (patch) | |
| tree | 585abe7c11ac191fe616d78c431d3be7c65e864a /kernel/nativelambda.mli | |
| parent | ae819deb38c3a962e3badf020705c3d0c6c84e67 (diff) | |
Support OCaml primitives with an actual arity larger than 4.
PArray.set has arity 4, but due to the polymorphic universe, its actual
arity is 5. As a consequence, Kshort_apply cannot be used to invoke it
(or rather its accumulating version).
Using Kapply does not quite work here, because Kpush_retaddr would have to
be invoked before the arguments, that is, before we even know whether the
arguments are accumulators. So, to use Kapply, one would need to push the
return address, push duplicates of the already computed arguments, call
the accumulator, and then pop the original arguments.
This commit follows a simpler approach, but more restrictive, as it is
still limited to arity 4, but this time independently from universes. To
do so, the call is performed in two steps. First, a closure containing the
universes is created. Second, the actual application to the original
arguments is performed, for which Kshort_apply is sufficient.
So, this is inefficient, because a closure is created just so that it can
be immediately fully applied. But since this is the accumulator slow path,
this does not matter.
Diffstat (limited to 'kernel/nativelambda.mli')
0 files changed, 0 insertions, 0 deletions
