Closed DavePearce closed 2 years ago
One problem which needs to be resolved is runtime checking of old(e)
expressions. The obvious solution is to save the entire machine state on entry to a method, but that's kind of ridiculous. The solution used in JML was to execute old(e)
expressions at the beginning of a method, and save their results for use in the postcondition. One problem with this arises from quantifiers and, in particular, old(e)
expressions which contain quantified variables.
Part of the issue here is that, in the current design of the interpreter, its quite difficult to snapshot the machine state since references are actually implemented using JVM Object
s.
My current solution to the issue of handling old(e)
expressions is actually to save the entire state on entry to a method. This is obviously costly, but provides a simple semantic. The problem I have is that evaluating old(e)
in the prestate on entry to a method is extremely difficult to manage correctly. For example, if we have a recursive variant ... how to do we determine the set of locations to which it might refer? We can't.
This is a little controversial, since I haven't figure out all the details yet! But, what the heck. Let's get a preliminary implementation for
\old()
syntax into the compiler.