github.com/primecitizens/pcz/std@v0.2.1/core/abi/symtab.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2023 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 abi 9 10 // A FuncFlag records bits about a function, passed to the runtime. 11 type FuncFlag uint8 12 13 const ( 14 // FuncFlagTopFrame indicates a function that appears at the top of its stack. 15 // The traceback routine stop at such a function and consider that a 16 // successful, complete traversal of the stack. 17 // Examples of TopFrame functions include goexit, which appears 18 // at the top of a user goroutine stack, and mstart, which appears 19 // at the top of a system goroutine stack. 20 FuncFlagTopFrame FuncFlag = 1 << iota 21 22 // FuncFlagSPWrite indicates a function that writes an arbitrary value to SP 23 // (any write other than adding or subtracting a constant amount). 24 // The traceback routines cannot encode such changes into the 25 // pcsp tables, so the function traceback cannot safely unwind past 26 // SPWrite functions. Stopping at an SPWrite function is considered 27 // to be an incomplete unwinding of the stack. In certain contexts 28 // (in particular garbage collector stack scans) that is a fatal error. 29 FuncFlagSPWrite 30 31 // FuncFlagAsm indicates that a function was implemented in assembly. 32 FuncFlagAsm 33 ) 34 35 // A FuncID identifies particular functions that need to be treated 36 // specially by the runtime. 37 // Note that in some situations involving plugins, there may be multiple 38 // copies of a particular special runtime function. 39 type FuncID uint8 40 41 const ( 42 // If you add a FuncID, you probably also want to add an entry to the map in 43 // ../../cmd/internal/objabi/funcid.go 44 45 FuncIDNormal FuncID = iota // not a special function 46 FuncID_abort 47 FuncID_asmcgocall 48 FuncID_asyncPreempt 49 FuncID_cgocallback 50 FuncID_debugCallV2 51 FuncID_gcBgMarkWorker 52 FuncID_goexit 53 FuncID_gogo 54 FuncID_gopanic 55 FuncID_handleAsyncEvent 56 FuncID_mcall 57 FuncID_morestack 58 FuncID_mstart 59 FuncID_panicwrap 60 FuncID_rt0_go 61 FuncID_runfinq 62 FuncID_runtime_main 63 FuncID_sigpanic 64 FuncID_systemstack 65 FuncID_systemstack_switch 66 FuncIDWrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) 67 ) 68 69 // ArgsSizeUnknown is set in Func.argsize to mark all functions 70 // whose argument size is unknown (C vararg functions, and 71 // assembly code without an explicit specification). 72 // This value is generated by the compiler, assembler, or linker. 73 const ArgsSizeUnknown = -0x80000000 74 75 // IDs for PCDATA and FUNCDATA tables in Go binaries. 76 // 77 // These must agree with ../../../runtime/funcdata.h. 78 const ( 79 PCDATA_UnsafePoint = 0 80 PCDATA_StackMapIndex = 1 81 PCDATA_InlTreeIndex = 2 82 PCDATA_ArgLiveIndex = 3 83 84 FUNCDATA_ArgsPointerMaps = 0 85 FUNCDATA_LocalsPointerMaps = 1 86 FUNCDATA_StackObjects = 2 87 FUNCDATA_InlTree = 3 88 FUNCDATA_OpenCodedDeferInfo = 4 89 FUNCDATA_ArgInfo = 5 90 FUNCDATA_ArgLiveInfo = 6 91 FUNCDATA_WrapInfo = 7 92 ) 93 94 // Special values for the PCDATA_UnsafePoint table. 95 const ( 96 UnsafePointSafe = -1 // Safe for async preemption 97 UnsafePointUnsafe = -2 // Unsafe for async preemption 98 99 // UnsafePointRestart1(2) apply on a sequence of instructions, within 100 // which if an async preemption happens, we should back off the PC 101 // to the start of the sequence when resuming. 102 // We need two so we can distinguish the start/end of the sequence 103 // in case that two sequences are next to each other. 104 UnsafePointRestart1 = -3 105 UnsafePointRestart2 = -4 106 107 // Like UnsafePointRestart1, but back to function entry if async preempted. 108 UnsafePointRestartAtEntry = -5 109 )