Alias init functions
The extension library has each initialization function named "Init_" +
basename. If multiple extensions have the same base name (such as
cgi/escape and erb/escape), the same function will be registered for
both names.
To fix this conflict, rename the initialization functions under sub
directories using using parent names, when statically linking.
---
ext/extmk.rb | 16 +++++++++++++++-
template/extinit.c.tmpl | 2 +-
2 files changed, 16 insertions(+), 2 deletions(-)
Check if macros are defined before using
Assume macros with the same prefix would be defined together.
---
include/ruby/io/buffer.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
tool/runruby.rb: remove LD_PRELOAD-like env-var options from
runruby.rb
LD_PRELOAD sometimes forces loading libraries into unrelated
executables. For example, macOS on recent Apple Silicon can execute
arm64 and arm64e binaries by default, and /usr/bin/clang is built as
arm64e. If Ruby is built as arm64, and mkmf launched through runruby.rb
spawns /usr/bin/clang, dynamic loader tries to load libruby (arm64e)
into clang (arm64). This force-load causes library load failure.
In theory, we don't need both LD_PRELOAD and LD_LIBRARY_PATH at the same
time, because executables requiring libruby already have libruby
dependency, so LD_LIBRARY_PATH is enough for this case.
---
tool/runruby.rb | 9 ---------
1 file changed, 9 deletions(-)
Include headers for `ruby_qsort` only if needed
If GNU `qsort_r` is available, we use the function and these headers
are not used.
---
util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Bug #18997] Don't define ruby_qsort when POSIX qsort_r is available
The current code would define ruby_qsort as a wrapper of qsort_s
when it is available. When both qsort_s and POSIX (GNU) qsort_r
are available, we should call qsort_r directly instead, and
the qsort_s wrapper is redundant.
---
util.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[Bug #19985] Raise LoadError with the converted feature name
`Kernel#require` converts feature name objects that have the `to_path`
method such as `Pathname`, but had used the original object on error
and had resulted in an unexpected `TypeError`.
---
load.c | 14 +++++++++++---
test/ruby/test_require.rb | 26 +++++++++++++++++++++-----
2 files changed, 32 insertions(+), 8 deletions(-)
Fix false LocalJumpError when branch coverage is enabled
`throw TAG_BREAK` instruction makes a jump only if the continuation of
catch of TAG_BREAK exactly matches the instruction immediately following
the "send" instruction that is currently being executed. Otherwise, it
seems to determine break from proc-closure.
Branch coverage may insert some recording instructions after "send"
instruction, which broke the conditions for TAG_BREAK to work properly.
This change forces to set the continuation of catch of TAG_BREAK
immediately after "send" (or "invokesuper") instruction.
[Bug #18991]
---
compile.c | 25 ++++++++++++++++++++++++-
test/coverage/test_coverage.rb | 14 ++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
Fix memory leak in complemented method entries
[Bug #19894]
When a copy of a complemented method entry is created, there are two
issues:
1. IMEMO_FL_USER3 is not copied, so the complemented status is not
copied over.
2. In rb_method_entry_clone we increment both alias_count and
complemented_count. However, when we free the method entry in
rb_method_definition_release, we only decrement one of the two
counters, resulting in the rb_method_definition_t being leaked.
Co-authored-by: Adam Hess <adamhess1991@gmail.com>
---
method.h | 5 +++--
test/ruby/test_module.rb | 29 +++++++++++++++++++++++++++++
vm_method.c | 8 +++++---
3 files changed, 37 insertions(+), 5 deletions(-)