Open ktemkin opened 2 months ago
To add a bit more information to this:
How to perform pointer operations without compromising performance while adhering to the read-only Cairo memory model.
Based on @Eagle941's notes taken live during today's meeting.
alloc
method to return an address.llvm_guest_pointer
.malloc
are not initialized automatically.read_addr
and write_addr
to interface with the LLVM model.- Wojtek's comment: are we sure about this? I don't see them in the langref.
alloc
, dealloc
, alloc_zero
, and realloc
.flo
instead of a polyfill no-op. Initially unnecessary, but useful for future optimizations.rustc
.Something that might be interesting is the cairo-riscv project's allocator, thanks to Ariel!
Description
LLVM’s assumption of R/W memory and registers does not fit with the memory model used by the Cairo VM. We can either take the SSA form and treat the target as an infinite-register machine, or we can emulate R/W memory directly.
For this initial design phase we want to do the bare minimum to get mostly-correct semantics as far as the LLVM IR expects. This task includes designing the assignment model and the semantics of the operations on pointers.