diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-12-14 09:50:21 +0100 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2025-12-16 21:00:27 +0100 |
| commit | 094418a6de89a37fc51a17077a5565f125b97f2e (patch) | |
| tree | 77d163418b5bd5570a6aa95e0dd3778e942a78e3 /include | |
| parent | eaa952b536c48658a5a2e3f128e3afdef03a01b6 (diff) | |
gc.h: Reintroduce immediate guard in `rb_obj_written`
This guard was removed in https://github.com/ruby/ruby/pull/13497
on the justification that some GC may need to be notified even for
immediate.
But the two currently available GCs don't, and there are plenty
of assumtions GCs don't everywhere, notably in YJIT and ZJIT.
This optimization is also not so micro (but not huge either).
I routinely see 1-2% wasted there on micro-benchmarks.
So perhaps if in the future we actually need this, it might make
sense to introduce a way for GCs to declare that as an option,
but in the meantime it's extra overhead with little gain.
Diffstat (limited to 'include')
| -rw-r--r-- | include/ruby/internal/abi.h | 2 | ||||
| -rw-r--r-- | include/ruby/internal/gc.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/ruby/internal/abi.h b/include/ruby/internal/abi.h index e735a67564..e6d1fa7e8f 100644 --- a/include/ruby/internal/abi.h +++ b/include/ruby/internal/abi.h @@ -24,7 +24,7 @@ * In released versions of Ruby, this number is not defined since teeny * versions of Ruby should guarantee ABI compatibility. */ -#define RUBY_ABI_VERSION 0 +#define RUBY_ABI_VERSION 1 /* Windows does not support weak symbols so ruby_abi_version will not exist * in the shared library. */ diff --git a/include/ruby/internal/gc.h b/include/ruby/internal/gc.h index 19783f3023..5ab3bb266e 100644 --- a/include/ruby/internal/gc.h +++ b/include/ruby/internal/gc.h @@ -785,7 +785,9 @@ rb_obj_written( RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line); #endif - rb_gc_writebarrier(a, b); + if (!RB_SPECIAL_CONST_P(b)) { + rb_gc_writebarrier(a, b); + } return a; } |
