github.com/primecitizens/pcz/std@v0.2.1/rt0/os_js.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  //go:build !noos && js
     5  
     6  package rt0
     7  
     8  import (
     9  	_ "github.com/primecitizens/pcz/std/ffi/js" // import symbol "wasm_export_run" and "wasm_export_getsp"
    10  
    11  	"github.com/primecitizens/pcz/std/core/alloc"
    12  	"github.com/primecitizens/pcz/std/core/alloc/sbrkalloc"
    13  	"github.com/primecitizens/pcz/std/core/yield"
    14  	"github.com/primecitizens/pcz/std/ffi/js/bindings"
    15  )
    16  
    17  var _alloc sbrkalloc.T
    18  
    19  func malloc() alloc.M { return &_alloc }
    20  func palloc() alloc.P { return &_alloc }
    21  
    22  func exit0() {
    23  	bindings.Exit(0)
    24  	yield.Thread()
    25  }