You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Better discriminant types, transmute special cases, onInt attributes (#778)
* The `rvalueDiscriminant` operation was unconditionally returning
128-bit integers, which turns out to be wrong. We now consult the layout
to return the correct bit width (but still always unsigned as this seems
to be an invariant).
Closesruntimeverification/solana-token#41
* Two special cases of `transmute` are implemented, removing `thunk`s
that `transmute` would have created before.
- round-trip `transmute`s through a given type back to the original type
are eliminated
- for a `transmute` from an `Integer` to an `enum` without fields
followed by a `discriminant` operation, the original integer value is
returned as the discriminant.
* the (partial) `onInt` function was missing `preserves-definedness`
attributes on its equation so booster did not apply it
requires lookupTy(TY_SRC_INNER) ==K lookupTy(TY_DEST_OUTER) // cast is a round-trip
1414
+
andBool lookupTy(TY_DEST_INNER) ==K lookupTy(TY_SRC_OUTER) // and is well-formed (invariant)
1415
+
```
1416
+
1417
+
Another specialisation is getting the discriminant of `enum`s without fields after converting some integer data to it
1418
+
(see `#discriminant` and `rvalueDiscriminant`).
1419
+
If none of the `enum` variants has any fields, the `Transmute` of a number to the `enum` data is necessarily just the discriminant itself., and can be returned as the integer value afgter adjusting to the byte length of the discriminant:
0 commit comments