blob: 375a881bd82b12c914aa21aa239016963449b652 [file] [log] [blame]
Russ Cox9ddfb642013-07-16 16:24:09 -04001// 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
Russ Coxfee9e4752014-11-11 17:05:19 -05006// in Go binaries. It is included by assembly sources, so it must
7// be written using #defines.
8//
9// The Go compiler also #includes this file, for now.
Russ Cox97f83862014-09-03 13:02:48 -040010//
11// symtab.go also contains a copy of these constants.
Russ Cox9ddfb642013-07-16 16:24:09 -040012
Russ Cox68c1c6a2014-09-12 07:51:00 -040013#define PCDATA_StackMapIndex 0
Russ Cox48769bf2013-07-19 16:04:09 -040014
Matthew Dempsky3d128db2014-08-28 19:08:09 -070015#define FUNCDATA_ArgsPointerMaps 0 /* garbage collector blocks */
16#define FUNCDATA_LocalsPointerMaps 1
Russ Cox9ddfb642013-07-16 16:24:09 -040017
Russ Cox99f7df02014-09-12 00:18:20 -040018// Pseudo-assembly statements.
19
20// GO_ARGS, GO_RESULTS_INITIALIZED, and NO_LOCAL_POINTERS are macros
21// that communicate to the runtime information about the location and liveness
22// of pointers in an assembly function's arguments, results, and stack frame.
23// This communication is only required in assembly functions that make calls
24// to other functions that might be preempted or grow the stack.
25// NOSPLIT functions that make no calls do not need to use these macros.
26
27// GO_ARGS indicates that the Go prototype for this assembly function
28// defines the pointer map for the function's arguments.
29// GO_ARGS should be the first instruction in a function that uses it.
30// It can be omitted if there are no arguments at all.
Russ Cox202bf8d2014-10-28 15:51:06 -040031// GO_ARGS is inserted implicitly by the linker for any function
32// that also has a Go prototype and therefore is usually not necessary
33// to write explicitly.
Russ Cox99f7df02014-09-12 00:18:20 -040034#define GO_ARGS FUNCDATA $FUNCDATA_ArgsPointerMaps, go_args_stackmap(SB)
35
36// GO_RESULTS_INITIALIZED indicates that the assembly function
37// has initialized the stack space for its results and that those results
38// should be considered live for the remainder of the function.
39#define GO_RESULTS_INITIALIZED FUNCDATA PCDATA $PCDATA_StackMapIndex, 1
40
41// NO_LOCAL_POINTERS indicates that the assembly function stores
42// no pointers to heap objects in its local stack variables.
43#define NO_LOCAL_POINTERS FUNCDATA $FUNCDATA_LocalsPointerMaps, runtimeยทno_pointers_stackmap(SB)
44
Keith Randall6fc49c12013-07-19 11:19:18 -070045// ArgsSizeUnknown is set in Func.argsize to mark all functions
46// whose argument size is unknown (C vararg functions, and
47// assembly code without an explicit specification).
48// This value is generated by the compiler, assembler, or linker.
49#define ArgsSizeUnknown 0x80000000