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

     1  //go:build go1.17 && !go1.18
     2  // +build go1.17,!go1.18
     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  	gcdata   *byte // pointer map or GC prog of the type
    20  }
    21  
    22  func setStackObjectPtr(obj *stackObjectRecord, ptr unsafe.Pointer, noptrdata uintptr) {
    23  	obj.gcdata = (*byte)(ptr)
    24  }