From 00521434a4a727e5a312ac9a42d48572ffa6388a Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sun, 16 Nov 2025 20:51:27 +0000 Subject: [PATCH 1/6] [DOC] Tweaks for String#unpack1 --- pack.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pack.rb b/pack.rb index e70c6c7dc8b77d..5cadc0cc8b1c3d 100644 --- a/pack.rb +++ b/pack.rb @@ -28,8 +28,10 @@ def unpack(fmt, offset: 0) # call-seq: # unpack1(template, offset: 0) -> object # - # Like String#unpack, but unpacks and returns only the first extracted object. + # Like String#unpack with no block, but unpacks and returns only the first extracted object. # See {Packed Data}[rdoc-ref:packed_data.rdoc]. + # + # Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString]. def unpack1(fmt, offset: 0) Primitive.pack_unpack1(fmt, offset) end From 43e26d02df845e9fc0ee597cbfa4425537e76020 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sun, 16 Nov 2025 20:40:43 +0000 Subject: [PATCH 2/6] [DOC] Tweaks for String#unpack --- pack.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pack.rb b/pack.rb index 5cadc0cc8b1c3d..d57788b222a126 100644 --- a/pack.rb +++ b/pack.rb @@ -10,16 +10,18 @@ def pack(fmt, buffer: nil) end class String - # call-seq: - # unpack(template, offset: 0, &block) -> array + # call-seq: + # unpack(template, offset: 0) {|o| .... } -> object + # unpack(template, offset: 0) -> array # - # Extracts data from +self+. + # Extracts data from +self+ to form new objects; + # see {Packed Data}[rdoc-ref:packed_data.rdoc]. # - # If +block+ is not given, forming objects that become the elements - # of a new array, and returns that array. Otherwise, yields each - # object. + # With a block given, calls the block with each unpacked object. # - # See {Packed Data}[rdoc-ref:packed_data.rdoc]. + # With no block given, returns an array containing the unpacked objects. + # + # Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString]. def unpack(fmt, offset: 0) Primitive.attr! :use_block Primitive.pack_unpack(fmt, offset) From 17f3588a43ba2311f1ba7843a0293072861db760 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sun, 16 Nov 2025 20:17:22 +0000 Subject: [PATCH 3/6] [DOC] Tweaks for String#unicode_normalized? --- string.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/string.c b/string.c index d5d50be51325b5..b42f04a70f0e94 100644 --- a/string.c +++ b/string.c @@ -11986,8 +11986,9 @@ rb_str_unicode_normalize_bang(int argc, VALUE *argv, VALUE str) /* call-seq: * unicode_normalized?(form = :nfc) -> true or false * - * Returns +true+ if +self+ is in the given +form+ of Unicode normalization, - * +false+ otherwise. + * Returns whether +self+ is in the given +form+ of Unicode normalization; + * see String#unicode_normalize. + * * The +form+ must be one of +:nfc+, +:nfd+, +:nfkc+, or +:nfkd+. * * Examples: @@ -12001,10 +12002,9 @@ rb_str_unicode_normalize_bang(int argc, VALUE *argv, VALUE str) * Raises an exception if +self+ is not in a Unicode encoding: * * s = "\xE0".force_encoding(Encoding::ISO_8859_1) - * s.unicode_normalized? # Raises Encoding::CompatibilityError. - * - * Related: String#unicode_normalize, String#unicode_normalize!. + * s.unicode_normalized? # Raises Encoding::CompatibilityError * + * Related: see {Querying}[rdoc-ref:String@Querying]. */ static VALUE rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str) From 3cd30814d415bba94adb26bdc04aeed7ff240d92 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sun, 16 Nov 2025 19:53:53 +0000 Subject: [PATCH 4/6] [DOC] Tweaks for String#unicode_normalize! --- string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/string.c b/string.c index b42f04a70f0e94..5c4e15c4a10384 100644 --- a/string.c +++ b/string.c @@ -11972,9 +11972,9 @@ rb_str_unicode_normalize(int argc, VALUE *argv, VALUE str) * unicode_normalize!(form = :nfc) -> self * * Like String#unicode_normalize, except that the normalization - * is performed on +self+. + * is performed on +self+ (not on a copy of +self+). * - * Related String#unicode_normalized?. + * Related: see {Modifying}[rdoc-ref:String@Modifying]. * */ static VALUE From bdeee7012c37834a17712c7aaa8c602ae1208a8e Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Fri, 14 Nov 2025 12:53:42 -0800 Subject: [PATCH 5/6] Avoid allocating intermediate string in zone_str --- benchmark/time_now.yml | 1 + time.c | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/benchmark/time_now.yml b/benchmark/time_now.yml index f6d6a314893d30..9336877cd4f4dc 100644 --- a/benchmark/time_now.yml +++ b/benchmark/time_now.yml @@ -1,3 +1,4 @@ benchmark: - 'Time.now' - 'Time.now(in: "+09:00")' + - 'Time.now.year' diff --git a/time.c b/time.c index 95df85db9359a4..2a121d5fcc8f74 100644 --- a/time.c +++ b/time.c @@ -981,7 +981,6 @@ zone_str(const char *zone) { const char *p; int ascii_only = 1; - VALUE str; size_t len; if (zone == NULL) { @@ -997,18 +996,18 @@ zone_str(const char *zone) } len = p - zone; if (ascii_only) { - str = rb_usascii_str_new(zone, len); + return rb_enc_interned_str(zone, len, rb_usascii_encoding()); } else { #ifdef _WIN32 - str = rb_utf8_str_new(zone, len); + VALUE str = rb_utf8_str_new(zone, len); /* until we move to UTF-8 on Windows completely */ str = rb_str_export_locale(str); + return rb_fstring(str); #else - str = rb_enc_str_new(zone, len, rb_locale_encoding()); + return rb_enc_interned_str(zone, len, rb_locale_encoding()); #endif } - return rb_fstring(str); } static void From 4870fbd04a015717800a8b5ab87da03e4d93e894 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 17 Nov 2025 07:49:56 +0800 Subject: [PATCH 6/6] vm_dump.c: unbreak unwind on powerpc (#14650) --- vm_dump.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vm_dump.c b/vm_dump.c index 1b0d69b30e9b5a..c1a8d707359aa0 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -770,7 +770,7 @@ rb_vmdebug_thread_dump_state(FILE *errout, VALUE self) # include # undef backtrace -# if defined(__arm64__) +# if defined(__arm64__) || defined(__POWERPC__) static bool is_coroutine_start(unw_word_t ip) { @@ -879,19 +879,22 @@ backtrace(void **trace, int size) } return n; -# elif defined(__arm64__) +# elif defined(__arm64__) || defined(__POWERPC__) /* Since Darwin arm64's _sigtramp is implemented as normal function, * unwind can unwind frames without special code. * https://github.com/apple/darwin-libplatform/blob/215b09856ab5765b7462a91be7076183076600df/src/setjmp/generic/sigtramp.c */ while (unw_step(&cursor) > 0) { unw_get_reg(&cursor, UNW_REG_IP, &ip); +# if defined(__arm64__) // Strip Arm64's pointer authentication. // https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication // I wish I could use "ptrauth_strip()" but I get an error: // "this target does not support pointer authentication" trace[n++] = (void *)(ip & 0x7fffffffffffull); - +# else + trace[n++] = (void *)ip; +# endif // Apple's libunwind can't handle our coroutine switching code if (is_coroutine_start(ip)) break; }