aboutsummaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorGuillaume Melquiond2021-03-25 14:32:27 +0100
committerGuillaume Melquiond2021-03-26 15:18:28 +0100
commit6a6e58ea763d3bacda86056b6e7f404bf95ad45d (patch)
tree585abe7c11ac191fe616d78c431d3be7c65e864a /dev
parentae819deb38c3a962e3badf020705c3d0c6c84e67 (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 'dev')
0 files changed, 0 insertions, 0 deletions