Ruby 4.1.0dev (2026-11-04 revision 9bfa7c99a6b4b115318e63d92438f1a92cfbb9ed)
Macros | Functions
stack.h File Reference

(9bfa7c99a6b4b115318e63d92438f1a92cfbb9ed)

#include "prism/compiler/inline.h"
#include <stdint.h>
#include <intrin.h>
Include dependency graph for stack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static PRISM_INLINE uintptr_t pm_stack_address (void)
 Returns the current position of the C stack, for measuring how much of it has been consumed since an earlier call.
 

Macro Definition Documentation

◆ PRISM_HAS_BUILTIN_STACK_ADDRESS

#define PRISM_HAS_BUILTIN_STACK_ADDRESS

Definition at line 13 of file stack.h.

Function Documentation

◆ pm_stack_address()

static PRISM_INLINE uintptr_t pm_stack_address ( void  )
static

Returns the current position of the C stack, for measuring how much of it has been consumed since an earlier call.

The stack pointer is read directly where the compiler or architecture allows it. Unlike __builtin_frame_address, that does not force the calling function to set up a frame pointer, which costs a register on targets that omit frame pointers by default (x86-64 at -O2), and unlike the address of a local it does not add a slot to the frame.

Definition at line 30 of file stack.h.

Referenced by pm_parse().