diff options
| author | Guillaume Melquiond | 2020-12-26 17:40:38 +0100 |
|---|---|---|
| committer | Guillaume Melquiond | 2020-12-26 17:40:38 +0100 |
| commit | 6d2c2094648e956352723113a55e8f3963c35ceb (patch) | |
| tree | a3e9cc7099988882b42a3e9c935229da44f37c65 /kernel/vmbytecodes.ml | |
| parent | 015310b9d984f623558f3062d479b517079a2548 (diff) | |
Protect caml_process_pending_actions_exn with caml_something_to_do.
When using OCaml >= 4.10, function caml_process_pending_actions_exn is
called whenever the bytecode interpreter tries to apply a term. This
function exits immediately when caml_something_to_do is not set. But since
term application happens every few opcodes, even exiting immediately still
accounts between 5% and 10% of the whole interpreter. So, this commit
makes sure the function is not called unless caml_something_to_do is
already set (i.e., when the user presses Ctrl+C). This means that this
conditional branch is perfectly predicted by the processor.
On the following benchmark, this commit makes the VM 13% faster.
Time Eval vm_compute in Pos.iter (fun x => x) tt 100000000.
Note that, before OCaml 4.10, the VM code was checking the value of
caml_signals_are_pending before calling caml_process_pending_signals. So,
this commit actually fixes a regression.
Diffstat (limited to 'kernel/vmbytecodes.ml')
0 files changed, 0 insertions, 0 deletions
