github.com/primecitizens/pcz/std@v0.2.1/builtin/go/panic.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2009 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  package stdgo
     9  
    10  import (
    11  	"unsafe"
    12  
    13  	"github.com/primecitizens/pcz/std/core/atomic"
    14  )
    15  
    16  // A Panic holds information about an active panic.
    17  //
    18  // A Panic value must only ever live on the stack.
    19  //
    20  // The argp and link fields are stack pointers, but don't need special
    21  // handling during stack growth: because they are pointer-typed and
    22  // Panic values only live on the stack, regular stack pointer
    23  // adjustment takes care of them.
    24  //
    25  // see $GOROOT/src/runtime/runtime2.go#type:_panic
    26  type Panic struct {
    27  	Argp      unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink
    28  	Arg       any            // argument to panic
    29  	Link      *Panic         // link to earlier panic
    30  	PC        uintptr        // where to return to in runtime if this panic is bypassed
    31  	SP        unsafe.Pointer // where to return to in runtime if this panic is bypassed
    32  	Recovered bool           // whether this panic is over
    33  	Aborted   bool           // the panic was aborted
    34  	Goexit    bool
    35  }
    36  
    37  var panicking atomic.Uint32[uint32]