diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-29 07:26:44 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-29 07:26:44 +0000 |
commit | ffa87b40576976f5ab0bfeb7c7eca81021841500 (patch) | |
tree | d14bb86e2f2d0c7874ec6679cf1d0c6f0846cb9c /internal.h | |
parent | 017ac002c5d1f4b6ced6b5ad7f2add74de0341e3 (diff) |
* gc.c: introduce rb_wb_unprotected_newobj_of() and
rb_wb_protected_newobj_of(), pass the WB_PROTECTED
information explicitly.
* internal.h: use introduced functions by NEWOBJ_OF().
`flag' is immediate value, so that C compilers can
solve them at compile time.
* include/ruby/ruby.h: add a commnent about that.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal.h b/internal.h index a21f1512e0..30d4952734 100644 --- a/internal.h +++ b/internal.h @@ -814,6 +814,18 @@ void ruby_sized_xfree(void *x, size_t size); void rb_gc_resurrect(VALUE ptr); +VALUE rb_wb_protected_newobj_of(VALUE, VALUE); +VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE); + +/* optimized version of NEWOBJ() */ +#undef NEWOBJF_OF +#undef RB_NEWOBJ_OF +#define RB_NEWOBJ_OF(obj,type,klass,flags) \ + type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \ + rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \ + rb_wb_unprotected_newobj_of(klass, flags)) +#define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags) + /* hash.c */ struct st_table *rb_hash_tbl_raw(VALUE hash); VALUE rb_hash_has_key(VALUE hash, VALUE key); |