-
Notifications
You must be signed in to change notification settings - Fork 3
Remove alloc decoding from the K definition #729
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
Conversation
The following tests are failing:
The root cause is, type @dkcumming, @jberthold, how was this test file generated? Is is also possible the linker has / at some point had a bug (i.e. a type reference is missed somewhere in the JSON tree). |
Interesting... |
```k | ||
syntax Map ::= #decodeAllocs ( GlobalAllocs , Map ) [function, total, symbol("decodeAllocs") ] // AllocId |-> Thing | ||
| #decodeAllocsAux ( Map , GlobalAllocs , Map ) [function, total, symbol("decodeAllocsAux")] // accumulating version | ||
// ----------------------------------------------------------------------------------------------- | ||
rule #decodeAllocs(ALLOCS, TYPEMAP) => #decodeAllocsAux(.Map, ALLOCS, TYPEMAP) | ||
rule #decodeAllocsAux(ACCUM, .GlobalAllocs, _TYPEMAP) => ACCUM | ||
rule #decodeAllocsAux(ACCUM, globalAllocEntry(ID, TY, Memory(ALLOC)) ALLOCS, TYPEMAP) | ||
=> #decodeAllocsAux(ACCUM #decodeAlloc(ID, TY, ALLOC, TYPEMAP), ALLOCS, TYPEMAP) | ||
requires TY in_keys(TYPEMAP) | ||
[preserves-definedness] | ||
``` | ||
|
||
If the type of an alloc cannot be found, or for non-`Memory` allocs, the raw data is stored in a super-sort of `Value`. | ||
This ensures that the function is total (anyway lookups require constraining the sort). | ||
|
||
```k | ||
syntax AllocData ::= Value | AllocData ( Ty , GlobalAllocKind ) | ||
rule #decodeAllocsAux(ACCUM, globalAllocEntry(ID, TY, OTHER) ALLOCS, TYPEMAP) | ||
=> #decodeAllocsAux(ACCUM ID |-> AllocData(TY, OTHER), ALLOCS, TYPEMAP) | ||
[owise] | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule here at the bottom previously took care of the case where the type ID is not found in the type map, producing AllocData
nodes in the expected output:
https://github.com/runtimeverification/mir-semantics/blob/master/kmir/src/tests/integration/data/exec-smir/allocs/enum-two-refs-fail.state#L87-L90
About the question of why we are getting the Inspecting the data, I can see that allocs 10-13 are referenced from other allocs (1 references 10 and 11, 2 references 12 and 13), and 1 and 2 are of type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! All tests green so let's merge it.
No description provided.