summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 02:25:19 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 02:25:19 +0000
commit5a06ae3bf9a4c1bc81e4f9f6cd35659334749f50 (patch)
treea4e5a9fdb1dfb8706378de5d41c8dcb79f6ac4f3
parent2af3621ab53b5c55285bcd9a8f503e569bf2cdd8 (diff)
* gc.c (MARKED_IN_BITMAP, MARK_IN_BITMAP, CLEAR_IN_BITMAP): bring
bitmap macros in one place, and introduce BITMAP_BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--gc.c12
2 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index d5f0095e39a..270897fbf54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jun 7 11:20:57 2013 Masaya Tarui <tarui@ruby-lang.org>
+
+ * gc.c (MARKED_IN_BITMAP, MARK_IN_BITMAP, CLEAR_IN_BITMAP): bring
+ bitmap macros in one place, and introduce BITMAP_BIT.
+
Fri Jun 7 11:18:35 2013 Masaya Tarui <tarui@ruby-lang.org>
* array.c (ary_new): change order of allocation in order
diff --git a/gc.c b/gc.c
index 1d50bf89f02..47e56c536e0 100644
--- a/gc.c
+++ b/gc.c
@@ -425,7 +425,12 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#define NUM_IN_SLOT(p) (((uintptr_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE))
#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)))
+#define BITMAP_BIT(p) ((uintptr_t)1 << BITMAP_OFFSET(p))
+/* Marking */
+#define MARKED_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] & BITMAP_BIT(p))
+#define MARK_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] | BITMAP_BIT(p))
+#define CLEAR_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))
+
#ifndef HEAP_ALIGN_LOG
/* default tiny heap size: 16KB */
@@ -2561,11 +2566,6 @@ init_mark_stack(mark_stack_t *stack)
}
-/* Marking */
-
-#define MARK_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] | ((uintptr_t)1 << BITMAP_OFFSET(p)))
-#define CLEAR_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] & ~((uintptr_t)1 << BITMAP_OFFSET(p)))
-
#ifdef __ia64
#define SET_STACK_END (SET_MACHINE_STACK_END(&th->machine_stack_end), th->machine_register_stack_end = rb_ia64_bsp())