diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-09-28 22:07:50 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-09-28 23:51:38 +0900 |
commit | a05b2614645594df896aaf44a2e5701ee7fb5fec () | |
tree | 610f1d3e79baed4ea8ee7bb32b1fdd97cc851340 | |
parent | 09bce061afa3f5710e8d6aafebf865096f11b957 (diff) |
Always use the longer version of `TRY_WITH_GC`
Notes: Merged: https://.com/ruby/ruby/pull/6464
-rw-r--r-- | gc.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -12121,10 +12121,16 @@ objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size) } #if defined(__GNUC__) && RUBY_DEBUG -#define RB_BUG_INSTEAD_OF_RB_MEMERROR #endif -#ifdef RB_BUG_INSTEAD_OF_RB_MEMERROR #define TRY_WITH_GC(siz, expr) do { \ const gc_profile_record_flag gpr = \ GPR_FLAG_FULL_MARK | \ @@ -12138,29 +12144,17 @@ objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size) } \ else if (!garbage_collect_with_gvl(objspace, gpr)) { \ /* @shyouhei thinks this doesn't happen */ \ - rb_bug("TRY_WITH_GC: could not GC"); \ } \ else if ((expr)) { \ /* Success on 2nd try */ \ } \ else { \ - rb_bug("TRY_WITH_GC: could not allocate:" \ - "%"PRIdSIZE" bytes for %s", \ - siz, # expr); \ } \ } while (0) -#else -#define TRY_WITH_GC(siz, alloc) do { \ - objspace_malloc_gc_stress(objspace); \ - if (!(alloc) && \ - (!garbage_collect_with_gvl(objspace, GPR_FLAG_FULL_MARK | \ - GPR_FLAG_IMMEDIATE_MARK | GPR_FLAG_IMMEDIATE_SWEEP | \ - GPR_FLAG_MALLOC) || \ - !(alloc))) { \ - ruby_memerror(); \ - } \ - } while (0) -#endif /* these shouldn't be called directly. * objspace_* functions do not check allocation size. |