From 37067ed905954940bafb3b2cc4e1d67c374d31f9 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 2 Apr 2014 11:59:50 +0000 Subject: [PATCH] * gc.c, gc.h (rb_objspace_each_objects_without_setup): Add a new (hidden) C-API to iterate objspace snapshot. This API is not safe to call any C-APIs in a given callback function. Be careful to use this C-API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ gc.c | 10 ++++++++++ gc.h | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 344ad21acb..c59d0b6963 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Apr 2 20:57:15 2014 Koichi Sasada + + * gc.c, gc.h (rb_objspace_each_objects_without_setup): + Add a new (hidden) C-API to iterate objspace snapshot. + + This API is not safe to call any C-APIs in a given callback + function. Be careful to use this C-API. + Wed Apr 2 17:43:17 2014 Nobuyoshi Nakada * configure.in (ac_cv_func___builtin_setjmp): gcc 4.9 disallows a diff --git a/gc.c b/gc.c index fb7008bacd..2e7f0b1e58 100644 --- a/gc.c +++ b/gc.c @@ -1788,6 +1788,16 @@ rb_objspace_each_objects(each_obj_callback *callback, void *data) } } +void +rb_objspace_each_objects_without_setup(each_obj_callback *callback, void *data) +{ + struct each_obj_args args; + args.callback = callback; + args.data = data; + + objspace_each_objects((VALUE)&args); +} + struct os_each_struct { size_t num; VALUE of; diff --git a/gc.h b/gc.h index ae62b091af..d3bf71026c 100644 --- a/gc.h +++ b/gc.h @@ -97,6 +97,10 @@ void rb_objspace_each_objects( int (*callback)(void *start, void *end, size_t stride, void *data), void *data); +void rb_objspace_each_objects_without_setup( + int (*callback)(void *, void *, size_t, void *), + void *data); + RUBY_SYMBOL_EXPORT_END #endif /* RUBY_GC_H */