Open acheroncrypto opened 1 year ago
Is this related to compiling the Interpreter for WASM or is there a different motivation of bringing it to 32 bit? The thing is that our entire ecosystem relies on the implicit assumption of running 64bit guests on 64bit host systems. So while not impossible, it is hard to pull off and will probably not receive much attention from our side.
That being said, the memory mapping system currently in place does assume that the 64bit address space is essentially for fat pointers which are split into a 32bit region index and a 32bit address space inside each region. We also have unaligned memory mapping, so that design broke down a little.
In program runtime v2, if we manage to remove address translation, then this will be a lot easier as the host could dictate the memory layout and also address space size, thus would be able to use 32 bit pointers.
Yes, the motivation is to run programs in browsers with wasm32-unknown-unknown
target as wasm64
is not ready yet.
Unfortunately, as you've said there seems to be a quite a bit of 64bit assumption of usize
etc.
In program runtime v2, if we manage to remove address translation, then this will be a lot easier as the host could dictate the memory layout and also address space size, thus would be able to use 32 bit pointers.
That sounds great! All of the issues that I've run into so far with WASM seems to be caused by the address translation.
I would like to make interpreter work on 32bit architechtures. Currently there is no compilation error and regular programs seem to work as expected but various memory readings during syscalls like
InvokeSignedRust
return invalid pointers which results in program fails to complete error.Going by the comment of
I've played with some of the values like
MM_PROGRAM_START
andVIRTUAL_ADDRESS_BITS
and got some improvements(some of the memory translations ended up being correct during syscalls) but programs still failed to complete on 32bit and worked fine on 64bit after the changes.And what's the effect of
program-runtime-v2
on this? Particularly this part https://github.com/solana-labs/solana/issues/29864:A general advice on how to achieve this would be really helpful, thank you!