miden-vm
miden-vm copied to clipboard
Assembly IO instruction refactoring
IO operations are the only ones currently left still use "dot-format" (underscore format). As discussed in #329, it might be good to move them to the underscore format as well. Additionally, I think it might be a good opportunity for a bigger refactoring. Specifically, I'm thinking we could do the following:
-
push
operation stays as is now. -
push.env.sdepth
->sdepth
-
push.env.locaddr
->locaddr
-
push.mem
->mem_load
-
pushw.mem
delete -
loadw.mem
->mem_loadw
-
push.mem
->mem_store
-
popw.mem
delete -
storew.mem
->mem_storew
-
push.local
->loc_load
-
pushw.local
delete -
loadw.local
->loc_loadw
-
pop.local
->loc_store
-
popw.local
-> delete -
storew.local
->loc_storew
The motivation behind removing some operations is that these are expensive operations and frequently their use can be eliminated by more efficient use of load and store operations.
I think this will make instructions look more familiar --- cognitive parsing becomes easier.
I'm in favor of getting rid of pushw
and popw
. They both have a big performance penalty that's a bit opaque right now, so it's probably better if people have to explicitly pad the stack & see the cycle cost whenever they need this functionality.
If we're getting rid of pushw
/popw
, I'd change push
/pop
for memory & locals to to load
/store
for the same reason. Otherwise I think the same performance issue is likely to manifest itself in those instructions.
As mentioned in the other issue, I'm also in favor of switching to underscores, and I think the change to the env
instructions makes sense here as well.
I'd change
push
/pop
for memory & locals to toload
/store
Agreed! I've updated the original post.
Closed by #393