aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-24 09:42:43 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-24 09:42:43 +0000
commit33ebcb053809f36a5a244cd587349389958c4d33 (patch)
tree3c0b778a7ad281bd5654f19c9177d4a7d2c19caf /array.c
parent1758ff03819ce2c699345a4299f6fecdd25f8c0b (diff)
downloadruby-33ebcb053809f36a5a244cd587349389958c4d33.tar.gz
* array.c, gc.c: move ary_unprotect_logging() into
rb_gc_unprotect_logging() which is general version * include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT to enable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/array.c b/array.c
index 8022ab2cc6..9457851c10 100644
--- a/array.c
+++ b/array.c
@@ -11,12 +11,6 @@
**********************************************************************/
-#define RGENGC_UNPROTECT_LOGGING 0
-#if RGENGC_UNPROTECT_LOGGING
-static void ary_unprotect_logging(void *x, const char *filename, int line);
-#define RGENGC_LOGGING_WB_UNPROTECT(x, f, l) ary_unprotect_logging((void *)x, f, l)
-#endif
-
#include "ruby/ruby.h"
#include "ruby/util.h"
#include "ruby/st.h"
@@ -37,46 +31,6 @@ static ID id_cmp, id_div, id_power;
#define ARY_DEFAULT_SIZE 16
#define ARY_MAX_SIZE (LONG_MAX / (int)sizeof(VALUE))
-#if RGENGC_UNPROTECT_LOGGING
-static st_table *ary_unprotect_logging_table;
-
-static void
-ary_unprotect_logging(void *objptr, const char *filename, int line)
-{
- VALUE obj = (VALUE)objptr;
-
- if (OBJ_WB_PROTECTED(obj)) {
- char buff[0x100];
- st_data_t cnt = 1;
- char *ptr = buff;
-
- snprintf(ptr, 0x100 - 1, "%s:%d", filename, line);
-
- if (st_lookup(ary_unprotect_logging_table, (st_data_t)ptr, &cnt)) {
- cnt++;
- }
- else {
- ptr = (char *)malloc(strlen(buff) + 1);
- strcpy(ptr, buff);
- }
- st_insert(ary_unprotect_logging_table, (st_data_t)ptr, cnt);
- }
-}
-
-static int
-ary_unprotect_logging_exit_func_i(st_data_t key, st_data_t val)
-{
- fprintf(stderr, "%s\t%d\n", (char *)key, (int)val);
- return ST_CONTINUE;
-}
-
-static void
-ary_unprotect_logging_exit_func(void)
-{
- st_foreach(ary_unprotect_logging_table, ary_unprotect_logging_exit_func_i, 0);
-}
-#endif
-
void
rb_mem_clear(register VALUE *mem, register long size)
{
@@ -5559,11 +5513,6 @@ Init_Array(void)
rb_cArray = rb_define_class("Array", rb_cObject);
rb_include_module(rb_cArray, rb_mEnumerable);
-#if RGENGC_UNPROTECT_LOGGING
- ary_unprotect_logging_table = st_init_strtable();
- atexit(ary_unprotect_logging_exit_func);
-#endif
-
rb_define_alloc_func(rb_cArray, empty_ary_alloc);
rb_define_singleton_method(rb_cArray, "[]", rb_ary_s_create, -1);
rb_define_singleton_method(rb_cArray, "try_convert", rb_ary_s_try_convert, 1);