github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/ir/cfg.go (about)

     1  // Copyright 2009 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  package ir
     6  
     7  var (
     8  	// MaxStackVarSize is the maximum size variable which we will allocate on the stack.
     9  	// This limit is for explicit variable declarations like "var x T" or "x := ...".
    10  	// Note: the flag smallframes can update this value.
    11  	MaxStackVarSize = int64(10 * 1024 * 1024)
    12  
    13  	// MaxImplicitStackVarSize is the maximum size of implicit variables that we will allocate on the stack.
    14  	//   p := new(T)          allocating T on the stack
    15  	//   p := &T{}            allocating T on the stack
    16  	//   s := make([]T, n)    allocating [n]T on the stack
    17  	//   s := []byte("...")   allocating [n]byte on the stack
    18  	// Note: the flag smallframes can update this value.
    19  	MaxImplicitStackVarSize = int64(64 * 1024)
    20  
    21  	// MaxSmallArraySize is the maximum size of an array which is considered small.
    22  	// Small arrays will be initialized directly with a sequence of constant stores.
    23  	// Large arrays will be initialized by copying from a static temp.
    24  	// 256 bytes was chosen to minimize generated code + statictmp size.
    25  	MaxSmallArraySize = int64(256)
    26  )