Commit 0f5e36a
committed
Add
The existing `VALUE rb_gc_location(VALUE obj)` API isn't ideal in my opinion,
because the idomatic way to use it is:
```c
struct->field = rb_gc_location(struct->field);
```
Which means that when running `GC.compact`, any reference that is
movable is rewritten, even if the referenced object didn't move.
I suspect this is a lot of unnecessary writes that are trashing
shared pages.
Inside the GC itself, there's the much more convenient `UPDATE_IF_MOVED`
macro, that only update the reference if it's actually needed.void rb_gc_update_reference(VALUE *ptr) API1 parent 547f111 commit 0f5e36a
3 files changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2878 | 2878 | | |
2879 | 2879 | | |
2880 | 2880 | | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
2881 | 2890 | | |
2882 | 2891 | | |
2883 | 2892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
0 commit comments