github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/experimental/experimental.go (about)

     1  // Package experimental includes features we aren't yet sure about. These are enabled with context.Context keys.
     2  //
     3  // Note: All features here may be changed or deleted at any time, so use with caution!
     4  package experimental
     5  
     6  import (
     7  	"github.com/bananabytelabs/wazero/api"
     8  )
     9  
    10  // InternalModule is an api.Module that exposes additional
    11  // information.
    12  type InternalModule interface {
    13  	api.Module
    14  
    15  	// NumGlobal returns the count of all globals in the module.
    16  	NumGlobal() int
    17  
    18  	// Global provides a read-only view for a given global index.
    19  	//
    20  	// The methods panics if i is out of bounds.
    21  	Global(i int) api.Global
    22  }
    23  
    24  // ProgramCounter is an opaque value representing a specific execution point in
    25  // a module. It is meant to be used with Function.SourceOffsetForPC and
    26  // StackIterator.
    27  type ProgramCounter uint64
    28  
    29  // InternalFunction exposes some information about a function instance.
    30  type InternalFunction interface {
    31  	// Definition provides introspection into the function's names and
    32  	// signature.
    33  	Definition() api.FunctionDefinition
    34  
    35  	// SourceOffsetForPC resolves a program counter into its corresponding
    36  	// offset in the Code section of the module this function belongs to.
    37  	// The source offset is meant to help map the function calls to their
    38  	// location in the original source files. Returns 0 if the offset cannot
    39  	// be calculated.
    40  	SourceOffsetForPC(pc ProgramCounter) uint64
    41  }