github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/runtime_wasm_unknown.go (about)

     1  //go:build wasm_unknown
     2  
     3  package runtime
     4  
     5  import "unsafe"
     6  
     7  type timeUnit int64
     8  
     9  // libc constructors
    10  //
    11  //export __wasm_call_ctors
    12  func __wasm_call_ctors()
    13  
    14  //export _initialize
    15  func _initialize() {
    16  	// These need to be initialized early so that the heap can be initialized.
    17  	heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
    18  	heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize)
    19  	initAll()
    20  }
    21  
    22  func init() {
    23  	__wasm_call_ctors()
    24  }
    25  
    26  var args []string
    27  
    28  func ticksToNanoseconds(ticks timeUnit) int64 {
    29  	return int64(ticks)
    30  }
    31  
    32  func nanosecondsToTicks(ns int64) timeUnit {
    33  	return timeUnit(ns)
    34  }
    35  
    36  // with the wasm32-unknown-unknown target there is no way to determine any `precision`
    37  const timePrecisionNanoseconds = 1000
    38  
    39  func sleepTicks(d timeUnit) {
    40  }
    41  
    42  func ticks() timeUnit {
    43  	return timeUnit(0)
    44  }