-
Notifications
You must be signed in to change notification settings - Fork 45
Vec arrays #1647
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
base: master
Are you sure you want to change the base?
Vec arrays #1647
Conversation
| -- | We expect this to have one instance: for `RegValue'`. | ||
| -- We don't use that type directly to avoid recursive module dependencies. | ||
| class IsExprBuilder sym => IsRegValue sym f | f -> sym where |
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.
Do you always expect this class to have exactly one instance? If so, my preference would be to move the definition of RegValue' to another module to avoid recursive module dependencies, rather than complicating all of the type signatures in this module with yet another type class.
| class MonadIO m => VecMonad sym m where | ||
|
|
||
| -- | We use this for partial operations (e.g., indexing a vector out of bounds). | ||
| vecAbort :: IsSymBackend sym bak => bak -> SimErrorReason -> m a | ||
|
|
||
| -- | A pre-condition on the current operation. Assertions we generate | ||
| -- are conditional on this. | ||
| vecPre :: IsExprBuilder sym => sym -> m (Pred sym) |
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.
For symmetry with the VecSize class, it might be worth factoring out the IsExprBuilder sym constraint into a superclass, i.e.,
| class MonadIO m => VecMonad sym m where | |
| -- | We use this for partial operations (e.g., indexing a vector out of bounds). | |
| vecAbort :: IsSymBackend sym bak => bak -> SimErrorReason -> m a | |
| -- | A pre-condition on the current operation. Assertions we generate | |
| -- are conditional on this. | |
| vecPre :: IsExprBuilder sym => sym -> m (Pred sym) | |
| class (IsExprBuilder sym, MonadIO m) => VecMonad sym m where | |
| -- | We use this for partial operations (e.g., indexing a vector out of bounds). | |
| vecAbort :: IsSymBackend sym bak => bak -> SimErrorReason -> m a | |
| -- | A pre-condition on the current operation. Assertions we generate | |
| -- are conditional on this. | |
| vecPre :: sym -> m (Pred sym) |
| data VecVal (f :: CrucibleType -> Type) (tp :: CrucibleType) where | ||
| VecVal :: V.Vector (f tp) -> VecVal f tp |
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 name of this module is "VecValue", but this data type is named "VecVal". For consistency, it would be nice to use the same name throughout. My personal preference would be "VecValue", as it more closely aligns with the names of other types in Crucible (e.g., RegValue and AtomValue).
This PR wraps the vectors used to implement Crucible vector values with a newtype, which should allow us to support more representations in the future (e.g., vectors backed by SMT arrays, which would be useful for uninterpreted functions returning vectors)