Brad Fitzpatrick | 5194744 | 2016-03-01 22:57:46 +0000 | [diff] [blame] | 1 | // Copyright 2013 The Go Authors. All rights reserved. |
Russ Cox | 9ddfb64 | 2013-07-16 16:24:09 -0400 | [diff] [blame] | 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 |
Russ Cox | fee9e475 | 2014-11-11 17:05:19 -0500 | [diff] [blame] | 6 | // in Go binaries. It is included by assembly sources, so it must |
| 7 | // be written using #defines. |
| 8 | // |
Xia Bin | c19f86f | 2018-07-12 18:34:34 +0800 | [diff] [blame] | 9 | // These must agree with symtab.go and ../cmd/internal/objabi/funcdata.go. |
Russ Cox | 9ddfb64 | 2013-07-16 16:24:09 -0400 | [diff] [blame] | 10 | |
Russ Cox | 68c1c6a | 2014-09-12 07:51:00 -0400 | [diff] [blame] | 11 | #define PCDATA_StackMapIndex 0 |
David Lazar | 699175a | 2017-02-17 12:28:05 -0500 | [diff] [blame] | 12 | #define PCDATA_InlTreeIndex 1 |
Austin Clements | 9f95c9d | 2018-03-27 15:50:45 -0400 | [diff] [blame] | 13 | #define PCDATA_RegMapIndex 2 |
Russ Cox | 48769bf | 2013-07-19 16:04:09 -0400 | [diff] [blame] | 14 | |
Matthew Dempsky | 3d128db | 2014-08-28 19:08:09 -0700 | [diff] [blame] | 15 | #define FUNCDATA_ArgsPointerMaps 0 /* garbage collector blocks */ |
| 16 | #define FUNCDATA_LocalsPointerMaps 1 |
David Lazar | 699175a | 2017-02-17 12:28:05 -0500 | [diff] [blame] | 17 | #define FUNCDATA_InlTree 2 |
Austin Clements | 9f95c9d | 2018-03-27 15:50:45 -0400 | [diff] [blame] | 18 | #define FUNCDATA_RegPointerMaps 3 |
Keith Randall | cbafcc5 | 2018-09-01 20:16:39 -0700 | [diff] [blame] | 19 | #define FUNCDATA_StackObjects 4 |
Russ Cox | 9ddfb64 | 2013-07-16 16:24:09 -0400 | [diff] [blame] | 20 | |
Russ Cox | 99f7df0 | 2014-09-12 00:18:20 -0400 | [diff] [blame] | 21 | // Pseudo-assembly statements. |
| 22 | |
| 23 | // GO_ARGS, GO_RESULTS_INITIALIZED, and NO_LOCAL_POINTERS are macros |
| 24 | // that communicate to the runtime information about the location and liveness |
| 25 | // of pointers in an assembly function's arguments, results, and stack frame. |
| 26 | // This communication is only required in assembly functions that make calls |
| 27 | // to other functions that might be preempted or grow the stack. |
| 28 | // NOSPLIT functions that make no calls do not need to use these macros. |
| 29 | |
| 30 | // GO_ARGS indicates that the Go prototype for this assembly function |
| 31 | // defines the pointer map for the function's arguments. |
| 32 | // GO_ARGS should be the first instruction in a function that uses it. |
| 33 | // It can be omitted if there are no arguments at all. |
Russ Cox | 202bf8d | 2014-10-28 15:51:06 -0400 | [diff] [blame] | 34 | // GO_ARGS is inserted implicitly by the linker for any function |
| 35 | // that also has a Go prototype and therefore is usually not necessary |
| 36 | // to write explicitly. |
Russ Cox | 99f7df0 | 2014-09-12 00:18:20 -0400 | [diff] [blame] | 37 | #define GO_ARGS FUNCDATA $FUNCDATA_ArgsPointerMaps, go_args_stackmap(SB) |
| 38 | |
| 39 | // GO_RESULTS_INITIALIZED indicates that the assembly function |
| 40 | // has initialized the stack space for its results and that those results |
| 41 | // should be considered live for the remainder of the function. |
Richard Miller | 8a2d6e9 | 2016-03-14 10:24:19 +0000 | [diff] [blame] | 42 | #define GO_RESULTS_INITIALIZED PCDATA $PCDATA_StackMapIndex, $1 |
Russ Cox | 99f7df0 | 2014-09-12 00:18:20 -0400 | [diff] [blame] | 43 | |
| 44 | // NO_LOCAL_POINTERS indicates that the assembly function stores |
| 45 | // no pointers to heap objects in its local stack variables. |
| 46 | #define NO_LOCAL_POINTERS FUNCDATA $FUNCDATA_LocalsPointerMaps, runtimeยทno_pointers_stackmap(SB) |
| 47 | |
Keith Randall | 6fc49c1 | 2013-07-19 11:19:18 -0700 | [diff] [blame] | 48 | // ArgsSizeUnknown is set in Func.argsize to mark all functions |
| 49 | // whose argument size is unknown (C vararg functions, and |
| 50 | // assembly code without an explicit specification). |
| 51 | // This value is generated by the compiler, assembler, or linker. |
| 52 | #define ArgsSizeUnknown 0x80000000 |