-
Notifications
You must be signed in to change notification settings - Fork 42
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
Rearrange the handling of constant slices. #1243
Conversation
Instead of sending them as blobs with values, mir-json now encodes them as references to static definitions. The values appear as separate bodies as static allocations. The new input kinds "slicebody" and "strbody" are used to ship the bodies in the JSON. Change our internal representation of the input MIR to split the ConstSlice and ConstStr cases accordingly. Kill off the ConstByteStr case as it's no longer needed; byte strings come through as ordinary references now. Adjust the translation step to handle the bodies and references separately. The critical part of this is that it produces globalMirRef instead of constMirRef; this avoids using constMirRef for cases it can't support that lead to "Cannot compare Const_RefRoots". See saw-script #2064. Note that the handling of slice and string slice bodies is probably now the same as the handling for ordinary arrays and could be simplified away. It is also possible that Const_RefRoots can be killed off entirely. One thing at a time though. Requires corresponding update to mir-json.
Note that this shouldn't get merged without a commit that bumps the mir-json submodule reference, but that should wait until the mir-json changes are ready to merge. |
oh, of course none of the tests are going to work without the new mir-json... |
Indeed, I think it would be worth bumping the Relatedly, I think it would be worth noting somewhere in the commit message that this depends on the changes from GaloisInc/mir-json#73. |
Kill off ConstStrRef.
Pointed out by Ryan Scott
- don't output rubbish when prettyprinting - clarify some comments - remove obsolete comments - update some names - remove separate binding of vec_tpr in the ConstStrBody case which no longer serves its original illustrative purpose
I have done this.
Now each of the descriptions references the other one. |
9c49f44
to
45bdefc
Compare
I force-pushed to squash the reference to the pre-merged version in mir-json. Perhaps not strictly necessary (since that version still exists) but it's untidy to leave it lying around. |
The idea is to split the slice into a reference and a separate static allocation for the body the reference points to. This then allows us to treat the references as normal references to memory, which in turn avoids problems in SAW that arise when it goes to try to enforce disjointness.
Requires accompanying changes in mir-json that produce the new output we read. (These are in mir-json #73.)
See saw-script #2064 for background.