github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/obj/plist.go (about)

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package obj
     6  
     7  import (
     8  	"github.com/shogo82148/std/cmd/internal/src"
     9  )
    10  
    11  type Plist struct {
    12  	Firstpc *Prog
    13  	Curfn   Func
    14  }
    15  
    16  // ProgAlloc is a function that allocates Progs.
    17  // It is used to provide access to cached/bulk-allocated Progs to the assemblers.
    18  type ProgAlloc func() *Prog
    19  
    20  func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc)
    21  
    22  func (ctxt *Link) InitTextSym(s *LSym, flag int, start src.XPos)
    23  
    24  func (ctxt *Link) Globl(s *LSym, size int64, flag int)
    25  
    26  func (ctxt *Link) GloblPos(s *LSym, size int64, flag int, pos src.XPos)
    27  
    28  // EmitEntryLiveness generates PCDATA Progs after p to switch to the
    29  // liveness map active at the entry of function s. It returns the last
    30  // Prog generated.
    31  func (ctxt *Link) EmitEntryLiveness(s *LSym, p *Prog, newprog ProgAlloc) *Prog
    32  
    33  // Similar to EmitEntryLiveness, but just emit stack map.
    34  func (ctxt *Link) EmitEntryStackMap(s *LSym, p *Prog, newprog ProgAlloc) *Prog
    35  
    36  // Similar to EmitEntryLiveness, but just emit unsafe point map.
    37  func (ctxt *Link) EmitEntryUnsafePoint(s *LSym, p *Prog, newprog ProgAlloc) *Prog
    38  
    39  // StartUnsafePoint generates PCDATA Progs after p to mark the
    40  // beginning of an unsafe point. The unsafe point starts immediately
    41  // after p.
    42  // It returns the last Prog generated.
    43  func (ctxt *Link) StartUnsafePoint(p *Prog, newprog ProgAlloc) *Prog
    44  
    45  // EndUnsafePoint generates PCDATA Progs after p to mark the end of an
    46  // unsafe point, restoring the register map index to oldval.
    47  // The unsafe point ends right after p.
    48  // It returns the last Prog generated.
    49  func (ctxt *Link) EndUnsafePoint(p *Prog, newprog ProgAlloc, oldval int64) *Prog
    50  
    51  // MarkUnsafePoints inserts PCDATAs to mark nonpreemptible and restartable
    52  // instruction sequences, based on isUnsafePoint and isRestartable predicate.
    53  // p0 is the start of the instruction stream.
    54  // isUnsafePoint(p) returns true if p is not safe for async preemption.
    55  // isRestartable(p) returns true if we can restart at the start of p (this Prog)
    56  // upon async preemption. (Currently multi-Prog restartable sequence is not
    57  // supported.)
    58  // isRestartable can be nil. In this case it is treated as always returning false.
    59  // If isUnsafePoint(p) and isRestartable(p) are both true, it is treated as
    60  // an unsafe point.
    61  func MarkUnsafePoints(ctxt *Link, p0 *Prog, newprog ProgAlloc, isUnsafePoint, isRestartable func(*Prog) bool)