-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster interpreter #1225
base: main
Are you sure you want to change the base?
Faster interpreter #1225
Conversation
This has been sitting untouched for a long while now, so people might wondering where it's at ... The short answer is that I ran into a problem with the assert-by-computer-then-z3 mode, since it requires turning the optimized 'Value' nodes back into 'Exp' nodes, which requires computing the types of each expression. To resolve this, I either need to make types into first-class values into the executor, or do some kind of monomorphization thing. Anyway, it's not trivial to resolve. |
Hmm, that does sound annoying. Thanks for the update! |
This is a proof-of-concept for a faster interpreter. It needs a lot of work to reach feature parity with the current one, but it is orders of magnitude faster. As a test case I have been using the bin-sizes lemma from the mem allocator project, which loops over 100k values. We previously found this example to be infeasible, taking several minutes at the very least. With the faster interpreter in this PR, it completes in a couple of seconds.
This new interpreter works by "compiling" spec expressions into a simple stack-based instruction set with instructions for unary ops, binary ops, jumps, constructors, calls, memoized calls, and closure calls. We also operate on a new datatype, called
Value
, rather than working withExp
. Though not implemented yet, the plan is to convert Values back to Exps for the 'compute-followed-by-z3' mode. The logic for all the different unary ops and binary ops is mostly unchanged, just copied and adjusted for the new datatypes.Some advantages of this system: