Project

General

Profile

Feature #13295 ยป 0001-compile.c-apply-opt_str_freeze-to-String-uminus.patch

normalperson (Eric Wong), 03/08/2017 09:26 PM

View differences:

bootstraptest/test_insns.rb
},
[ 'opt_str_freeze', %q{ 'true'.freeze }, ],
[ 'opt_str_freeze', %q{ -'true' }, ],
[ 'opt_str_freeze', <<~'},', ], # {
class String
def freeze
compile.c
* "literal".freeze -> opt_str_freeze("literal")
*/
if (node->nd_recv && nd_type(node->nd_recv) == NODE_STR &&
node->nd_mid == idFreeze && node->nd_args == NULL &&
(node->nd_mid == idFreeze || node->nd_mid == idUMinus) &&
node->nd_args == NULL &&
ISEQ_COMPILE_DATA(iseq)->current_block == NULL &&
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
VALUE str = rb_fstring(node->nd_recv->nd_lit);
-
    (1-1/1)