mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
fae0402fde
See: https://github.com/tinygo-org/tinygo/issues/4314 The os package isn't particularly useful on wasm-unknown, but just like on baremetal systems it's imported by a lot of packages so it should at least be possible to import this package.
43 lines
783 B
Go
43 lines
783 B
Go
//go:build wasm_unknown
|
|
|
|
package runtime
|
|
|
|
import "unsafe"
|
|
|
|
type timeUnit int64
|
|
|
|
// libc constructors
|
|
//
|
|
//export __wasm_call_ctors
|
|
func __wasm_call_ctors()
|
|
|
|
//export _initialize
|
|
func _initialize() {
|
|
// These need to be initialized early so that the heap can be initialized.
|
|
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
|
|
heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize)
|
|
initAll()
|
|
}
|
|
|
|
func init() {
|
|
__wasm_call_ctors()
|
|
}
|
|
|
|
func ticksToNanoseconds(ticks timeUnit) int64 {
|
|
return int64(ticks)
|
|
}
|
|
|
|
func nanosecondsToTicks(ns int64) timeUnit {
|
|
return timeUnit(ns)
|
|
}
|
|
|
|
// with the wasm32-unknown-unknown target there is no way to determine any `precision`
|
|
const timePrecisionNanoseconds = 1000
|
|
|
|
func sleepTicks(d timeUnit) {
|
|
}
|
|
|
|
func ticks() timeUnit {
|
|
return timeUnit(0)
|
|
}
|