mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c: use enum for debugging.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fab7e66131
commit
6fa2980e53
1 changed files with 55 additions and 53 deletions
18
gc.c
18
gc.c
|
@ -315,8 +315,8 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
|
|||
#define GET_HEAP_SLOT(x) (GET_HEAP_HEADER(x)->base)
|
||||
#define GET_HEAP_BITMAP(x) (GET_HEAP_HEADER(x)->bits)
|
||||
#define NUM_IN_SLOT(p) (((uintptr_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE))
|
||||
#define BITMAP_INDEX(p) (NUM_IN_SLOT(p) / (sizeof(uintptr_t) * 8))
|
||||
#define BITMAP_OFFSET(p) (NUM_IN_SLOT(p) & ((sizeof(uintptr_t) * 8)-1))
|
||||
#define BITMAP_INDEX(p) (NUM_IN_SLOT(p) / (sizeof(uintptr_t) * CHAR_BIT))
|
||||
#define BITMAP_OFFSET(p) (NUM_IN_SLOT(p) & ((sizeof(uintptr_t) * CHAR_BIT)-1))
|
||||
#define MARKED_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] & ((uintptr_t)1 << BITMAP_OFFSET(p)))
|
||||
|
||||
#ifndef HEAP_ALIGN_LOG
|
||||
|
@ -324,14 +324,16 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
|
|||
#define HEAP_ALIGN_LOG 14
|
||||
#endif
|
||||
|
||||
#define HEAP_ALIGN (1UL << HEAP_ALIGN_LOG)
|
||||
#define HEAP_ALIGN_MASK (~(~0UL << HEAP_ALIGN_LOG))
|
||||
#define REQUIRED_SIZE_BY_MALLOC (sizeof(size_t) * 5)
|
||||
#define HEAP_SIZE (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC)
|
||||
#define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
|
||||
|
||||
#define HEAP_OBJ_LIMIT (unsigned int)((HEAP_SIZE - sizeof(struct heaps_header))/sizeof(struct RVALUE))
|
||||
#define HEAP_BITMAP_LIMIT CEILDIV(CEILDIV(HEAP_SIZE, sizeof(struct RVALUE)), sizeof(uintptr_t)*8)
|
||||
enum {
|
||||
HEAP_ALIGN = (1UL << HEAP_ALIGN_LOG),
|
||||
HEAP_ALIGN_MASK = (~(~0UL << HEAP_ALIGN_LOG)),
|
||||
REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5),
|
||||
HEAP_SIZE = (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC),
|
||||
HEAP_OBJ_LIMIT = (unsigned int)((HEAP_SIZE - sizeof(struct heaps_header))/sizeof(struct RVALUE)),
|
||||
HEAP_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_SIZE, sizeof(struct RVALUE)), sizeof(uintptr_t) * CHAR_BIT)
|
||||
};
|
||||
|
||||
int ruby_gc_debug_indent = 0;
|
||||
VALUE rb_mGC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue