You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the division/remainder instructions in the AMD64 backend are implemented by generating quite a lot of code inline (due to having to handle all of the corner cases of emulating RISC-V division), and considering that division is a relatively rare and expensive operation anyway it probably doesn't make sense to bloat the code with it (I'd like to have some upper bound on how much native code one PolkaVM instruction can generate, and this instruction bloats it a lot).
Convert div_rem in crates/polkavm/src/compiler/amd64.rs into a generic routine (you'll probably want two, one for div and one for rem) that will be emitted only once by the recompiler (e.g. similar to the emit_*_trampoline functions, just with a ret at the end), and strip down the div_rem to essentially only 1) push the arguments on the stack, 2) call the generic routine, 3) once the generic route returns move the result into the destination register.
The text was updated successfully, but these errors were encountered:
Currently the division/remainder instructions in the AMD64 backend are implemented by generating quite a lot of code inline (due to having to handle all of the corner cases of emulating RISC-V division), and considering that division is a relatively rare and expensive operation anyway it probably doesn't make sense to bloat the code with it (I'd like to have some upper bound on how much native code one PolkaVM instruction can generate, and this instruction bloats it a lot).
Convert
div_rem
incrates/polkavm/src/compiler/amd64.rs
into a generic routine (you'll probably want two, one for div and one for rem) that will be emitted only once by the recompiler (e.g. similar to theemit_*_trampoline
functions, just with aret
at the end), and strip down thediv_rem
to essentially only 1) push the arguments on the stack, 2)call
the generic routine, 3) once the generic route returns move the result into the destination register.The text was updated successfully, but these errors were encountered: