Conversation
|
@xFrednet tagging you as I can't add you as a reviewer without you accepting the invitation |
TobiasWrigstad
left a comment
There was a problem hiding this comment.
Super! Only one thing really which I suspect is too early to do, but probably good to have discussed at some point.
| /** | ||
| * Global status for performing the region check. | ||
| */ | ||
| bool do_region_check = false; |
There was a problem hiding this comment.
This is probably over thinking this (or too early) but should these bits be part of the per-interpreter state? Or will the invariant check always stop all subinterpreters and then check? I am thinking we (eventually) need to support the existance of multiple threads while we are checking.
What I am thinking is that it may be wise to access these through an indirection already which allows us to lift these globals into something else later.
There was a problem hiding this comment.
Not sure. This is very localised code, so lets design when we get there.
This creates a simple approach to checking an invariant on each step of the interpreter.
It exposes 3 Python builtins.
If there is an invariant failure, then it sets the src (source) and tgt (target) functions to be the values of the start and end of the edge that violates the region topology. Once a violation is detected the check is disabled.
The check can be reenabled by
enableinvariant. We currently only enable the check on the first call tomakeimmutableor onceenableinvariantis called.