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
As a part of migration to the MAST-base program format in #826, we ended up with duplicates of several procedures (here, here, and here). This is because these procedures are needed both by the kernel and by miden-lib, but miden-lib cannot directly reference procedures defined directly in the kernel (it can do so only via syscalls).
We need to find a way to avoid this duplication.
The text was updated successfully, but these errors were encountered:
the miden library, which can call kernel procedures only with syscall, and the list of the procedures is severely limited (we don't want to add some utility procedures to the kernel)
the api.masm which contains the kernel procedures and can internally call the kernel library
the kernel library, containing the procedures which can be used only inside of the kernel (in kernel modules, in api.masm or in main.masm)
The problem is that miden could call the kernel procedures only through the api.masm or, in other words, only by calling kernel procedures, so we can't call a procedure placed in some kernel lib module. On the other hand the kernel procedures could not reach any procedure outside the kernel library, since a kernel is compiled slightly different. So that's why we needed to duplicate those procedures.
Without any modification of the miden-vm I can see the only solution: we could create a new utilities library, which would be placed next to the miden library, but will be imported by default to the both kernel and miden libs on the building stage. This library will contain all the duplicated procedures and should work the same as stdlib, which can be used both in kernel and in miden. This should be possible, since all the duplicated procedures only need a set of constants to work, they don't need any imports.
This should work but there could also be a slightly simpler approach (actually not sure if simpler, maybe just different):
We could move these procedures into a separate module (e.g., utils.masm or shared.masm) and then include this module into both kernel library and miden library at build time.
Though, maybe creating a separate utilities library may be a better idea.
As a part of migration to the MAST-base program format in #826, we ended up with duplicates of several procedures (here, here, and here). This is because these procedures are needed both by the kernel and by
miden-lib
, butmiden-lib
cannot directly reference procedures defined directly in the kernel (it can do so only viasyscall
s).We need to find a way to avoid this duplication.
The text was updated successfully, but these errors were encountered: