Source file src/runtime/os_wasip1_wasm32.go

     1  // Copyright 2026 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 "unsafe"
     8  
     9  // wasiPtr is a Go pointer so the GC can track buffers referenced by WASI data.
    10  type wasiPtr = *byte
    11  
    12  //go:nosplit
    13  func makeWASIPtr(p *byte) wasiPtr {
    14  	return p
    15  }
    16  
    17  func wasiPtrOffset(p wasiPtr, base *byte) uint32 {
    18  	return uint32(uintptr(unsafe.Pointer(p)) - uintptr(unsafe.Pointer(base)))
    19  }
    20  

View as plain text