summaryrefslogtreecommitdiff
path: root/version.h
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-02-03 16:17:28 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2021-02-04 09:49:00 -0800
commit75b96c3a056d9e50bdabd87fa4676e6aaffbcff0 (patch)
tree1f26dd9f8ccdb4899e116e89a6d62b408bb0480d /version.h
parentb79d44348216e293f35801984f109ec9b02dcf83 (diff)
Don't register non-heap allocated objects
`rb_define_const` can add objects as "mark objects". This is to make code like this work: https://github.com/ruby/ruby/blob/33d6e92e0c6eaf1308ce7108e653c53bb5fb106c/ext/etc/etc.c#L1201 ``` rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */ ``` sPasswd is a heap allocated object that is also a C global, so we can't move it (it needs to be pinned). However, we have many calls to `rb_define_const` that just pass in an integer like this: ``` rb_define_const(rb_cDBM, "WRITER", INT2FIX(O_RDWR|RUBY_DBM_RW_BIT)); ``` Non heap allocated objects like integers will never move, so there is no reason to waste time in the GC marking / pinning them.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4152
Diffstat (limited to 'version.h')
0 files changed, 0 insertions, 0 deletions