github.com/pkujhd/goloader@v0.0.0-20240411034752-1a28096bd7bd/stackobject/stackobject.1.18.go (about)

     1  //go:build go1.18 && !go1.23
     2  // +build go1.18,!go1.23
     3  
     4  package stackobject
     5  
     6  import (
     7  	"unsafe"
     8  )
     9  
    10  // A stackObjectRecord is generated by the compiler for each stack object in a stack frame.
    11  // This record must match the generator code in cmd/compile/internal/liveness/plive.go:emitStackObjects.
    12  type stackObjectRecord struct {
    13  	// offset in frame
    14  	// if negative, offset from varp
    15  	// if non-negative, offset from argp
    16  	off       int32
    17  	size      int32
    18  	_ptrdata  int32  // ptrdata, or -ptrdata is GC prog is used
    19  	gcdataoff uint32 // offset to gcdata from moduledata.rodata
    20  }
    21  
    22  func setStackObjectPtr(obj *stackObjectRecord, ptr unsafe.Pointer, noptrdata uintptr) {
    23  	obj.gcdataoff = uint32(uintptr(ptr) - noptrdata)
    24  }