wa-lang.org/wazero@v1.0.2/internal/engine/compiler/arch_amd64.go (about)

     1  package compiler
     2  
     3  import (
     4  	"wa-lang.org/wazero/internal/asm/amd64"
     5  	"wa-lang.org/wazero/internal/wazeroir"
     6  )
     7  
     8  // init initializes variables for the amd64 architecture
     9  func init() {
    10  	newArchContext = newArchContextImpl
    11  	registerNameFn = amd64.RegisterName
    12  	unreservedGeneralPurposeRegisters = amd64UnreservedGeneralPurposeRegisters
    13  	unreservedVectorRegisters = amd64UnreservedVectorRegisters
    14  }
    15  
    16  // archContext is embedded in callEngine in order to store architecture-specific data.
    17  // For amd64, this is empty.
    18  type archContext struct{}
    19  
    20  // newArchContextImpl implements newArchContext for amd64 architecture.
    21  func newArchContextImpl() (ret archContext) { return }
    22  
    23  // newCompiler returns a new compiler interface which can be used to compile the given function instance.
    24  // Note: ir param can be nil for host functions.
    25  func newCompiler(ir *wazeroir.CompilationResult, withListener bool) (compiler, error) {
    26  	return newAmd64Compiler(ir, withListener)
    27  }