Source file src/runtime/stubs_wasm.go

     1  // Copyright 2024 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  // pause sets SP to newsp and pauses the execution of Go's WebAssembly
     8  // code until an event is triggered, or call back into Go.
     9  //
    10  // Note: the epilogue of pause pops 8 bytes from the stack, so when
    11  // returning to the host, the SP is newsp+8.
    12  // If we want to set the SP such that when it calls back into Go, the
    13  // Go function appears to be called from pause's caller's caller, then
    14  // call pause with newsp = internal/runtime/sys.GetCallerSP()-16 (another 8 is
    15  // the return PC pushed to the stack).
    16  func pause(newsp uintptr)
    17  

View as plain text