summaryrefslogtreecommitdiff
path: root/lib/ruby_vm
diff options
context:
space:
mode:
authorJean byroot Boussier <[email protected]>2024-11-13 15:20:00 +0100
committerGitHub <[email protected]>2024-11-13 09:20:00 -0500
commit6deeec5d459ecff5ec4628523b14ac7379fd942e (patch)
tree1815b684da615359165055c3a12df4dca45a1ae7 /lib/ruby_vm
parent37a16c7812f5b7e6faa762b927e9f04065cc495a (diff)
Mark strings returned by Symbol#to_s as chilled (#12065)
* Use FL_USER0 for ELTS_SHARED This makes space in RString for two bits for chilled strings. * Mark strings returned by `Symbol#to_s` as chilled [Feature #20350] `STR_CHILLED` now spans on two user flags. If one bit is set it marks a chilled string literal, if it's the other it marks a `Symbol#to_s` chilled string. Since it's not possible, and doesn't make much sense to include debug info when `--debug-frozen-string-literal` is set, we can't include allocation source, but we can safely include the symbol name in the warning message, making it much easier to find the source of the issue. Co-Authored-By: Étienne Barrié <[email protected]> --------- Co-authored-by: Étienne Barrié <[email protected]> Co-authored-by: Jean Boussier <[email protected]>
Diffstat (limited to 'lib/ruby_vm')
-rw-r--r--lib/ruby_vm/rjit/c_type.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ruby_vm/rjit/c_type.rb b/lib/ruby_vm/rjit/c_type.rb
index 3b313a658b..98011f9f61 100644
--- a/lib/ruby_vm/rjit/c_type.rb
+++ b/lib/ruby_vm/rjit/c_type.rb
@@ -31,8 +31,8 @@ module RubyVM::RJIT
def self.new(fiddle_type)
name = Fiddle.constants.find do |const|
const.start_with?('TYPE_') && Fiddle.const_get(const) == fiddle_type.abs
- end&.to_s
- name.delete_prefix!('TYPE_')
+ end&.name
+ name = name.delete_prefix('TYPE_')
if fiddle_type.negative?
name.prepend('U')
end