package platform

Import Path
	github.com/tetratelabs/wazero/internal/platform (on go.dev)

Dependency Relation
	imports 15 packages, and imported by 5 packages

Involved Source Files cpuid.go cpuid_amd64.go crypto.go mmap_linux.go mmap_unix.go mprotect_syscall.go path.go Package platform includes runtime-specific code needed for the compiler or otherwise. Note: This is a dependency-free alternative to depending on parts of Go's x/sys. See /RATIONALE.md for more context. time.go time_cgo.go cpuid_amd64.s
Package-Level Type Names (total 2)
/* sort by: | */
func CpuFeatureFlags.Has(cpuFeature CpuFeature) bool func CpuFeatureFlags.HasExtra(cpuFeature CpuFeature) bool const CpuExtraFeatureAmd64ABM const CpuFeatureAmd64SSE3 const CpuFeatureAmd64SSE4_1 const CpuFeatureAmd64SSE4_2 const CpuFeatureArm64Atomic
CpuFeatureFlags exposes methods for querying CPU capabilities Has returns true when the specified flag (represented as uint64) is supported HasExtra returns true when the specified extraFlag (represented as uint64) is supported Raw returns the raw bitset that represents CPU features used by wazero. This can be used for cache keying. For now, we only use four features, so uint64 is enough. var CpuFeatures
Package-Level Functions (total 12)
CompilerSupported includes constraints here and also the assembler.
MmapCodeSegment copies the code into the executable region and returns the byte slice of the region. See https://man7.org/linux/man-pages/man2/mmap.2.html for mmap API and flags.
MprotectRX is like syscall.Mprotect with RX permission.
MunmapCodeSegment unmaps the given memory region.
Nanosleep implements sys.Nanosleep with time.Sleep.
Nanotime implements sys.Nanotime with runtime.nanotime() if CGO is available and time.Since if not.
NewFakeNanotime implements sys.Nanotime that increases by 1ms each reading. See /RATIONALE.md
NewFakeRandSource returns a deterministic source of random values.
NewFakeWalltime implements sys.Walltime with FakeEpochNanos that increases by 1ms each reading. See /RATIONALE.md
ToPosixPath returns the input, as only windows might return backslashes.
Walltime implements sys.Walltime with time.Now. Note: This is only notably less efficient than it could be is reading runtime.walltime(). time.Now defensively reads nanotime also, just in case time.Since is used. This doubles the performance impact. However, wall time is likely to be read less frequently than Nanotime. Also, doubling the cost matters less on fast platforms that can return both in <=100ns.
Package-Level Variables (total 3)
CpuFeatures exposes the capabilities for this CPU, queried via the Has, HasExtra methods.
FakeNanosleep implements sys.Nanosleep by returning without sleeping.
FakeOsyield implements sys.Osyield by returning without yielding.
Package-Level Constants (total 6)
CpuExtraFeatureAmd64ABM is the flag to query CpuFeatureFlags.HasExtra for Advanced Bit Manipulation capabilities (e.g. LZCNT) on amd64
CpuFeatureAmd64SSE3 is the flag to query CpuFeatureFlags.Has for SSEv3 capabilities on amd64
CpuFeatureAmd64SSE4_1 is the flag to query CpuFeatureFlags.Has for SSEv4.1 capabilities on amd64
CpuFeatureAmd64SSE4_2 is the flag to query CpuFeatureFlags.Has for SSEv4.2 capabilities on amd64
CpuFeatureArm64Atomic is the flag to query CpuFeatureFlags.Has for Large System Extensions capabilities on arm64
FakeEpochNanos is midnight UTC 2022-01-01 and exposed for testing