You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruby 2.1 introduced the compiler optimization that "literal string".freeze would be recognized by the compiler to return the same object every time. But even before that, we needed frozen strings for backtick:
$ rvm ruby-2.1 do ruby -e 'o = Object.new; def o.`(x); x; end; def o.go; `hello`; end; p o.go.frozen?'
true
We did this freezing before in the backtick AST node and by extension in the bytecode we generated for it, but IR has broken backtick into the creation of the string and the invocation of the backtick method, so it is no longer being frozen.
And we'll want this for "string".freeze, String literal hash keys, and possibly other places.
The text was updated successfully, but these errors were encountered:
Actually, I'm an idiot...I was even implementing BacktickInstr logic in the JIT when I filed this. Realized we could do this for backtick by just adding the logic to backtick...but I believe we still need something for frozen literal strings.
Ruby 2.1 introduced the compiler optimization that "literal string".freeze would be recognized by the compiler to return the same object every time. But even before that, we needed frozen strings for backtick:
We did this freezing before in the backtick AST node and by extension in the bytecode we generated for it, but IR has broken backtick into the creation of the string and the invocation of the backtick method, so it is no longer being frozen.
And we'll want this for "string".freeze, String literal hash keys, and possibly other places.
The text was updated successfully, but these errors were encountered: