Wasm: expose building block of compute step in Internal for tests
Context
see #3590 (closed) see #3803 (closed)
To facilitate benchmarking, enough internals are added exposed to be able to decompose one call to compute_step_many into several intermediate steps that can be benchmarked independently.
compute_step_many is refactored a bit to expose enough to be able to
- run on
pvm_staterather thantreeto measure the impact ofencode/decode - stop the execution sooner than when a snapshotable state is reached, parametrized by a predicate on
pvm_state
The internals are exposed in a Internal_for_benchmark module, parallel to Internal_for_tests, to make explicit the contest on which they should be used. A new module (besides _for_tests) has been added to encourage avoiding using them in tests: with them it would be possible to write tests that bypass so much of the main execution loop as to be very fragile.
A module Wasm_pvm_state is introduced to isolate state types declaration.
Remarque: the ppx time-measurement, which provides means to benchmark by putting annotation directly on the code to observe, could allow to obtain some information. However it is out-of-service at the moment (see #3895) and would not allow to isolate parts of the execution.
Manually testing the MR
No new tests, as only internal are made available.
Checklist
-
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR