Commit 5452fbc9 authored by Matthew Fernandez's avatar Matthew Fernandez
Browse files

pass *all* function parameters using handles

This is quite a complex change and requires some explanation...

First of all, the motivation was that I discovered CMurphi believes it is valid
to pass an undefined value into a function/procedure and only discover this as
an error when you try to read from it within the function/procedure. This caused
some problems for our previous approach as we were passing in non-var simple
parameters as unboxed (value_t) values. This meant that they would be read prior
to calling the function/procedure and an error would immediately surface.

To avoid this situation, we now treat all parameters uniformly as still-boxed
(handles). However, naturally things are not just that simple. This affects how
we call functions as we now always need a handle available and we frequently do
not have one (e.g. in the case of numeric literals). To get around this, we need
to construct temporary storage and copy raw read values into this. There are
more subtleties than this, but I'll leave the source comment to explain the four
scenarios we can experience.

Along with this change comes the following related things:

 * VarDecls now properly understand and report that they are lvalues. We can
   afford to stop lying about this because function calls now understand the
   additional concept of "read-only".
 * One of the isundefined test cases that was made invalid by this change is
   replaced by a different test case checking the new behaviour.
parent 6740004f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment