Home | History | Annotate | Download | only in runtime
      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 // The Go compiler also #includes this file, for now.
     10 //
     11 // symtab.go also contains a copy of these constants.
     12 
     13 #define PCDATA_StackMapIndex 0
     14 
     15 #define FUNCDATA_ArgsPointerMaps 0 /* garbage collector blocks */
     16 #define FUNCDATA_LocalsPointerMaps 1
     17 #define FUNCDATA_DeadValueMaps 2
     18 
     19 // Pseudo-assembly statements.
     20 
     21 // GO_ARGS, GO_RESULTS_INITIALIZED, and NO_LOCAL_POINTERS are macros
     22 // that communicate to the runtime information about the location and liveness
     23 // of pointers in an assembly function's arguments, results, and stack frame.
     24 // This communication is only required in assembly functions that make calls
     25 // to other functions that might be preempted or grow the stack.
     26 // NOSPLIT functions that make no calls do not need to use these macros.
     27 
     28 // GO_ARGS indicates that the Go prototype for this assembly function
     29 // defines the pointer map for the function's arguments.
     30 // GO_ARGS should be the first instruction in a function that uses it.
     31 // It can be omitted if there are no arguments at all.
     32 // GO_ARGS is inserted implicitly by the linker for any function
     33 // that also has a Go prototype and therefore is usually not necessary
     34 // to write explicitly.
     35 #define GO_ARGS	FUNCDATA $FUNCDATA_ArgsPointerMaps, go_args_stackmap(SB)
     36 
     37 // GO_RESULTS_INITIALIZED indicates that the assembly function
     38 // has initialized the stack space for its results and that those results
     39 // should be considered live for the remainder of the function.
     40 #define GO_RESULTS_INITIALIZED	FUNCDATA PCDATA $PCDATA_StackMapIndex, 1
     41 
     42 // NO_LOCAL_POINTERS indicates that the assembly function stores
     43 // no pointers to heap objects in its local stack variables.
     44 #define NO_LOCAL_POINTERS	FUNCDATA $FUNCDATA_LocalsPointerMaps, runtimeno_pointers_stackmap(SB)
     45 
     46 // ArgsSizeUnknown is set in Func.argsize to mark all functions
     47 // whose argument size is unknown (C vararg functions, and
     48 // assembly code without an explicit specification).
     49 // This value is generated by the compiler, assembler, or linker.
     50 #define ArgsSizeUnknown 0x80000000
     51 
     52 /*c2go
     53 enum {
     54 	PCDATA_StackMapIndex = 0,
     55 	FUNCDATA_ArgsPointerMaps = 0,
     56 	FUNCDATA_LocalsPointerMaps = 1,
     57 	FUNCDATA_DeadValueMaps = 2,
     58 	ArgsSizeUnknown = 0x80000000,
     59 };
     60 */
     61