Skip to content

WIP: Add optional timeouts for hyperstrict evaluation

Clean Importer requested to merge timeouts into master

This allows the programmer to specify a timeout when using strict evaluation.

To do:

  • Figure out why CodeSharing and GraphTest fail with a 32-bit build with gcc 6 when optimizations are turned on (not an issue with this branch in particular; see #94 (closed)).
  • Think about the case !create_restore_point && timeout>=0. This can probably happen when an indirection is created as part of an argument of the host function. Presumably the timer at the top of the stack needs to be restarted in this case. In other words, this should be caught: interpret_f host_f, with interpret_f = \f -> f (last [0..1000000000])
  • Find a way to not corrupt the heap. At least two ways: 1. we can lock for the duration of each instruction (may be slow); 2. we can copy the heap before interpretation and restore it in case it fails. This may use a lot of memory and be slow, but on the other hand this has the benefit that we can also use it for other failures. If we use the garbage collector beforehand, the memory costs may be smaller, but this is tricky because nodes without pointers are copied to the end of the heap.
  • Need to be sure that the heap pointer is updated also in case a thread is killed, otherwise the heap is corrupt (this does not apply if we go for option 2 above).
  • Ideally time spent in the host (in case of indirections to the host) is not counted towards the timeout.
  • Ideally it would be possible to retry an interpretation after it timed out. This can be done by changing the constructor to DV_Timeout a, so that you can either match on it and handle the timeout, or retry by evaluating its argument. This is potentially useful for various error values of DeserializedValue, but I will only add it when it is shown to actually have a use case.
  • Windows implementation.
  • Need to change clean-build to not remove import code from library any more (https://gitlab.science.ru.nl/clean-and-itasks/clean-build/-/merge_requests/57).
Edited by Camil Staps

Merge request reports