Debian Codegraph @

src/runtime/sys_wasm.go

raw
1 // Copyright 2018 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 import (
8 "internal/goarch"
9 "internal/runtime/sys"
10 "unsafe"
11 )
12
13 type m0Stack struct {
14 _ [8192 * sys.StackGuardMultiplier]byte
15 }
16
17 var wasmStack m0Stack
18
19 func wasmDiv()
20
21 func wasmTruncS()
22 func wasmTruncU()
23
24 //go:wasmimport gojs runtime.wasmExit
25 func wasmExit(code int32)
26
27 // adjust Gobuf as it if executed a call to fn with context ctxt
28 // and then stopped before the first instruction in fn.
29 func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
30 sp := buf.sp
31 sp -= goarch.PtrSize
32 *(*uintptr)(unsafe.Pointer(sp)) = buf.pc
33 buf.sp = sp
34 buf.pc = uintptr(fn)
35 buf.ctxt = ctxt
36 }
37
38 func notInitialized() // defined in assembly, call notInitialized1
39
40 // Called if a wasmexport function is called before runtime initialization
41 //
42 //go:nosplit
43 func notInitialized1() {
44 writeErrStr("runtime: wasmexport function called before runtime initialization\n")
45 if isarchive || islibrary {
46 writeErrStr("\tcall _initialize first\n")
47 } else {
48 writeErrStr("\tcall _start first\n")
49 }
50 }