Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
Data Structures | Macros | Enumerations | Functions
transient_heap.c File Reference
#include "ruby/ruby.h"
#include "ruby/debug.h"
#include "vm_debug.h"
#include "gc.h"
#include "internal.h"
#include "ruby_assert.h"
#include "transient_heap.h"
#include "debug_counter.h"

Go to the source code of this file.

Data Structures

struct  transient_heap_block
 
struct  transient_heap_block::transient_heap_block_header
 
struct  transient_heap
 
struct  transient_alloc_header
 

Macros

#define TRANSIENT_HEAP_CHECK_MODE   0
 
#define TH_ASSERT(expr)   RUBY_ASSERT_MESG_WHEN(TRANSIENT_HEAP_CHECK_MODE > 0, expr, #expr)
 
#define TRANSIENT_HEAP_DEBUG   0
 
#define TRANSIENT_HEAP_DEBUG_INFINITE_BLOCK   0
 
#define TRANSIENT_HEAP_DEBUG_DONT_PROMOTE   0
 
#define TRANSIENT_HEAP_PROMOTED_DEFAULT_SIZE   1024
 
#define TRANSIENT_HEAP_BLOCK_SIZE   (1024 * 32 ) /* 32KB int16_t */
 
#define TRANSIENT_HEAP_TOTAL_SIZE   (1024 * 1024 * 32) /* 32 MB */
 
#define TRANSIENT_HEAP_ALLOC_MAX   (1024 * 2 ) /* 2 KB */
 
#define TRANSIENT_HEAP_BLOCK_NUM   (TRANSIENT_HEAP_TOTAL_SIZE / TRANSIENT_HEAP_BLOCK_SIZE)
 
#define TRANSIENT_HEAP_ALLOC_MAGIC   0xfeab
 
#define TRANSIENT_HEAP_ALLOC_ALIGN   RUBY_ALIGNOF(void *)
 
#define TRANSIENT_HEAP_ALLOC_MARKING_LAST   -1
 
#define TRANSIENT_HEAP_ALLOC_MARKING_FREE   -2
 
#define ROUND_UP(v, a)   (((size_t)(v) + (a) - 1) & ~((a) - 1))
 

Enumerations

enum  transient_heap_status { transient_heap_none , transient_heap_marking , transient_heap_escaping }
 

Functions

void rb_transient_heap_dump (void)
 
void rb_transient_heap_verify (void)
 
voidrb_transient_heap_alloc (VALUE obj, size_t req_size)
 
void Init_TransientHeap (void)
 
int rb_transient_heap_managed_ptr_p (const void *ptr)
 
void rb_transient_heap_mark (VALUE obj, const void *ptr)
 
 ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS (static const void *transient_heap_ptr(VALUE obj, int error))
 
void rb_transient_heap_promote (VALUE obj)
 
void rb_transient_heap_update_references (void)
 
void rb_transient_heap_start_marking (int full_marking)
 
void rb_transient_heap_finish_marking (void)
 

Macro Definition Documentation

◆ ROUND_UP

#define ROUND_UP (   v,
 
)    (((size_t)(v) + (a) - 1) & ~((a) - 1))

Definition at line 113 of file transient_heap.c.

◆ TH_ASSERT

#define TH_ASSERT (   expr)    RUBY_ASSERT_MESG_WHEN(TRANSIENT_HEAP_CHECK_MODE > 0, expr, #expr)

Definition at line 26 of file transient_heap.c.

◆ TRANSIENT_HEAP_ALLOC_ALIGN

#define TRANSIENT_HEAP_ALLOC_ALIGN   RUBY_ALIGNOF(void *)

Definition at line 60 of file transient_heap.c.

◆ TRANSIENT_HEAP_ALLOC_MAGIC

#define TRANSIENT_HEAP_ALLOC_MAGIC   0xfeab

Definition at line 59 of file transient_heap.c.

◆ TRANSIENT_HEAP_ALLOC_MARKING_FREE

#define TRANSIENT_HEAP_ALLOC_MARKING_FREE   -2

