runtimekit

package
v0.297.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchBitSize added in v0.289.0

func ArchBitSize() int

ArchBitSize returns the current Architecture's supported bit size.

In this context, `unsafe.Sizeof(ptr)` returns the size (in bytes) of a variable or zero-sized type.

For pointer types like `uintptr`, this will return either 4 (for a 32-bit architecture) or 8 (for a 64-bit architecture), because those are the standard sizes that pointers occupy in memory for these architectures.

By multiplying the result by 8 (`sizeOfPtr*8`), we're converting bytes to bits, because there are 8 bits in one byte.

In other words:

- If your machine is 32 bit (and thus `uintptr` size is 4 bytes) - `4 * 8 = 32` - If your machine is 64 bit (and thus `uintptr` size is 8 bytes) - `8 * 8 = 64`

This multiplication gives you the number of bits that a pointer uses, which can be used as an indication of whether the system is running a 32-bit or 64-bit version of the Go runtime.

func FuncOf added in v0.290.0

func FuncOf(fn any) *runtime.Func

FuncOf returns the runtime function metadata for the given function.

It takes any func type value as input and attempts to resolve it to a runtime.Func. If the input is not a function, it panics. If the input is nil, it returns nil.

func OverStack added in v0.290.0

func OverStack() iter.Seq[runtime.Frame]

func RegisterFrameException added in v0.290.0

func RegisterFrameException(isException func(f runtime.Frame) bool) func()

RegisterFrameException ensures that runtimekit globally ignores frames that match the given exception filter function.

func Stack added in v0.289.0

func Stack() []runtime.Frame

Types

type FuncInfo added in v0.290.0

type FuncInfo struct {
	// ID is the function's identifier
	ID string
	// Receiver is the type's identifier in case of a method.
	Receiver string
	// Package is the name of the package where the function is declared.
	Package string
	// Import is the import path of the function's package.
	// Import includes the package name as well
	Import string
	// IsMethodValue indicates if the function is a method value.
	//
	// In Go, methods are functions associated with a specific type and require
	// a receiver (instance) to be called. When a method is assigned to a function
	// variable (e.g., `m.MyMethod`), Go creates a *method value* — a closure function
	// that "remembers" the receiver and can be invoked like a regular function.
	//
	// https://go.dev/ref/spec#Method_values
	IsMethodValue bool
}

FuncInfo is the information of a function type.

IT's naming is based on the go language spec's terminology. https://go.dev/ref/spec#Function_types

func FuncInfoOf added in v0.290.0

func FuncInfoOf(fn *runtime.Func) FuncInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL