Text file src/runtime/stackswitch_wasm.s

     1  // Copyright 2026 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  //go:build wasm.stackswitch
     6  
     7  #include "go_asm.h"
     8  #include "textflag.h"
     9  
    10  // Accessors for the continuation table (see stackswitch_wasm.go). An I32Load
    11  // with an FP operand pushes SP itself, but an I32Store does not: each result
    12  // store takes its address from an explicit Get SP pushed beforehand.
    13  
    14  // func wasmContTableSize() int32
    15  TEXT ·wasmContTableSize(SB), NOSPLIT, $0-4
    16  	Get SP
    17  	TableSize $const_wasmContTable
    18  	I32Store ret+0(FP)
    19  	RET
    20  
    21  // func wasmContTableGrow(delta int32) int32
    22  TEXT ·wasmContTableGrow(SB), NOSPLIT, $0-12
    23  	// The operand stack is shown after each instruction.
    24  	Get SP				// SP: address of the result
    25  	RefNull				// SP, null: value of the new slots
    26  	I32Load delta+0(FP)		// SP, null, delta
    27  	TableGrow $const_wasmContTable	// SP, previous size or -1
    28  	I32Store ret+8(FP)
    29  	RET
    30  

View as plain text