GaloisInc / crucible

Crucible is a library for symbolic simulation of imperative programs
617 stars 42 forks source link

RFC: crucible-llvm: Parameterize over memory and pointer types #1194

Closed langston-barrett closed 1 month ago

langston-barrett commented 4 months ago

Note that the code changes are very WIP. Further notes below.

The idea is that we have a lot of big changes we'd potentially like to make to the memory model:

The problem is that these are all very hard to get started on, because they would involve sweeping changes across Crucible-LLVM and all downstream packages.

We could also consider alternative memory models for different use-cases:

All of these would have interesting trade-offs, but can't effectively be explored at the moment.

This PR is the first step in making it easier to run such experiments. The goal is to parameterize Crucible-LLVM over a typeclass that provides (Crucible and Haskell) types and operations on memory and pointers.

To that end, it introduces a new mem type variable. At the moment, a lot of places in the code add the abstraction-breaking mem ~ Mem constraint. The goal would be to gradually add operations to the Mem class and remove such equality constraints.

Some notable downsides:

Notes on progress:

langston-barrett commented 4 months ago

@RyanGlScott Could you take a look and see if you like the direction this is headed? This still needs:

But at that point, I think it will be a self-contained first step towards parameterizing the memory model, the next steps being removing the mem ~ Mem constraints in favor of adding more operations to the Mem typeclass.

RyanGlScott commented 4 months ago

Some initial thoughts:

langston-barrett commented 1 month ago

Closing as this has merge conflicts and I don't have time to push it to completion right now.