wa-lang.org/wazero@v1.0.2/internal/engine/compiler/arch_arm64.s (about)

     1  #include "funcdata.h"
     2  #include "textflag.h"
     3  
     4  // nativecall(codeSegment, ce, moduleInstanceAddress)
     5  TEXT ·nativecall(SB),NOSPLIT|NOFRAME,$0-24
     6          // Load the address of *callEngine into arm64ReservedRegisterForCallEngine.
     7          MOVD ce+8(FP),R0
     8          // In arm64, return address is stored in R30 after jumping into the code.
     9          // We save the return address value into archContext.compilerReturnAddress in Engine.
    10          // Note that the const 136 drifts after editting Engine or archContext struct. See TestArchContextOffsetInEngine.
    11          MOVD R30,136(R0)
    12          // Load the address of *wasm.ModuleInstance into arm64CallingConventionModuleInstanceAddressRegister.
    13          MOVD moduleInstanceAddress+16(FP),R29
    14          // Load the address of native code.
    15          MOVD codeSegment+0(FP),R1
    16          // Jump to native code.
    17          JMP (R1)