Definition at line 63 of file transient_heap.c.

◆ TRANSIENT_HEAP_ALLOC_MARKING_LAST

#define TRANSIENT_HEAP_ALLOC_MARKING_LAST   -1

Definition at line 62 of file transient_heap.c.

◆ TRANSIENT_HEAP_ALLOC_MAX

#define TRANSIENT_HEAP_ALLOC_MAX   (1024 * 2 ) /* 2 KB */

Definition at line 56 of file transient_heap.c.

◆ TRANSIENT_HEAP_BLOCK_NUM

#define TRANSIENT_HEAP_BLOCK_NUM   (TRANSIENT_HEAP_TOTAL_SIZE / TRANSIENT_HEAP_BLOCK_SIZE)

Definition at line 57 of file transient_heap.c.

◆ TRANSIENT_HEAP_BLOCK_SIZE

#define TRANSIENT_HEAP_BLOCK_SIZE   (1024 * 32 ) /* 32KB int16_t */

Definition at line 54 of file transient_heap.c.

◆ TRANSIENT_HEAP_CHECK_MODE

#define TRANSIENT_HEAP_CHECK_MODE   0

Definition at line 24 of file transient_heap.c.

◆ TRANSIENT_HEAP_DEBUG

#define TRANSIENT_HEAP_DEBUG   0

Definition at line 33 of file transient_heap.c.

◆ TRANSIENT_HEAP_DEBUG_DONT_PROMOTE

#define TRANSIENT_HEAP_DEBUG_DONT_PROMOTE   0

Definition at line 48 of file transient_heap.c.

◆ TRANSIENT_HEAP_DEBUG_INFINITE_BLOCK

#define TRANSIENT_HEAP_DEBUG_INFINITE_BLOCK   0

Definition at line 39 of file transient_heap.c.

◆ TRANSIENT_HEAP_PROMOTED_DEFAULT_SIZE

#define TRANSIENT_HEAP_PROMOTED_DEFAULT_SIZE   1024

Definition at line 51 of file transient_heap.c.

◆ TRANSIENT_HEAP_TOTAL_SIZE

#define TRANSIENT_HEAP_TOTAL_SIZE   (1024 * 1024 * 32) /* 32 MB */

Definition at line 55 of file transient_heap.c.

Enumeration Type Documentation

◆ transient_heap_status

Enumerator
transient_heap_none 
transient_heap_marking 
transient_heap_escaping 

Definition at line 65 of file transient_heap.c.

Function Documentation

◆ ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS()

ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS ( static const void transient_heap_ptrVALUE obj, int error)

◆ Init_TransientHeap()

void Init_TransientHeap ( void  )

Definition at line 426 of file transient_heap.c.

References i.

◆ rb_transient_heap_alloc()

void * rb_transient_heap_alloc ( VALUE  obj,
size_t  req_size 
)

Definition at line 359 of file transient_heap.c.

◆ rb_transient_heap_dump()

void rb_transient_heap_dump ( void  )

Definition at line 152 of file transient_heap.c.

◆ rb_transient_heap_finish_marking()

void rb_transient_heap_finish_marking ( void  )

Definition at line 916 of file transient_heap.c.

◆ rb_transient_heap_managed_ptr_p()

int rb_transient_heap_managed_ptr_p ( const void ptr)

Definition at line 506 of file transient_heap.c.

◆ rb_transient_heap_mark()

void rb_transient_heap_mark ( VALUE  obj,
const void ptr 
)

Definition at line 529 of file transient_heap.c.

◆ rb_transient_heap_promote()

void rb_transient_heap_promote ( VALUE  obj)

Definition at line 640 of file transient_heap.c.

◆ rb_transient_heap_start_marking()

void rb_transient_heap_start_marking ( int  full_marking)

Definition at line 868 of file transient_heap.c.

◆ rb_transient_heap_update_references()

void rb_transient_heap_update_references ( void  )

Definition at line 853 of file transient_heap.c.

◆ rb_transient_heap_verify()

void rb_transient_heap_verify ( void  )

Definition at line 219 of file transient_heap.c.