Skip to content

Commit a862692

Browse files
committed
* gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used
`sizeof(struct heaps_slot)` while heap is currently allocated with `struct heaps_header`. HEAP_BITMAP_LIMIT were calculated from `HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object, not one Bit. [Bug ruby#6006] patched by Sokolov Yura. ruby#92 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 286aed6 commit a862692

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Mon Feb 13 21:52:06 2012 Narihiro Nakamura <authornari@gmail.com>
2+
3+
* gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used
4+
`sizeof(struct heaps_slot)` while heap is currently allocated
5+
with `struct heaps_header`.
6+
HEAP_BITMAP_LIMIT were calculated from
7+
`HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object,
8+
not one Bit. [Bug #6006]
9+
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
10+
111
Mon Feb 13 18:30:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
212

313
* io.c (io_setstrbuf): defer resizing buffer string until data is

gc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,10 @@ rb_objspace_free(rb_objspace_t *objspace)
544544
#define HEAP_ALIGN_MASK (~(~0UL << HEAP_ALIGN_LOG))
545545
#define REQUIRED_SIZE_BY_MALLOC (sizeof(size_t) * 5)
546546
#define HEAP_SIZE (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC)
547+
#define CEILMOD(i, mod) (((i) + (mod) - 1)/(mod))
547548

548-
#define HEAP_OBJ_LIMIT (unsigned int)(HEAP_SIZE/sizeof(struct RVALUE) - (sizeof(struct heaps_slot)/sizeof(struct RVALUE)+1))
549-
#define HEAP_BITMAP_LIMIT (HEAP_OBJ_LIMIT/sizeof(uintptr_t)+1)
549+
#define HEAP_OBJ_LIMIT (unsigned int)((HEAP_SIZE - sizeof(struct heaps_header))/sizeof(struct RVALUE))
550+
#define HEAP_BITMAP_LIMIT CEILMOD(HEAP_OBJ_LIMIT, sizeof(uintptr_t)*8)
550551

551552
#define GET_HEAP_HEADER(x) (HEAP_HEADER(((uintptr_t)x) & ~(HEAP_ALIGN_MASK)))
552553
#define GET_HEAP_SLOT(x) (GET_HEAP_HEADER(x)->base)

0 commit comments

Comments
 (0)