github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/abi/stack.go (about)

     1  // Copyright 2023 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 abi
     6  
     7  const (
     8  	// StackNosplitBase is the base maximum number of bytes that a chain of
     9  	// NOSPLIT functions can use.
    10  	//
    11  	// This value must be multiplied by the stack guard multiplier, so do not
    12  	// use it directly. See runtime/stack.go:stackNosplit and
    13  	// cmd/internal/objabi/stack.go:StackNosplit.
    14  	StackNosplitBase = 800
    15  
    16  	// After a stack split check the SP is allowed to be StackSmall bytes below
    17  	// the stack guard.
    18  	//
    19  	// Functions that need frames <= StackSmall can perform the stack check
    20  	// using a single comparison directly between the stack guard and the SP
    21  	// because we ensure that StackSmall bytes of stack space are available
    22  	// beyond the stack guard.
    23  	StackSmall = 128
    24  
    25  	// Functions that need frames <= StackBig can assume that neither
    26  	// SP-framesize nor stackGuard-StackSmall will underflow, and thus use a
    27  	// more efficient check. In order to ensure this, StackBig must be <= the
    28  	// size of the unmapped space at zero.
    29  	StackBig = 4096
    30  )