Daily bump.
[gcc.git] / libgo / runtime / mgc0.h
1 // Copyright 2012 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 // Garbage collector (GC)
6
7 // GC instruction opcodes.
8 //
9 // The opcode of an instruction is followed by zero or more
10 // arguments to the instruction.
11 //
12 // Meaning of arguments:
13 // off Offset (in bytes) from the start of the current object
14 // objgc Pointer to GC info of an object
15 // len Length of an array
16 // elemsize Size (in bytes) of an element
17 // size Size (in bytes)
18 enum {
19 GC_END, // End of object, loop or subroutine. Args: none
20 GC_PTR, // A typed pointer. Args: (off, objgc)
21 GC_APTR, // Pointer to an arbitrary object. Args: (off)
22 GC_ARRAY_START, // Start an array with a fixed length. Args: (off, len, elemsize)
23 GC_ARRAY_NEXT, // The next element of an array. Args: none
24 GC_CALL, // Call a subroutine. Args: (off, objgc)
25 GC_MAP_PTR, // Go map. Args: (off, MapType*)
26 GC_STRING, // Go string. Args: (off)
27 GC_EFACE, // interface{}. Args: (off)
28 GC_IFACE, // interface{...}. Args: (off)
29 GC_SLICE, // Go slice. Args: (off, objgc)
30 GC_REGION, // A region/part of the current object. Args: (off, size, objgc)
31
32 GC_NUM_INSTR, // Number of instruction opcodes
33 };
34
35 enum {
36 // Size of GC's fixed stack.
37 //
38 // The current GC implementation permits:
39 // - at most 1 stack allocation because of GC_CALL
40 // - at most GC_STACK_CAPACITY allocations because of GC_ARRAY_START
41 GC_STACK_CAPACITY = 8,
42 };