Skip to content
Snippets Groups Projects
  • Cherry Mui's avatar
    2ebe15c6
    cmd/internal/obj/wasm: handle stack unwinding in wasmexport · 2ebe15c6
    Cherry Mui authored
    CL 603055 added basic support of wasmexport. This CL follows it
    and adds stack unwinding handling. If the wasmexport Go function
    returns normally, we directly return to the host. If the Go
    function unwinds the stack (e.g. goroutine switch, stack growth),
    we need to run a PC loop to call functions on the new stack,
    similar to wasm_pc_f_loop. One difference is that when the
    wasmexport function returns normally, we need to exit the loop and
    return to the host.
    
    Now a wasmimport function can call back into the Go via wasmexport.
    During the callback the stack could have moved. The wasmimport
    code needs to read a new SP after the host function returns,
    instead of assuming the SP doesn't change.
    
    For #65199.
    
    Change-Id: I62c1cde1c46f7eb72625892dea41e8137b361891
    Reviewed-on: https://go-review.googlesource.com/c/go/+/603836
    
    
    Reviewed-by: default avatarMichael Knyszek <mknyszek@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: default avatarAchille Roussel <achille.roussel@gmail.com>
    2ebe15c6
    History
    cmd/internal/obj/wasm: handle stack unwinding in wasmexport
    Cherry Mui authored
    CL 603055 added basic support of wasmexport. This CL follows it
    and adds stack unwinding handling. If the wasmexport Go function
    returns normally, we directly return to the host. If the Go
    function unwinds the stack (e.g. goroutine switch, stack growth),
    we need to run a PC loop to call functions on the new stack,
    similar to wasm_pc_f_loop. One difference is that when the
    wasmexport function returns normally, we need to exit the loop and
    return to the host.
    
    Now a wasmimport function can call back into the Go via wasmexport.
    During the callback the stack could have moved. The wasmimport
    code needs to read a new SP after the host function returns,
    instead of assuming the SP doesn't change.
    
    For #65199.
    
    Change-Id: I62c1cde1c46f7eb72625892dea41e8137b361891
    Reviewed-on: https://go-review.googlesource.com/c/go/+/603836
    
    
    Reviewed-by: default avatarMichael Knyszek <mknyszek@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: default avatarAchille Roussel <achille.roussel@gmail.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.