Skip to content

Commit

Permalink
Comply with the new memory model
Browse files Browse the repository at this point in the history
Unfortunately our memory model has had to change in order to support the
kinds of type punning that we see in the output of `rustc`. What this
primarily means is that we have changed to a byte-addressable model,
reducing overall memory usage on the Cairo VM at the cost of more
computation steps.

Each machine word fits 28 bytes, along with 28 bits worth of flags for
future use by the memory subsystem. These flags are not treated as part
of contiguous memory.

The primary changes are:

- A swap to calculate both `size_of` and `align_of` in bytes in the LLVM
  type system used by the compiler. This relies on the specified data
  layout for accurate computation.
- Alterations to the semantics of the memory-related polyfills and
  opcodes to compute offsets and sizes properly using the new machinery
  for doing so.

This commit also includes documentation of the new memory model.
  • Loading branch information
iamrecursion committed Jan 9, 2025
1 parent e09f21c commit fb43a53
Show file tree
Hide file tree
Showing 5 changed files with 809 additions and 86 deletions.
Loading

0 comments on commit fb43a53

Please sign in to comment.