Closed odesenfans closed 10 months ago
The cache is already side-stepped in main for non-zero segments. We need to make a new release including support for running programs from other segments.
You're talking about #1493, right? That should work, I'll test it.
Describe the bug
In an effort to run the Cairo bootloader on top of the Cairo VM, I found out that the instruction cache used in
vm_core.rs
only considers execution from one segment. This hypothesis is not respected when running the bootloader as we can execute code from different segments.In this situation, the bootloader and the program(s) it attempts to load pollute each other's instruction cache, which typically ends up with a crash of the VM.
Expected behavior The cache should either be multi-dimensional or just not get in the way. I see several solutions:
HashMap<Relocatable, Option<Instruction>>
instead of the vector used right now.Vec<Vec<Option<Instruction>>
: if solution 1 ends up hitting performance too badly, using a 2-D vector could be a solution.What do you think? There's also the option to introduce a caching policy to keep the current caching solution for most cases and use a more complex one when running the bootloader.
What version/commit are you on? v0.9.1.