package constant

import "github.com/open-policy-agent/opa/internal/wasm/constant"

Package constant contains WASM constant definitions.

Index

Constants

const (
	CustomSectionID uint8 = iota
	TypeSectionID
	ImportSectionID
	FunctionSectionID
	TableSectionID
	MemorySectionID
	GlobalSectionID
	ExportSectionID
	StartSectionID
	ElementSectionID
	CodeSectionID
	DataSectionID
)

WASM module section IDs.

const (
	ValueTypeF64 byte = iota + 0x7C
	ValueTypeF32
	ValueTypeI64
	ValueTypeI32
)

ValueType represents an intrinsic value type in WASM.

const (
	ImportDescType byte = iota
	ImportDescTable
	ImportDescMem
	ImportDescGlobal
)

WASM import descriptor types.

const (
	ExportDescType byte = iota
	ExportDescTable
	ExportDescMem
	ExportDescGlobal
)

WASM export descriptor types.

const (
	Const byte = iota
	Mutable
)

WASM global varialbe mutability flag.

const (
	NameSectionModuleType byte = iota
	NameSectionFunctionsType
	NameSectionLocalsType
)

Subtypes of the 'name' custom section

const BlockTypeEmpty byte = 0x40

BlockTypeEmpty represents a block type.

const ElementTypeAnyFunc byte = 0x70

ElementTypeAnyFunc indicates the type of a table import.

const FunctionTypeID = byte(0x60)

FunctionTypeID indicates the start of a function type definition.

const Magic = uint32(0x6D736100)

Magic bytes at the beginning of every WASM file ("\0asm").

const NameSectionCustomID = "name"

NameSectionCustomID is the ID of the "Name" section Custom Section

const Version = uint32(1)

Version defines the WASM version.

Source Files

constant.go

Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Last checked
6 hours ago

Tools for package owners.