Text file
src/runtime/funcdata.h
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 // This file defines the IDs for PCDATA and FUNCDATA instructions
6 // in Go binaries. It is included by assembly sources, so it must
7 // be written using #defines.
8 //
9 // These must agree with symtab.go and ../cmd/internal/objabi/funcdata.go.
10
11 #define PCDATA_UnsafePoint 0
12 #define PCDATA_StackMapIndex 1
13 #define PCDATA_InlTreeIndex 2
14 #define PCDATA_ArgLiveIndex 3
15
16 #define FUNCDATA_ArgsPointerMaps 0 /* garbage collector blocks */
17 #define FUNCDATA_LocalsPointerMaps 1
18 #define FUNCDATA_StackObjects 2
19 #define FUNCDATA_InlTree 3
20 #define FUNCDATA_OpenCodedDeferInfo 4 /* info for func with open-coded defers */
21 #define FUNCDATA_ArgInfo 5
22 #define FUNCDATA_ArgLiveInfo 6
23 #define FUNCDATA_WrapInfo 7
24
25 // Pseudo-assembly statements.
26
27 // GO_ARGS, GO_RESULTS_INITIALIZED, and NO_LOCAL_POINTERS are macros
28 // that communicate to the runtime information about the location and liveness
29 // of pointers in an assembly function's arguments, results, and stack frame.
30 // This communication is only required in assembly functions that make calls
31 // to other functions that might be preempted or grow the stack.
32 // NOSPLIT functions that make no calls do not need to use these macros.
33
34 // GO_ARGS indicates that the Go prototype for this assembly function
35 // defines the pointer map for the function's arguments.
36 // GO_ARGS should be the first instruction in a function that uses it.
37 // It can be omitted if there are no arguments at all.
38 // GO_ARGS is inserted implicitly by the linker for any function whose
39 // name starts with a middle-dot and that also has a Go prototype; it
40 // is therefore usually not necessary to write explicitly.
41 #define GO_ARGS FUNCDATA $FUNCDATA_ArgsPointerMaps, go_args_stackmap(SB)
42
43 // GO_RESULTS_INITIALIZED indicates that the assembly function
44 // has initialized the stack space for its results and that those results
45 // should be considered live for the remainder of the function.
46 #define GO_RESULTS_INITIALIZED PCDATA $PCDATA_StackMapIndex, $1
47
48 // NO_LOCAL_POINTERS indicates that the assembly function stores
49 // no pointers to heap objects in its local stack variables.
50 #define NO_LOCAL_POINTERS FUNCDATA $FUNCDATA_LocalsPointerMaps, no_pointers_stackmap(SB)
51
52 // ArgsSizeUnknown is set in Func.argsize to mark all functions
53 // whose argument size is unknown (C vararg functions, and
54 // assembly code without an explicit specification).
55 // This value is generated by the compiler, assembler, or linker.
56 #define ArgsSizeUnknown 0x80000000
57
View as plain text