diff --git a/insns.def b/insns.def index b7a60f3d5d3a2a..92ae7c181628b9 100644 --- a/insns.def +++ b/insns.def @@ -569,6 +569,7 @@ splatkw (VALUE hash, VALUE block) (VALUE obj, VALUE block) // attr bool leaf = false; /* has rb_to_hash_type() */ +// attr bool zjit_profile = true; { if (NIL_P(hash)) { obj = Qnil; diff --git a/parse.y b/parse.y index 3a22c68d5df3eb..86c95f9c820276 100644 --- a/parse.y +++ b/parse.y @@ -3044,45 +3044,45 @@ rb_parser_ary_free(rb_parser_t *p, rb_parser_ary_t *ary) : var_lhs tOP_ASGN lex_ctxt rhs { $$ = new_op_assign(p, $var_lhs, $tOP_ASGN, $rhs, $lex_ctxt, &@$); - /*% ripper: opassign!($:1, $:2, $:4) %*/ + /*% ripper: opassign!($:var_lhs, $:tOP_ASGN, $:rhs) %*/ } | primary_value '['[lbracket] opt_call_args rbracket tOP_ASGN lex_ctxt rhs { $$ = new_ary_op_assign(p, $primary_value, $opt_call_args, $tOP_ASGN, $rhs, &@opt_call_args, &@$, &NULL_LOC, &@lbracket, &@rbracket, &@tOP_ASGN); - /*% ripper: opassign!(aref_field!($:1, $:3), $:5, $:7) %*/ + /*% ripper: opassign!(aref_field!($:primary_value, $:opt_call_args), $:tOP_ASGN, $:rhs) %*/ } | primary_value call_op tIDENTIFIER tOP_ASGN lex_ctxt rhs { $$ = new_attr_op_assign(p, $primary_value, $call_op, $tIDENTIFIER, $tOP_ASGN, $rhs, &@$, &@call_op, &@tIDENTIFIER, &@tOP_ASGN); - /*% ripper: opassign!(field!($:1, $:2, $:3), $:4, $:6) %*/ + /*% ripper: opassign!(field!($:primary_value, $:call_op, $:tIDENTIFIER), $:tOP_ASGN, $:rhs) %*/ } | primary_value call_op tCONSTANT tOP_ASGN lex_ctxt rhs { $$ = new_attr_op_assign(p, $primary_value, $call_op, $tCONSTANT, $tOP_ASGN, $rhs, &@$, &@call_op, &@tCONSTANT, &@tOP_ASGN); - /*% ripper: opassign!(field!($:1, $:2, $:3), $:4, $:6) %*/ + /*% ripper: opassign!(field!($:primary_value, $:call_op, $:tCONSTANT), $:tOP_ASGN, $:rhs) %*/ } | primary_value tCOLON2 tIDENTIFIER tOP_ASGN lex_ctxt rhs { $$ = new_attr_op_assign(p, $primary_value, idCOLON2, $tIDENTIFIER, $tOP_ASGN, $rhs, &@$, &@tCOLON2, &@tIDENTIFIER, &@tOP_ASGN); - /*% ripper: opassign!(field!($:1, $:2, $:3), $:4, $:6) %*/ + /*% ripper: opassign!(field!($:primary_value, $:tCOLON2, $:tIDENTIFIER), $:tOP_ASGN, $:rhs) %*/ } | primary_value tCOLON2 tCONSTANT tOP_ASGN lex_ctxt rhs { YYLTYPE loc = code_loc_gen(&@primary_value, &@tCONSTANT); $$ = new_const_op_assign(p, NEW_COLON2($primary_value, $tCONSTANT, &loc, &@tCOLON2, &@tCONSTANT), $tOP_ASGN, $rhs, $lex_ctxt, &@$); - /*% ripper: opassign!(const_path_field!($:1, $:3), $:4, $:6) %*/ + /*% ripper: opassign!(const_path_field!($:primary_value, $:tCONSTANT), $:tOP_ASGN, $:rhs) %*/ } | tCOLON3 tCONSTANT tOP_ASGN lex_ctxt rhs { YYLTYPE loc = code_loc_gen(&@tCOLON3, &@tCONSTANT); $$ = new_const_op_assign(p, NEW_COLON3($tCONSTANT, &loc, &@tCOLON3, &@tCONSTANT), $tOP_ASGN, $rhs, $lex_ctxt, &@$); - /*% ripper: opassign!(top_const_field!($:2), $:3, $:5) %*/ + /*% ripper: opassign!(top_const_field!($:tCONSTANT), $:tOP_ASGN, $:rhs) %*/ } | backref tOP_ASGN lex_ctxt rhs { VALUE MAYBE_UNUSED(e) = rb_backref_error(p, $backref); $$ = NEW_ERROR(&@$); - /*% ripper[error]: assign_error!(?e, opassign!(var_field!($:1), $:2, $:4)) %*/ + /*% ripper[error]: assign_error!(?e, opassign!(var_field!($:backref), $:tOP_ASGN, $:rhs)) %*/ } ; @@ -3090,11 +3090,11 @@ rb_parser_ary_free(rb_parser_t *p, rb_parser_ary_t *ary) : ',' tail { $$ = $tail; - /*% ripper: $:2 %*/ + /*% ripper: $:tail %*/ } | /* none */ { - $$ = new_args_tail(p, 0, 0, 0, &@0); + $$ = new_args_tail(p, 0, 0, 0, &@$); /*% ripper: [Qnil, Qnil, Qnil] %*/ } ; @@ -3152,7 +3152,7 @@ rb_parser_ary_free(rb_parser_t *p, rb_parser_ary_t *ary) : begin ' '+ word_list tSTRING_END { $$ = make_list($word_list, &@$); - /*% ripper: array!($:3) %*/ + /*% ripper: array!($:word_list) %*/ } ; @@ -3218,9 +3218,9 @@ begin_block : block_open compstmt(top_stmts) '}' { restore_block_exit(p, $block_open); p->eval_tree_begin = block_append(p, p->eval_tree_begin, - NEW_BEGIN($2, &@$)); + NEW_BEGIN($compstmt, &@$)); $$ = NEW_BEGIN(0, &@$); - /*% ripper: BEGIN!($:2) %*/ + /*% ripper: BEGIN!($:compstmt) %*/ } ; @@ -3291,119 +3291,119 @@ k_END : keyword_END lex_ctxt /*% ripper: $:2 %*/ }; -stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem +stmt : keyword_alias[kw] fitem[new] {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem[old] { - $$ = NEW_ALIAS($2, $4, &@$, &@1); - /*% ripper: alias!($:2, $:4) %*/ + $$ = NEW_ALIAS($new, $old, &@$, &@kw); + /*% ripper: alias!($:new, $:old) %*/ } - | keyword_alias tGVAR tGVAR + | keyword_alias[kw] tGVAR[new] tGVAR[old] { - $$ = NEW_VALIAS($2, $3, &@$, &@1); - /*% ripper: var_alias!($:2, $:3) %*/ + $$ = NEW_VALIAS($new, $old, &@$, &@kw); + /*% ripper: var_alias!($:new, $:old) %*/ } - | keyword_alias tGVAR tBACK_REF + | keyword_alias[kw] tGVAR[new] tBACK_REF[old] { char buf[2]; buf[0] = '$'; - buf[1] = (char)RNODE_BACK_REF($3)->nd_nth; - $$ = NEW_VALIAS($2, rb_intern2(buf, 2), &@$, &@1); - /*% ripper: var_alias!($:2, $:3) %*/ + buf[1] = (char)RNODE_BACK_REF($old)->nd_nth; + $$ = NEW_VALIAS($new, rb_intern2(buf, 2), &@$, &@kw); + /*% ripper: var_alias!($:new, $:old) %*/ } - | keyword_alias tGVAR tNTH_REF + | keyword_alias tGVAR tNTH_REF[nth] { static const char mesg[] = "can't make alias for the number variables"; /*%%%*/ - yyerror1(&@3, mesg); + yyerror1(&@nth, mesg); /*% %*/ $$ = NEW_ERROR(&@$); - /*% ripper[error]: alias_error!(ERR_MESG(), $:3) %*/ + /*% ripper[error]: alias_error!(ERR_MESG(), $:nth) %*/ } - | keyword_undef undef_list + | keyword_undef[kw] undef_list[list] { - nd_set_first_loc($2, @1.beg_pos); - RNODE_UNDEF($2)->keyword_loc = @1; - $$ = $2; - /*% ripper: undef!($:2) %*/ + nd_set_first_loc($list, @kw.beg_pos); + RNODE_UNDEF($list)->keyword_loc = @kw; + $$ = $list; + /*% ripper: undef!($:list) %*/ } - | stmt modifier_if expr_value + | stmt[body] modifier_if[mod] expr_value[cond] { - $$ = new_if(p, $3, remove_begin($1), 0, &@$, &@2, &NULL_LOC, &NULL_LOC); - fixpos($$, $3); - /*% ripper: if_mod!($:3, $:1) %*/ + $$ = new_if(p, $cond, remove_begin($body), 0, &@$, &@mod, &NULL_LOC, &NULL_LOC); + fixpos($$, $cond); + /*% ripper: if_mod!($:cond, $:body) %*/ } - | stmt modifier_unless expr_value + | stmt[body] modifier_unless[mod] expr_value[cond] { - $$ = new_unless(p, $3, remove_begin($1), 0, &@$, &@2, &NULL_LOC, &NULL_LOC); - fixpos($$, $3); - /*% ripper: unless_mod!($:3, $:1) %*/ + $$ = new_unless(p, $cond, remove_begin($body), 0, &@$, &@mod, &NULL_LOC, &NULL_LOC); + fixpos($$, $cond); + /*% ripper: unless_mod!($:cond, $:body) %*/ } - | stmt modifier_while expr_value + | stmt[body] modifier_while[mod] expr_value[cond_expr] { clear_block_exit(p, false); - if ($1 && nd_type_p($1, NODE_BEGIN)) { - $$ = NEW_WHILE(cond(p, $3, &@3), RNODE_BEGIN($1)->nd_body, 0, &@$, &@2, &NULL_LOC); + if ($body && nd_type_p($body, NODE_BEGIN)) { + $$ = NEW_WHILE(cond(p, $cond_expr, &@cond_expr), RNODE_BEGIN($body)->nd_body, 0, &@$, &@mod, &NULL_LOC); } else { - $$ = NEW_WHILE(cond(p, $3, &@3), $1, 1, &@$, &@2, &NULL_LOC); + $$ = NEW_WHILE(cond(p, $cond_expr, &@cond_expr), $body, 1, &@$, &@mod, &NULL_LOC); } - /*% ripper: while_mod!($:3, $:1) %*/ + /*% ripper: while_mod!($:cond_expr, $:body) %*/ } - | stmt modifier_until expr_value + | stmt[body] modifier_until[mod] expr_value[cond_expr] { clear_block_exit(p, false); - if ($1 && nd_type_p($1, NODE_BEGIN)) { - $$ = NEW_UNTIL(cond(p, $3, &@3), RNODE_BEGIN($1)->nd_body, 0, &@$, &@2, &NULL_LOC); + if ($body && nd_type_p($body, NODE_BEGIN)) { + $$ = NEW_UNTIL(cond(p, $cond_expr, &@cond_expr), RNODE_BEGIN($body)->nd_body, 0, &@$, &@mod, &NULL_LOC); } else { - $$ = NEW_UNTIL(cond(p, $3, &@3), $1, 1, &@$, &@2, &NULL_LOC); + $$ = NEW_UNTIL(cond(p, $cond_expr, &@cond_expr), $body, 1, &@$, &@mod, &NULL_LOC); } - /*% ripper: until_mod!($:3, $:1) %*/ + /*% ripper: until_mod!($:cond_expr, $:body) %*/ } - | stmt modifier_rescue after_rescue stmt + | stmt[body] modifier_rescue[mod] after_rescue[ctxt] stmt[resbody] { - p->ctxt.in_rescue = $3.in_rescue; + p->ctxt.in_rescue = $ctxt.in_rescue; NODE *resq; - YYLTYPE loc = code_loc_gen(&@2, &@4); - resq = NEW_RESBODY(0, 0, remove_begin($4), 0, &loc); - $$ = NEW_RESCUE(remove_begin($1), resq, 0, &@$); - /*% ripper: rescue_mod!($:1, $:4) %*/ + YYLTYPE loc = code_loc_gen(&@mod, &@resbody); + resq = NEW_RESBODY(0, 0, remove_begin($resbody), 0, &loc); + $$ = NEW_RESCUE(remove_begin($body), resq, 0, &@$); + /*% ripper: rescue_mod!($:body, $:resbody) %*/ } - | k_END allow_exits '{' compstmt(stmts) '}' + | k_END[k_end] allow_exits[allow] '{'[lbrace] compstmt(stmts)[body] '}'[rbrace] { if (p->ctxt.in_def) { rb_warn0("END in method; use at_exit"); } - restore_block_exit(p, $allow_exits); - p->ctxt = $k_END; + restore_block_exit(p, $allow); + p->ctxt = $k_end; { - NODE *scope = NEW_SCOPE2(0 /* tbl */, 0 /* args */, $compstmt /* body */, NULL /* parent */, &@$); - $$ = NEW_POSTEXE(scope, &@$, &@1, &@3, &@5); + NODE *scope = NEW_SCOPE2(0 /* tbl */, 0 /* args */, $body /* body */, NULL /* parent */, &@$); + $$ = NEW_POSTEXE(scope, &@$, &@k_end, &@lbrace, &@rbrace); RNODE_SCOPE(scope)->nd_parent = $$; } - /*% ripper: END!($:compstmt) %*/ + /*% ripper: END!($:body) %*/ } | command_asgn - | mlhs '=' lex_ctxt command_call_value + | mlhs[lhs] '=' lex_ctxt[ctxt] command_call_value[rhs] { - $$ = node_assign(p, (NODE *)$1, $4, $3, &@$); - /*% ripper: massign!($:1, $:4) %*/ + $$ = node_assign(p, (NODE *)$lhs, $rhs, $ctxt, &@$); + /*% ripper: massign!($:lhs, $:rhs) %*/ } | asgn(mrhs) - | mlhs '=' lex_ctxt mrhs_arg modifier_rescue - after_rescue stmt[resbody] + | mlhs[lhs] '=' lex_ctxt[lex_ctxt] mrhs_arg[mrhs_arg] modifier_rescue[modifier_rescue] + after_rescue[after_rescue] stmt[resbody] { - p->ctxt.in_rescue = $3.in_rescue; + p->ctxt.in_rescue = $after_rescue.in_rescue; YYLTYPE loc = code_loc_gen(&@modifier_rescue, &@resbody); $resbody = NEW_RESBODY(0, 0, remove_begin($resbody), 0, &loc); loc.beg_pos = @mrhs_arg.beg_pos; $mrhs_arg = NEW_RESCUE($mrhs_arg, $resbody, 0, &loc); - $$ = node_assign(p, (NODE *)$mlhs, $mrhs_arg, $lex_ctxt, &@$); - /*% ripper: massign!($:1, rescue_mod!($:4, $:7)) %*/ + $$ = node_assign(p, (NODE *)$lhs, $mrhs_arg, $lex_ctxt, &@$); + /*% ripper: massign!($:lhs, rescue_mod!($:mrhs_arg, $:resbody)) %*/ } - | mlhs '=' lex_ctxt mrhs_arg + | mlhs[lhs] '=' lex_ctxt[ctxt] mrhs_arg[rhs] { - $$ = node_assign(p, (NODE *)$1, $4, $3, &@$); - /*% ripper: massign!($:1, $:4) %*/ + $$ = node_assign(p, (NODE *)$lhs, $rhs, $ctxt, &@$); + /*% ripper: massign!($:lhs, $:rhs) %*/ } | expr | error @@ -3444,27 +3444,27 @@ command_rhs : command_call_value %prec tOP_ASGN ; expr : command_call - | expr keyword_and expr + | expr[left] keyword_and[op] expr[right] { - $$ = logop(p, idAND, $1, $3, &@2, &@$); - /*% ripper: binary!($:1, ID2VAL(idAND), $:3) %*/ + $$ = logop(p, idAND, $left, $right, &@op, &@$); + /*% ripper: binary!($:left, ID2VAL(idAND), $:right) %*/ } - | expr keyword_or expr + | expr[left] keyword_or[op] expr[right] { - $$ = logop(p, idOR, $1, $3, &@2, &@$); - /*% ripper: binary!($:1, ID2VAL(idOR), $:3) %*/ + $$ = logop(p, idOR, $left, $right, &@op, &@$); + /*% ripper: binary!($:left, ID2VAL(idOR), $:right) %*/ } - | keyword_not '\n'? expr + | keyword_not[not] '\n'? expr[arg] { - $$ = call_uni_op(p, method_cond(p, $3, &@3), METHOD_NOT, &@1, &@$); - /*% ripper: unary!(ID2VAL(idNOT), $:3) %*/ + $$ = call_uni_op(p, method_cond(p, $arg, &@arg), METHOD_NOT, &@not, &@$); + /*% ripper: unary!(ID2VAL(idNOT), $:arg) %*/ } - | '!' command_call + | '!'[not] command_call[arg] { - $$ = call_uni_op(p, method_cond(p, $2, &@2), '!', &@1, &@$); - /*% ripper: unary!(ID2VAL('\'!\''), $:2) %*/ + $$ = call_uni_op(p, method_cond(p, $arg, &@arg), '!', &@not, &@$); + /*% ripper: unary!(ID2VAL('\'!\''), $:arg) %*/ } - | arg tASSOC + | arg tASSOC[assoc] { value_expr(p, $arg); } @@ -3476,7 +3476,7 @@ expr : command_call p->ctxt.in_kwarg = $ctxt.in_kwarg; p->ctxt.in_alt_pattern = $ctxt.in_alt_pattern; p->ctxt.capture_in_pattern = $ctxt.capture_in_pattern; - $$ = NEW_CASE3($arg, NEW_IN($body, 0, 0, &@body, &NULL_LOC, &NULL_LOC, &@2), &@$, &NULL_LOC, &NULL_LOC); + $$ = NEW_CASE3($arg, NEW_IN($body, 0, 0, &@body, &NULL_LOC, &NULL_LOC, &@assoc), &@$, &NULL_LOC, &NULL_LOC); /*% ripper: case!($:arg, in!($:body, Qnil, Qnil)) %*/ } | arg keyword_in @@ -4366,184 +4366,184 @@ mrhs : args ',' arg_value primary : inline_primary | var_ref | backref - | tFID + | tFID[fid] { - $$ = (NODE *)NEW_FCALL($1, 0, &@$); - /*% ripper: method_add_arg!(fcall!($:1), args_new!) %*/ + $$ = (NODE *)NEW_FCALL($fid, 0, &@$); + /*% ripper: method_add_arg!(fcall!($:fid), args_new!) %*/ } - | k_begin + | k_begin[kw] { CMDARG_PUSH(0); } - bodystmt - k_end + bodystmt[body] + k_end[k_end] { CMDARG_POP(); - set_line_body($3, @1.end_pos.lineno); - $$ = NEW_BEGIN($3, &@$); - nd_set_line($$, @1.end_pos.lineno); - /*% ripper: begin!($:3) %*/ + set_line_body($body, @kw.end_pos.lineno); + $$ = NEW_BEGIN($body, &@$); + nd_set_line($$, @kw.end_pos.lineno); + /*% ripper: begin!($:body) %*/ } - | tLPAREN_ARG compstmt(stmts) {SET_LEX_STATE(EXPR_ENDARG);} ')' + | tLPAREN_ARG compstmt(stmts)[body] {SET_LEX_STATE(EXPR_ENDARG);} ')' { - if (nd_type_p($2, NODE_SELF)) RNODE_SELF($2)->nd_state = 0; - $$ = $2; - /*% ripper: paren!($:2) %*/ + if (nd_type_p($body, NODE_SELF)) RNODE_SELF($body)->nd_state = 0; + $$ = $body; + /*% ripper: paren!($:body) %*/ } - | tLPAREN compstmt(stmts) ')' + | tLPAREN compstmt(stmts)[body] ')' { - if (nd_type_p($2, NODE_SELF)) RNODE_SELF($2)->nd_state = 0; - $$ = NEW_BLOCK($2, &@$); - /*% ripper: paren!($:2) %*/ + if (nd_type_p($body, NODE_SELF)) RNODE_SELF($body)->nd_state = 0; + $$ = NEW_BLOCK($body, &@$); + /*% ripper: paren!($:body) %*/ } - | primary_value tCOLON2 tCONSTANT + | primary_value[recv] tCOLON2[op] tCONSTANT[name] { - $$ = NEW_COLON2($1, $3, &@$, &@2, &@3); - /*% ripper: const_path_ref!($:1, $:3) %*/ + $$ = NEW_COLON2($recv, $name, &@$, &@op, &@name); + /*% ripper: const_path_ref!($:recv, $:name) %*/ } - | tCOLON3 tCONSTANT + | tCOLON3[top] tCONSTANT[name] { - $$ = NEW_COLON3($2, &@$, &@1, &@2); - /*% ripper: top_const_ref!($:2) %*/ + $$ = NEW_COLON3($name, &@$, &@top, &@name); + /*% ripper: top_const_ref!($:name) %*/ } - | tLBRACK aref_args ']' + | tLBRACK aref_args[args] ']' { - $$ = make_list($2, &@$); - /*% ripper: array!($:2) %*/ + $$ = make_list($args, &@$); + /*% ripper: array!($:args) %*/ } - | tLBRACE assoc_list '}' + | tLBRACE assoc_list[list] '}' { - $$ = new_hash(p, $2, &@$); + $$ = new_hash(p, $list, &@$); RNODE_HASH($$)->nd_brace = TRUE; - /*% ripper: hash!($:2) %*/ + /*% ripper: hash!($:list) %*/ } - | k_return + | k_return[kw] { - $$ = NEW_RETURN(0, &@$, &@1); + $$ = NEW_RETURN(0, &@$, &@kw); /*% ripper: return0! %*/ } - | k_yield '(' call_args rparen + | k_yield[kw] '('[lpar] call_args[args] rparen[rpar] { - $$ = NEW_YIELD($3, &@$, &@1, &@2, &@4); - /*% ripper: yield!(paren!($:3)) %*/ + $$ = NEW_YIELD($args, &@$, &@kw, &@lpar, &@rpar); + /*% ripper: yield!(paren!($:args)) %*/ } - | k_yield '(' rparen + | k_yield[kw] '('[lpar] rparen[rpar] { - $$ = NEW_YIELD(0, &@$, &@1, &@2, &@3); + $$ = NEW_YIELD(0, &@$, &@kw, &@lpar, &@rpar); /*% ripper: yield!(paren!(args_new!)) %*/ } - | k_yield + | k_yield[kw] { - $$ = NEW_YIELD(0, &@$, &@1, &NULL_LOC, &NULL_LOC); + $$ = NEW_YIELD(0, &@$, &@kw, &NULL_LOC, &NULL_LOC); /*% ripper: yield0! %*/ } - | keyword_defined '\n'? '(' begin_defined expr rparen + | keyword_defined[kw] '\n'? '(' begin_defined[ctxt] expr[arg] rparen { - p->ctxt.in_defined = $4.in_defined; - $$ = new_defined(p, $5, &@$, &@1); - p->ctxt.has_trailing_semicolon = $4.has_trailing_semicolon; - /*% ripper: defined!($:5) %*/ + p->ctxt.in_defined = $ctxt.in_defined; + $$ = new_defined(p, $arg, &@$, &@kw); + p->ctxt.has_trailing_semicolon = $ctxt.has_trailing_semicolon; + /*% ripper: defined!($:arg) %*/ } - | keyword_not '(' expr rparen + | keyword_not[kw] '(' expr[arg] rparen { - $$ = call_uni_op(p, method_cond(p, $3, &@3), METHOD_NOT, &@1, &@$); - /*% ripper: unary!(ID2VAL(idNOT), $:3) %*/ + $$ = call_uni_op(p, method_cond(p, $arg, &@arg), METHOD_NOT, &@kw, &@$); + /*% ripper: unary!(ID2VAL(idNOT), $:arg) %*/ } - | keyword_not '(' rparen + | keyword_not[kw] '('[lpar] rparen { - $$ = call_uni_op(p, method_cond(p, NEW_NIL(&@2), &@2), METHOD_NOT, &@1, &@$); + $$ = call_uni_op(p, method_cond(p, NEW_NIL(&@lpar), &@lpar), METHOD_NOT, &@kw, &@$); /*% ripper: unary!(ID2VAL(idNOT), Qnil) %*/ } - | fcall brace_block + | fcall[call] brace_block[block] { - $$ = method_add_block(p, (NODE *)$1, $2, &@$); - /*% ripper: method_add_block!(method_add_arg!(fcall!($:1), args_new!), $:2) %*/ + $$ = method_add_block(p, (NODE *)$call, $block, &@$); + /*% ripper: method_add_block!(method_add_arg!(fcall!($:call), args_new!), $:block) %*/ } | method_call - | method_call brace_block + | method_call[call] brace_block[block] { - block_dup_check(p, get_nd_args(p, $1), $2); - $$ = method_add_block(p, $1, $2, &@$); - /*% ripper: method_add_block!($:1, $:2) %*/ + block_dup_check(p, get_nd_args(p, $call), $block); + $$ = method_add_block(p, $call, $block, &@$); + /*% ripper: method_add_block!($:call, $:block) %*/ } | lambda - | k_if expr_value then - compstmt(stmts) - if_tail - k_end + | k_if[kw] expr_value[cond] then[then] + compstmt(stmts)[body] + if_tail[tail] + k_end[k_end] { - if ($5 && nd_type_p($5, NODE_IF)) - RNODE_IF($5)->end_keyword_loc = @6; + if ($tail && nd_type_p($tail, NODE_IF)) + RNODE_IF($tail)->end_keyword_loc = @k_end; - $$ = new_if(p, $2, $4, $5, &@$, &@1, &@3, &@6); - fixpos($$, $2); - /*% ripper: if!($:2, $:4, $:5) %*/ + $$ = new_if(p, $cond, $body, $tail, &@$, &@kw, &@then, &@k_end); + fixpos($$, $cond); + /*% ripper: if!($:cond, $:body, $:tail) %*/ } - | k_unless expr_value then - compstmt(stmts) - opt_else - k_end + | k_unless[kw] expr_value[cond] then[then] + compstmt(stmts)[body] + opt_else[tail] + k_end[k_end] { - $$ = new_unless(p, $2, $4, $5, &@$, &@1, &@3, &@6); - fixpos($$, $2); - /*% ripper: unless!($:2, $:4, $:5) %*/ + $$ = new_unless(p, $cond, $body, $tail, &@$, &@kw, &@then, &@k_end); + fixpos($$, $cond); + /*% ripper: unless!($:cond, $:body, $:tail) %*/ } - | k_while expr_value_do - compstmt(stmts) - k_end + | k_while[kw] expr_value_do[cond] + compstmt(stmts)[body] + k_end[k_end] { - restore_block_exit(p, $1); - $$ = NEW_WHILE(cond(p, $2, &@2), $3, 1, &@$, &@1, &@4); - fixpos($$, $2); - /*% ripper: while!($:2, $:3) %*/ + restore_block_exit(p, $kw); + $$ = NEW_WHILE(cond(p, $cond, &@cond), $body, 1, &@$, &@kw, &@k_end); + fixpos($$, $cond); + /*% ripper: while!($:cond, $:body) %*/ } - | k_until expr_value_do - compstmt(stmts) - k_end + | k_until[kw] expr_value_do[cond] + compstmt(stmts)[body] + k_end[k_end] { - restore_block_exit(p, $1); - $$ = NEW_UNTIL(cond(p, $2, &@2), $3, 1, &@$, &@1, &@4); - fixpos($$, $2); - /*% ripper: until!($:2, $:3) %*/ + restore_block_exit(p, $kw); + $$ = NEW_UNTIL(cond(p, $cond, &@cond), $body, 1, &@$, &@kw, &@k_end); + fixpos($$, $cond); + /*% ripper: until!($:cond, $:body) %*/ } - | k_case expr_value terms? + | k_case[k_case] expr_value[expr] terms? { $$ = p->case_labels; p->case_labels = CHECK_LITERAL_WHEN; - } - case_body - k_end + }[labels] + case_body[body] + k_end[k_end] { if (CASE_LABELS_ENABLED_P(p->case_labels)) st_free_table(p->case_labels); - p->case_labels = $4; - $$ = NEW_CASE($2, $5, &@$, &@1, &@6); - fixpos($$, $2); - /*% ripper: case!($:2, $:5) %*/ + p->case_labels = $labels; + $$ = NEW_CASE($expr, $body, &@$, &@k_case, &@k_end); + fixpos($$, $expr); + /*% ripper: case!($:expr, $:body) %*/ } - | k_case terms? + | k_case[k_case] terms? { $$ = p->case_labels; p->case_labels = 0; - } - case_body - k_end + }[labels] + case_body[body] + k_end[k_end] { if (p->case_labels) st_free_table(p->case_labels); - p->case_labels = $3; - $$ = NEW_CASE2($4, &@$, &@1, &@5); - /*% ripper: case!(Qnil, $:4) %*/ + p->case_labels = $labels; + $$ = NEW_CASE2($body, &@$, &@k_case, &@k_end); + /*% ripper: case!(Qnil, $:body) %*/ } - | k_case expr_value terms? - p_case_body - k_end + | k_case[k_case] expr_value[expr] terms? + p_case_body[body] + k_end[k_end] { - $$ = NEW_CASE3($2, $4, &@$, &@1, &@5); - /*% ripper: case!($:2, $:4) %*/ + $$ = NEW_CASE3($expr, $body, &@$, &@k_case, &@k_end); + /*% ripper: case!($:expr, $:body) %*/ } - | k_for for_var keyword_in - {COND_PUSH(1);} expr_value do {COND_POP();} - compstmt(stmts) - k_end + | k_for[k_for] for_var[for_var] keyword_in[keyword_in] + {COND_PUSH(1);} expr_value[expr_value] do[do] {COND_POP();} + compstmt(stmts)[compstmt] + k_end[k_end] { restore_block_exit(p, $k_for); /* @@ -4580,7 +4580,7 @@ primary : inline_primary args = new_args(p, m, 0, id, 0, new_args_tail(p, 0, 0, 0, &@for_var), &@for_var); scope = NEW_SCOPE2(tbl, args, $compstmt, NULL, &@$); YYLTYPE do_keyword_loc = $do == keyword_do_cond ? @do : NULL_LOC; - $$ = NEW_FOR($5, scope, &@$, &@k_for, &@keyword_in, &do_keyword_loc, &@k_end); + $$ = NEW_FOR($expr_value, scope, &@$, &@k_for, &@keyword_in, &do_keyword_loc, &@k_end); RNODE_SCOPE(scope)->nd_parent = $$; fixpos($$, $for_var); /*% ripper: for!($:for_var, $:expr_value, $:compstmt) %*/ @@ -4673,29 +4673,29 @@ primary : inline_primary /*% ripper: defs!(*$:head[0..2], $:args, $:bodystmt) %*/ local_pop(p); } - | keyword_break + | keyword_break[kw] { - $$ = add_block_exit(p, NEW_BREAK(0, &@$, &@1)); + $$ = add_block_exit(p, NEW_BREAK(0, &@$, &@kw)); /*% ripper: break!(args_new!) %*/ } - | keyword_next + | keyword_next[kw] { - $$ = add_block_exit(p, NEW_NEXT(0, &@$, &@1)); + $$ = add_block_exit(p, NEW_NEXT(0, &@$, &@kw)); /*% ripper: next!(args_new!) %*/ } - | keyword_redo + | keyword_redo[kw] { - $$ = add_block_exit(p, NEW_REDO(&@$, &@1)); + $$ = add_block_exit(p, NEW_REDO(&@$, &@kw)); /*% ripper: redo! %*/ } - | keyword_retry + | keyword_retry[kw] { if (!p->ctxt.in_defined) { switch (p->ctxt.in_rescue) { - case before_rescue: yyerror1(&@1, "Invalid retry without rescue"); break; + case before_rescue: yyerror1(&@kw, "Invalid retry without rescue"); break; case after_rescue: /* ok */ break; - case after_else: yyerror1(&@1, "Invalid retry after else"); break; - case after_ensure: yyerror1(&@1, "Invalid retry after ensure"); break; + case after_else: yyerror1(&@kw, "Invalid retry after else"); break; + case after_ensure: yyerror1(&@kw, "Invalid retry after ensure"); break; } } $$ = NEW_RETRY(&@$); @@ -4738,19 +4738,19 @@ k_unless : keyword_unless } ; -k_while : keyword_while allow_exits +k_while : keyword_while[kw] allow_exits { $$ = $allow_exits; token_info_push(p, "while", &@$); - push_end_expect_token_locations(p, &@1.beg_pos); + push_end_expect_token_locations(p, &@kw.beg_pos); } ; -k_until : keyword_until allow_exits +k_until : keyword_until[kw] allow_exits { $$ = $allow_exits; token_info_push(p, "until", &@$); - push_end_expect_token_locations(p, &@1.beg_pos); + push_end_expect_token_locations(p, &@kw.beg_pos); } ; @@ -4761,11 +4761,11 @@ k_case : keyword_case } ; -k_for : keyword_for allow_exits +k_for : keyword_for[kw] allow_exits { $$ = $allow_exits; token_info_push(p, "for", &@$); - push_end_expect_token_locations(p, &@1.beg_pos); + push_end_expect_token_locations(p, &@kw.beg_pos); } ; @@ -4983,75 +4983,75 @@ excessed_comma : ',' } ; -block_param : f_arg ',' f_opt_arg(primary_value) ',' f_rest_arg opt_args_tail(block_args_tail) +block_param : f_arg[pre] ',' f_opt_arg(primary_value)[opt] ',' f_rest_arg[rest] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, $3, $5, 0, $6, &@$); - /*% ripper: params!($:1, $:3, $:5, Qnil, *$:6[0..2]) %*/ + $$ = new_args(p, $pre, $opt, $rest, 0, $tail, &@$); + /*% ripper: params!($:pre, $:opt, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_arg ',' f_opt_arg(primary_value) ',' f_rest_arg ',' f_arg opt_args_tail(block_args_tail) + | f_arg[pre] ',' f_opt_arg(primary_value)[opt] ',' f_rest_arg[rest] ',' f_arg[post] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, $3, $5, $7, $8, &@$); - /*% ripper: params!($:1, $:3, $:5, $:7, *$:8[0..2]) %*/ + $$ = new_args(p, $pre, $opt, $rest, $post, $tail, &@$); + /*% ripper: params!($:pre, $:opt, $:rest, $:post, *$:tail[0..2]) %*/ } - | f_arg ',' f_opt_arg(primary_value) opt_args_tail(block_args_tail) + | f_arg[pre] ',' f_opt_arg(primary_value)[opt] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, $3, 0, 0, $4, &@$); - /*% ripper: params!($:1, $:3, Qnil, Qnil, *$:4[0..2]) %*/ + $$ = new_args(p, $pre, $opt, 0, 0, $tail, &@$); + /*% ripper: params!($:pre, $:opt, Qnil, Qnil, *$:tail[0..2]) %*/ } - | f_arg ',' f_opt_arg(primary_value) ',' f_arg opt_args_tail(block_args_tail) + | f_arg[pre] ',' f_opt_arg(primary_value)[opt] ',' f_arg[post] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, $3, 0, $5, $6, &@$); - /*% ripper: params!($:1, $:3, Qnil, $:5, *$:6[0..2]) %*/ + $$ = new_args(p, $pre, $opt, 0, $post, $tail, &@$); + /*% ripper: params!($:pre, $:opt, Qnil, $:post, *$:tail[0..2]) %*/ } - | f_arg ',' f_rest_arg opt_args_tail(block_args_tail) + | f_arg[pre] ',' f_rest_arg[rest] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, 0, $3, 0, $4, &@$); - /*% ripper: params!($:1, Qnil, $:3, Qnil, *$:4[0..2]) %*/ + $$ = new_args(p, $pre, 0, $rest, 0, $tail, &@$); + /*% ripper: params!($:pre, Qnil, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_arg ',' f_rest_arg ',' f_arg opt_args_tail(block_args_tail) + | f_arg[pre] ',' f_rest_arg[rest] ',' f_arg[post] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, 0, $3, $5, $6, &@$); - /*% ripper: params!($:1, Qnil, $:3, $:5, *$:6[0..2]) %*/ + $$ = new_args(p, $pre, 0, $rest, $post, $tail, &@$); + /*% ripper: params!($:pre, Qnil, $:rest, $:post, *$:tail[0..2]) %*/ } - | f_arg opt_args_tail(block_args_tail) + | f_arg[pre] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, $1, 0, 0, 0, $2, &@$); - /*% ripper: params!($:1, Qnil, Qnil, Qnil, *$:2[0..2]) %*/ + $$ = new_args(p, $pre, 0, 0, 0, $tail, &@$); + /*% ripper: params!($:pre, Qnil, Qnil, Qnil, *$:tail[0..2]) %*/ } - | f_opt_arg(primary_value) ',' f_rest_arg opt_args_tail(block_args_tail) + | f_opt_arg(primary_value)[opt] ',' f_rest_arg[rest] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, 0, $1, $3, 0, $4, &@$); - /*% ripper: params!(Qnil, $:1, $:3, Qnil, *$:4[0..2]) %*/ + $$ = new_args(p, 0, $opt, $rest, 0, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_opt_arg(primary_value) ',' f_rest_arg ',' f_arg opt_args_tail(block_args_tail) + | f_opt_arg(primary_value)[opt] ',' f_rest_arg[rest] ',' f_arg[post] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, 0, $1, $3, $5, $6, &@$); - /*% ripper: params!(Qnil, $:1, $:3, $:5, *$:6[0..2]) %*/ + $$ = new_args(p, 0, $opt, $rest, $post, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, $:rest, $:post, *$:tail[0..2]) %*/ } - | f_opt_arg(primary_value) opt_args_tail(block_args_tail) + | f_opt_arg(primary_value)[opt] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, 0, $1, 0, 0, $2, &@$); - /*% ripper: params!(Qnil, $:1, Qnil, Qnil, *$:2[0..2]) %*/ + $$ = new_args(p, 0, $opt, 0, 0, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, Qnil, Qnil, *$:tail[0..2]) %*/ } - | f_opt_arg(primary_value) ',' f_arg opt_args_tail(block_args_tail) + | f_opt_arg(primary_value)[opt] ',' f_arg[post] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, 0, $1, 0, $3, $4, &@$); - /*% ripper: params!(Qnil, $:1, Qnil, $:3, *$:4[0..2]) %*/ + $$ = new_args(p, 0, $opt, 0, $post, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, Qnil, $:post, *$:tail[0..2]) %*/ } - | f_rest_arg opt_args_tail(block_args_tail) + | f_rest_arg[rest] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, 0, 0, $1, 0, $2, &@$); - /*% ripper: params!(Qnil, Qnil, $:1, Qnil, *$:2[0..2]) %*/ + $$ = new_args(p, 0, 0, $rest, 0, $tail, &@$); + /*% ripper: params!(Qnil, Qnil, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_rest_arg ',' f_arg opt_args_tail(block_args_tail) + | f_rest_arg[rest] ',' f_arg[post] opt_args_tail(block_args_tail)[tail] { - $$ = new_args(p, 0, 0, $1, $3, $4, &@$); - /*% ripper: params!(Qnil, Qnil, $:1, $:3, *$:4[0..2]) %*/ + $$ = new_args(p, 0, 0, $rest, $post, $tail, &@$); + /*% ripper: params!(Qnil, Qnil, $:rest, $:post, *$:tail[0..2]) %*/ } - | block_args_tail + | block_args_tail[tail] { - $$ = new_args(p, 0, 0, 0, 0, $1, &@$); - /*% ripper: params!(Qnil, Qnil, Qnil, Qnil, *$:1[0..2]) %*/ + $$ = new_args(p, 0, 0, 0, 0, $tail, &@$); + /*% ripper: params!(Qnil, Qnil, Qnil, Qnil, *$:tail[0..2]) %*/ } ; @@ -5133,7 +5133,7 @@ it_id : { lambda : tLAMBDA[lpar] { - token_info_push(p, "->", &@1); + token_info_push(p, "->", &@lpar); $$ = dyna_push(p); }[dyna] max_numparam numparam it_id allow_exits @@ -5156,7 +5156,7 @@ lambda : tLAMBDA[lpar] $$ = NEW_LAMBDA($args, $body->node, &loc, &@lpar, &$body->opening_loc, &$body->closing_loc); nd_set_line(RNODE_LAMBDA($$)->nd_body, @body.end_pos.lineno); nd_set_line($$, @args.end_pos.lineno); - nd_set_first_loc($$, @1.beg_pos); + nd_set_first_loc($$, @lpar.beg_pos); xfree($body); } /*% ripper: lambda!($:args, $:body) %*/ @@ -5170,12 +5170,12 @@ f_larglist : '(' f_args opt_bv_decl ')' p->ctxt.in_argdef = 0; $$ = $f_args; p->max_numparam = ORDINAL_PARAM; - /*% ripper: paren!($:2) %*/ + /*% ripper: paren!($:f_args) %*/ } | f_args { p->ctxt.in_argdef = 0; - if (!args_info_empty_p(&$1->nd_ainfo)) + if (!args_info_empty_p(&$f_args->nd_ainfo)) p->max_numparam = ORDINAL_PARAM; $$ = $f_args; } @@ -5571,8 +5571,8 @@ p_expr_basic : p_value | p_const '[' rbracket { $$ = new_array_pattern_tail(p, 0, 0, 0, 0, &@$); - $$ = new_array_pattern(p, $1, 0, $$, &@$); - /*% ripper: aryptn!($:1, Qnil, Qnil, Qnil) %*/ + $$ = new_array_pattern(p, $p_const, 0, $$, &@$); + /*% ripper: aryptn!($:p_const, Qnil, Qnil, Qnil) %*/ } | tLBRACK p_args rbracket { @@ -6093,21 +6093,21 @@ regexp_contents : /* none */ } ; -string_content : tSTRING_CONTENT - /*% ripper[brace]: $:1 %*/ - | tSTRING_DVAR +string_content : tSTRING_CONTENT[content] + /*% ripper[brace]: $:content %*/ + | tSTRING_DVAR[state] { /* need to backup p->lex.strterm so that a string literal `%&foo,#$&,bar&` can be parsed */ $$ = p->lex.strterm; p->lex.strterm = 0; SET_LEX_STATE(EXPR_BEG); - } - string_dvar + }[strterm] + string_dvar[dvar] { - p->lex.strterm = $2; - $$ = NEW_EVSTR($3, &@$, &@1, &NULL_LOC); - nd_set_line($$, @3.end_pos.lineno); - /*% ripper: string_dvar!($:3) %*/ + p->lex.strterm = $strterm; + $$ = NEW_EVSTR($dvar, &@$, &@state, &NULL_LOC); + nd_set_line($$, @dvar.end_pos.lineno); + /*% ripper: string_dvar!($:dvar) %*/ } | tSTRING_DBEG[state] { @@ -6260,11 +6260,11 @@ superclass : '<' ; f_opt_paren_args: f_paren_args - | none + | /* none */ { p->ctxt.in_argdef = 0; - $$ = new_args_tail(p, 0, 0, 0, &@0); - $$ = new_args(p, 0, 0, 0, 0, $$, &@0); + $$ = new_args_tail(p, 0, 0, 0, &@$); + $$ = new_args(p, 0, 0, 0, 0, $$, &@$); /*% ripper: params!(Qnil, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil) %*/ } ; @@ -6309,86 +6309,86 @@ args_tail : args_tail_basic(arg_value) else { add_forwarding_args(p); } - $$ = new_args_tail(p, 0, fwd, arg_FWD_BLOCK, &@1); + $$ = new_args_tail(p, 0, fwd, arg_FWD_BLOCK, &@args_forward); $$->nd_ainfo.forwarding = 1; - /*% ripper: [Qnil, $:1, Qnil] %*/ + /*% ripper: [Qnil, $:args_forward, Qnil] %*/ } ; -f_args : f_arg ',' f_opt_arg(arg_value) ',' f_rest_arg opt_args_tail(args_tail) +f_args : f_arg[pre] ',' f_opt_arg(arg_value)[opt] ',' f_rest_arg[rest] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, $3, $5, 0, $6, &@$); - /*% ripper: params!($:1, $:3, $:5, Qnil, *$:6[0..2]) %*/ + $$ = new_args(p, $pre, $opt, $rest, 0, $tail, &@$); + /*% ripper: params!($:pre, $:opt, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_arg ',' f_opt_arg(arg_value) ',' f_rest_arg ',' f_arg opt_args_tail(args_tail) + | f_arg[pre] ',' f_opt_arg(arg_value)[opt] ',' f_rest_arg[rest] ',' f_arg[post] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, $3, $5, $7, $8, &@$); - /*% ripper: params!($:1, $:3, $:5, $:7, *$:8[0..2]) %*/ + $$ = new_args(p, $pre, $opt, $rest, $post, $tail, &@$); + /*% ripper: params!($:pre, $:opt, $:rest, $:post, *$:tail[0..2]) %*/ } - | f_arg ',' f_opt_arg(arg_value) opt_args_tail(args_tail) + | f_arg[pre] ',' f_opt_arg(arg_value)[opt] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, $3, 0, 0, $4, &@$); - /*% ripper: params!($:1, $:3, Qnil, Qnil, *$:4[0..2]) %*/ + $$ = new_args(p, $pre, $opt, 0, 0, $tail, &@$); + /*% ripper: params!($:pre, $:opt, Qnil, Qnil, *$:tail[0..2]) %*/ } - | f_arg ',' f_opt_arg(arg_value) ',' f_arg opt_args_tail(args_tail) + | f_arg[pre] ',' f_opt_arg(arg_value)[opt] ',' f_arg[post] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, $3, 0, $5, $6, &@$); - /*% ripper: params!($:1, $:3, Qnil, $:5, *$:6[0..2]) %*/ + $$ = new_args(p, $pre, $opt, 0, $post, $tail, &@$); + /*% ripper: params!($:pre, $:opt, Qnil, $:post, *$:tail[0..2]) %*/ } - | f_arg ',' f_rest_arg opt_args_tail(args_tail) + | f_arg[pre] ',' f_rest_arg[rest] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, 0, $3, 0, $4, &@$); - /*% ripper: params!($:1, Qnil, $:3, Qnil, *$:4[0..2]) %*/ + $$ = new_args(p, $pre, 0, $rest, 0, $tail, &@$); + /*% ripper: params!($:pre, Qnil, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_arg ',' f_rest_arg ',' f_arg opt_args_tail(args_tail) + | f_arg[pre] ',' f_rest_arg[rest] ',' f_arg[post] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, 0, $3, $5, $6, &@$); - /*% ripper: params!($:1, Qnil, $:3, $:5, *$:6[0..2]) %*/ + $$ = new_args(p, $pre, 0, $rest, $post, $tail, &@$); + /*% ripper: params!($:pre, Qnil, $:rest, $:post, *$:tail[0..2]) %*/ } - | f_arg opt_args_tail(args_tail) + | f_arg[pre] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, $1, 0, 0, 0, $2, &@$); - /*% ripper: params!($:1, Qnil, Qnil, Qnil, *$:2[0..2]) %*/ + $$ = new_args(p, $pre, 0, 0, 0, $tail, &@$); + /*% ripper: params!($:pre, Qnil, Qnil, Qnil, *$:tail[0..2]) %*/ } - | f_opt_arg(arg_value) ',' f_rest_arg opt_args_tail(args_tail) + | f_opt_arg(arg_value)[opt] ',' f_rest_arg[rest] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, 0, $1, $3, 0, $4, &@$); - /*% ripper: params!(Qnil, $:1, $:3, Qnil, *$:4[0..2]) %*/ + $$ = new_args(p, 0, $opt, $rest, 0, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_opt_arg(arg_value) ',' f_rest_arg ',' f_arg opt_args_tail(args_tail) + | f_opt_arg(arg_value)[opt] ',' f_rest_arg[rest] ',' f_arg[post] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, 0, $1, $3, $5, $6, &@$); - /*% ripper: params!(Qnil, $:1, $:3, $:5, *$:6[0..2]) %*/ + $$ = new_args(p, 0, $opt, $rest, $post, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, $:rest, $:post, *$:tail[0..2]) %*/ } - | f_opt_arg(arg_value) opt_args_tail(args_tail) + | f_opt_arg(arg_value)[opt] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, 0, $1, 0, 0, $2, &@$); - /*% ripper: params!(Qnil, $:1, Qnil, Qnil, *$:2[0..2]) %*/ + $$ = new_args(p, 0, $opt, 0, 0, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, Qnil, Qnil, *$:tail[0..2]) %*/ } - | f_opt_arg(arg_value) ',' f_arg opt_args_tail(args_tail) + | f_opt_arg(arg_value)[opt] ',' f_arg[post] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, 0, $1, 0, $3, $4, &@$); - /*% ripper: params!(Qnil, $:1, Qnil, $:3, *$:4[0..2]) %*/ + $$ = new_args(p, 0, $opt, 0, $post, $tail, &@$); + /*% ripper: params!(Qnil, $:opt, Qnil, $:post, *$:tail[0..2]) %*/ } - | f_rest_arg opt_args_tail(args_tail) + | f_rest_arg[rest] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, 0, 0, $1, 0, $2, &@$); - /*% ripper: params!(Qnil, Qnil, $:1, Qnil, *$:2[0..2]) %*/ + $$ = new_args(p, 0, 0, $rest, 0, $tail, &@$); + /*% ripper: params!(Qnil, Qnil, $:rest, Qnil, *$:tail[0..2]) %*/ } - | f_rest_arg ',' f_arg opt_args_tail(args_tail) + | f_rest_arg[rest] ',' f_arg[post] opt_args_tail(args_tail)[tail] { - $$ = new_args(p, 0, 0, $1, $3, $4, &@$); - /*% ripper: params!(Qnil, Qnil, $:1, $:3, *$:4[0..2]) %*/ + $$ = new_args(p, 0, 0, $rest, $post, $tail, &@$); + /*% ripper: params!(Qnil, Qnil, $:rest, $:post, *$:tail[0..2]) %*/ } - | args_tail + | args_tail[tail] { - $$ = new_args(p, 0, 0, 0, 0, $1, &@$); - /*% ripper: params!(Qnil, Qnil, Qnil, Qnil, *$:1[0..2]) %*/ + $$ = new_args(p, 0, 0, 0, 0, $tail, &@$); + /*% ripper: params!(Qnil, Qnil, Qnil, Qnil, *$:tail[0..2]) %*/ } | /* none */ { - $$ = new_args_tail(p, 0, 0, 0, &@0); - $$ = new_args(p, 0, 0, 0, 0, $$, &@0); + $$ = new_args_tail(p, 0, 0, 0, &@$); + $$ = new_args(p, 0, 0, 0, 0, $$, &@$); /*% ripper: params!(Qnil, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil) %*/ } ; diff --git a/prism/config.yml b/prism/config.yml index 472ab291a706f9..dbf0c9e1e1952d 100644 --- a/prism/config.yml +++ b/prism/config.yml @@ -17,6 +17,8 @@ errors: - ARGUMENT_FORWARDING_UNBOUND - ARGUMENT_NO_FORWARDING_AMPERSAND - ARGUMENT_NO_FORWARDING_ELLIPSES + - ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA + - ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK - ARGUMENT_NO_FORWARDING_STAR - ARGUMENT_NO_FORWARDING_STAR_STAR - ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT diff --git a/prism/prism.c b/prism/prism.c index bfa91f4296cdbf..3b61472cbc0830 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -13957,6 +13957,7 @@ parse_parameters( bool allows_forwarding_parameters, bool accepts_blocks_in_defaults, bool in_block, + pm_diagnostic_id_t diag_id_forwarding, uint16_t depth ) { pm_do_loop_stack_push(parser, false); @@ -14018,7 +14019,7 @@ parse_parameters( } case PM_TOKEN_UDOT_DOT_DOT: { if (!allows_forwarding_parameters) { - pm_parser_err_current(parser, PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES); + pm_parser_err_current(parser, diag_id_forwarding); } bool succeeded = update_parameter_state(parser, &parser->current, &order); @@ -14682,6 +14683,7 @@ parse_block_parameters( false, accepts_blocks_in_defaults, true, + is_lambda_literal ? PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA : PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK, (uint16_t) (depth + 1) ); if (!is_lambda_literal) { @@ -18904,7 +18906,17 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } else { // https://bugs.ruby-lang.org/issues/19107 bool allow_trailing_comma = parser->version >= PM_OPTIONS_VERSION_CRUBY_4_1; - params = parse_parameters(parser, PM_BINDING_POWER_DEFINED, true, allow_trailing_comma, true, true, false, (uint16_t) (depth + 1)); + params = parse_parameters( + parser, + PM_BINDING_POWER_DEFINED, + true, + allow_trailing_comma, + true, + true, + false, + PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES, + (uint16_t) (depth + 1) + ); } lex_state_set(parser, PM_LEX_STATE_BEG); @@ -18927,7 +18939,17 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b lex_state_set(parser, parser->lex_state | PM_LEX_STATE_LABEL); } - params = parse_parameters(parser, PM_BINDING_POWER_DEFINED, false, false, true, true, false, (uint16_t) (depth + 1)); + params = parse_parameters( + parser, + PM_BINDING_POWER_DEFINED, + false, + false, + true, + true, + false, + PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES, + (uint16_t) (depth + 1) + ); // Reject `def * = 1` and similar. We have to specifically check // for them because they create ambiguity with optional arguments. diff --git a/prism/templates/src/diagnostic.c.erb b/prism/templates/src/diagnostic.c.erb index a11c7893d3acda..c943c3afb95534 100644 --- a/prism/templates/src/diagnostic.c.erb +++ b/prism/templates/src/diagnostic.c.erb @@ -102,6 +102,8 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_ARGUMENT_FORWARDING_UNBOUND] = { "unexpected `...` in an non-parenthesized call", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND] = { "unexpected `&`; no anonymous block parameter", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES] = { "unexpected ... when the parent method is not forwarding", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA] = { "unexpected ... in lambda argument", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK] = { "unexpected ... in block argument", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_ARGUMENT_NO_FORWARDING_STAR] = { "unexpected `*`; no anonymous rest parameter", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR] = { "unexpected `**`; no anonymous keyword rest parameter", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT] = { "unexpected `*` splat argument after a `**` keyword splat argument", PM_ERROR_LEVEL_SYNTAX }, diff --git a/test/prism/errors/do_not_allow_forward_arguments_in_blocks.txt b/test/prism/errors/do_not_allow_forward_arguments_in_blocks.txt index df495576177796..639dec3af295c2 100644 --- a/test/prism/errors/do_not_allow_forward_arguments_in_blocks.txt +++ b/test/prism/errors/do_not_allow_forward_arguments_in_blocks.txt @@ -1,3 +1,13 @@ a {|...|} - ^~~ unexpected ... when the parent method is not forwarding + ^~~ unexpected ... in block argument + +def foo(...) + a {|...|} + ^~~ unexpected ... in block argument +end + +def foo + a {|...|} + ^~~ unexpected ... in block argument +end diff --git a/test/prism/errors/do_not_allow_forward_arguments_in_lambda_literals.txt b/test/prism/errors/do_not_allow_forward_arguments_in_lambda_literals.txt index c2405a5c66fed1..03e17683e459bb 100644 --- a/test/prism/errors/do_not_allow_forward_arguments_in_lambda_literals.txt +++ b/test/prism/errors/do_not_allow_forward_arguments_in_lambda_literals.txt @@ -1,3 +1,13 @@ ->(...) {} - ^~~ unexpected ... when the parent method is not forwarding + ^~~ unexpected ... in lambda argument + +def foo(...) + ->(...) {} + ^~~ unexpected ... in lambda argument +end + +def foo + ->(...) {} + ^~~ unexpected ... in lambda argument +end diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index 9ce8b5a020042b..0f59417fd5ddbc 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -929,36 +929,37 @@ pub const YARVINSN_trace_putobject_INT2FIX_1_: ruby_vminsn_type = 225; pub const YARVINSN_zjit_getblockparamproxy: ruby_vminsn_type = 226; pub const YARVINSN_zjit_getinstancevariable: ruby_vminsn_type = 227; pub const YARVINSN_zjit_setinstancevariable: ruby_vminsn_type = 228; -pub const YARVINSN_zjit_definedivar: ruby_vminsn_type = 229; -pub const YARVINSN_zjit_send: ruby_vminsn_type = 230; -pub const YARVINSN_zjit_opt_send_without_block: ruby_vminsn_type = 231; -pub const YARVINSN_zjit_objtostring: ruby_vminsn_type = 232; -pub const YARVINSN_zjit_opt_nil_p: ruby_vminsn_type = 233; -pub const YARVINSN_zjit_invokesuper: ruby_vminsn_type = 234; -pub const YARVINSN_zjit_invokeblock: ruby_vminsn_type = 235; -pub const YARVINSN_zjit_opt_plus: ruby_vminsn_type = 236; -pub const YARVINSN_zjit_opt_minus: ruby_vminsn_type = 237; -pub const YARVINSN_zjit_opt_mult: ruby_vminsn_type = 238; -pub const YARVINSN_zjit_opt_div: ruby_vminsn_type = 239; -pub const YARVINSN_zjit_opt_mod: ruby_vminsn_type = 240; -pub const YARVINSN_zjit_opt_eq: ruby_vminsn_type = 241; -pub const YARVINSN_zjit_opt_neq: ruby_vminsn_type = 242; -pub const YARVINSN_zjit_opt_lt: ruby_vminsn_type = 243; -pub const YARVINSN_zjit_opt_le: ruby_vminsn_type = 244; -pub const YARVINSN_zjit_opt_gt: ruby_vminsn_type = 245; -pub const YARVINSN_zjit_opt_ge: ruby_vminsn_type = 246; -pub const YARVINSN_zjit_opt_ltlt: ruby_vminsn_type = 247; -pub const YARVINSN_zjit_opt_and: ruby_vminsn_type = 248; -pub const YARVINSN_zjit_opt_or: ruby_vminsn_type = 249; -pub const YARVINSN_zjit_opt_aref: ruby_vminsn_type = 250; -pub const YARVINSN_zjit_opt_aset: ruby_vminsn_type = 251; -pub const YARVINSN_zjit_opt_length: ruby_vminsn_type = 252; -pub const YARVINSN_zjit_opt_size: ruby_vminsn_type = 253; -pub const YARVINSN_zjit_opt_empty_p: ruby_vminsn_type = 254; -pub const YARVINSN_zjit_opt_succ: ruby_vminsn_type = 255; -pub const YARVINSN_zjit_opt_not: ruby_vminsn_type = 256; -pub const YARVINSN_zjit_opt_regexpmatch2: ruby_vminsn_type = 257; -pub const VM_INSTRUCTION_SIZE: ruby_vminsn_type = 258; +pub const YARVINSN_zjit_splatkw: ruby_vminsn_type = 229; +pub const YARVINSN_zjit_definedivar: ruby_vminsn_type = 230; +pub const YARVINSN_zjit_send: ruby_vminsn_type = 231; +pub const YARVINSN_zjit_opt_send_without_block: ruby_vminsn_type = 232; +pub const YARVINSN_zjit_objtostring: ruby_vminsn_type = 233; +pub const YARVINSN_zjit_opt_nil_p: ruby_vminsn_type = 234; +pub const YARVINSN_zjit_invokesuper: ruby_vminsn_type = 235; +pub const YARVINSN_zjit_invokeblock: ruby_vminsn_type = 236; +pub const YARVINSN_zjit_opt_plus: ruby_vminsn_type = 237; +pub const YARVINSN_zjit_opt_minus: ruby_vminsn_type = 238; +pub const YARVINSN_zjit_opt_mult: ruby_vminsn_type = 239; +pub const YARVINSN_zjit_opt_div: ruby_vminsn_type = 240; +pub const YARVINSN_zjit_opt_mod: ruby_vminsn_type = 241; +pub const YARVINSN_zjit_opt_eq: ruby_vminsn_type = 242; +pub const YARVINSN_zjit_opt_neq: ruby_vminsn_type = 243; +pub const YARVINSN_zjit_opt_lt: ruby_vminsn_type = 244; +pub const YARVINSN_zjit_opt_le: ruby_vminsn_type = 245; +pub const YARVINSN_zjit_opt_gt: ruby_vminsn_type = 246; +pub const YARVINSN_zjit_opt_ge: ruby_vminsn_type = 247; +pub const YARVINSN_zjit_opt_ltlt: ruby_vminsn_type = 248; +pub const YARVINSN_zjit_opt_and: ruby_vminsn_type = 249; +pub const YARVINSN_zjit_opt_or: ruby_vminsn_type = 250; +pub const YARVINSN_zjit_opt_aref: ruby_vminsn_type = 251; +pub const YARVINSN_zjit_opt_aset: ruby_vminsn_type = 252; +pub const YARVINSN_zjit_opt_length: ruby_vminsn_type = 253; +pub const YARVINSN_zjit_opt_size: ruby_vminsn_type = 254; +pub const YARVINSN_zjit_opt_empty_p: ruby_vminsn_type = 255; +pub const YARVINSN_zjit_opt_succ: ruby_vminsn_type = 256; +pub const YARVINSN_zjit_opt_not: ruby_vminsn_type = 257; +pub const YARVINSN_zjit_opt_regexpmatch2: ruby_vminsn_type = 258; +pub const VM_INSTRUCTION_SIZE: ruby_vminsn_type = 259; pub type ruby_vminsn_type = u32; pub type rb_iseq_callback = ::std::option::Option< unsafe extern "C" fn(arg1: *const rb_iseq_t, arg2: *mut ::std::os::raw::c_void), diff --git a/zjit.rb b/zjit.rb index ce489aaf932e0b..d98be33cd127b6 100644 --- a/zjit.rb +++ b/zjit.rb @@ -247,7 +247,6 @@ def stats_string :vm_write_locals_count, :vm_write_stack_count, :vm_write_to_parent_iseq_local_count, - :vm_read_from_parent_iseq_local_count, :guard_type_count, :guard_type_exit_ratio, diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs index c1c5b72690adc5..2e665927055006 100644 --- a/zjit/src/codegen.rs +++ b/zjit/src/codegen.rs @@ -570,7 +570,6 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio Insn::GetIvar { self_val, id, ic, state: _ } => gen_getivar(jit, asm, opnd!(self_val), *id, *ic), Insn::SetGlobal { id, val, state } => no_output!(gen_setglobal(jit, asm, *id, opnd!(val), &function.frame_state(*state))), Insn::GetGlobal { id, state } => gen_getglobal(jit, asm, *id, &function.frame_state(*state)), - &Insn::GetLocal { ep_offset, level, use_sp, .. } => gen_getlocal(asm, ep_offset, level, use_sp), &Insn::IsBlockParamModified { ep } => gen_is_block_param_modified(asm, opnd!(ep)), &Insn::GetBlockParam { ep_offset, level, state } => gen_getblockparam(jit, asm, ep_offset, level, &function.frame_state(state)), &Insn::SetLocal { val, ep_offset, level } => no_output!(gen_setlocal(asm, opnd!(val), function.type_of(val), ep_offset, level)), @@ -600,8 +599,8 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio &Insn::ArrayExtend { left, right, state } => { no_output!(gen_array_extend(jit, asm, opnd!(left), opnd!(right), &function.frame_state(state))) }, Insn::LoadPC => gen_load_pc(asm), Insn::LoadEC => gen_load_ec(), + Insn::LoadSP => gen_load_sp(), &Insn::GetEP { level } => gen_get_ep(asm, level), - Insn::GetLEP => gen_get_lep(jit, asm), Insn::LoadSelf => gen_load_self(), &Insn::LoadField { recv, id, offset, return_type } => gen_load_field(asm, opnd!(recv), id, offset, return_type), &Insn::StoreField { recv, id, offset, val } => no_output!(gen_store_field(asm, opnd!(recv), id, offset, opnd!(val), function.type_of(val))), @@ -630,18 +629,6 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio /// Gets the EP of the ISeq of the containing method, or "local level". /// Equivalent of GET_LEP() macro. fn gen_get_lep(jit: &JITState, asm: &mut Assembler) -> Opnd { - // Equivalent of get_lvar_level() in compile.c - fn get_lvar_level(mut iseq: IseqPtr) -> u32 { - let local_iseq = unsafe { rb_get_iseq_body_local_iseq(iseq) }; - let mut level = 0; - while iseq != local_iseq { - iseq = unsafe { rb_get_iseq_body_parent_iseq(iseq) }; - level += 1; - } - - level - } - let level = get_lvar_level(jit.iseq); gen_get_ep(asm, level) } @@ -722,26 +709,6 @@ fn gen_unbox_fixnum(asm: &mut Assembler, val: Opnd) -> Opnd { asm.rshift(val, Opnd::UImm(1)) } -/// Get a local variable from a higher scope or the heap. `local_ep_offset` is in number of VALUEs. -/// We generate this instruction with level=0 only when the local variable is on the heap, so we -/// can't optimize the level=0 case using the SP register. -fn gen_getlocal(asm: &mut Assembler, local_ep_offset: u32, level: u32, use_sp: bool) -> lir::Opnd { - let local_ep_offset = i32::try_from(local_ep_offset).unwrap_or_else(|_| panic!("Could not convert local_ep_offset {local_ep_offset} to i32")); - if level > 0 { - gen_incr_counter(asm, Counter::vm_read_from_parent_iseq_local_count); - } - let local = if use_sp { - assert_eq!(level, 0, "use_sp optimization should be used only for level=0 locals"); - let offset = -(SIZEOF_VALUE_I32 * (local_ep_offset + 1)); - Opnd::mem(64, SP, offset) - } else { - let ep = gen_get_ep(asm, level); - let offset = -(SIZEOF_VALUE_I32 * local_ep_offset); - Opnd::mem(64, ep, offset) - }; - asm.load(local) -} - /// Set a local variable from a higher scope or the heap. `local_ep_offset` is in number of VALUEs. /// We generate this instruction with level=0 only when the local variable is on the heap, so we /// can't optimize the level=0 case using the SP register. @@ -1230,6 +1197,10 @@ fn gen_load_ec() -> Opnd { EC } +fn gen_load_sp() -> Opnd { + SP +} + fn gen_load_self() -> Opnd { Opnd::mem(64, CFP, RUBY_OFFSET_CFP_SELF) } @@ -1461,7 +1432,7 @@ fn gen_send_iseq_direct( // which optional keyword arguments need their defaults evaluated. // We write this to the local table slot at bits_start so that: // 1. The interpreter can read it via checkkeyword if we side-exit - // 2. The JIT entry can read it via GetLocal + // 2. The JIT entry can read it from the callee frame slot if unsafe { rb_get_iseq_flags_has_kw(iseq) } { let keyword = unsafe { rb_get_iseq_body_param_keyword(iseq) }; let bits_start = unsafe { (*keyword).bits_start } as usize; diff --git a/zjit/src/cruby.rs b/zjit/src/cruby.rs index 49a3ccb08d593b..e51853fa24842f 100644 --- a/zjit/src/cruby.rs +++ b/zjit/src/cruby.rs @@ -831,6 +831,18 @@ pub fn iseq_name(iseq: IseqPtr) -> String { } } +// Equivalent of get_lvar_level() in compile.c +pub fn get_lvar_level(mut iseq: IseqPtr) -> u32 { + let local_iseq = unsafe { rb_get_iseq_body_local_iseq(iseq) }; + let mut level = 0; + while iseq != local_iseq { + iseq = unsafe { rb_get_iseq_body_parent_iseq(iseq) }; + level += 1; + } + + level +} + // Location is the file defining the method, colon, method name. // Filenames are sometimes internal strings supplied to eval, // so be careful with them. diff --git a/zjit/src/cruby_bindings.inc.rs b/zjit/src/cruby_bindings.inc.rs index e1e162c0c290f2..172196c312d198 100644 --- a/zjit/src/cruby_bindings.inc.rs +++ b/zjit/src/cruby_bindings.inc.rs @@ -1756,36 +1756,37 @@ pub const YARVINSN_trace_putobject_INT2FIX_1_: ruby_vminsn_type = 225; pub const YARVINSN_zjit_getblockparamproxy: ruby_vminsn_type = 226; pub const YARVINSN_zjit_getinstancevariable: ruby_vminsn_type = 227; pub const YARVINSN_zjit_setinstancevariable: ruby_vminsn_type = 228; -pub const YARVINSN_zjit_definedivar: ruby_vminsn_type = 229; -pub const YARVINSN_zjit_send: ruby_vminsn_type = 230; -pub const YARVINSN_zjit_opt_send_without_block: ruby_vminsn_type = 231; -pub const YARVINSN_zjit_objtostring: ruby_vminsn_type = 232; -pub const YARVINSN_zjit_opt_nil_p: ruby_vminsn_type = 233; -pub const YARVINSN_zjit_invokesuper: ruby_vminsn_type = 234; -pub const YARVINSN_zjit_invokeblock: ruby_vminsn_type = 235; -pub const YARVINSN_zjit_opt_plus: ruby_vminsn_type = 236; -pub const YARVINSN_zjit_opt_minus: ruby_vminsn_type = 237; -pub const YARVINSN_zjit_opt_mult: ruby_vminsn_type = 238; -pub const YARVINSN_zjit_opt_div: ruby_vminsn_type = 239; -pub const YARVINSN_zjit_opt_mod: ruby_vminsn_type = 240; -pub const YARVINSN_zjit_opt_eq: ruby_vminsn_type = 241; -pub const YARVINSN_zjit_opt_neq: ruby_vminsn_type = 242; -pub const YARVINSN_zjit_opt_lt: ruby_vminsn_type = 243; -pub const YARVINSN_zjit_opt_le: ruby_vminsn_type = 244; -pub const YARVINSN_zjit_opt_gt: ruby_vminsn_type = 245; -pub const YARVINSN_zjit_opt_ge: ruby_vminsn_type = 246; -pub const YARVINSN_zjit_opt_ltlt: ruby_vminsn_type = 247; -pub const YARVINSN_zjit_opt_and: ruby_vminsn_type = 248; -pub const YARVINSN_zjit_opt_or: ruby_vminsn_type = 249; -pub const YARVINSN_zjit_opt_aref: ruby_vminsn_type = 250; -pub const YARVINSN_zjit_opt_aset: ruby_vminsn_type = 251; -pub const YARVINSN_zjit_opt_length: ruby_vminsn_type = 252; -pub const YARVINSN_zjit_opt_size: ruby_vminsn_type = 253; -pub const YARVINSN_zjit_opt_empty_p: ruby_vminsn_type = 254; -pub const YARVINSN_zjit_opt_succ: ruby_vminsn_type = 255; -pub const YARVINSN_zjit_opt_not: ruby_vminsn_type = 256; -pub const YARVINSN_zjit_opt_regexpmatch2: ruby_vminsn_type = 257; -pub const VM_INSTRUCTION_SIZE: ruby_vminsn_type = 258; +pub const YARVINSN_zjit_splatkw: ruby_vminsn_type = 229; +pub const YARVINSN_zjit_definedivar: ruby_vminsn_type = 230; +pub const YARVINSN_zjit_send: ruby_vminsn_type = 231; +pub const YARVINSN_zjit_opt_send_without_block: ruby_vminsn_type = 232; +pub const YARVINSN_zjit_objtostring: ruby_vminsn_type = 233; +pub const YARVINSN_zjit_opt_nil_p: ruby_vminsn_type = 234; +pub const YARVINSN_zjit_invokesuper: ruby_vminsn_type = 235; +pub const YARVINSN_zjit_invokeblock: ruby_vminsn_type = 236; +pub const YARVINSN_zjit_opt_plus: ruby_vminsn_type = 237; +pub const YARVINSN_zjit_opt_minus: ruby_vminsn_type = 238; +pub const YARVINSN_zjit_opt_mult: ruby_vminsn_type = 239; +pub const YARVINSN_zjit_opt_div: ruby_vminsn_type = 240; +pub const YARVINSN_zjit_opt_mod: ruby_vminsn_type = 241; +pub const YARVINSN_zjit_opt_eq: ruby_vminsn_type = 242; +pub const YARVINSN_zjit_opt_neq: ruby_vminsn_type = 243; +pub const YARVINSN_zjit_opt_lt: ruby_vminsn_type = 244; +pub const YARVINSN_zjit_opt_le: ruby_vminsn_type = 245; +pub const YARVINSN_zjit_opt_gt: ruby_vminsn_type = 246; +pub const YARVINSN_zjit_opt_ge: ruby_vminsn_type = 247; +pub const YARVINSN_zjit_opt_ltlt: ruby_vminsn_type = 248; +pub const YARVINSN_zjit_opt_and: ruby_vminsn_type = 249; +pub const YARVINSN_zjit_opt_or: ruby_vminsn_type = 250; +pub const YARVINSN_zjit_opt_aref: ruby_vminsn_type = 251; +pub const YARVINSN_zjit_opt_aset: ruby_vminsn_type = 252; +pub const YARVINSN_zjit_opt_length: ruby_vminsn_type = 253; +pub const YARVINSN_zjit_opt_size: ruby_vminsn_type = 254; +pub const YARVINSN_zjit_opt_empty_p: ruby_vminsn_type = 255; +pub const YARVINSN_zjit_opt_succ: ruby_vminsn_type = 256; +pub const YARVINSN_zjit_opt_not: ruby_vminsn_type = 257; +pub const YARVINSN_zjit_opt_regexpmatch2: ruby_vminsn_type = 258; +pub const VM_INSTRUCTION_SIZE: ruby_vminsn_type = 259; pub type ruby_vminsn_type = u32; pub type rb_iseq_callback = ::std::option::Option< unsafe extern "C" fn(arg1: *const rb_iseq_t, arg2: *mut ::std::os::raw::c_void), diff --git a/zjit/src/cruby_methods.rs b/zjit/src/cruby_methods.rs index d6cbda0c698144..88002078f2ff2d 100644 --- a/zjit/src/cruby_methods.rs +++ b/zjit/src/cruby_methods.rs @@ -333,7 +333,10 @@ fn inline_kernel_block_given_p(fun: &mut hir::Function, block: hir::BlockId, _re let local_iseq = unsafe { rb_get_iseq_body_local_iseq(fun.iseq()) }; if unsafe { rb_get_iseq_body_type(local_iseq) } == ISEQ_TYPE_METHOD { - let lep = fun.push_insn(block, hir::Insn::GetLEP); + // Get the EP of the ISeq of the containing method, or "local level", skipping over block-level EPs. + // Equivalent of GET_LEP() macro. + let level = crate::cruby::get_lvar_level(fun.iseq()); + let lep = fun.push_insn(block, hir::Insn::GetEP { level }); Some(fun.push_insn(block, hir::Insn::IsBlockGiven { lep })) } else { Some(fun.push_insn(block, hir::Insn::Const { val: hir::Const::Value(Qfalse) })) diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index 7cb117eca5be4c..d531b6d8fa1289 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -522,6 +522,9 @@ pub enum SideExitReason { FixnumModByZero, FixnumDivByZero, BoxFixnumOverflow, + SplatKwNotNilOrHash, + SplatKwPolymorphic, + SplatKwNotProfiled, } #[derive(Debug, Clone, Copy)] @@ -853,6 +856,8 @@ pub enum Insn { LoadPC, /// Load EC LoadEC, + /// Load SP + LoadSP, /// Load cfp->self LoadSelf, LoadField { recv: InsnId, id: ID, offset: i32, return_type: Type }, @@ -861,11 +866,6 @@ pub enum Insn { StoreField { recv: InsnId, id: ID, offset: i32, val: InsnId }, WriteBarrier { recv: InsnId, val: InsnId }, - /// Get a local variable from a higher scope or the heap. - /// If `use_sp` is true, it uses the SP register to optimize the read. - /// `rest_param` is used by infer_types to infer the ArrayExact type. - /// TODO: Replace the level == 0 + use_sp path with LoadSP + LoadField. - GetLocal { level: u32, ep_offset: u32, use_sp: bool, rest_param: bool }, /// Check whether VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM is set in the environment flags. /// Returns CBool (0/1). IsBlockParamModified { ep: InsnId }, @@ -884,10 +884,6 @@ pub enum Insn { /// Get the EP at the given level from the current CFP. GetEP { level: u32 }, - /// Get the EP of the ISeq of the containing method, or "local level", skipping over block-level EPs. - /// Equivalent of GET_LEP() macro. - GetLEP, - /// Own a FrameState so that instructions can look up their dominating FrameState when /// generating deopt side-exits and frame reconstruction metadata. Does not directly generate /// any code. @@ -1169,7 +1165,8 @@ impl Insn { Insn::GetConstantPath { .. } => effects::Any, Insn::IsBlockGiven { .. } => Effect::read_write(abstract_heaps::Other, abstract_heaps::Empty), Insn::FixnumBitCheck { .. } => effects::Empty, - Insn::IsA { .. } => effects::Empty, + // IsA needs to read the class of the value and traverse the class hierarchy, which we model as reading from Memory. + Insn::IsA { .. } => Effect::read_write(abstract_heaps::Memory, abstract_heaps::Empty), Insn::GetGlobal { .. } => effects::Any, Insn::SetGlobal { .. } => effects::Any, Insn::GetIvar { .. } => effects::Any, @@ -1177,13 +1174,13 @@ impl Insn { Insn::DefinedIvar { .. } => effects::Any, Insn::LoadPC { .. } => Effect::read_write(abstract_heaps::PC, abstract_heaps::Empty), Insn::LoadEC { .. } => effects::Empty, - Insn::GetEP { .. } => effects::Empty, - Insn::GetLEP { .. } => effects::Empty, + Insn::LoadSP { .. } => effects::Empty, + // GetEP reads from the current frame pointer (abstract_heaps::Frame) and also traverses previous frames too. + Insn::GetEP { .. } => Effect::read_write(abstract_heaps::Memory, abstract_heaps::Empty), Insn::LoadSelf { .. } => Effect::read_write(abstract_heaps::Frame, abstract_heaps::Empty), Insn::LoadField { .. } => Effect::read_write(abstract_heaps::Memory, abstract_heaps::Empty), Insn::StoreField { .. } => effects::Any, Insn::WriteBarrier { .. } => effects::Any, - Insn::GetLocal { .. } => Effect::read_write(abstract_heaps::Locals, abstract_heaps::Empty), Insn::SetLocal { .. } => effects::Any, Insn::GetSpecialSymbol { .. } => effects::Any, Insn::GetSpecialNumber { .. } => effects::Any, @@ -1240,8 +1237,16 @@ impl Insn { Insn::FixnumRShift { .. } => effects::Empty, Insn::ObjToString { .. } => effects::Any, Insn::AnyToString { .. } => effects::Any, - Insn::GuardType { .. } => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Control), - Insn::GuardTypeNot { .. } => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Control), + Insn::GuardType { guard_type, .. } + => Effect::read_write( + if guard_type.is_subtype(types::Immediate) { abstract_heaps::Empty } else { abstract_heaps::Memory }, + abstract_heaps::Control + ), + Insn::GuardTypeNot { guard_type, .. } + => Effect::read_write( + if guard_type.is_subtype(types::Immediate) { abstract_heaps::Empty } else { abstract_heaps::Memory }, + abstract_heaps::Control + ), Insn::GuardBitEquals { .. } => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Control), Insn::GuardAnyBitSet { .. } => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Control), Insn::GuardNoBitsSet { .. } => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Control), @@ -1254,7 +1259,11 @@ impl Insn { Insn::CheckInterrupts { .. } => Effect::read_write(abstract_heaps::InterruptFlag, abstract_heaps::Control), Insn::InvokeProc { .. } => effects::Any, Insn::RefineType { .. } => effects::Empty, - Insn::HasType { .. } => effects::Empty, + Insn::HasType { expected, .. } + => Effect::read_write( + if expected.is_subtype(types::Immediate) { abstract_heaps::Empty } else { abstract_heaps::Memory }, + abstract_heaps::Control + ), Insn::Entries { .. } => effects::Any, } } @@ -1303,13 +1312,18 @@ fn get_local_var_id(iseq: IseqPtr, level: u32, ep_offset: u32) -> ID { fn get_local_var_name_for_printer(iseq: Option, level: u32, ep_offset: u32) -> Option { let id = get_local_var_id(iseq?, level, ep_offset); - if id.0 == 0 || unsafe { rb_id2str(id) } == Qfalse { + if id_is_empty(id) { return Some(String::from("")); } Some(format!(":{}", id.contents_lossy())) } + +fn id_is_empty(id: ID) -> bool { + id.0 == 0 || unsafe { rb_id2str(id) } == Qfalse +} + /// Construct a qualified method name for display/debug output. /// Returns strings like "Array#length" for instance methods or "Foo.bar" for singleton methods. fn qualified_method_name(class: VALUE, method_id: ID) -> String { @@ -1651,23 +1665,22 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> { Insn::GetIvar { self_val, id, .. } => write!(f, "GetIvar {self_val}, :{}", id.contents_lossy()), Insn::LoadPC => write!(f, "LoadPC"), Insn::LoadEC => write!(f, "LoadEC"), + Insn::LoadSP => write!(f, "LoadSP"), &Insn::GetEP { level } => write!(f, "GetEP {level}"), - Insn::GetLEP => write!(f, "GetLEP"), Insn::LoadSelf => write!(f, "LoadSelf"), - &Insn::LoadField { recv, id, offset, return_type: _ } => write!(f, "LoadField {recv}, :{}@{:#x}", id.contents_lossy(), self.ptr_map.map_offset(offset)), + &Insn::LoadField { recv, id, offset, return_type: _ } => { + let field_name = if id_is_empty(id) { + std::borrow::Cow::Borrowed("") + } else { + id.contents_lossy() + }; + write!(f, "LoadField {recv}, :{}@{:#x}", field_name, self.ptr_map.map_offset(offset)) + } &Insn::StoreField { recv, id, offset, val } => write!(f, "StoreField {recv}, :{}@{:#x}, {val}", id.contents_lossy(), self.ptr_map.map_offset(offset)), &Insn::WriteBarrier { recv, val } => write!(f, "WriteBarrier {recv}, {val}"), Insn::SetIvar { self_val, id, val, .. } => write!(f, "SetIvar {self_val}, :{}, {val}", id.contents_lossy()), Insn::GetGlobal { id, .. } => write!(f, "GetGlobal :{}", id.contents_lossy()), Insn::SetGlobal { id, val, .. } => write!(f, "SetGlobal :{}, {val}", id.contents_lossy()), - &Insn::GetLocal { level, ep_offset, use_sp: true, rest_param } => { - let name = get_local_var_name_for_printer(self.iseq, level, ep_offset).map_or(String::new(), |x| format!("{x}, ")); - write!(f, "GetLocal {name}l{level}, SP@{}{}", ep_offset + 1, if rest_param { ", *" } else { "" }) - }, - &Insn::GetLocal { level, ep_offset, use_sp: false, rest_param } => { - let name = get_local_var_name_for_printer(self.iseq, level, ep_offset).map_or(String::new(), |x| format!("{x}, ")); - write!(f, "GetLocal {name}l{level}, EP@{ep_offset}{}", if rest_param { ", *" } else { "" }) - }, &Insn::IsBlockParamModified { ep } => { write!(f, "IsBlockParamModified {ep}") }, @@ -2240,13 +2253,12 @@ impl Function { | PatchPoint {..} | PutSpecialObject {..} | GetGlobal {..} - | GetLocal {..} | SideExit {..} | EntryPoint {..} | LoadPC + | LoadSP | LoadEC | GetEP {..} - | GetLEP | LoadSelf | IncrCounterPtr {..} | IncrCounter(_)) => result.clone(), @@ -2583,9 +2595,9 @@ impl Function { Insn::GetGlobal { .. } => types::BasicObject, Insn::GetIvar { .. } => types::BasicObject, Insn::LoadPC => types::CPtr, + Insn::LoadSP => types::CPtr, Insn::LoadEC => types::CPtr, Insn::GetEP { .. } => types::CPtr, - Insn::GetLEP => types::CPtr, Insn::LoadSelf => types::BasicObject, &Insn::LoadField { return_type, .. } => return_type, Insn::GetSpecialSymbol { .. } => types::BasicObject, @@ -2595,8 +2607,6 @@ impl Function { Insn::ToArray { .. } => types::ArrayExact, Insn::ObjToString { .. } => types::BasicObject, Insn::AnyToString { .. } => types::String, - Insn::GetLocal { rest_param: true, .. } => types::ArrayExact, - Insn::GetLocal { .. } => types::BasicObject, Insn::IsBlockParamModified { .. } => types::CBool, Insn::GetBlockParam { .. } => types::BasicObject, // The type of Snapshot doesn't really matter; it's never materialized. It's used only @@ -3078,16 +3088,14 @@ impl Function { self.push_insn(block, Insn::GuardNoBitsSet { val: flags, mask: Const::CUInt64(RUBY_ELTS_SHARED as u64), mask_name: Some(ID!(RUBY_ELTS_SHARED)), reason: SideExitReason::GuardNotShared, state }); } - // TODO: This helper is currently used for level>0 local reads only. - // Split GetLocal(level==0) into explicit SP/EP helpers in a follow-up. fn get_local_from_ep( &mut self, block: BlockId, + ep: InsnId, ep_offset: u32, level: u32, return_type: Type, ) -> InsnId { - let ep = self.push_insn(block, Insn::GetEP { level }); let local_id = get_local_var_id(self.iseq, level, ep_offset); let ep_offset = i32::try_from(ep_offset) .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to i32")); @@ -3101,6 +3109,26 @@ impl Function { }) } + fn get_local_from_sp( + &mut self, + block: BlockId, + sp: InsnId, + ep_offset: u32, + return_type: Type, + ) -> InsnId { + let local_id = get_local_var_id(self.iseq, 0, ep_offset); + let ep_offset = i32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to i32")); + let offset = -(SIZEOF_VALUE_I32 * (ep_offset + 1)); + + self.push_insn(block, Insn::LoadField { + recv: sp, + id: local_id, + offset, + return_type, + }) + } + /// Rewrite eligible Send opcodes into SendDirect /// opcodes if we know the target ISEQ statically. This removes run-time method lookups and /// opens the door for inlining. @@ -3507,7 +3535,10 @@ impl Function { state }); - let lep = fun.push_insn(block, Insn::GetLEP); + // Get the EP of the ISeq of the containing method, or "local level", skipping over block-level EPs. + // Equivalent of GET_LEP() macro. + let level = get_lvar_level(fun.iseq); + let lep = fun.push_insn(block, Insn::GetEP { level }); // Load ep[VM_ENV_DATA_INDEX_ME_CREF] let method_entry = fun.push_insn(block, Insn::LoadField { recv: lep, id: ID!(_ep_method_entry), offset: SIZEOF_VALUE_I32 * VM_ENV_DATA_INDEX_ME_CREF, return_type: types::RubyValue }); // Guard that it matches the expected CME @@ -4609,6 +4640,12 @@ impl Function { _ => None, }) } + Insn::FixnumOr { left, right, .. } => { + self.fold_fixnum_bop(insn_id, left, right, |l, r| match (l, r) { + (Some(l), Some(r)) => Some(l | r), + _ => None, + }) + } Insn::FixnumEq { left, right, .. } => { self.fold_fixnum_pred(insn_id, left, right, |l, r| match (l, r) { (Some(l), Some(r)) => Some(l == r), @@ -4700,11 +4737,10 @@ impl Function { | &Insn::Entries { .. } | &Insn::EntryPoint { .. } | &Insn::LoadPC + | &Insn::LoadSP | &Insn::LoadEC | &Insn::GetEP { .. } - | &Insn::GetLEP | &Insn::LoadSelf - | &Insn::GetLocal { .. } | &Insn::PutSpecialObject { .. } | &Insn::IncrCounter(_) | &Insn::IncrCounterPtr { .. } => @@ -5568,9 +5604,9 @@ impl Function { | Insn::IsBlockParamModified { .. } | Insn::GetGlobal { .. } | Insn::LoadPC + | Insn::LoadSP | Insn::LoadEC | Insn::GetEP { .. } - | Insn::GetLEP | Insn::LoadSelf | Insn::Snapshot { .. } | Insn::Jump { .. } @@ -5584,7 +5620,6 @@ impl Function { | Insn::GetClassVar { .. } | Insn::GetSpecialNumber { .. } | Insn::GetSpecialSymbol { .. } - | Insn::GetLocal { .. } | Insn::GetBlockParam { .. } | Insn::StoreField { .. } => { Ok(()) @@ -6681,6 +6716,33 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { }; state.stack_push(obj); } + YARVINSN_splatkw => { + let block_val = state.stack_pop()?; + let hash = state.stack_pop()?; + // Get profiled type of hash (operand index 0) + let summary = profiles.payload.profile.get_operand_types(exit_state.insn_idx) + .and_then(|types| types.first()) + .map(|dist| TypeDistributionSummary::new(dist)); + let Some(summary) = summary else { + fun.push_insn(block, Insn::SideExit { state: exit_id, reason: SideExitReason::SplatKwNotProfiled }); + break; // End the block + }; + if !summary.is_monomorphic() { + fun.push_insn(block, Insn::SideExit { state: exit_id, reason: SideExitReason::SplatKwPolymorphic }); + break; // End the block + } + let ty = Type::from_profiled_type(summary.bucket(0)); + let obj = if ty.is_subtype(types::NilClass) { + fun.push_insn(block, Insn::GuardType { val: hash, guard_type: types::NilClass, state: exit_id }) + } else if ty.is_subtype(types::HashExact) { + fun.push_insn(block, Insn::GuardType { val: hash, guard_type: types::HashExact, state: exit_id }) + } else { + fun.push_insn(block, Insn::SideExit { state: exit_id, reason: SideExitReason::SplatKwNotNilOrHash }); + break; // End the block + }; + state.stack_push(obj); + state.stack_push(block_val); + } YARVINSN_concattoarray => { let right = state.stack_pop()?; let left = state.stack_pop()?; @@ -6743,7 +6805,8 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { let val = if !local_inval { state.getlocal(ep_offset) } else if ep_escaped { - fun.push_insn(block, Insn::GetLocal { ep_offset, level: 0, use_sp: false, rest_param: false }) + let ep = fun.push_insn(block, Insn::GetEP { level: 0 }); + fun.get_local_from_ep(block, ep, ep_offset, 0, types::BasicObject) } else { let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state.without_locals() }); fun.push_insn(block, Insn::PatchPoint { invariant: Invariant::NoEPEscape(iseq), state: exit_id }); @@ -6881,7 +6944,8 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { state.stack_push(val); } else if ep_escaped { // Read the local using EP - let val = fun.push_insn(block, Insn::GetLocal { ep_offset, level: 0, use_sp: false, rest_param: false }); + let ep = fun.push_insn(block, Insn::GetEP { level: 0 }); + let val = fun.get_local_from_ep(block, ep, ep_offset, 0, types::BasicObject); state.setlocal(ep_offset, val); // remember the result to spill on side-exits state.stack_push(val); } else { @@ -6915,7 +6979,8 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { } YARVINSN_getlocal_WC_1 => { let ep_offset = get_arg(pc, 0).as_u32(); - state.stack_push(fun.get_local_from_ep(block, ep_offset, 1, types::BasicObject)); + let ep = fun.push_insn(block, Insn::GetEP { level: 1 }); + state.stack_push(fun.get_local_from_ep(block, ep, ep_offset, 1, types::BasicObject)); } YARVINSN_setlocal_WC_1 => { let ep_offset = get_arg(pc, 0).as_u32(); @@ -6924,11 +6989,8 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { YARVINSN_getlocal => { let ep_offset = get_arg(pc, 0).as_u32(); let level = get_arg(pc, 1).as_u32(); - if level == 0 { - state.stack_push(fun.push_insn(block, Insn::GetLocal { ep_offset, level, use_sp: false, rest_param: false })); - } else { - state.stack_push(fun.get_local_from_ep(block, ep_offset, level, types::BasicObject)); - } + let ep = fun.push_insn(block, Insn::GetEP { level }); + state.stack_push(fun.get_local_from_ep(block, ep, ep_offset, level, types::BasicObject)); } YARVINSN_setlocal => { let ep_offset = get_arg(pc, 0).as_u32(); @@ -7040,11 +7102,13 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { })); // Push modified block: read Proc from EP. - let modified_val = if level == 0 { - fun.push_insn(modified_block, Insn::GetLocal { ep_offset, level, use_sp: false, rest_param: false }) - } else { - fun.get_local_from_ep(modified_block, ep_offset, level, types::BasicObject) - }; + let ep = fun.push_insn(modified_block, Insn::GetEP { level }); + let modified_val = fun.get_local_from_ep(modified_block, + ep, + ep_offset, + level, + types::BasicObject, + ); finish_getblockparam_branch( &mut fun, modified_block, @@ -7314,11 +7378,14 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { // Reload locals that may have been modified by the blockiseq. // TODO: Avoid reloading locals that are not referenced by the blockiseq // or not used after this. Max thinks we could eventually DCE them. + let ep = fun.push_insn(block, Insn::GetEP { level: 0 }); for local_idx in 0..state.locals.len() { - let ep_offset = local_idx_to_ep_offset(iseq, local_idx) as u32; - // TODO: We could use `use_sp: true` with PatchPoint - let val = fun.push_insn(block, Insn::GetLocal { ep_offset, level: 0, use_sp: false, rest_param: false }); - state.setlocal(ep_offset, val); + let ep_offset = local_idx_to_ep_offset(iseq, local_idx); + let ep_offset_u32 = u32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to u32")); + // TODO: We could use `use_sp: true` with PatchPoint. + let val = fun.get_local_from_ep(block, ep, ep_offset_u32, 0, types::BasicObject); + state.setlocal(ep_offset_u32, val); } } } @@ -7342,11 +7409,14 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { if !blockiseq.is_null() { // Reload locals that may have been modified by the blockiseq. + let ep = fun.push_insn(block, Insn::GetEP { level: 0 }); for local_idx in 0..state.locals.len() { - let ep_offset = local_idx_to_ep_offset(iseq, local_idx) as u32; - // TODO: We could use `use_sp: true` with PatchPoint - let val = fun.push_insn(block, Insn::GetLocal { ep_offset, level: 0, use_sp: false, rest_param: false }); - state.setlocal(ep_offset, val); + let ep_offset = local_idx_to_ep_offset(iseq, local_idx); + let ep_offset_u32 = u32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to u32")); + // TODO: We could use `use_sp: true` with PatchPoint. + let val = fun.get_local_from_ep(block, ep, ep_offset_u32, 0, types::BasicObject); + state.setlocal(ep_offset_u32, val); } } } @@ -7371,11 +7441,14 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { // Reload locals that may have been modified by the blockiseq. // TODO: Avoid reloading locals that are not referenced by the blockiseq // or not used after this. Max thinks we could eventually DCE them. + let ep = fun.push_insn(block, Insn::GetEP { level: 0 }); for local_idx in 0..state.locals.len() { - let ep_offset = local_idx_to_ep_offset(iseq, local_idx) as u32; - // TODO: We could use `use_sp: true` with PatchPoint - let val = fun.push_insn(block, Insn::GetLocal { ep_offset, level: 0, use_sp: false, rest_param: false }); - state.setlocal(ep_offset, val); + let ep_offset = local_idx_to_ep_offset(iseq, local_idx); + let ep_offset_u32 = u32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to u32")); + // TODO: We could use `use_sp: true` with PatchPoint. + let val = fun.get_local_from_ep(block, ep, ep_offset_u32, 0, types::BasicObject); + state.setlocal(ep_offset_u32, val); } } } @@ -7400,11 +7473,14 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result { // Reload locals that may have been modified by the blockiseq. // TODO: Avoid reloading locals that are not referenced by the blockiseq // or not used after this. Max thinks we could eventually DCE them. + let ep = fun.push_insn(block, Insn::GetEP { level: 0 }); for local_idx in 0..state.locals.len() { - let ep_offset = local_idx_to_ep_offset(iseq, local_idx) as u32; - // TODO: We could use `use_sp: true` with PatchPoint - let val = fun.push_insn(block, Insn::GetLocal { ep_offset, level: 0, use_sp: false, rest_param: false }); - state.setlocal(ep_offset, val); + let ep_offset = local_idx_to_ep_offset(iseq, local_idx); + let ep_offset_u32 = u32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to u32")); + // TODO: We could use `use_sp: true` with PatchPoint. + let val = fun.get_local_from_ep(block, ep, ep_offset_u32, 0, types::BasicObject); + state.setlocal(ep_offset_u32, val); } } } @@ -7695,12 +7771,31 @@ fn compile_entry_state(fun: &mut Function) -> (InsnId, FrameState) { let self_param = fun.push_insn(entry_block, Insn::LoadSelf); let mut entry_state = FrameState::new(iseq); + // If the ISEQ does not escape EP, we can assume EP + 1 == SP + // TODO: This should maybe also consider if the EP has historically been escaped in this iseq. + // (see: https://github.com/Shopify/ruby/issues/774) + let use_sp = !iseq_escapes_ep(iseq); + let mut base: Option = None; for local_idx in 0..num_locals(iseq) { if local_idx < param_size { - let ep_offset = local_idx_to_ep_offset(iseq, local_idx) as u32; - let use_sp = !iseq_escapes_ep(iseq); // If the ISEQ does not escape EP, we can assume EP + 1 == SP - let rest_param = Some(local_idx as i32) == rest_param_idx; - entry_state.locals.push(fun.push_insn(entry_block, Insn::GetLocal { level: 0, ep_offset, use_sp, rest_param })); + let ep_offset = local_idx_to_ep_offset(iseq, local_idx); + let ep_offset_u32 = u32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to u32")); + let return_type = if Some(local_idx as i32) == rest_param_idx { + types::ArrayExact + } else { + types::BasicObject + }; + let recv = *base.get_or_insert_with(|| { + let base_insn = if use_sp { Insn::LoadSP } else { Insn::GetEP { level: 0 } }; + fun.push_insn(entry_block, base_insn) + }); + let val = if use_sp { + fun.get_local_from_sp(entry_block, recv, ep_offset_u32, return_type) + } else { + fun.get_local_from_ep(entry_block, recv, ep_offset_u32, 0, return_type) + }; + entry_state.locals.push(val); } else { entry_state.locals.push(fun.push_insn(entry_block, Insn::Const { val: Const::Value(Qnil) })); } @@ -7745,6 +7840,7 @@ fn compile_jit_entry_state(fun: &mut Function, jit_entry_block: BlockId, jit_ent let self_param = fun.push_insn(jit_entry_block, Insn::LoadArg { idx: arg_idx, id: ID!(self_), val_type: types::BasicObject }); arg_idx += 1; let mut entry_state = FrameState::new(iseq); + let mut ep: Option = None; for local_idx in 0..num_locals(iseq) { if (lead_num + passed_opt_num..lead_num + opt_num).contains(&local_idx) { // Omitted optionals are locals, so they start as nils before their code run @@ -7753,9 +7849,18 @@ fn compile_jit_entry_state(fun: &mut Function, jit_entry_block: BlockId, jit_ent // Read the kw_bits value written by the caller to the callee frame. // This tells us which optional keywords were NOT provided and need their defaults evaluated. // Note: The caller writes kw_bits to memory via gen_send_iseq_direct but does NOT pass it - // as a C argument, so we must read it from memory using GetLocal rather than Param. - let ep_offset = local_idx_to_ep_offset(iseq, local_idx) as u32; - entry_state.locals.push(fun.push_insn(jit_entry_block, Insn::GetLocal { level: 0, ep_offset, use_sp: false, rest_param: false })); + // as a C argument, so we must read it from EP memory rather than Param. + let ep_offset = local_idx_to_ep_offset(iseq, local_idx); + let ep_offset_u32 = u32::try_from(ep_offset) + .unwrap_or_else(|_| panic!("Could not convert ep_offset {ep_offset} to u32")); + let ep = *ep.get_or_insert_with(|| fun.push_insn(jit_entry_block, Insn::GetEP { level: 0 })); + entry_state.locals.push(fun.get_local_from_ep( + jit_entry_block, + ep, + ep_offset_u32, + 0, + types::BasicObject, + )); } else if local_idx < param_size { let id = unsafe { rb_zjit_local_id(iseq, local_idx.try_into().unwrap()) }; entry_state.locals.push(fun.push_insn(jit_entry_block, Insn::LoadArg { idx: arg_idx, id, val_type: types::BasicObject })); @@ -8498,36 +8603,37 @@ mod graphviz_tests { mode=hier; overlap=false; splines=true; bb0 [label=< - +
bb0() 
Entries bb1, bb2 
Entries bb1, bb2 
>]; bb1 [label=< - - - + + + +
bb1() 
EntryPoint interpreter 
v1:BasicObject = LoadSelf 
v2:BasicObject = GetLocal :x, l0, SP@5 
v3:BasicObject = GetLocal :y, l0, SP@4 
Jump bb3(v1, v2, v3) 
v2:CPtr = LoadSP 
v3:BasicObject = LoadField v2, :x@0x1000 
v4:BasicObject = LoadField v2, :y@0x1001 
Jump bb3(v1, v3, v4) 
>]; - bb1:v4 -> bb3:params:n; + bb1:v5 -> bb3:params:n; bb2 [label=< - - - - - + + + + +
bb2() 
EntryPoint JIT(0) 
v6:BasicObject = LoadArg :self@0 
v7:BasicObject = LoadArg :x@1 
v8:BasicObject = LoadArg :y@2 
Jump bb3(v6, v7, v8) 
EntryPoint JIT(0) 
v7:BasicObject = LoadArg :self@0 
v8:BasicObject = LoadArg :x@1 
v9:BasicObject = LoadArg :y@2 
Jump bb3(v7, v8, v9) 
>]; - bb2:v9 -> bb3:params:n; + bb2:v10 -> bb3:params:n; bb3 [label=< - - - - + + + - - - - + + + + +
bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject) 
PatchPoint NoTracePoint 
PatchPoint MethodRedefined(Integer@0x1000, |@0x1008, cme:0x1010) 
v27:Fixnum = GuardType v11, Fixnum 
bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject) 
PatchPoint NoTracePoint 
PatchPoint MethodRedefined(Integer@0x1008, |@0x1010, cme:0x1018) 
v28:Fixnum = GuardType v12, Fixnum 
v29:Fixnum = FixnumOr v27, v28 
IncrCounter inline_cfunc_optimized_send_count 
CheckInterrupts 
Return v29 
v29:Fixnum = GuardType v13, Fixnum 
v30:Fixnum = FixnumOr v28, v29 
IncrCounter inline_cfunc_optimized_send_count 
CheckInterrupts 
Return v30 
>]; } "#); @@ -8553,44 +8659,45 @@ mod graphviz_tests { mode=hier; overlap=false; splines=true; bb0 [label=< - +
bb0() 
Entries bb1, bb2 
Entries bb1, bb2 
>]; bb1 [label=< - - + + +
bb1() 
EntryPoint interpreter 
v1:BasicObject = LoadSelf 
v2:BasicObject = GetLocal :c, l0, SP@4 
Jump bb3(v1, v2) 
v2:CPtr = LoadSP 
v3:BasicObject = LoadField v2, :c@0x1000 
Jump bb3(v1, v3) 
>]; - bb1:v3 -> bb3:params:n; + bb1:v4 -> bb3:params:n; bb2 [label=< - - - - + + + +
bb2() 
EntryPoint JIT(0) 
v5:BasicObject = LoadArg :self@0 
v6:BasicObject = LoadArg :c@1 
Jump bb3(v5, v6) 
EntryPoint JIT(0) 
v6:BasicObject = LoadArg :self@0 
v7:BasicObject = LoadArg :c@1 
Jump bb3(v6, v7) 
>]; - bb2:v7 -> bb3:params:n; + bb2:v8 -> bb3:params:n; bb3 [label=< - - - - - - - - - - - + + + + + + + + + + +
bb3(v8:BasicObject, v9:BasicObject) 
PatchPoint NoTracePoint 
CheckInterrupts 
v15:CBool = Test v9 
v16:Falsy = RefineType v9, Falsy 
IfFalse v15, bb4(v8, v16) 
v18:Truthy = RefineType v9, Truthy 
PatchPoint NoTracePoint 
v21:Fixnum[3] = Const Value(3) 
CheckInterrupts 
Return v21 
bb3(v9:BasicObject, v10:BasicObject) 
PatchPoint NoTracePoint 
CheckInterrupts 
v16:CBool = Test v10 
v17:Falsy = RefineType v10, Falsy 
IfFalse v16, bb4(v9, v17) 
v19:Truthy = RefineType v10, Truthy 
PatchPoint NoTracePoint 
v22:Fixnum[3] = Const Value(3) 
CheckInterrupts 
Return v22 
>]; - bb3:v17 -> bb4:params:n; + bb3:v18 -> bb4:params:n; bb4 [label=< - - - - - + + + + +
bb4(v26:BasicObject, v27:Falsy) 
PatchPoint NoTracePoint 
v31:Fixnum[4] = Const Value(4) 
CheckInterrupts 
Return v31 
bb4(v27:BasicObject, v28:Falsy) 
PatchPoint NoTracePoint 
v32:Fixnum[4] = Const Value(4) 
CheckInterrupts 
Return v32 
>]; } "#); diff --git a/zjit/src/hir/opt_tests.rs b/zjit/src/hir/opt_tests.rs index 1d3b062a58b09c..e58e61f3c4e182 100644 --- a/zjit/src/hir/opt_tests.rs +++ b/zjit/src/hir/opt_tests.rs @@ -216,33 +216,34 @@ mod hir_opt_tests { end test 1; test 2 "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :n, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :n@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :n@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[0] = Const Value(0) - PatchPoint MethodRedefined(Integer@0x1000, *@0x1008, cme:0x1010) - v34:Fixnum = GuardType v9, Fixnum - v46:Fixnum[0] = Const Value(0) - IncrCounter inline_cfunc_optimized_send_count - v20:Fixnum[0] = Const Value(0) - v39:Fixnum = GuardType v9, Fixnum + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :n@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[0] = Const Value(0) + PatchPoint MethodRedefined(Integer@0x1008, *@0x1010, cme:0x1018) + v35:Fixnum = GuardType v10, Fixnum v47:Fixnum[0] = Const Value(0) IncrCounter inline_cfunc_optimized_send_count - PatchPoint MethodRedefined(Integer@0x1000, +@0x1038, cme:0x1040) + v21:Fixnum[0] = Const Value(0) + v40:Fixnum = GuardType v10, Fixnum v48:Fixnum[0] = Const Value(0) IncrCounter inline_cfunc_optimized_send_count + PatchPoint MethodRedefined(Integer@0x1008, +@0x1040, cme:0x1048) + v49:Fixnum[0] = Const Value(0) + IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v48 + Return v49 "); } @@ -561,6 +562,96 @@ mod hir_opt_tests { "); } + #[test] + fn test_fold_fixnum_or() { + eval(" + def test + 4 | 1 + end + "); + + assert_snapshot!(inspect("test"), @"5"); + assert_snapshot!(hir_string("test"), @" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + Jump bb3(v1) + bb2(): + EntryPoint JIT(0) + v4:BasicObject = LoadArg :self@0 + Jump bb3(v4) + bb3(v6:BasicObject): + v10:Fixnum[4] = Const Value(4) + v12:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1000, |@0x1008, cme:0x1010) + v25:Fixnum[5] = Const Value(5) + IncrCounter inline_cfunc_optimized_send_count + CheckInterrupts + Return v25 + "); + } + + #[test] + fn test_fold_fixnum_or_with_negative_self() { + eval(" + def test + -4 | 1 + end + "); + + assert_snapshot!(inspect("test"), @"-3"); + assert_snapshot!(hir_string("test"), @" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + Jump bb3(v1) + bb2(): + EntryPoint JIT(0) + v4:BasicObject = LoadArg :self@0 + Jump bb3(v4) + bb3(v6:BasicObject): + v10:Fixnum[-4] = Const Value(-4) + v12:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1000, |@0x1008, cme:0x1010) + v25:Fixnum[-3] = Const Value(-3) + IncrCounter inline_cfunc_optimized_send_count + CheckInterrupts + Return v25 + "); + } + + #[test] + fn test_fold_fixnum_or_with_negative_other() { + eval(" + def test + 4 | -1 + end + "); + + assert_snapshot!(inspect("test"), @"-1"); + assert_snapshot!(hir_string("test"), @" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + Jump bb3(v1) + bb2(): + EntryPoint JIT(0) + v4:BasicObject = LoadArg :self@0 + Jump bb3(v4) + bb3(v6:BasicObject): + v10:Fixnum[4] = Const Value(4) + v12:Fixnum[-1] = Const Value(-1) + PatchPoint MethodRedefined(Integer@0x1000, |@0x1008, cme:0x1010) + v25:Fixnum[-1] = Const Value(-1) + IncrCounter inline_cfunc_optimized_send_count + CheckInterrupts + Return v25 + "); + } + #[test] fn test_fold_fixnum_less() { eval(" @@ -866,26 +957,27 @@ mod hir_opt_tests { custom.count "); assert_eq!(VALUE::fixnum_from_usize(2), result); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:13: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :object, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :object@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :object@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(CustomEq@0x1000) - PatchPoint MethodRedefined(CustomEq@0x1000, !=@0x1008, cme:0x1010) - v29:HeapObject[class_exact:CustomEq] = GuardType v9, HeapObject[class_exact:CustomEq] - v30:BoolExact = CCallWithFrame v29, :BasicObject#!=@0x1038, v9 - v20:NilClass = Const Value(nil) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :object@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(CustomEq@0x1008) + PatchPoint MethodRedefined(CustomEq@0x1008, !=@0x1010, cme:0x1018) + v30:HeapObject[class_exact:CustomEq] = GuardType v10, HeapObject[class_exact:CustomEq] + v31:BoolExact = CCallWithFrame v30, :BasicObject#!=@0x1040, v10 + v21:NilClass = Const Value(nil) CheckInterrupts - Return v20 + Return v21 "); } @@ -897,26 +989,27 @@ mod hir_opt_tests { end test(2); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1000, +@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:Fixnum = FixnumAdd v25, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1008, +@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:Fixnum = FixnumAdd v26, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -929,86 +1022,92 @@ mod hir_opt_tests { def post(*rest, post) = post def block(&b) = nil "); - assert_snapshot!(hir_strings!("rest", "kw", "kw_rest", "block", "post"), @r" + assert_snapshot!(hir_strings!("rest", "kw", "kw_rest", "block", "post"), @" fn rest@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:ArrayExact = GetLocal :array, l0, SP@4, * - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:ArrayExact = LoadField v2, :array@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :array@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :array@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - Return v9 + Return v10 fn kw@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :k, l0, SP@5 - v3:BasicObject = GetLocal , l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :k@0x1000 + v4:BasicObject = LoadField v2, :@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :k@1 - v8:BasicObject = GetLocal , l0, EP@3 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :k@1 + v9:CPtr = GetEP 0 + v10:BasicObject = LoadField v9, :@0x1002 + Jump bb3(v7, v8, v10) + bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject): CheckInterrupts - Return v11 + Return v13 fn kw_rest@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :k, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :k@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :k@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :k@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - Return v9 + Return v10 fn block@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :b@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :b@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:NilClass = Const Value(nil) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :b@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:NilClass = Const Value(nil) CheckInterrupts - Return v13 + Return v14 fn post@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:ArrayExact = GetLocal :rest, l0, SP@5, * - v3:BasicObject = GetLocal :post, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:ArrayExact = LoadField v2, :rest@0x1000 + v4:BasicObject = LoadField v2, :post@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :rest@1 - v8:BasicObject = LoadArg :post@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :rest@1 + v9:BasicObject = LoadArg :post@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): CheckInterrupts - Return v12 + Return v13 "); } @@ -1147,26 +1246,28 @@ mod hir_opt_tests { def test(o) = o.fun_new_map {|e| e } test C.new; test C.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, fun_new_map@0x1008, cme:0x1010) - v23:ArraySubclass[class_exact:C] = GuardType v9, ArraySubclass[class_exact:C] - v24:BasicObject = SendDirect v23, 0x1038, :fun_new_map (0x1048) - v15:BasicObject = GetLocal :o, l0, EP@3 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, fun_new_map@0x1010, cme:0x1018) + v25:ArraySubclass[class_exact:C] = GuardType v10, ArraySubclass[class_exact:C] + v26:BasicObject = SendDirect v25, 0x1040, :fun_new_map (0x1050) + v16:CPtr = GetEP 0 + v17:BasicObject = LoadField v16, :o@0x1058 CheckInterrupts - Return v24 + Return v26 "); } @@ -1181,26 +1282,28 @@ mod hir_opt_tests { def test(o) = o.bar { |x| x } test C.new; test C.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:7: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, bar@0x1008, cme:0x1010) - v24:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v25:BasicObject = CCallWithFrame v24, :Enumerable#bar@0x1038, block=0x1040 - v15:BasicObject = GetLocal :o, l0, EP@3 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, bar@0x1010, cme:0x1018) + v26:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v27:BasicObject = CCallWithFrame v26, :Enumerable#bar@0x1040, block=0x1048 + v16:CPtr = GetEP 0 + v17:BasicObject = LoadField v16, :o@0x1050 CheckInterrupts - Return v25 + Return v27 "); } @@ -1215,25 +1318,26 @@ mod hir_opt_tests { def test(a) = a.length test([1,2,3]); test([1,2,3]) ", "{ specialized_instruction: false }"); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, length@0x1008, cme:0x1010) - v23:ArrayExact = GuardType v9, ArrayExact - v24:BasicObject = CCallWithFrame v23, :Array#length@0x1038 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, length@0x1010, cme:0x1018) + v24:ArrayExact = GuardType v10, ArrayExact + v25:BasicObject = CCallWithFrame v24, :Array#length@0x1040 CheckInterrupts - Return v24 + Return v25 "); } @@ -1557,27 +1661,28 @@ mod hir_opt_tests { def test(a, b) = a + b test(1,2); test(3,4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:7: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, +@0x1008, cme:0x1010) - v26:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, +@0x1010, cme:0x1018) + v27:Fixnum = GuardType v12, Fixnum IncrCounter inline_iseq_optimized_send_count - v29:Fixnum[100] = Const Value(100) + v30:Fixnum[100] = Const Value(100) CheckInterrupts - Return v29 + Return v30 "); } @@ -1587,28 +1692,29 @@ mod hir_opt_tests { def test(a, b) = a + b test(1,2); test(3,4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, +@0x1008, cme:0x1010) - v27:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, +@0x1010, cme:0x1018) v28:Fixnum = GuardType v12, Fixnum - v29:Fixnum = FixnumAdd v27, v28 + v29:Fixnum = GuardType v13, Fixnum + v30:Fixnum = FixnumAdd v28, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -1618,26 +1724,27 @@ mod hir_opt_tests { def test(a) = a + 1 test(1); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1000, +@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:Fixnum = FixnumAdd v25, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1008, +@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:Fixnum = FixnumAdd v26, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -1647,26 +1754,27 @@ mod hir_opt_tests { def test(a) = 1 + a test(1); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1000, +@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:Fixnum = FixnumAdd v13, v25 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1008, +@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:Fixnum = FixnumAdd v14, v26 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -1676,28 +1784,29 @@ mod hir_opt_tests { def test(a, b) = a[b] test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, []@0x1008, cme:0x1010) - v27:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, []@0x1010, cme:0x1018) v28:Fixnum = GuardType v12, Fixnum - v29:Fixnum = FixnumAref v27, v28 + v29:Fixnum = GuardType v13, Fixnum + v30:Fixnum = FixnumAref v28, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -1788,28 +1897,29 @@ mod hir_opt_tests { def test(a, b) = a < b test(1,2); test(3,4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, <@0x1008, cme:0x1010) - v27:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, <@0x1010, cme:0x1018) v28:Fixnum = GuardType v12, Fixnum - v29:BoolExact = FixnumLt v27, v28 + v29:Fixnum = GuardType v13, Fixnum + v30:BoolExact = FixnumLt v28, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -1819,26 +1929,27 @@ mod hir_opt_tests { def test(a) = a < 1 test(1); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1000, <@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:BoolExact = FixnumLt v25, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1008, <@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:BoolExact = FixnumLt v26, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -1848,26 +1959,27 @@ mod hir_opt_tests { def test(a) = 1 < a test(1); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1000, <@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:BoolExact = FixnumLt v13, v25 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1008, <@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:BoolExact = FixnumLt v14, v26 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -1940,24 +2052,25 @@ mod hir_opt_tests { end test(2); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[1] = Const Value(1) - v22:Fixnum = GuardType v9, Fixnum - v23:RangeExact = NewRangeFixnum v13 NewRangeInclusive v22 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[1] = Const Value(1) + v23:Fixnum = GuardType v10, Fixnum + v24:RangeExact = NewRangeFixnum v14 NewRangeInclusive v23 CheckInterrupts - Return v23 + Return v24 "); } @@ -1969,24 +2082,25 @@ mod hir_opt_tests { end test(2); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[1] = Const Value(1) - v22:Fixnum = GuardType v9, Fixnum - v23:RangeExact = NewRangeFixnum v13 NewRangeExclusive v22 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[1] = Const Value(1) + v23:Fixnum = GuardType v10, Fixnum + v24:RangeExact = NewRangeFixnum v14 NewRangeExclusive v23 CheckInterrupts - Return v23 + Return v24 "); } @@ -1998,24 +2112,25 @@ mod hir_opt_tests { end test(2); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[10] = Const Value(10) - v22:Fixnum = GuardType v9, Fixnum - v23:RangeExact = NewRangeFixnum v22 NewRangeInclusive v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[10] = Const Value(10) + v23:Fixnum = GuardType v10, Fixnum + v24:RangeExact = NewRangeFixnum v23 NewRangeInclusive v15 CheckInterrupts - Return v23 + Return v24 "); } @@ -2027,24 +2142,25 @@ mod hir_opt_tests { end test(2); test(3) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[10] = Const Value(10) - v22:Fixnum = GuardType v9, Fixnum - v23:RangeExact = NewRangeFixnum v22 NewRangeExclusive v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[10] = Const Value(10) + v23:Fixnum = GuardType v10, Fixnum + v24:RangeExact = NewRangeFixnum v23 NewRangeExclusive v15 CheckInterrupts - Return v23 + Return v24 "); } @@ -2084,32 +2200,33 @@ mod hir_opt_tests { def test(arr) = arr[0] test(arr) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[0] = Const Value(0) - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, []@0x1008, cme:0x1010) - v26:ArrayExact = GuardType v9, ArrayExact - v27:CInt64[0] = UnboxFixnum v14 - v28:CInt64 = ArrayLength v26 - v29:CInt64[0] = GuardLess v27, v28 - v30:CInt64[0] = Const CInt64(0) - v31:CInt64[0] = GuardGreaterEq v29, v30 - v32:BasicObject = ArrayAref v26, v31 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[0] = Const Value(0) + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018) + v27:ArrayExact = GuardType v10, ArrayExact + v28:CInt64[0] = UnboxFixnum v15 + v29:CInt64 = ArrayLength v27 + v30:CInt64[0] = GuardLess v28, v29 + v31:CInt64[0] = Const CInt64(0) + v32:CInt64[0] = GuardGreaterEq v30, v31 + v33:BasicObject = ArrayAref v27, v32 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v32 + Return v33 "); assert_snapshot!(inspect("test [1,2,3]"), @"1"); } @@ -2121,27 +2238,28 @@ mod hir_opt_tests { def test(arr) = arr[0] test(arr) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[0] = Const Value(0) - PatchPoint NoSingletonClass(Hash@0x1000) - PatchPoint MethodRedefined(Hash@0x1000, []@0x1008, cme:0x1010) - v26:HashExact = GuardType v9, HashExact - v27:BasicObject = HashAref v26, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[0] = Const Value(0) + PatchPoint NoSingletonClass(Hash@0x1008) + PatchPoint MethodRedefined(Hash@0x1008, []@0x1010, cme:0x1018) + v27:HashExact = GuardType v10, HashExact + v28:BasicObject = HashAref v27, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v27 + Return v28 "); assert_snapshot!(inspect("test({0 => 4})"), @"4"); } @@ -2218,25 +2336,26 @@ mod hir_opt_tests { end test(1); test(2) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:NilClass = Const Value(nil) - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:NilClass): - v17:ArrayExact = NewArray v11 - v21:Fixnum[5] = Const Value(5) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:NilClass = Const Value(nil) + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:NilClass): + v18:ArrayExact = NewArray v12 + v22:Fixnum[5] = Const Value(5) CheckInterrupts - Return v21 + Return v22 "); } @@ -2277,30 +2396,31 @@ mod hir_opt_tests { 5 end "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :aval, l0, SP@6 - v3:BasicObject = GetLocal :bval, l0, SP@5 - v4:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4) - bb2(): - EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :aval@1 - v9:BasicObject = LoadArg :bval@2 - v10:NilClass = Const Value(nil) - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:NilClass): - v19:StaticSymbol[:a] = Const Value(VALUE(0x1000)) - v22:StaticSymbol[:b] = Const Value(VALUE(0x1008)) - v25:HashExact = NewHash v19: v13, v22: v14 + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :aval@0x1000 + v4:BasicObject = LoadField v2, :bval@0x1001 + v5:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5) + bb2(): + EntryPoint JIT(0) + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :aval@1 + v10:BasicObject = LoadArg :bval@2 + v11:NilClass = Const Value(nil) + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:NilClass): + v20:StaticSymbol[:a] = Const Value(VALUE(0x1008)) + v23:StaticSymbol[:b] = Const Value(VALUE(0x1010)) + v26:HashExact = NewHash v20: v14, v23: v15 PatchPoint NoEPEscape(test) - v31:Fixnum[5] = Const Value(5) + v32:Fixnum[5] = Const Value(5) CheckInterrupts - Return v31 + Return v32 "); } @@ -2430,28 +2550,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, +@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, +@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2464,28 +2585,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, -@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, -@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2498,28 +2620,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, *@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, *@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2532,29 +2655,30 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, /@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, /@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum - v33:Fixnum = FixnumDiv v31, v32 + v33:Fixnum = GuardType v13, Fixnum + v34:Fixnum = FixnumDiv v32, v33 IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2567,29 +2691,30 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, %@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, %@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum - v33:Fixnum = FixnumMod v31, v32 + v33:Fixnum = GuardType v13, Fixnum + v34:Fixnum = FixnumMod v32, v33 IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2602,28 +2727,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, <@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, <@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2636,28 +2762,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, <=@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, <=@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2670,28 +2797,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, >@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, >@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2704,28 +2832,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, >=@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, >=@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2738,28 +2867,29 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, ==@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, ==@0x1010, cme:0x1018) v32:Fixnum = GuardType v12, Fixnum + v33:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2772,29 +2902,30 @@ mod hir_opt_tests { end test(1, 2); test(3, 4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, !=@0x1008, cme:0x1010) - v31:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, !=@0x1010, cme:0x1018) + v32:Fixnum = GuardType v12, Fixnum PatchPoint BOPRedefined(INTEGER_REDEFINED_OP_FLAG, BOP_EQ) - v33:Fixnum = GuardType v12, Fixnum + v34:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v23:Fixnum[5] = Const Value(5) + v24:Fixnum[5] = Const Value(5) CheckInterrupts - Return v23 + Return v24 "); } @@ -2832,24 +2963,25 @@ mod hir_opt_tests { 5 end "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :klass, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :klass@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :klass@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:FalseClass = Const Value(false) - v16:BasicObject = GetConstant v9, :ARGV, v14 - v20:Fixnum[5] = Const Value(5) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :klass@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:FalseClass = Const Value(false) + v17:BasicObject = GetConstant v10, :ARGV, v15 + v21:Fixnum[5] = Const Value(5) CheckInterrupts - Return v20 + Return v21 "); } @@ -2860,24 +2992,25 @@ mod hir_opt_tests { test(0) # profile test(1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, itself@0x1008, cme:0x1010) - v22:Fixnum = GuardType v9, Fixnum + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, itself@0x1010, cme:0x1018) + v23:Fixnum = GuardType v10, Fixnum IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v22 + Return v23 "); } @@ -3193,7 +3326,7 @@ mod hir_opt_tests { PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, block_given?@0x1008, cme:0x1010) v20:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] - v21:CPtr = GetLEP + v21:CPtr = GetEP 0 v22:BoolExact = IsBlockGiven v21 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts @@ -3263,25 +3396,26 @@ mod hir_opt_tests { eval(" def test(x) = 1.zero? "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1000, zero?@0x1008, cme:0x1010) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1008, zero?@0x1010, cme:0x1018) IncrCounter inline_iseq_optimized_send_count - v24:BasicObject = InvokeBuiltin leaf , v13 + v25:BasicObject = InvokeBuiltin leaf , v14 CheckInterrupts - Return v24 + Return v25 "); } @@ -3293,29 +3427,30 @@ mod hir_opt_tests { a.first end "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:NilClass = Const Value(nil) - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:NilClass): - v16:ArrayExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v17:ArrayExact = ArrayDup v16 - PatchPoint NoSingletonClass(Array@0x1008) - PatchPoint MethodRedefined(Array@0x1008, first@0x1010, cme:0x1018) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:NilClass = Const Value(nil) + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:NilClass): + v17:ArrayExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v18:ArrayExact = ArrayDup v17 + PatchPoint NoSingletonClass(Array@0x1010) + PatchPoint MethodRedefined(Array@0x1010, first@0x1018, cme:0x1020) IncrCounter inline_iseq_optimized_send_count - v32:BasicObject = InvokeBuiltin leaf , v17 + v33:BasicObject = InvokeBuiltin leaf , v18 CheckInterrupts - Return v32 + Return v33 "); } @@ -3364,25 +3499,26 @@ mod hir_opt_tests { test c "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :c, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :c@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :c@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v23:BasicObject = SendDirect v22, 0x1038, :foo (0x1048) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :c@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v24:BasicObject = SendDirect v23, 0x1040, :foo (0x1050) CheckInterrupts - Return v23 + Return v24 "); } @@ -3395,7 +3531,7 @@ mod hir_opt_tests { test "); assert_eq!(VALUE::fixnum_from_usize(3), result); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter @@ -3410,10 +3546,10 @@ mod hir_opt_tests { v13:Fixnum[2] = Const Value(2) PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, foo@0x1008, cme:0x1010) - v23:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] - v24:BasicObject = SendDirect v23, 0x1038, :foo (0x1048), v11, v13 + v24:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] + v25:BasicObject = SendDirect v24, 0x1038, :foo (0x1048), v11, v13 CheckInterrupts - Return v24 + Return v25 "); } @@ -3429,7 +3565,7 @@ mod hir_opt_tests { test test "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter @@ -3445,12 +3581,13 @@ mod hir_opt_tests { v13:Fixnum[1] = Const Value(1) PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, foo@0x1008, cme:0x1010) - v32:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v8, HeapObject[class_exact*:Object@VALUE(0x1000)] + v33:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v8, HeapObject[class_exact*:Object@VALUE(0x1000)] IncrCounter inline_iseq_optimized_send_count - v19:BasicObject = GetLocal :a, l0, EP@3 + v19:CPtr = GetEP 0 + v20:BasicObject = LoadField v19, :a@0x1038 PatchPoint NoEPEscape(test) CheckInterrupts - Return v19 + Return v20 "); } @@ -3986,30 +4123,32 @@ mod hir_opt_tests { test %(a\nb\nc) test %() "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@5 - v3:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + v4:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :s@1 - v8:NilClass = Const Value(nil) - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:NilClass): - v16:ArrayExact = NewArray - v21:TrueClass = Const Value(true) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :s@1 + v9:NilClass = Const Value(nil) + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:NilClass): + v17:ArrayExact = NewArray + v22:TrueClass = Const Value(true) IncrCounter complex_arg_pass_caller_kwarg - v23:BasicObject = Send v11, 0x1000, :each_line, v21 # SendFallbackReason: Complex argument passing - v24:BasicObject = GetLocal :s, l0, EP@4 - v25:BasicObject = GetLocal :a, l0, EP@3 + v24:BasicObject = Send v12, 0x1008, :each_line, v22 # SendFallbackReason: Complex argument passing + v25:CPtr = GetEP 0 + v26:BasicObject = LoadField v25, :s@0x1030 + v27:BasicObject = LoadField v25, :a@0x1031 PatchPoint NoEPEscape(test) CheckInterrupts - Return v25 + Return v27 "); } @@ -4418,29 +4557,30 @@ mod hir_opt_tests { eval(" def test(a,b) = [a,b].length "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:ArrayExact = NewArray v11, v12 - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, length@0x1008, cme:0x1010) - v30:CInt64 = ArrayLength v18 - v31:Fixnum = BoxFixnum v30 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:ArrayExact = NewArray v12, v13 + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, length@0x1010, cme:0x1018) + v31:CInt64 = ArrayLength v19 + v32:Fixnum = BoxFixnum v31 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -4449,29 +4589,30 @@ mod hir_opt_tests { eval(" def test(a,b) = [a,b].size "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:ArrayExact = NewArray v11, v12 - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, size@0x1008, cme:0x1010) - v30:CInt64 = ArrayLength v18 - v31:Fixnum = BoxFixnum v30 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:ArrayExact = NewArray v12, v13 + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, size@0x1010, cme:0x1018) + v31:CInt64 = ArrayLength v19 + v32:Fixnum = BoxFixnum v31 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -4480,28 +4621,29 @@ mod hir_opt_tests { eval(" def test(&block) = tap(&block) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :block, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :block@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :block@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:CPtr = GetEP 0 - v15:CInt64 = LoadField v14, :_env_data_index_flags@0x1000 - v16:CInt64 = GuardNoBitsSet v15, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) - v17:CInt64 = LoadField v14, :_env_data_index_specval@0x1001 - v18:CInt64 = GuardAnyBitSet v17, CUInt64(1) - v19:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) - v21:BasicObject = Send v8, 0x1000, :tap, v19 # SendFallbackReason: Uncategorized(send) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :block@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:CPtr = GetEP 0 + v16:CInt64 = LoadField v15, :_env_data_index_flags@0x1001 + v17:CInt64 = GuardNoBitsSet v16, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v18:CInt64 = LoadField v15, :_env_data_index_specval@0x1002 + v19:CInt64 = GuardAnyBitSet v18, CUInt64(1) + v20:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + v22:BasicObject = Send v9, 0x1001, :tap, v20 # SendFallbackReason: Uncategorized(send) CheckInterrupts - Return v21 + Return v22 "); } @@ -4510,30 +4652,32 @@ mod hir_opt_tests { eval(" def test(&block) = block "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :block, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :block@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :block@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:CPtr = GetEP 0 - v14:CBool = IsBlockParamModified v13 - IfTrue v14, bb4(v8, v9) - v25:BasicObject = GetBlockParam :block, l0, EP@3 - Jump bb6(v8, v25, v25) - bb4(v15:BasicObject, v16:BasicObject): - v23:BasicObject = GetLocal :block, l0, EP@3 - Jump bb6(v15, v23, v23) - bb6(v27:BasicObject, v28:BasicObject, v29:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :block@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:CPtr = GetEP 0 + v15:CBool = IsBlockParamModified v14 + IfTrue v15, bb4(v9, v10) + v27:BasicObject = GetBlockParam :block, l0, EP@3 + Jump bb6(v9, v27, v27) + bb4(v16:BasicObject, v17:BasicObject): + v24:CPtr = GetEP 0 + v25:BasicObject = LoadField v24, :block@0x1001 + Jump bb6(v16, v25, v25) + bb6(v29:BasicObject, v30:BasicObject, v31:BasicObject): CheckInterrupts - Return v29 + Return v31 "); } @@ -4546,7 +4690,7 @@ mod hir_opt_tests { end end "); - assert_snapshot!(hir_string_proc("test"), @r" + assert_snapshot!(hir_string_proc("test"), @" fn block in test@:4: bb1(): EntryPoint interpreter @@ -4683,26 +4827,27 @@ mod hir_opt_tests { end test p "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :p, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :p@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :p@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint NoSingletonClass(Proc@0x1000) - PatchPoint MethodRedefined(Proc@0x1000, call@0x1008, cme:0x1010) - v24:HeapObject[class_exact:Proc] = GuardType v9, HeapObject[class_exact:Proc] - v25:BasicObject = InvokeProc v24, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :p@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint NoSingletonClass(Proc@0x1008) + PatchPoint MethodRedefined(Proc@0x1008, call@0x1010, cme:0x1018) + v25:HeapObject[class_exact:Proc] = GuardType v10, HeapObject[class_exact:Proc] + v26:BasicObject = InvokeProc v25, v15 CheckInterrupts - Return v25 + Return v26 "); } @@ -4715,26 +4860,27 @@ mod hir_opt_tests { end test p "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :p, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :p@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :p@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[2] = Const Value(2) - PatchPoint NoSingletonClass(Proc@0x1000) - PatchPoint MethodRedefined(Proc@0x1000, []@0x1008, cme:0x1010) - v25:HeapObject[class_exact:Proc] = GuardType v9, HeapObject[class_exact:Proc] - v26:BasicObject = InvokeProc v25, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :p@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[2] = Const Value(2) + PatchPoint NoSingletonClass(Proc@0x1008) + PatchPoint MethodRedefined(Proc@0x1008, []@0x1010, cme:0x1018) + v26:HeapObject[class_exact:Proc] = GuardType v10, HeapObject[class_exact:Proc] + v27:BasicObject = InvokeProc v26, v15 CheckInterrupts - Return v26 + Return v27 "); } @@ -4747,26 +4893,27 @@ mod hir_opt_tests { end test p "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :p, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :p@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :p@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[3] = Const Value(3) - PatchPoint NoSingletonClass(Proc@0x1000) - PatchPoint MethodRedefined(Proc@0x1000, yield@0x1008, cme:0x1010) - v24:HeapObject[class_exact:Proc] = GuardType v9, HeapObject[class_exact:Proc] - v25:BasicObject = InvokeProc v24, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :p@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[3] = Const Value(3) + PatchPoint NoSingletonClass(Proc@0x1008) + PatchPoint MethodRedefined(Proc@0x1008, yield@0x1010, cme:0x1018) + v25:HeapObject[class_exact:Proc] = GuardType v10, HeapObject[class_exact:Proc] + v26:BasicObject = InvokeProc v25, v15 CheckInterrupts - Return v25 + Return v26 "); } @@ -4779,26 +4926,27 @@ mod hir_opt_tests { end test p "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :p, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :p@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :p@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint NoSingletonClass(Proc@0x1000) - PatchPoint MethodRedefined(Proc@0x1000, ===@0x1008, cme:0x1010) - v24:HeapObject[class_exact:Proc] = GuardType v9, HeapObject[class_exact:Proc] - v25:BasicObject = InvokeProc v24, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :p@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint NoSingletonClass(Proc@0x1008) + PatchPoint MethodRedefined(Proc@0x1008, ===@0x1010, cme:0x1018) + v25:HeapObject[class_exact:Proc] = GuardType v10, HeapObject[class_exact:Proc] + v26:BasicObject = InvokeProc v25, v15 CheckInterrupts - Return v25 + Return v26 "); } @@ -4812,27 +4960,28 @@ mod hir_opt_tests { end test p "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :p, l0, SP@5 - v3:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :p@0x1000 + v4:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :p@1 - v8:NilClass = Const Value(nil) - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:NilClass): - v16:ArrayExact = NewArray - v22:ArrayExact = ToArray v16 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :p@1 + v9:NilClass = Const Value(nil) + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:NilClass): + v17:ArrayExact = NewArray + v23:ArrayExact = ToArray v17 IncrCounter complex_arg_pass_caller_splat - v24:BasicObject = Send v11, :call, v22 # SendFallbackReason: Complex argument passing + v25:BasicObject = Send v12, :call, v23 # SendFallbackReason: Complex argument passing CheckInterrupts - Return v24 + Return v25 "); } @@ -4845,24 +4994,25 @@ mod hir_opt_tests { end test p "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :p, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :p@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :p@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :p@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) IncrCounter complex_arg_pass_caller_kwarg - v16:BasicObject = Send v9, :call, v14 # SendFallbackReason: Complex argument passing + v17:BasicObject = Send v10, :call, v15 # SendFallbackReason: Complex argument passing CheckInterrupts - Return v16 + Return v17 "); } @@ -5648,25 +5798,26 @@ mod hir_opt_tests { test('foo'); test('foo') "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(String@0x1008) - v28:String = GuardType v9, String - v21:StringExact = StringConcat v13, v28 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(String@0x1010) + v29:String = GuardType v10, String + v22:StringExact = StringConcat v14, v29 CheckInterrupts - Return v21 + Return v22 "); } @@ -5682,25 +5833,26 @@ mod hir_opt_tests { test(MyString.new(foo)); test(MyString.new(foo)) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(MyString@0x1008) - v28:String = GuardType v9, String - v21:StringExact = StringConcat v13, v28 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(MyString@0x1010) + v29:String = GuardType v10, String + v22:StringExact = StringConcat v14, v29 CheckInterrupts - Return v21 + Return v22 "); } @@ -5713,28 +5865,29 @@ mod hir_opt_tests { test([1,2,3]); test([1,2,3]) # No fast path for array "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v27:ArrayExact = GuardType v9, ArrayExact - PatchPoint NoSingletonClass(Array@0x1008) - PatchPoint MethodRedefined(Array@0x1008, to_s@0x1010, cme:0x1018) - v32:BasicObject = CCallWithFrame v27, :Array#to_s@0x1040 - v19:String = AnyToString v9, str: v32 - v21:StringExact = StringConcat v13, v19 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v28:ArrayExact = GuardType v10, ArrayExact + PatchPoint NoSingletonClass(Array@0x1010) + PatchPoint MethodRedefined(Array@0x1010, to_s@0x1018, cme:0x1020) + v33:BasicObject = CCallWithFrame v28, :Array#to_s@0x1048 + v20:String = AnyToString v10, str: v33 + v22:StringExact = StringConcat v14, v20 CheckInterrupts - Return v21 + Return v22 "); } @@ -6011,24 +6164,25 @@ mod hir_opt_tests { arr[1] = 10 end "##); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:7: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v16:Fixnum[1] = Const Value(1) - v18:Fixnum[10] = Const Value(10) - v22:BasicObject = Send v9, :[]=, v16, v18 # SendFallbackReason: Uncategorized(opt_aset) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v17:Fixnum[1] = Const Value(1) + v19:Fixnum[10] = Const Value(10) + v23:BasicObject = Send v10, :[]=, v17, v19 # SendFallbackReason: Uncategorized(opt_aset) CheckInterrupts - Return v18 + Return v19 "); } @@ -6342,25 +6496,26 @@ mod hir_opt_tests { test(nil) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(NilClass@0x1000, nil?@0x1008, cme:0x1010) - v23:NilClass = GuardType v9, NilClass - v24:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(NilClass@0x1008, nil?@0x1010, cme:0x1018) + v24:NilClass = GuardType v10, NilClass + v25:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6371,25 +6526,26 @@ mod hir_opt_tests { test(false) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(FalseClass@0x1000, nil?@0x1008, cme:0x1010) - v23:FalseClass = GuardType v9, FalseClass - v24:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(FalseClass@0x1008, nil?@0x1010, cme:0x1018) + v24:FalseClass = GuardType v10, FalseClass + v25:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6400,25 +6556,26 @@ mod hir_opt_tests { test(true) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(TrueClass@0x1000, nil?@0x1008, cme:0x1010) - v23:TrueClass = GuardType v9, TrueClass - v24:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(TrueClass@0x1008, nil?@0x1010, cme:0x1018) + v24:TrueClass = GuardType v10, TrueClass + v25:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6429,25 +6586,26 @@ mod hir_opt_tests { test(:foo) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Symbol@0x1000, nil?@0x1008, cme:0x1010) - v23:StaticSymbol = GuardType v9, StaticSymbol - v24:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Symbol@0x1008, nil?@0x1010, cme:0x1018) + v24:StaticSymbol = GuardType v10, StaticSymbol + v25:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6458,25 +6616,26 @@ mod hir_opt_tests { test(1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, nil?@0x1008, cme:0x1010) - v23:Fixnum = GuardType v9, Fixnum - v24:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, nil?@0x1010, cme:0x1018) + v24:Fixnum = GuardType v10, Fixnum + v25:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6487,25 +6646,26 @@ mod hir_opt_tests { test(1.0) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Float@0x1000, nil?@0x1008, cme:0x1010) - v23:Flonum = GuardType v9, Flonum - v24:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Float@0x1008, nil?@0x1010, cme:0x1018) + v24:Flonum = GuardType v10, Flonum + v25:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6516,26 +6676,27 @@ mod hir_opt_tests { test('foo') "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, nil?@0x1008, cme:0x1010) - v24:StringExact = GuardType v9, StringExact - v25:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, nil?@0x1010, cme:0x1018) + v25:StringExact = GuardType v10, StringExact + v26:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v25 + Return v26 "); } @@ -6546,26 +6707,27 @@ mod hir_opt_tests { test([]) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, !@0x1008, cme:0x1010) - v24:ArrayExact = GuardType v9, ArrayExact - v25:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, !@0x1010, cme:0x1018) + v25:ArrayExact = GuardType v10, ArrayExact + v26:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v25 + Return v26 "); } @@ -6576,25 +6738,26 @@ mod hir_opt_tests { test(false) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(FalseClass@0x1000, !@0x1008, cme:0x1010) - v23:FalseClass = GuardType v9, FalseClass - v24:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(FalseClass@0x1008, !@0x1010, cme:0x1018) + v24:FalseClass = GuardType v10, FalseClass + v25:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6605,25 +6768,26 @@ mod hir_opt_tests { test(nil) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(NilClass@0x1000, !@0x1008, cme:0x1010) - v23:NilClass = GuardType v9, NilClass - v24:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(NilClass@0x1008, !@0x1010, cme:0x1018) + v24:NilClass = GuardType v10, NilClass + v25:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v24 + Return v25 "); } @@ -6637,37 +6801,38 @@ mod hir_opt_tests { test(false) test(true) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - v15:CBool = Test v9 - v16:Falsy = RefineType v9, Falsy - IfFalse v15, bb4(v8, v16) - v18:Truthy = RefineType v9, Truthy - v20:FalseClass = Const Value(false) + v16:CBool = Test v10 + v17:Falsy = RefineType v10, Falsy + IfFalse v16, bb4(v9, v17) + v19:Truthy = RefineType v10, Truthy + v21:FalseClass = Const Value(false) CheckInterrupts - Jump bb5(v8, v18, v20) - bb4(v24:BasicObject, v25:Falsy): - v28:NilClass = Const Value(nil) - Jump bb5(v24, v25, v28) - bb5(v30:BasicObject, v31:BasicObject, v32:Falsy): - PatchPoint MethodRedefined(NilClass@0x1000, !@0x1008, cme:0x1010) - v44:NilClass = GuardType v32, NilClass - v45:TrueClass = Const Value(true) + Jump bb5(v9, v19, v21) + bb4(v25:BasicObject, v26:Falsy): + v29:NilClass = Const Value(nil) + Jump bb5(v25, v26, v29) + bb5(v31:BasicObject, v32:BasicObject, v33:Falsy): + PatchPoint MethodRedefined(NilClass@0x1008, !@0x1010, cme:0x1018) + v45:NilClass = GuardType v33, NilClass + v46:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v45 + Return v46 "); } @@ -6678,29 +6843,30 @@ mod hir_opt_tests { test([]) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, empty?@0x1008, cme:0x1010) - v24:ArrayExact = GuardType v9, ArrayExact - v25:CInt64 = ArrayLength v24 - v26:CInt64[0] = Const CInt64(0) - v27:CBool = IsBitEqual v25, v26 - v28:BoolExact = BoxBool v27 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, empty?@0x1010, cme:0x1018) + v25:ArrayExact = GuardType v10, ArrayExact + v26:CInt64 = ArrayLength v25 + v27:CInt64[0] = Const CInt64(0) + v28:CBool = IsBitEqual v26, v27 + v29:BoolExact = BoxBool v28 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v28 + Return v29 "); } @@ -6711,26 +6877,27 @@ mod hir_opt_tests { test({}) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Hash@0x1000) - PatchPoint MethodRedefined(Hash@0x1000, empty?@0x1008, cme:0x1010) - v24:HashExact = GuardType v9, HashExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Hash@0x1008) + PatchPoint MethodRedefined(Hash@0x1008, empty?@0x1010, cme:0x1018) + v25:HashExact = GuardType v10, HashExact IncrCounter inline_cfunc_optimized_send_count - v26:BoolExact = CCall v24, :Hash#empty?@0x1038 + v27:BoolExact = CCall v25, :Hash#empty?@0x1040 CheckInterrupts - Return v26 + Return v27 "); } @@ -6742,29 +6909,30 @@ mod hir_opt_tests { test(C.new, C.new) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, ==@0x1008, cme:0x1010) - v28:HeapObject[class_exact:C] = GuardType v11, HeapObject[class_exact:C] - v29:CBool = IsBitEqual v28, v12 - v30:BoolExact = BoxBool v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, ==@0x1010, cme:0x1018) + v29:HeapObject[class_exact:C] = GuardType v12, HeapObject[class_exact:C] + v30:CBool = IsBitEqual v29, v13 + v31:BoolExact = BoxBool v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v30 + Return v31 "); } @@ -6775,28 +6943,29 @@ mod hir_opt_tests { test(1, 2) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, &@0x1008, cme:0x1010) - v27:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, &@0x1010, cme:0x1018) v28:Fixnum = GuardType v12, Fixnum - v29:Fixnum = FixnumAnd v27, v28 + v29:Fixnum = GuardType v13, Fixnum + v30:Fixnum = FixnumAnd v28, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -6807,28 +6976,29 @@ mod hir_opt_tests { test(1, 2) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, |@0x1008, cme:0x1010) - v27:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, |@0x1010, cme:0x1018) v28:Fixnum = GuardType v12, Fixnum - v29:Fixnum = FixnumOr v27, v28 + v29:Fixnum = GuardType v13, Fixnum + v30:Fixnum = FixnumOr v28, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -6877,27 +7047,28 @@ mod hir_opt_tests { test O test O "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:10: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v25:CShape = LoadField v22, :_shape_id@0x1038 - v26:CShape[0x1039] = GuardBitEquals v25, CShape(0x1039) - v27:BasicObject = LoadField v22, :@foo@0x103a + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v26:CShape = LoadField v23, :_shape_id@0x1040 + v27:CShape[0x1041] = GuardBitEquals v26, CShape(0x1041) + v28:BasicObject = LoadField v23, :@foo@0x1042 CheckInterrupts - Return v27 + Return v28 "); } @@ -6919,28 +7090,29 @@ mod hir_opt_tests { test O test O "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:13: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v25:CShape = LoadField v22, :_shape_id@0x1038 - v26:CShape[0x1039] = GuardBitEquals v25, CShape(0x1039) - v27:CPtr = LoadField v22, :_as_heap@0x103a - v28:BasicObject = LoadField v27, :@foo@0x103b + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v26:CShape = LoadField v23, :_shape_id@0x1040 + v27:CShape[0x1041] = GuardBitEquals v26, CShape(0x1041) + v28:CPtr = LoadField v23, :_as_heap@0x1042 + v29:BasicObject = LoadField v28, :@foo@0x1043 CheckInterrupts - Return v28 + Return v29 "); } @@ -7120,42 +7292,43 @@ mod hir_opt_tests { test O1 test O2 "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:20: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:CBool = HasType v9, HeapObject[class_exact:C] - IfTrue v14, bb5(v8, v9, v9) - v23:CBool = HasType v9, HeapObject[class_exact:C] - IfTrue v23, bb6(v8, v9, v9) - v32:BasicObject = Send v9, :foo # SendFallbackReason: SendWithoutBlock: polymorphic fallback - Jump bb4(v8, v9, v32) - bb5(v15:BasicObject, v16:BasicObject, v17:BasicObject): - v19:HeapObject[class_exact:C] = RefineType v17, HeapObject[class_exact:C] - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:CBool = HasType v10, HeapObject[class_exact:C] + IfTrue v15, bb5(v9, v10, v10) + v24:CBool = HasType v10, HeapObject[class_exact:C] + IfTrue v24, bb6(v9, v10, v10) + v33:BasicObject = Send v10, :foo # SendFallbackReason: SendWithoutBlock: polymorphic fallback + Jump bb4(v9, v10, v33) + bb5(v16:BasicObject, v17:BasicObject, v18:BasicObject): + v20:HeapObject[class_exact:C] = RefineType v18, HeapObject[class_exact:C] + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) IncrCounter getivar_fallback_not_monomorphic - v45:BasicObject = GetIvar v19, :@foo - Jump bb4(v15, v16, v45) - bb6(v24:BasicObject, v25:BasicObject, v26:BasicObject): - v28:HeapObject[class_exact:C] = RefineType v26, HeapObject[class_exact:C] - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) + v46:BasicObject = GetIvar v20, :@foo + Jump bb4(v16, v17, v46) + bb6(v25:BasicObject, v26:BasicObject, v27:BasicObject): + v29:HeapObject[class_exact:C] = RefineType v27, HeapObject[class_exact:C] + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) IncrCounter getivar_fallback_not_monomorphic - v48:BasicObject = GetIvar v28, :@foo - Jump bb4(v24, v25, v48) - bb4(v34:BasicObject, v35:BasicObject, v36:BasicObject): + v49:BasicObject = GetIvar v29, :@foo + Jump bb4(v25, v26, v49) + bb4(v35:BasicObject, v36:BasicObject, v37:BasicObject): CheckInterrupts - Return v36 + Return v37 "); } @@ -7175,26 +7348,27 @@ mod hir_opt_tests { def test(o) = o.foo test obj "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:12: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] IncrCounter getivar_fallback_too_complex - v23:BasicObject = GetIvar v22, :@foo + v24:BasicObject = GetIvar v23, :@foo CheckInterrupts - Return v23 + Return v24 "); } @@ -7204,7 +7378,7 @@ mod hir_opt_tests { def test = [1, 2, 3].map { |x| x * 2 } test; test "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter @@ -7219,9 +7393,9 @@ mod hir_opt_tests { v11:ArrayExact = ArrayDup v10 PatchPoint NoSingletonClass(Array@0x1008) PatchPoint MethodRedefined(Array@0x1008, map@0x1010, cme:0x1018) - v21:BasicObject = SendDirect v11, 0x1040, :map (0x1050) + v22:BasicObject = SendDirect v11, 0x1040, :map (0x1050) CheckInterrupts - Return v21 + Return v22 "); } @@ -7239,7 +7413,7 @@ mod hir_opt_tests { test; test "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter @@ -7255,16 +7429,17 @@ mod hir_opt_tests { v13:ArrayExact = NewArray PatchPoint SingleRactorMode PatchPoint StableConstantNames(0x1000, A) - v35:ArrayExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v36:ArrayExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) PatchPoint StableConstantNames(0x1010, B) - v38:ArrayExact[VALUE(0x1018)] = Const Value(VALUE(0x1018)) + v39:ArrayExact[VALUE(0x1018)] = Const Value(VALUE(0x1018)) PatchPoint NoSingletonClass(Array@0x1020) PatchPoint MethodRedefined(Array@0x1020, zip@0x1028, cme:0x1030) - v42:BasicObject = CCallVariadic v35, :zip@0x1058, v38 - v22:BasicObject = GetLocal :result, l0, EP@3 + v43:BasicObject = CCallVariadic v36, :zip@0x1058, v39 + v22:CPtr = GetEP 0 + v23:BasicObject = LoadField v22, :result@0x1060 PatchPoint NoEPEscape(test) CheckInterrupts - Return v22 + Return v23 "); } @@ -7274,30 +7449,31 @@ mod hir_opt_tests { def test(&block) = [].map(&block) test { |x| x }; test { |x| x } "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :block, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :block@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :block@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:ArrayExact = NewArray - v15:CPtr = GetEP 0 - v16:CInt64 = LoadField v15, :_env_data_index_flags@0x1000 - v17:CInt64 = GuardNoBitsSet v16, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) - v18:CInt64 = LoadField v15, :_env_data_index_specval@0x1001 - v19:CInt64 = GuardAnyBitSet v18, CUInt64(1) - v20:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :block@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:ArrayExact = NewArray + v16:CPtr = GetEP 0 + v17:CInt64 = LoadField v16, :_env_data_index_flags@0x1001 + v18:CInt64 = GuardNoBitsSet v17, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v19:CInt64 = LoadField v16, :_env_data_index_specval@0x1002 + v20:CInt64 = GuardAnyBitSet v19, CUInt64(1) + v21:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) IncrCounter complex_arg_pass_caller_blockarg - v22:BasicObject = Send v13, 0x1000, :map, v20 # SendFallbackReason: Complex argument passing + v23:BasicObject = Send v14, 0x1001, :map, v21 # SendFallbackReason: Complex argument passing CheckInterrupts - Return v22 + Return v23 "); } @@ -7307,30 +7483,31 @@ mod hir_opt_tests { def test(&block) = [].map(&block) test; test "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :block, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :block@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :block@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:ArrayExact = NewArray - v15:CPtr = GetEP 0 - v16:CInt64 = LoadField v15, :_env_data_index_flags@0x1000 - v17:CInt64 = GuardNoBitsSet v16, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) - v18:CInt64 = LoadField v15, :_env_data_index_specval@0x1001 - v19:CInt64[0] = GuardBitEquals v18, CInt64(0) - v20:NilClass = Const Value(nil) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :block@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:ArrayExact = NewArray + v16:CPtr = GetEP 0 + v17:CInt64 = LoadField v16, :_env_data_index_flags@0x1001 + v18:CInt64 = GuardNoBitsSet v17, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v19:CInt64 = LoadField v16, :_env_data_index_specval@0x1002 + v20:CInt64[0] = GuardBitEquals v19, CInt64(0) + v21:NilClass = Const Value(nil) IncrCounter complex_arg_pass_caller_blockarg - v22:BasicObject = Send v13, 0x1000, :map, v20 # SendFallbackReason: Complex argument passing + v23:BasicObject = Send v14, 0x1001, :map, v21 # SendFallbackReason: Complex argument passing CheckInterrupts - Return v22 + Return v23 "); } @@ -7380,7 +7557,7 @@ mod hir_opt_tests { test; test "#); assert_eq!(VALUE::fixnum_from_usize(2), result); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter @@ -7393,10 +7570,10 @@ mod hir_opt_tests { bb3(v6:BasicObject): PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, foo@0x1008, cme:0x1010) - v19:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] - v20:BasicObject = SendDirect v19, 0x1038, :foo (0x1048) + v20:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] + v21:BasicObject = SendDirect v20, 0x1038, :foo (0x1048) CheckInterrupts - Return v20 + Return v21 "); } @@ -7483,27 +7660,28 @@ mod hir_opt_tests { test C.new test C.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v25:CShape = LoadField v22, :_shape_id@0x1038 - v26:CShape[0x1039] = GuardBitEquals v25, CShape(0x1039) - v27:NilClass = Const Value(nil) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v26:CShape = LoadField v23, :_shape_id@0x1040 + v27:CShape[0x1041] = GuardBitEquals v26, CShape(0x1041) + v28:NilClass = Const Value(nil) CheckInterrupts - Return v27 + Return v28 "); } @@ -7518,27 +7696,28 @@ mod hir_opt_tests { test C.new test C.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v25:CShape = LoadField v22, :_shape_id@0x1038 - v26:CShape[0x1039] = GuardBitEquals v25, CShape(0x1039) - v27:NilClass = Const Value(nil) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v26:CShape = LoadField v23, :_shape_id@0x1040 + v27:CShape[0x1041] = GuardBitEquals v26, CShape(0x1041) + v28:NilClass = Const Value(nil) CheckInterrupts - Return v27 + Return v28 "); } @@ -7553,30 +7732,31 @@ mod hir_opt_tests { test C.new test C.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v16:Fixnum[5] = Const Value(5) - PatchPoint MethodRedefined(C@0x1000, foo=@0x1008, cme:0x1010) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v30:CShape = LoadField v27, :_shape_id@0x1038 - v31:CShape[0x1039] = GuardBitEquals v30, CShape(0x1039) - StoreField v27, :@foo@0x103a, v16 - WriteBarrier v27, v16 - v34:CShape[0x103b] = Const CShape(0x103b) - StoreField v27, :_shape_id@0x1038, v34 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v17:Fixnum[5] = Const Value(5) + PatchPoint MethodRedefined(C@0x1008, foo=@0x1010, cme:0x1018) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v31:CShape = LoadField v28, :_shape_id@0x1040 + v32:CShape[0x1041] = GuardBitEquals v31, CShape(0x1041) + StoreField v28, :@foo@0x1042, v17 + WriteBarrier v28, v17 + v35:CShape[0x1043] = Const CShape(0x1043) + StoreField v28, :_shape_id@0x1040, v35 CheckInterrupts - Return v16 + Return v17 "); } @@ -7591,30 +7771,31 @@ mod hir_opt_tests { test C.new test C.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v16:Fixnum[5] = Const Value(5) - PatchPoint MethodRedefined(C@0x1000, foo=@0x1008, cme:0x1010) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v30:CShape = LoadField v27, :_shape_id@0x1038 - v31:CShape[0x1039] = GuardBitEquals v30, CShape(0x1039) - StoreField v27, :@foo@0x103a, v16 - WriteBarrier v27, v16 - v34:CShape[0x103b] = Const CShape(0x103b) - StoreField v27, :_shape_id@0x1038, v34 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v17:Fixnum[5] = Const Value(5) + PatchPoint MethodRedefined(C@0x1008, foo=@0x1010, cme:0x1018) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v31:CShape = LoadField v28, :_shape_id@0x1040 + v32:CShape[0x1041] = GuardBitEquals v31, CShape(0x1041) + StoreField v28, :@foo@0x1042, v17 + WriteBarrier v28, v17 + v35:CShape[0x1043] = Const CShape(0x1043) + StoreField v28, :_shape_id@0x1040, v35 CheckInterrupts - Return v16 + Return v17 "); } @@ -7626,25 +7807,26 @@ mod hir_opt_tests { test C.new test C.new "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v23:BasicObject = LoadField v22, :foo@0x1038 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v24:BasicObject = LoadField v23, :foo@0x1040 CheckInterrupts - Return v23 + Return v24 "); } @@ -7656,26 +7838,27 @@ mod hir_opt_tests { test C.new test C.new "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v23:CPtr = LoadField v22, :_as_heap@0x1038 - v24:BasicObject = LoadField v23, :foo@0x1039 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v24:CPtr = LoadField v23, :_as_heap@0x1040 + v25:BasicObject = LoadField v24, :foo@0x1041 CheckInterrupts - Return v24 + Return v25 "); } @@ -7690,25 +7873,26 @@ mod hir_opt_tests { test C.new test C.new "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) - v26:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v18:Fixnum[5] = Const Value(5) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) + v27:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v19:Fixnum[5] = Const Value(5) CheckInterrupts - Return v18 + Return v19 "); } @@ -7721,30 +7905,31 @@ mod hir_opt_tests { test C.new, value test C.new, value "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@5 - v3:BasicObject = GetLocal :v, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + v4:BasicObject = LoadField v2, :v@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :o@1 - v8:BasicObject = LoadArg :v@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo=@0x1008, cme:0x1010) - v30:HeapObject[class_exact:C] = GuardType v11, HeapObject[class_exact:C] - v31:CUInt64 = LoadField v30, :_rbasic_flags@0x1038 - v32:CUInt64 = GuardNoBitsSet v31, RUBY_FL_FREEZE=CUInt64(2048) - StoreField v30, :foo=@0x1039, v12 - WriteBarrier v30, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :o@1 + v9:BasicObject = LoadArg :v@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo=@0x1010, cme:0x1018) + v31:HeapObject[class_exact:C] = GuardType v12, HeapObject[class_exact:C] + v32:CUInt64 = LoadField v31, :_rbasic_flags@0x1040 + v33:CUInt64 = GuardNoBitsSet v32, RUBY_FL_FREEZE=CUInt64(2048) + StoreField v31, :foo=@0x1041, v13 + WriteBarrier v31, v13 CheckInterrupts - Return v12 + Return v13 "); } @@ -7757,31 +7942,32 @@ mod hir_opt_tests { test C.new, value test C.new, value "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@5 - v3:BasicObject = GetLocal :v, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + v4:BasicObject = LoadField v2, :v@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :o@1 - v8:BasicObject = LoadArg :v@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo=@0x1008, cme:0x1010) - v30:HeapObject[class_exact:C] = GuardType v11, HeapObject[class_exact:C] - v31:CUInt64 = LoadField v30, :_rbasic_flags@0x1038 - v32:CUInt64 = GuardNoBitsSet v31, RUBY_FL_FREEZE=CUInt64(2048) - v33:CPtr = LoadField v30, :_as_heap@0x1039 - StoreField v33, :foo=@0x103a, v12 - WriteBarrier v30, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :o@1 + v9:BasicObject = LoadArg :v@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo=@0x1010, cme:0x1018) + v31:HeapObject[class_exact:C] = GuardType v12, HeapObject[class_exact:C] + v32:CUInt64 = LoadField v31, :_rbasic_flags@0x1040 + v33:CUInt64 = GuardNoBitsSet v32, RUBY_FL_FREEZE=CUInt64(2048) + v34:CPtr = LoadField v31, :_as_heap@0x1041 + StoreField v34, :foo=@0x1042, v13 + WriteBarrier v31, v13 CheckInterrupts - Return v12 + Return v13 "); } @@ -7923,25 +8109,26 @@ mod hir_opt_tests { def test(o) = o.to_s test "foo" "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, to_s@0x1008, cme:0x1010) - v23:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, to_s@0x1010, cme:0x1018) + v24:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v23 + Return v24 "); } @@ -7951,24 +8138,25 @@ mod hir_opt_tests { def test(x) = x.to_s test 5 "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, to_s@0x1008, cme:0x1010) - v22:Fixnum = GuardType v9, Fixnum - v23:StringExact = CCallVariadic v22, :Integer#to_s@0x1038 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, to_s@0x1010, cme:0x1018) + v23:Fixnum = GuardType v10, Fixnum + v24:StringExact = CCallVariadic v23, :Integer#to_s@0x1040 CheckInterrupts - Return v23 + Return v24 "); } @@ -7978,24 +8166,25 @@ mod hir_opt_tests { def test(x) = x.to_s test (2**65) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, to_s@0x1008, cme:0x1010) - v22:Integer = GuardType v9, Integer - v23:StringExact = CCallVariadic v22, :Integer#to_s@0x1038 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, to_s@0x1010, cme:0x1018) + v23:Integer = GuardType v10, Integer + v24:StringExact = CCallVariadic v23, :Integer#to_s@0x1040 CheckInterrupts - Return v23 + Return v24 "); } @@ -8005,26 +8194,27 @@ mod hir_opt_tests { def test(x) = "#{x}" test 123 "##); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v27:Fixnum = GuardType v9, Fixnum - PatchPoint MethodRedefined(Integer@0x1008, to_s@0x1010, cme:0x1018) - v31:StringExact = CCallVariadic v27, :Integer#to_s@0x1040 - v21:StringExact = StringConcat v13, v31 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v28:Fixnum = GuardType v10, Fixnum + PatchPoint MethodRedefined(Integer@0x1010, to_s@0x1018, cme:0x1020) + v32:StringExact = CCallVariadic v28, :Integer#to_s@0x1048 + v22:StringExact = StringConcat v14, v32 CheckInterrupts - Return v21 + Return v22 "); } @@ -8074,34 +8264,35 @@ mod hir_opt_tests { end test([1, 2, 3], 0) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@5 - v3:BasicObject = GetLocal :idx, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + v4:BasicObject = LoadField v2, :idx@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :arr@1 - v8:BasicObject = LoadArg :idx@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, []@0x1008, cme:0x1010) - v28:ArrayExact = GuardType v11, ArrayExact - v29:Fixnum = GuardType v12, Fixnum - v30:CInt64 = UnboxFixnum v29 - v31:CInt64 = ArrayLength v28 - v32:CInt64 = GuardLess v30, v31 - v33:CInt64[0] = Const CInt64(0) - v34:CInt64 = GuardGreaterEq v32, v33 - v35:BasicObject = ArrayAref v28, v34 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :arr@1 + v9:BasicObject = LoadArg :idx@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018) + v29:ArrayExact = GuardType v12, ArrayExact + v30:Fixnum = GuardType v13, Fixnum + v31:CInt64 = UnboxFixnum v30 + v32:CInt64 = ArrayLength v29 + v33:CInt64 = GuardLess v31, v32 + v34:CInt64[0] = Const CInt64(0) + v35:CInt64 = GuardGreaterEq v33, v34 + v36:BasicObject = ArrayAref v29, v35 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v35 + Return v36 "); } @@ -8114,34 +8305,35 @@ mod hir_opt_tests { end test(C.new([1, 2, 3]), 0) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@5 - v3:BasicObject = GetLocal :idx, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + v4:BasicObject = LoadField v2, :idx@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :arr@1 - v8:BasicObject = LoadArg :idx@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, []@0x1008, cme:0x1010) - v28:ArraySubclass[class_exact:C] = GuardType v11, ArraySubclass[class_exact:C] - v29:Fixnum = GuardType v12, Fixnum - v30:CInt64 = UnboxFixnum v29 - v31:CInt64 = ArrayLength v28 - v32:CInt64 = GuardLess v30, v31 - v33:CInt64[0] = Const CInt64(0) - v34:CInt64 = GuardGreaterEq v32, v33 - v35:BasicObject = ArrayAref v28, v34 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :arr@1 + v9:BasicObject = LoadArg :idx@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, []@0x1010, cme:0x1018) + v29:ArraySubclass[class_exact:C] = GuardType v12, ArraySubclass[class_exact:C] + v30:Fixnum = GuardType v13, Fixnum + v31:CInt64 = UnboxFixnum v30 + v32:CInt64 = ArrayLength v29 + v33:CInt64 = GuardLess v31, v32 + v34:CInt64[0] = Const CInt64(0) + v35:CInt64 = GuardGreaterEq v33, v34 + v36:BasicObject = ArrayAref v29, v35 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v35 + Return v36 "); } @@ -8186,28 +8378,29 @@ mod hir_opt_tests { end test({1 => 3}, 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :hash, l0, SP@5 - v3:BasicObject = GetLocal :key, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :hash@0x1000 + v4:BasicObject = LoadField v2, :key@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :hash@1 - v8:BasicObject = LoadArg :key@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(Hash@0x1000) - PatchPoint MethodRedefined(Hash@0x1000, []@0x1008, cme:0x1010) - v28:HashExact = GuardType v11, HashExact - v29:BasicObject = HashAref v28, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :hash@1 + v9:BasicObject = LoadArg :key@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(Hash@0x1008) + PatchPoint MethodRedefined(Hash@0x1008, []@0x1010, cme:0x1018) + v29:HashExact = GuardType v12, HashExact + v30:BasicObject = HashAref v29, v13 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -8220,27 +8413,28 @@ mod hir_opt_tests { end test(C.new({0 => 3}), 0) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :hash, l0, SP@5 - v3:BasicObject = GetLocal :key, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :hash@0x1000 + v4:BasicObject = LoadField v2, :key@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :hash@1 - v8:BasicObject = LoadArg :key@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, []@0x1008, cme:0x1010) - v28:HashSubclass[class_exact:C] = GuardType v11, HashSubclass[class_exact:C] - v29:BasicObject = CCallWithFrame v28, :Hash#[]@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :hash@1 + v9:BasicObject = LoadArg :key@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, []@0x1010, cme:0x1018) + v29:HashSubclass[class_exact:C] = GuardType v12, HashSubclass[class_exact:C] + v30:BasicObject = CCallWithFrame v29, :Hash#[]@0x1040, v13 CheckInterrupts - Return v29 + Return v30 "); } @@ -8317,30 +8511,31 @@ mod hir_opt_tests { end test({}, 0, 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :hash, l0, SP@6 - v3:BasicObject = GetLocal :key, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :hash@0x1000 + v4:BasicObject = LoadField v2, :key@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :hash@1 - v9:BasicObject = LoadArg :key@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(Hash@0x1000) - PatchPoint MethodRedefined(Hash@0x1000, []=@0x1008, cme:0x1010) - v36:HashExact = GuardType v13, HashExact - HashAset v36, v14, v15 + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :hash@1 + v10:BasicObject = LoadArg :key@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(Hash@0x1008) + PatchPoint MethodRedefined(Hash@0x1008, []=@0x1010, cme:0x1018) + v37:HashExact = GuardType v14, HashExact + HashAset v37, v15, v16 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v15 + Return v16 "); } @@ -8353,29 +8548,30 @@ mod hir_opt_tests { end test(C.new, 0, 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :hash, l0, SP@6 - v3:BasicObject = GetLocal :key, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :hash@0x1000 + v4:BasicObject = LoadField v2, :key@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :hash@1 - v9:BasicObject = LoadArg :key@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, []=@0x1008, cme:0x1010) - v36:HashSubclass[class_exact:C] = GuardType v13, HashSubclass[class_exact:C] - v37:BasicObject = CCallWithFrame v36, :Hash#[]=@0x1038, v14, v15 + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :hash@1 + v10:BasicObject = LoadArg :key@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, []=@0x1010, cme:0x1018) + v37:HashSubclass[class_exact:C] = GuardType v14, HashSubclass[class_exact:C] + v38:BasicObject = CCallWithFrame v37, :Hash#[]=@0x1040, v15, v16 CheckInterrupts - Return v15 + Return v16 "); } @@ -8418,38 +8614,39 @@ mod hir_opt_tests { end test([]) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v16:Fixnum[1] = Const Value(1) - v18:Fixnum[10] = Const Value(10) - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, []=@0x1008, cme:0x1010) - v32:ArrayExact = GuardType v9, ArrayExact - v33:CUInt64 = LoadField v32, :_rbasic_flags@0x1038 - v34:CUInt64 = GuardNoBitsSet v33, RUBY_FL_FREEZE=CUInt64(2048) - v35:CUInt64 = LoadField v32, :_rbasic_flags@0x1038 - v36:CUInt64 = GuardNoBitsSet v35, RUBY_ELTS_SHARED=CUInt64(4096) - v37:CInt64[1] = UnboxFixnum v16 - v38:CInt64 = ArrayLength v32 - v39:CInt64[1] = GuardLess v37, v38 - v40:CInt64[0] = Const CInt64(0) - v41:CInt64[1] = GuardGreaterEq v39, v40 - ArrayAset v32, v41, v18 - WriteBarrier v32, v18 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v17:Fixnum[1] = Const Value(1) + v19:Fixnum[10] = Const Value(10) + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, []=@0x1010, cme:0x1018) + v33:ArrayExact = GuardType v10, ArrayExact + v34:CUInt64 = LoadField v33, :_rbasic_flags@0x1040 + v35:CUInt64 = GuardNoBitsSet v34, RUBY_FL_FREEZE=CUInt64(2048) + v36:CUInt64 = LoadField v33, :_rbasic_flags@0x1040 + v37:CUInt64 = GuardNoBitsSet v36, RUBY_ELTS_SHARED=CUInt64(4096) + v38:CInt64[1] = UnboxFixnum v17 + v39:CInt64 = ArrayLength v33 + v40:CInt64[1] = GuardLess v38, v39 + v41:CInt64[0] = Const CInt64(0) + v42:CInt64[1] = GuardGreaterEq v40, v41 + ArrayAset v33, v42, v19 + WriteBarrier v33, v19 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v18 + Return v19 "); } @@ -8461,41 +8658,42 @@ mod hir_opt_tests { end test([], 0, 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@6 - v3:BasicObject = GetLocal :index, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + v4:BasicObject = LoadField v2, :index@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :arr@1 - v9:BasicObject = LoadArg :index@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, []=@0x1008, cme:0x1010) - v36:ArrayExact = GuardType v13, ArrayExact - v37:Fixnum = GuardType v14, Fixnum - v38:CUInt64 = LoadField v36, :_rbasic_flags@0x1038 - v39:CUInt64 = GuardNoBitsSet v38, RUBY_FL_FREEZE=CUInt64(2048) - v40:CUInt64 = LoadField v36, :_rbasic_flags@0x1038 - v41:CUInt64 = GuardNoBitsSet v40, RUBY_ELTS_SHARED=CUInt64(4096) - v42:CInt64 = UnboxFixnum v37 - v43:CInt64 = ArrayLength v36 - v44:CInt64 = GuardLess v42, v43 - v45:CInt64[0] = Const CInt64(0) - v46:CInt64 = GuardGreaterEq v44, v45 - ArrayAset v36, v46, v15 - WriteBarrier v36, v15 + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :arr@1 + v10:BasicObject = LoadArg :index@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, []=@0x1010, cme:0x1018) + v37:ArrayExact = GuardType v14, ArrayExact + v38:Fixnum = GuardType v15, Fixnum + v39:CUInt64 = LoadField v37, :_rbasic_flags@0x1040 + v40:CUInt64 = GuardNoBitsSet v39, RUBY_FL_FREEZE=CUInt64(2048) + v41:CUInt64 = LoadField v37, :_rbasic_flags@0x1040 + v42:CUInt64 = GuardNoBitsSet v41, RUBY_ELTS_SHARED=CUInt64(4096) + v43:CInt64 = UnboxFixnum v38 + v44:CInt64 = ArrayLength v37 + v45:CInt64 = GuardLess v43, v44 + v46:CInt64[0] = Const CInt64(0) + v47:CInt64 = GuardGreaterEq v45, v46 + ArrayAset v37, v47, v16 + WriteBarrier v37, v16 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v15 + Return v16 "); } @@ -8509,29 +8707,30 @@ mod hir_opt_tests { a = MyArray.new test(a, 0, 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@6 - v3:BasicObject = GetLocal :index, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + v4:BasicObject = LoadField v2, :index@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :arr@1 - v9:BasicObject = LoadArg :index@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(MyArray@0x1000) - PatchPoint MethodRedefined(MyArray@0x1000, []=@0x1008, cme:0x1010) - v36:ArraySubclass[class_exact:MyArray] = GuardType v13, ArraySubclass[class_exact:MyArray] - v37:BasicObject = CCallVariadic v36, :Array#[]=@0x1038, v14, v15 + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :arr@1 + v10:BasicObject = LoadArg :index@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(MyArray@0x1008) + PatchPoint MethodRedefined(MyArray@0x1008, []=@0x1010, cme:0x1018) + v37:ArraySubclass[class_exact:MyArray] = GuardType v14, ArraySubclass[class_exact:MyArray] + v38:BasicObject = CCallVariadic v37, :Array#[]=@0x1040, v15, v16 CheckInterrupts - Return v15 + Return v16 "); } @@ -8543,27 +8742,28 @@ mod hir_opt_tests { end test([]) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, <<@0x1008, cme:0x1010) - v26:ArrayExact = GuardType v9, ArrayExact - ArrayPush v26, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, <<@0x1010, cme:0x1018) + v27:ArrayExact = GuardType v10, ArrayExact + ArrayPush v27, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -8575,27 +8775,28 @@ mod hir_opt_tests { end test([]) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, push@0x1008, cme:0x1010) - v25:ArrayExact = GuardType v9, ArrayExact - ArrayPush v25, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, push@0x1010, cme:0x1018) + v26:ArrayExact = GuardType v10, ArrayExact + ArrayPush v26, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v25 + Return v26 "); } @@ -8607,28 +8808,29 @@ mod hir_opt_tests { end test([]) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - v16:Fixnum[2] = Const Value(2) - v18:Fixnum[3] = Const Value(3) - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, push@0x1008, cme:0x1010) - v29:ArrayExact = GuardType v9, ArrayExact - v30:BasicObject = CCallVariadic v29, :Array#push@0x1038, v14, v16, v18 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + v17:Fixnum[2] = Const Value(2) + v19:Fixnum[3] = Const Value(3) + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, push@0x1010, cme:0x1018) + v30:ArrayExact = GuardType v10, ArrayExact + v31:BasicObject = CCallVariadic v30, :Array#push@0x1040, v15, v17, v19 CheckInterrupts - Return v30 + Return v31 "); } @@ -8646,25 +8848,26 @@ mod hir_opt_tests { bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :val@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :val@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Array@0x1000, <<@0x1008, cme:0x1010) - v22:CPtr = GetLEP - v23:RubyValue = LoadField v22, :_ep_method_entry@0x1038 - v24:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v23, Value(VALUE(0x1040)) - v25:RubyValue = LoadField v22, :_ep_specval@0x1048 - v26:FalseClass = GuardBitEquals v25, Value(false) - v27:Array = GuardType v8, Array - ArrayPush v27, v9 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :val@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Array@0x1008, <<@0x1010, cme:0x1018) + v23:CPtr = GetEP 0 + v24:RubyValue = LoadField v23, :_ep_method_entry@0x1040 + v25:CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v24, Value(VALUE(0x1048)) + v26:RubyValue = LoadField v23, :_ep_specval@0x1050 + v27:FalseClass = GuardBitEquals v26, Value(false) + v28:Array = GuardType v9, Array + ArrayPush v28, v10 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v27 + Return v28 "); } @@ -8689,12 +8892,12 @@ mod hir_opt_tests { Jump bb3(v4) bb3(v6:BasicObject): PatchPoint MethodRedefined(Array@0x1000, pop@0x1008, cme:0x1010) - v18:CPtr = GetLEP + v18:CPtr = GetEP 0 v19:RubyValue = LoadField v18, :_ep_method_entry@0x1038 v20:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v19, Value(VALUE(0x1040)) v21:RubyValue = LoadField v18, :_ep_specval@0x1048 v22:FalseClass = GuardBitEquals v21, Value(false) - v28:CPtr = GetLEP + v28:CPtr = GetEP 0 v29:RubyValue = LoadField v28, :_ep_method_entry@0x1038 v30:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v29, Value(VALUE(0x1040)) v31:RubyValue = LoadField v28, :_ep_specval@0x1048 @@ -8723,36 +8926,37 @@ mod hir_opt_tests { bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :idx, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :idx@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :idx@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Array@0x1000, []@0x1008, cme:0x1010) - v22:CPtr = GetLEP - v23:RubyValue = LoadField v22, :_ep_method_entry@0x1038 - v24:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v23, Value(VALUE(0x1040)) - v25:RubyValue = LoadField v22, :_ep_specval@0x1048 - v26:FalseClass = GuardBitEquals v25, Value(false) - v36:CPtr = GetLEP - v37:RubyValue = LoadField v36, :_ep_method_entry@0x1038 - v38:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v37, Value(VALUE(0x1040)) - v39:RubyValue = LoadField v36, :_ep_specval@0x1048 - v40:FalseClass = GuardBitEquals v39, Value(false) - v27:Array = GuardType v8, Array - v28:Fixnum = GuardType v9, Fixnum - v29:CInt64 = UnboxFixnum v28 - v30:CInt64 = ArrayLength v27 - v31:CInt64 = GuardLess v29, v30 - v32:CInt64[0] = Const CInt64(0) - v33:CInt64 = GuardGreaterEq v31, v32 - v34:BasicObject = ArrayAref v27, v33 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :idx@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018) + v23:CPtr = GetEP 0 + v24:RubyValue = LoadField v23, :_ep_method_entry@0x1040 + v25:CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v24, Value(VALUE(0x1048)) + v26:RubyValue = LoadField v23, :_ep_specval@0x1050 + v27:FalseClass = GuardBitEquals v26, Value(false) + v37:CPtr = GetEP 0 + v38:RubyValue = LoadField v37, :_ep_method_entry@0x1040 + v39:CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v38, Value(VALUE(0x1048)) + v40:RubyValue = LoadField v37, :_ep_specval@0x1050 + v41:FalseClass = GuardBitEquals v40, Value(false) + v28:Array = GuardType v9, Array + v29:Fixnum = GuardType v10, Fixnum + v30:CInt64 = UnboxFixnum v29 + v31:CInt64 = ArrayLength v28 + v32:CInt64 = GuardLess v30, v31 + v33:CInt64[0] = Const CInt64(0) + v34:CInt64 = GuardGreaterEq v32, v33 + v35:BasicObject = ArrayAref v28, v34 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v34 + Return v35 "); } @@ -8770,23 +8974,24 @@ mod hir_opt_tests { bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :idx, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :idx@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :idx@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Array@0x1000, []@0x1008, cme:0x1010) - v22:CPtr = GetLEP - v23:RubyValue = LoadField v22, :_ep_method_entry@0x1038 - v24:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v23, Value(VALUE(0x1040)) - v25:RubyValue = LoadField v22, :_ep_specval@0x1048 - v26:FalseClass = GuardBitEquals v25, Value(false) - v27:BasicObject = CCallVariadic v8, :Array#[]@0x1050, v9 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :idx@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018) + v23:CPtr = GetEP 0 + v24:RubyValue = LoadField v23, :_ep_method_entry@0x1040 + v25:CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v24, Value(VALUE(0x1048)) + v26:RubyValue = LoadField v23, :_ep_specval@0x1050 + v27:FalseClass = GuardBitEquals v26, Value(false) + v28:BasicObject = CCallVariadic v9, :Array#[]@0x1058, v10 CheckInterrupts - Return v27 + Return v28 "); } @@ -8797,27 +9002,28 @@ mod hir_opt_tests { test([]) "); assert_contains_opcode("test", YARVINSN_opt_length); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, length@0x1008, cme:0x1010) - v24:ArrayExact = GuardType v9, ArrayExact - v25:CInt64 = ArrayLength v24 - v26:Fixnum = BoxFixnum v25 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, length@0x1010, cme:0x1018) + v25:ArrayExact = GuardType v10, ArrayExact + v26:CInt64 = ArrayLength v25 + v27:Fixnum = BoxFixnum v26 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -8828,27 +9034,28 @@ mod hir_opt_tests { test([]) "); assert_contains_opcode("test", YARVINSN_opt_size); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arr, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arr@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :arr@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Array@0x1000) - PatchPoint MethodRedefined(Array@0x1000, size@0x1008, cme:0x1010) - v24:ArrayExact = GuardType v9, ArrayExact - v25:CInt64 = ArrayLength v24 - v26:Fixnum = BoxFixnum v25 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :arr@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Array@0x1008) + PatchPoint MethodRedefined(Array@0x1008, size@0x1010, cme:0x1018) + v25:ArrayExact = GuardType v10, ArrayExact + v26:CInt64 = ArrayLength v25 + v27:Fixnum = BoxFixnum v26 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -8859,26 +9066,27 @@ mod hir_opt_tests { test("foo") "#); assert_contains_opcode("test", YARVINSN_opt_regexpmatch2); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:RegexpExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(String@0x1008) - PatchPoint MethodRedefined(String@0x1008, =~@0x1010, cme:0x1018) - v26:StringExact = GuardType v9, StringExact - v27:BasicObject = CCallWithFrame v26, :String#=~@0x1040, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:RegexpExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(String@0x1010) + PatchPoint MethodRedefined(String@0x1010, =~@0x1018, cme:0x1020) + v27:StringExact = GuardType v10, StringExact + v28:BasicObject = CCallWithFrame v27, :String#=~@0x1048, v15 CheckInterrupts - Return v27 + Return v28 "); } @@ -8888,34 +9096,35 @@ mod hir_opt_tests { def test(s, i) = s.getbyte(i) test("foo", 0) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@5 - v3:BasicObject = GetLocal :i, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + v4:BasicObject = LoadField v2, :i@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :s@1 - v8:BasicObject = LoadArg :i@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, getbyte@0x1008, cme:0x1010) - v27:StringExact = GuardType v11, StringExact - v28:Fixnum = GuardType v12, Fixnum - v29:CInt64 = UnboxFixnum v28 - v30:CInt64 = LoadField v27, :len@0x1038 - v31:CInt64 = GuardLess v29, v30 - v32:CInt64[0] = Const CInt64(0) - v33:CInt64 = GuardGreaterEq v31, v32 - v34:Fixnum = StringGetbyte v27, v31 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :s@1 + v9:BasicObject = LoadArg :i@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, getbyte@0x1010, cme:0x1018) + v28:StringExact = GuardType v12, StringExact + v29:Fixnum = GuardType v13, Fixnum + v30:CInt64 = UnboxFixnum v29 + v31:CInt64 = LoadField v28, :len@0x1040 + v32:CInt64 = GuardLess v30, v31 + v33:CInt64[0] = Const CInt64(0) + v34:CInt64 = GuardGreaterEq v32, v33 + v35:Fixnum = StringGetbyte v28, v32 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v34 + Return v35 "); } @@ -8928,34 +9137,35 @@ mod hir_opt_tests { end test("foo", 0) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@5 - v3:BasicObject = GetLocal :i, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + v4:BasicObject = LoadField v2, :i@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :s@1 - v8:BasicObject = LoadArg :i@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, getbyte@0x1008, cme:0x1010) - v31:StringExact = GuardType v11, StringExact - v32:Fixnum = GuardType v12, Fixnum - v33:CInt64 = UnboxFixnum v32 - v34:CInt64 = LoadField v31, :len@0x1038 - v35:CInt64 = GuardLess v33, v34 - v36:CInt64[0] = Const CInt64(0) - v37:CInt64 = GuardGreaterEq v35, v36 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :s@1 + v9:BasicObject = LoadArg :i@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, getbyte@0x1010, cme:0x1018) + v32:StringExact = GuardType v12, StringExact + v33:Fixnum = GuardType v13, Fixnum + v34:CInt64 = UnboxFixnum v33 + v35:CInt64 = LoadField v32, :len@0x1040 + v36:CInt64 = GuardLess v34, v35 + v37:CInt64[0] = Const CInt64(0) + v38:CInt64 = GuardGreaterEq v36, v37 IncrCounter inline_cfunc_optimized_send_count - v22:Fixnum[5] = Const Value(5) + v23:Fixnum[5] = Const Value(5) CheckInterrupts - Return v22 + Return v23 "); } @@ -8967,39 +9177,40 @@ mod hir_opt_tests { end test("foo", 0, 127) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@6 - v3:BasicObject = GetLocal :idx, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + v4:BasicObject = LoadField v2, :idx@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :s@1 - v9:BasicObject = LoadArg :idx@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, setbyte@0x1008, cme:0x1010) - v31:StringExact = GuardType v13, StringExact - v32:Fixnum = GuardType v14, Fixnum + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :s@1 + v10:BasicObject = LoadArg :idx@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, setbyte@0x1010, cme:0x1018) + v32:StringExact = GuardType v14, StringExact v33:Fixnum = GuardType v15, Fixnum - v34:CInt64 = UnboxFixnum v32 - v35:CInt64 = LoadField v31, :len@0x1038 - v36:CInt64 = GuardLess v34, v35 - v37:CInt64[0] = Const CInt64(0) - v38:CInt64 = GuardGreaterEq v36, v37 - v39:CUInt64 = LoadField v31, :_rbasic_flags@0x1039 - v40:CUInt64 = GuardNoBitsSet v39, RUBY_FL_FREEZE=CUInt64(2048) - v41:Fixnum = StringSetbyteFixnum v31, v32, v33 + v34:Fixnum = GuardType v16, Fixnum + v35:CInt64 = UnboxFixnum v33 + v36:CInt64 = LoadField v32, :len@0x1040 + v37:CInt64 = GuardLess v35, v36 + v38:CInt64[0] = Const CInt64(0) + v39:CInt64 = GuardGreaterEq v37, v38 + v40:CUInt64 = LoadField v32, :_rbasic_flags@0x1041 + v41:CUInt64 = GuardNoBitsSet v40, RUBY_FL_FREEZE=CUInt64(2048) + v42:Fixnum = StringSetbyteFixnum v32, v33, v34 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v33 + Return v34 "); } @@ -9013,39 +9224,40 @@ mod hir_opt_tests { end test(MyString.new('foo'), 0, 127) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@6 - v3:BasicObject = GetLocal :idx, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + v4:BasicObject = LoadField v2, :idx@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :s@1 - v9:BasicObject = LoadArg :idx@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(MyString@0x1000) - PatchPoint MethodRedefined(MyString@0x1000, setbyte@0x1008, cme:0x1010) - v31:StringSubclass[class_exact:MyString] = GuardType v13, StringSubclass[class_exact:MyString] - v32:Fixnum = GuardType v14, Fixnum + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :s@1 + v10:BasicObject = LoadArg :idx@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(MyString@0x1008) + PatchPoint MethodRedefined(MyString@0x1008, setbyte@0x1010, cme:0x1018) + v32:StringSubclass[class_exact:MyString] = GuardType v14, StringSubclass[class_exact:MyString] v33:Fixnum = GuardType v15, Fixnum - v34:CInt64 = UnboxFixnum v32 - v35:CInt64 = LoadField v31, :len@0x1038 - v36:CInt64 = GuardLess v34, v35 - v37:CInt64[0] = Const CInt64(0) - v38:CInt64 = GuardGreaterEq v36, v37 - v39:CUInt64 = LoadField v31, :_rbasic_flags@0x1039 - v40:CUInt64 = GuardNoBitsSet v39, RUBY_FL_FREEZE=CUInt64(2048) - v41:Fixnum = StringSetbyteFixnum v31, v32, v33 + v34:Fixnum = GuardType v16, Fixnum + v35:CInt64 = UnboxFixnum v33 + v36:CInt64 = LoadField v32, :len@0x1040 + v37:CInt64 = GuardLess v35, v36 + v38:CInt64[0] = Const CInt64(0) + v39:CInt64 = GuardGreaterEq v37, v38 + v40:CUInt64 = LoadField v32, :_rbasic_flags@0x1041 + v41:CUInt64 = GuardNoBitsSet v40, RUBY_FL_FREEZE=CUInt64(2048) + v42:Fixnum = StringSetbyteFixnum v32, v33, v34 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v33 + Return v34 "); } @@ -9057,29 +9269,30 @@ mod hir_opt_tests { end test("foo", 0, 3.14) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@6 - v3:BasicObject = GetLocal :idx, l0, SP@5 - v4:BasicObject = GetLocal :val, l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + v4:BasicObject = LoadField v2, :idx@0x1001 + v5:BasicObject = LoadField v2, :val@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :s@1 - v9:BasicObject = LoadArg :idx@2 - v10:BasicObject = LoadArg :val@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, setbyte@0x1008, cme:0x1010) - v31:StringExact = GuardType v13, StringExact - v32:BasicObject = CCallWithFrame v31, :String#setbyte@0x1038, v14, v15 + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :s@1 + v10:BasicObject = LoadArg :idx@2 + v11:BasicObject = LoadArg :val@3 + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:BasicObject, v16:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, setbyte@0x1010, cme:0x1018) + v32:StringExact = GuardType v14, StringExact + v33:BasicObject = CCallWithFrame v32, :String#setbyte@0x1040, v15, v16 CheckInterrupts - Return v32 + Return v33 "); } @@ -9091,29 +9304,30 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, empty?@0x1008, cme:0x1010) - v24:StringExact = GuardType v9, StringExact - v25:CInt64 = LoadField v24, :len@0x1038 - v26:CInt64[0] = Const CInt64(0) - v27:CBool = IsBitEqual v25, v26 - v28:BoolExact = BoxBool v27 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, empty?@0x1010, cme:0x1018) + v25:StringExact = GuardType v10, StringExact + v26:CInt64 = LoadField v25, :len@0x1040 + v27:CInt64[0] = Const CInt64(0) + v28:CBool = IsBitEqual v26, v27 + v29:BoolExact = BoxBool v28 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v28 + Return v29 "); } @@ -9126,26 +9340,27 @@ mod hir_opt_tests { end test("this should get removed") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, empty?@0x1008, cme:0x1010) - v28:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, empty?@0x1010, cme:0x1018) + v29:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v19:Fixnum[4] = Const Value(4) + v20:Fixnum[4] = Const Value(4) CheckInterrupts - Return v19 + Return v20 "); } @@ -9156,26 +9371,27 @@ mod hir_opt_tests { test(4) "); assert_contains_opcode("test", YARVINSN_opt_succ); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, succ@0x1008, cme:0x1010) - v23:Fixnum = GuardType v9, Fixnum - v24:Fixnum[1] = Const Value(1) - v25:Fixnum = FixnumAdd v23, v24 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, succ@0x1010, cme:0x1018) + v24:Fixnum = GuardType v10, Fixnum + v25:Fixnum[1] = Const Value(1) + v26:Fixnum = FixnumAdd v24, v25 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v25 + Return v26 "); } @@ -9186,24 +9402,25 @@ mod hir_opt_tests { test(4 << 70) "); assert_contains_opcode("test", YARVINSN_opt_succ); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, succ@0x1008, cme:0x1010) - v23:Integer = GuardType v9, Integer - v24:BasicObject = CCallWithFrame v23, :Integer#succ@0x1038 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, succ@0x1010, cme:0x1018) + v24:Integer = GuardType v10, Integer + v25:BasicObject = CCallWithFrame v24, :Integer#succ@0x1040 CheckInterrupts - Return v24 + Return v25 "); } @@ -9214,26 +9431,27 @@ mod hir_opt_tests { test(4) "); assert_contains_opcode("test", YARVINSN_opt_ltlt); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[5] = Const Value(5) - PatchPoint MethodRedefined(Integer@0x1000, <<@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:Fixnum = FixnumLShift v25, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[5] = Const Value(5) + PatchPoint MethodRedefined(Integer@0x1008, <<@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:Fixnum = FixnumLShift v26, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -9244,25 +9462,26 @@ mod hir_opt_tests { test(4) "); assert_contains_opcode("test", YARVINSN_opt_ltlt); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[-5] = Const Value(-5) - PatchPoint MethodRedefined(Integer@0x1000, <<@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:BasicObject = CCallWithFrame v25, :Integer#<<@0x1038, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[-5] = Const Value(-5) + PatchPoint MethodRedefined(Integer@0x1008, <<@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:BasicObject = CCallWithFrame v26, :Integer#<<@0x1040, v15 CheckInterrupts - Return v26 + Return v27 "); } @@ -9273,25 +9492,26 @@ mod hir_opt_tests { test(4) "); assert_contains_opcode("test", YARVINSN_opt_ltlt); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[64] = Const Value(64) - PatchPoint MethodRedefined(Integer@0x1000, <<@0x1008, cme:0x1010) - v25:Fixnum = GuardType v9, Fixnum - v26:BasicObject = CCallWithFrame v25, :Integer#<<@0x1038, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[64] = Const Value(64) + PatchPoint MethodRedefined(Integer@0x1008, <<@0x1010, cme:0x1018) + v26:Fixnum = GuardType v10, Fixnum + v27:BasicObject = CCallWithFrame v26, :Integer#<<@0x1040, v15 CheckInterrupts - Return v26 + Return v27 "); } @@ -9302,26 +9522,27 @@ mod hir_opt_tests { test(4, 5) "); assert_contains_opcode("test", YARVINSN_opt_ltlt); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, <<@0x1008, cme:0x1010) - v27:Fixnum = GuardType v11, Fixnum - v28:BasicObject = CCallWithFrame v27, :Integer#<<@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, <<@0x1010, cme:0x1018) + v28:Fixnum = GuardType v12, Fixnum + v29:BasicObject = CCallWithFrame v28, :Integer#<<@0x1040, v13 CheckInterrupts - Return v28 + Return v29 "); } @@ -9331,26 +9552,27 @@ mod hir_opt_tests { def test(x) = x >> 5 test(4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[5] = Const Value(5) - PatchPoint MethodRedefined(Integer@0x1000, >>@0x1008, cme:0x1010) - v24:Fixnum = GuardType v9, Fixnum - v25:Fixnum = FixnumRShift v24, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[5] = Const Value(5) + PatchPoint MethodRedefined(Integer@0x1008, >>@0x1010, cme:0x1018) + v25:Fixnum = GuardType v10, Fixnum + v26:Fixnum = FixnumRShift v25, v15 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v25 + Return v26 "); } @@ -9360,25 +9582,26 @@ mod hir_opt_tests { def test(x) = x >> -5 test(4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[-5] = Const Value(-5) - PatchPoint MethodRedefined(Integer@0x1000, >>@0x1008, cme:0x1010) - v24:Fixnum = GuardType v9, Fixnum - v25:BasicObject = CCallWithFrame v24, :Integer#>>@0x1038, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[-5] = Const Value(-5) + PatchPoint MethodRedefined(Integer@0x1008, >>@0x1010, cme:0x1018) + v25:Fixnum = GuardType v10, Fixnum + v26:BasicObject = CCallWithFrame v25, :Integer#>>@0x1040, v15 CheckInterrupts - Return v25 + Return v26 "); } @@ -9388,25 +9611,26 @@ mod hir_opt_tests { def test(x) = x >> 64 test(4) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[64] = Const Value(64) - PatchPoint MethodRedefined(Integer@0x1000, >>@0x1008, cme:0x1010) - v24:Fixnum = GuardType v9, Fixnum - v25:BasicObject = CCallWithFrame v24, :Integer#>>@0x1038, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[64] = Const Value(64) + PatchPoint MethodRedefined(Integer@0x1008, >>@0x1010, cme:0x1018) + v25:Fixnum = GuardType v10, Fixnum + v26:BasicObject = CCallWithFrame v25, :Integer#>>@0x1040, v15 CheckInterrupts - Return v25 + Return v26 "); } @@ -9416,26 +9640,27 @@ mod hir_opt_tests { def test(x, y) = x >> y test(4, 5) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, >>@0x1008, cme:0x1010) - v26:Fixnum = GuardType v11, Fixnum - v27:BasicObject = CCallWithFrame v26, :Integer#>>@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, >>@0x1010, cme:0x1018) + v27:Fixnum = GuardType v12, Fixnum + v28:BasicObject = CCallWithFrame v27, :Integer#>>@0x1040, v13 CheckInterrupts - Return v27 + Return v28 "); } @@ -9445,29 +9670,30 @@ mod hir_opt_tests { def test(x, y) = x << y test("iron", "fish") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, <<@0x1008, cme:0x1010) - v28:StringExact = GuardType v11, StringExact - v29:String = GuardType v12, String - v30:StringExact = StringAppend v28, v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, <<@0x1010, cme:0x1018) + v29:StringExact = GuardType v12, StringExact + v30:String = GuardType v13, String + v31:StringExact = StringAppend v29, v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v28 + Return v29 "); } @@ -9477,29 +9703,30 @@ mod hir_opt_tests { def test(x, y) = x << y test("iron", 4) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, <<@0x1008, cme:0x1010) - v28:StringExact = GuardType v11, StringExact - v29:Fixnum = GuardType v12, Fixnum - v30:StringExact = StringAppendCodepoint v28, v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, <<@0x1010, cme:0x1018) + v29:StringExact = GuardType v12, StringExact + v30:Fixnum = GuardType v13, Fixnum + v31:StringExact = StringAppendCodepoint v29, v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v28 + Return v29 "); } @@ -9511,29 +9738,30 @@ mod hir_opt_tests { def test(x, y) = x << y test("iron", MyString.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, <<@0x1008, cme:0x1010) - v28:StringExact = GuardType v11, StringExact - v29:String = GuardType v12, String - v30:StringExact = StringAppend v28, v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, <<@0x1010, cme:0x1018) + v29:StringExact = GuardType v12, StringExact + v30:String = GuardType v13, String + v31:StringExact = StringAppend v29, v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v28 + Return v29 "); } @@ -9545,27 +9773,28 @@ mod hir_opt_tests { def test(x, y) = x << y test(MyString.new, "iron") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(MyString@0x1000) - PatchPoint MethodRedefined(MyString@0x1000, <<@0x1008, cme:0x1010) - v28:StringSubclass[class_exact:MyString] = GuardType v11, StringSubclass[class_exact:MyString] - v29:BasicObject = CCallWithFrame v28, :String#<<@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(MyString@0x1008) + PatchPoint MethodRedefined(MyString@0x1008, <<@0x1010, cme:0x1018) + v29:StringSubclass[class_exact:MyString] = GuardType v12, StringSubclass[class_exact:MyString] + v30:BasicObject = CCallWithFrame v29, :String#<<@0x1040, v13 CheckInterrupts - Return v29 + Return v30 "); } @@ -9629,26 +9858,27 @@ mod hir_opt_tests { def test(x) = x.ascii_only? test("iron") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, ascii_only?@0x1008, cme:0x1010) - v23:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, ascii_only?@0x1010, cme:0x1018) + v24:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v25:BoolExact = CCall v23, :String#ascii_only?@0x1038 + v26:BoolExact = CCall v24, :String#ascii_only?@0x1040 CheckInterrupts - Return v25 + Return v26 "); } @@ -9706,28 +9936,29 @@ mod hir_opt_tests { def test(x, y) = x ^ y test(1, 2) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, ^@0x1008, cme:0x1010) - v26:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, ^@0x1010, cme:0x1018) v27:Fixnum = GuardType v12, Fixnum - v28:Fixnum = FixnumXor v26, v27 + v28:Fixnum = GuardType v13, Fixnum + v29:Fixnum = FixnumXor v27, v28 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v28 + Return v29 "); } @@ -9740,28 +9971,29 @@ mod hir_opt_tests { end test(1, 2) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, ^@0x1008, cme:0x1010) - v30:Fixnum = GuardType v11, Fixnum + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, ^@0x1010, cme:0x1018) v31:Fixnum = GuardType v12, Fixnum + v32:Fixnum = GuardType v13, Fixnum IncrCounter inline_cfunc_optimized_send_count - v22:Fixnum[42] = Const Value(42) + v23:Fixnum[42] = Const Value(42) CheckInterrupts - Return v22 + Return v23 "); } @@ -9771,78 +10003,81 @@ mod hir_opt_tests { def test(x, y) = x ^ y test(4 << 70, 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, ^@0x1008, cme:0x1010) - v26:Integer = GuardType v11, Integer - v27:BasicObject = CCallWithFrame v26, :Integer#^@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, ^@0x1010, cme:0x1018) + v27:Integer = GuardType v12, Integer + v28:BasicObject = CCallWithFrame v27, :Integer#^@0x1040, v13 CheckInterrupts - Return v27 + Return v28 "); eval(" def test(x, y) = x ^ y test(1, 4 << 70) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, ^@0x1008, cme:0x1010) - v26:Fixnum = GuardType v11, Fixnum - v27:BasicObject = CCallWithFrame v26, :Integer#^@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, ^@0x1010, cme:0x1018) + v27:Fixnum = GuardType v12, Fixnum + v28:BasicObject = CCallWithFrame v27, :Integer#^@0x1040, v13 CheckInterrupts - Return v27 + Return v28 "); eval(" def test(x, y) = x ^ y test(true, 0) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint MethodRedefined(TrueClass@0x1000, ^@0x1008, cme:0x1010) - v26:TrueClass = GuardType v11, TrueClass - v27:BasicObject = CCallWithFrame v26, :TrueClass#^@0x1038, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint MethodRedefined(TrueClass@0x1008, ^@0x1010, cme:0x1018) + v27:TrueClass = GuardType v12, TrueClass + v28:BasicObject = CCallWithFrame v27, :TrueClass#^@0x1040, v13 CheckInterrupts - Return v27 + Return v28 "); } @@ -9851,24 +10086,25 @@ mod hir_opt_tests { eval(" def test(x, y) = x.^() "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v17:BasicObject = Send v11, :^ # SendFallbackReason: Uncategorized(opt_send_without_block) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v18:BasicObject = Send v12, :^ # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v17 + Return v18 "); } @@ -9878,26 +10114,27 @@ mod hir_opt_tests { def test(hash) = hash.size test({foo: 3, bar: 1, baz: 4}) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :hash, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :hash@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :hash@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Hash@0x1000) - PatchPoint MethodRedefined(Hash@0x1000, size@0x1008, cme:0x1010) - v24:HashExact = GuardType v9, HashExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :hash@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Hash@0x1008) + PatchPoint MethodRedefined(Hash@0x1008, size@0x1010, cme:0x1018) + v25:HashExact = GuardType v10, HashExact IncrCounter inline_cfunc_optimized_send_count - v26:Fixnum = CCall v24, :Hash#size@0x1038 + v27:Fixnum = CCall v25, :Hash#size@0x1040 CheckInterrupts - Return v26 + Return v27 "); } @@ -9910,26 +10147,27 @@ mod hir_opt_tests { end test({foo: 3, bar: 1, baz: 4}) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :hash, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :hash@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :hash@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(Hash@0x1000) - PatchPoint MethodRedefined(Hash@0x1000, size@0x1008, cme:0x1010) - v28:HashExact = GuardType v9, HashExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :hash@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(Hash@0x1008) + PatchPoint MethodRedefined(Hash@0x1008, size@0x1010, cme:0x1018) + v29:HashExact = GuardType v10, HashExact IncrCounter inline_cfunc_optimized_send_count - v19:Fixnum[5] = Const Value(5) + v20:Fixnum[5] = Const Value(5) CheckInterrupts - Return v19 + Return v20 "); } @@ -9942,28 +10180,29 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v25:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v29:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v26:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v30:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -9975,29 +10214,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v25:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, respond_to_missing?@0x1040, cme:0x1048) - PatchPoint MethodRedefined(C@0x1008, foo@0x1070, cme:0x1078) - v31:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v26:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, respond_to_missing?@0x1048, cme:0x1050) + PatchPoint MethodRedefined(C@0x1010, foo@0x1078, cme:0x1080) + v32:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10011,28 +10251,29 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v25:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v29:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v26:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v30:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -10046,29 +10287,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo, false) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - v16:FalseClass = Const Value(false) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v31:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + v17:FalseClass = Const Value(false) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v32:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10082,29 +10324,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo, nil) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - v16:NilClass = Const Value(nil) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v31:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + v17:NilClass = Const Value(nil) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v32:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10118,29 +10361,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo, true) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - v16:TrueClass = Const Value(true) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v31:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + v17:TrueClass = Const Value(true) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v32:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10153,29 +10397,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo, 4) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - v16:Fixnum[4] = Const Value(4) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v31:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + v17:Fixnum[4] = Const Value(4) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v32:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10188,29 +10433,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo, nil) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - v16:NilClass = Const Value(nil) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v27:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, foo@0x1040, cme:0x1048) - v31:TrueClass = Const Value(true) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + v17:NilClass = Const Value(nil) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v28:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, foo@0x1048, cme:0x1050) + v32:TrueClass = Const Value(true) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10222,29 +10468,30 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v25:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - PatchPoint MethodRedefined(C@0x1008, respond_to_missing?@0x1040, cme:0x1048) - PatchPoint MethodRedefined(C@0x1008, foo@0x1070, cme:0x1078) - v31:FalseClass = Const Value(false) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v26:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + PatchPoint MethodRedefined(C@0x1010, respond_to_missing?@0x1048, cme:0x1050) + PatchPoint MethodRedefined(C@0x1010, foo@0x1078, cme:0x1080) + v32:FalseClass = Const Value(false) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v31 + Return v32 "); } @@ -10259,26 +10506,27 @@ mod hir_opt_tests { def test(o) = o.respond_to?(:foo) test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:7: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:StaticSymbol[:foo] = Const Value(VALUE(0x1000)) - PatchPoint NoSingletonClass(C@0x1008) - PatchPoint MethodRedefined(C@0x1008, respond_to?@0x1010, cme:0x1018) - v25:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] - v26:BasicObject = CCallVariadic v25, :Kernel#respond_to?@0x1040, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:StaticSymbol[:foo] = Const Value(VALUE(0x1008)) + PatchPoint NoSingletonClass(C@0x1010) + PatchPoint MethodRedefined(C@0x1010, respond_to?@0x1018, cme:0x1020) + v26:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] + v27:BasicObject = CCallVariadic v26, :Kernel#respond_to?@0x1048, v15 CheckInterrupts - Return v26 + Return v27 "); } @@ -10588,24 +10836,25 @@ mod hir_opt_tests { def test(o) = o.to_sym test :foo "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Symbol@0x1000, to_sym@0x1008, cme:0x1010) - v21:StaticSymbol = GuardType v9, StaticSymbol + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Symbol@0x1008, to_sym@0x1010, cme:0x1018) + v22:StaticSymbol = GuardType v10, StaticSymbol IncrCounter inline_iseq_optimized_send_count CheckInterrupts - Return v21 + Return v22 "); } @@ -10615,24 +10864,25 @@ mod hir_opt_tests { def test(o) = o.to_i test 5 "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(Integer@0x1000, to_i@0x1008, cme:0x1010) - v21:Fixnum = GuardType v9, Fixnum + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(Integer@0x1008, to_i@0x1010, cme:0x1018) + v22:Fixnum = GuardType v10, Fixnum IncrCounter inline_iseq_optimized_send_count CheckInterrupts - Return v21 + Return v22 "); } @@ -10646,7 +10896,7 @@ mod hir_opt_tests { end test "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter @@ -10659,11 +10909,11 @@ mod hir_opt_tests { bb3(v6:BasicObject): PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, callee@0x1008, cme:0x1010) - v19:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] + v20:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] IncrCounter inline_iseq_optimized_send_count - v22:Fixnum[123] = Const Value(123) + v23:Fixnum[123] = Const Value(123) CheckInterrupts - Return v22 + Return v23 "); } @@ -10677,7 +10927,7 @@ mod hir_opt_tests { end test "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter @@ -10690,11 +10940,11 @@ mod hir_opt_tests { bb3(v6:BasicObject): PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, callee@0x1008, cme:0x1010) - v19:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] + v20:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] IncrCounter inline_iseq_optimized_send_count - v22:Fixnum[123] = Const Value(123) + v23:Fixnum[123] = Const Value(123) CheckInterrupts - Return v22 + Return v23 "); } @@ -10708,7 +10958,7 @@ mod hir_opt_tests { end test "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter @@ -10721,11 +10971,11 @@ mod hir_opt_tests { bb3(v6:BasicObject): PatchPoint NoSingletonClass(Object@0x1000) PatchPoint MethodRedefined(Object@0x1000, callee@0x1008, cme:0x1010) - v19:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] + v20:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)] IncrCounter inline_iseq_optimized_send_count - v22:Fixnum[123] = Const Value(123) + v23:Fixnum[123] = Const Value(123) CheckInterrupts - Return v22 + Return v23 "); } @@ -10763,29 +11013,30 @@ mod hir_opt_tests { def test(l, r) = l == r test("a", "b") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :l, l0, SP@5 - v3:BasicObject = GetLocal :r, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :l@0x1000 + v4:BasicObject = LoadField v2, :r@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :l@1 - v8:BasicObject = LoadArg :r@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, ==@0x1008, cme:0x1010) - v28:StringExact = GuardType v11, StringExact - v29:String = GuardType v12, String - v30:BoolExact = CCall v28, :String#==@0x1038, v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :l@1 + v9:BasicObject = LoadArg :r@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, ==@0x1010, cme:0x1018) + v29:StringExact = GuardType v12, StringExact + v30:String = GuardType v13, String + v31:BoolExact = CCall v29, :String#==@0x1040, v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v30 + Return v31 "); } @@ -10797,29 +11048,30 @@ mod hir_opt_tests { def test(l, r) = l == r test(C.new("a"), C.new("b")) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :l, l0, SP@5 - v3:BasicObject = GetLocal :r, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :l@0x1000 + v4:BasicObject = LoadField v2, :r@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :l@1 - v8:BasicObject = LoadArg :r@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, ==@0x1008, cme:0x1010) - v28:StringSubclass[class_exact:C] = GuardType v11, StringSubclass[class_exact:C] - v29:String = GuardType v12, String - v30:BoolExact = CCall v28, :String#==@0x1038, v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :l@1 + v9:BasicObject = LoadArg :r@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, ==@0x1010, cme:0x1018) + v29:StringSubclass[class_exact:C] = GuardType v12, StringSubclass[class_exact:C] + v30:String = GuardType v13, String + v31:BoolExact = CCall v29, :String#==@0x1040, v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v30 + Return v31 "); } @@ -10831,29 +11083,30 @@ mod hir_opt_tests { def test(l, r) = l == r test("a", C.new("b")) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :l, l0, SP@5 - v3:BasicObject = GetLocal :r, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :l@0x1000 + v4:BasicObject = LoadField v2, :r@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :l@1 - v8:BasicObject = LoadArg :r@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, ==@0x1008, cme:0x1010) - v28:StringExact = GuardType v11, StringExact - v29:String = GuardType v12, String - v30:BoolExact = CCall v28, :String#==@0x1038, v29 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :l@1 + v9:BasicObject = LoadArg :r@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, ==@0x1010, cme:0x1018) + v29:StringExact = GuardType v12, StringExact + v30:String = GuardType v13, String + v31:BoolExact = CCall v29, :String#==@0x1040, v30 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v30 + Return v31 "); } @@ -10863,29 +11116,30 @@ mod hir_opt_tests { def test(l, r) = l === r test("a", "b") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :l, l0, SP@5 - v3:BasicObject = GetLocal :r, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :l@0x1000 + v4:BasicObject = LoadField v2, :r@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :l@1 - v8:BasicObject = LoadArg :r@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, ===@0x1008, cme:0x1010) - v27:StringExact = GuardType v11, StringExact - v28:String = GuardType v12, String - v29:BoolExact = CCall v27, :String#==@0x1038, v28 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :l@1 + v9:BasicObject = LoadArg :r@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, ===@0x1010, cme:0x1018) + v28:StringExact = GuardType v12, StringExact + v29:String = GuardType v13, String + v30:BoolExact = CCall v28, :String#==@0x1040, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -10897,29 +11151,30 @@ mod hir_opt_tests { def test(l, r) = l === r test(C.new("a"), C.new("b")) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :l, l0, SP@5 - v3:BasicObject = GetLocal :r, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :l@0x1000 + v4:BasicObject = LoadField v2, :r@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :l@1 - v8:BasicObject = LoadArg :r@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, ===@0x1008, cme:0x1010) - v27:StringSubclass[class_exact:C] = GuardType v11, StringSubclass[class_exact:C] - v28:String = GuardType v12, String - v29:BoolExact = CCall v27, :String#==@0x1038, v28 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :l@1 + v9:BasicObject = LoadArg :r@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, ===@0x1010, cme:0x1018) + v28:StringSubclass[class_exact:C] = GuardType v12, StringSubclass[class_exact:C] + v29:String = GuardType v13, String + v30:BoolExact = CCall v28, :String#==@0x1040, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -10931,29 +11186,30 @@ mod hir_opt_tests { def test(l, r) = l === r test("a", C.new("b")) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:4: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :l, l0, SP@5 - v3:BasicObject = GetLocal :r, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :l@0x1000 + v4:BasicObject = LoadField v2, :r@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :l@1 - v8:BasicObject = LoadArg :r@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, ===@0x1008, cme:0x1010) - v27:StringExact = GuardType v11, StringExact - v28:String = GuardType v12, String - v29:BoolExact = CCall v27, :String#==@0x1038, v28 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :l@1 + v9:BasicObject = LoadArg :r@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, ===@0x1010, cme:0x1018) + v28:StringExact = GuardType v12, StringExact + v29:String = GuardType v13, String + v30:BoolExact = CCall v28, :String#==@0x1040, v29 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -10965,26 +11221,27 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, size@0x1008, cme:0x1010) - v24:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, size@0x1010, cme:0x1018) + v25:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v26:Fixnum = CCall v24, :String#size@0x1038 + v27:Fixnum = CCall v25, :String#size@0x1040 CheckInterrupts - Return v26 + Return v27 "); } @@ -10997,26 +11254,27 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, size@0x1008, cme:0x1010) - v28:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, size@0x1010, cme:0x1018) + v29:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v19:Fixnum[5] = Const Value(5) + v20:Fixnum[5] = Const Value(5) CheckInterrupts - Return v19 + Return v20 "); } @@ -11028,27 +11286,28 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, bytesize@0x1008, cme:0x1010) - v23:StringExact = GuardType v9, StringExact - v24:CInt64 = LoadField v23, :len@0x1038 - v25:Fixnum = BoxFixnum v24 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, bytesize@0x1010, cme:0x1018) + v24:StringExact = GuardType v10, StringExact + v25:CInt64 = LoadField v24, :len@0x1040 + v26:Fixnum = BoxFixnum v25 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v25 + Return v26 "); } @@ -11061,26 +11320,27 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, bytesize@0x1008, cme:0x1010) - v27:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, bytesize@0x1010, cme:0x1018) + v28:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v18:Fixnum[5] = Const Value(5) + v19:Fixnum[5] = Const Value(5) CheckInterrupts - Return v18 + Return v19 "); } @@ -11092,26 +11352,27 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, length@0x1008, cme:0x1010) - v24:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, length@0x1010, cme:0x1018) + v25:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v26:Fixnum = CCall v24, :String#length@0x1038 + v27:Fixnum = CCall v25, :String#length@0x1040 CheckInterrupts - Return v26 + Return v27 "); } @@ -11121,29 +11382,30 @@ mod hir_opt_tests { def test(o) = String === o test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, String) - v26:Class[String@0x1008] = Const Value(VALUE(0x1008)) + PatchPoint StableConstantNames(0x1008, String) + v27:Class[String@0x1010] = Const Value(VALUE(0x1010)) PatchPoint NoEPEscape(test) - PatchPoint NoSingletonClass(Class@0x1010) - PatchPoint MethodRedefined(Class@0x1010, ===@0x1018, cme:0x1020) - v30:BoolExact = IsA v9, v26 + PatchPoint NoSingletonClass(Class@0x1018) + PatchPoint MethodRedefined(Class@0x1018, ===@0x1020, cme:0x1028) + v31:BoolExact = IsA v10, v27 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v30 + Return v31 "); } @@ -11153,29 +11415,30 @@ mod hir_opt_tests { def test(o) = Kernel === o test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, Kernel) - v26:ModuleExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + PatchPoint StableConstantNames(0x1008, Kernel) + v27:ModuleExact[VALUE(0x1010)] = Const Value(VALUE(0x1010)) PatchPoint NoEPEscape(test) - PatchPoint NoSingletonClass(Module@0x1010) - PatchPoint MethodRedefined(Module@0x1010, ===@0x1018, cme:0x1020) + PatchPoint NoSingletonClass(Module@0x1018) + PatchPoint MethodRedefined(Module@0x1018, ===@0x1020, cme:0x1028) IncrCounter inline_cfunc_optimized_send_count - v31:BoolExact = CCall v26, :Module#===@0x1048, v9 + v32:BoolExact = CCall v27, :Module#===@0x1050, v10 CheckInterrupts - Return v31 + Return v32 "); } @@ -11185,29 +11448,30 @@ mod hir_opt_tests { def test(o) = o.is_a?(String) test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, String) - v24:Class[String@0x1008] = Const Value(VALUE(0x1008)) - PatchPoint NoSingletonClass(String@0x1008) - PatchPoint MethodRedefined(String@0x1008, is_a?@0x1009, cme:0x1010) - v28:StringExact = GuardType v9, StringExact - v29:BoolExact = IsA v28, v24 + PatchPoint StableConstantNames(0x1008, String) + v25:Class[String@0x1010] = Const Value(VALUE(0x1010)) + PatchPoint NoSingletonClass(String@0x1010) + PatchPoint MethodRedefined(String@0x1010, is_a?@0x1011, cme:0x1018) + v29:StringExact = GuardType v10, StringExact + v30:BoolExact = IsA v29, v25 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -11217,28 +11481,29 @@ mod hir_opt_tests { def test(o) = o.is_a?(Kernel) test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, Kernel) - v24:ModuleExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) - PatchPoint NoSingletonClass(String@0x1010) - PatchPoint MethodRedefined(String@0x1010, is_a?@0x1018, cme:0x1020) - v28:StringExact = GuardType v9, StringExact - v29:BasicObject = CCallWithFrame v28, :Kernel#is_a?@0x1048, v24 + PatchPoint StableConstantNames(0x1008, Kernel) + v25:ModuleExact[VALUE(0x1010)] = Const Value(VALUE(0x1010)) + PatchPoint NoSingletonClass(String@0x1018) + PatchPoint MethodRedefined(String@0x1018, is_a?@0x1020, cme:0x1028) + v29:StringExact = GuardType v10, StringExact + v30:BasicObject = CCallWithFrame v29, :Kernel#is_a?@0x1050, v25 CheckInterrupts - Return v29 + Return v30 "); } @@ -11251,29 +11516,30 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, Integer) - v28:Class[Integer@0x1008] = Const Value(VALUE(0x1008)) - PatchPoint NoSingletonClass(String@0x1010) - PatchPoint MethodRedefined(String@0x1010, is_a?@0x1018, cme:0x1020) - v32:StringExact = GuardType v9, StringExact + PatchPoint StableConstantNames(0x1008, Integer) + v29:Class[Integer@0x1010] = Const Value(VALUE(0x1010)) + PatchPoint NoSingletonClass(String@0x1018) + PatchPoint MethodRedefined(String@0x1018, is_a?@0x1020, cme:0x1028) + v33:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v20:Fixnum[5] = Const Value(5) + v21:Fixnum[5] = Const Value(5) CheckInterrupts - Return v20 + Return v21 "); } @@ -11286,29 +11552,30 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, Integer) - v30:Class[Integer@0x1008] = Const Value(VALUE(0x1008)) + PatchPoint StableConstantNames(0x1008, Integer) + v31:Class[Integer@0x1010] = Const Value(VALUE(0x1010)) PatchPoint NoEPEscape(test) - PatchPoint NoSingletonClass(Class@0x1010) - PatchPoint MethodRedefined(Class@0x1010, ===@0x1018, cme:0x1020) + PatchPoint NoSingletonClass(Class@0x1018) + PatchPoint MethodRedefined(Class@0x1018, ===@0x1020, cme:0x1028) IncrCounter inline_cfunc_optimized_send_count - v22:Fixnum[5] = Const Value(5) + v23:Fixnum[5] = Const Value(5) CheckInterrupts - Return v22 + Return v23 "); } @@ -11318,29 +11585,30 @@ mod hir_opt_tests { def test(o) = o.kind_of?(String) test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, String) - v24:Class[String@0x1008] = Const Value(VALUE(0x1008)) - PatchPoint NoSingletonClass(String@0x1008) - PatchPoint MethodRedefined(String@0x1008, kind_of?@0x1009, cme:0x1010) - v28:StringExact = GuardType v9, StringExact - v29:BoolExact = IsA v28, v24 + PatchPoint StableConstantNames(0x1008, String) + v25:Class[String@0x1010] = Const Value(VALUE(0x1010)) + PatchPoint NoSingletonClass(String@0x1010) + PatchPoint MethodRedefined(String@0x1010, kind_of?@0x1011, cme:0x1018) + v29:StringExact = GuardType v10, StringExact + v30:BoolExact = IsA v29, v25 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v29 + Return v30 "); } @@ -11350,28 +11618,29 @@ mod hir_opt_tests { def test(o) = o.kind_of?(Kernel) test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, Kernel) - v24:ModuleExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) - PatchPoint NoSingletonClass(String@0x1010) - PatchPoint MethodRedefined(String@0x1010, kind_of?@0x1018, cme:0x1020) - v28:StringExact = GuardType v9, StringExact - v29:BasicObject = CCallWithFrame v28, :Kernel#kind_of?@0x1048, v24 + PatchPoint StableConstantNames(0x1008, Kernel) + v25:ModuleExact[VALUE(0x1010)] = Const Value(VALUE(0x1010)) + PatchPoint NoSingletonClass(String@0x1018) + PatchPoint MethodRedefined(String@0x1018, kind_of?@0x1020, cme:0x1028) + v29:StringExact = GuardType v10, StringExact + v30:BasicObject = CCallWithFrame v29, :Kernel#kind_of?@0x1050, v25 CheckInterrupts - Return v29 + Return v30 "); } @@ -11384,29 +11653,30 @@ mod hir_opt_tests { end test("asdf") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1000, Integer) - v28:Class[Integer@0x1008] = Const Value(VALUE(0x1008)) - PatchPoint NoSingletonClass(String@0x1010) - PatchPoint MethodRedefined(String@0x1010, kind_of?@0x1018, cme:0x1020) - v32:StringExact = GuardType v9, StringExact + PatchPoint StableConstantNames(0x1008, Integer) + v29:Class[Integer@0x1010] = Const Value(VALUE(0x1010)) + PatchPoint NoSingletonClass(String@0x1018) + PatchPoint MethodRedefined(String@0x1018, kind_of?@0x1020, cme:0x1028) + v33:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v20:Fixnum[5] = Const Value(5) + v21:Fixnum[5] = Const Value(5) CheckInterrupts - Return v20 + Return v21 "); } @@ -11472,26 +11742,27 @@ mod hir_opt_tests { end test("this should get removed") "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(String@0x1000) - PatchPoint MethodRedefined(String@0x1000, length@0x1008, cme:0x1010) - v28:StringExact = GuardType v9, StringExact + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(String@0x1008) + PatchPoint MethodRedefined(String@0x1008, length@0x1010, cme:0x1018) + v29:StringExact = GuardType v10, StringExact IncrCounter inline_cfunc_optimized_send_count - v19:Fixnum[4] = Const Value(4) + v20:Fixnum[4] = Const Value(4) CheckInterrupts - Return v19 + Return v20 "); } @@ -11553,31 +11824,32 @@ mod hir_opt_tests { def test(o) = o.class.name test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, class@0x1008, cme:0x1010) - v24:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, class@0x1010, cme:0x1018) + v25:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] IncrCounter inline_iseq_optimized_send_count - v28:Class[C@0x1000] = Const Value(VALUE(0x1000)) + v29:Class[C@0x1008] = Const Value(VALUE(0x1008)) IncrCounter inline_cfunc_optimized_send_count - PatchPoint NoSingletonClass(Class@0x1038) - PatchPoint MethodRedefined(Class@0x1038, name@0x1040, cme:0x1048) + PatchPoint NoSingletonClass(Class@0x1040) + PatchPoint MethodRedefined(Class@0x1040, name@0x1048, cme:0x1050) IncrCounter inline_cfunc_optimized_send_count - v34:StringExact|NilClass = CCall v28, :Module#name@0x1070 + v35:StringExact|NilClass = CCall v29, :Module#name@0x1078 CheckInterrupts - Return v34 + Return v35 "); } @@ -11588,27 +11860,28 @@ mod hir_opt_tests { def test(o) = o.class test(C.new) "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, class@0x1008, cme:0x1010) - v22:HeapObject[class_exact:C] = GuardType v9, HeapObject[class_exact:C] + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, class@0x1010, cme:0x1018) + v23:HeapObject[class_exact:C] = GuardType v10, HeapObject[class_exact:C] IncrCounter inline_iseq_optimized_send_count - v26:Class[C@0x1000] = Const Value(VALUE(0x1000)) + v27:Class[C@0x1008] = Const Value(VALUE(0x1008)) IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v26 + Return v27 "); } @@ -11686,45 +11959,47 @@ mod hir_opt_tests { @formatted "); assert_eq!(Qtrue, formatted, "{}", formatted.obj_info()); - assert_snapshot!(hir_string("read_nil_local"), @r" + assert_snapshot!(hir_string("read_nil_local"), @" fn read_nil_local@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :_b, l0, SP@6 - v4:BasicObject = GetLocal :_c, l0, SP@5 - v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :_b@0x1001 + v5:BasicObject = LoadField v2, :_c@0x1002 + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :_b@2 - v11:BasicObject = LoadArg :_c@3 - v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass): + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :_b@2 + v12:BasicObject = LoadArg :_c@3 + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:BasicObject, v19:NilClass): CheckInterrupts - SetLocal :formatted, l0, EP@3, v15 + SetLocal :formatted, l0, EP@3, v16 PatchPoint SingleRactorMode - v58:HeapBasicObject = GuardType v14, HeapBasicObject - v59:CShape = LoadField v58, :_shape_id@0x1000 - v60:CShape[0x1001] = GuardBitEquals v59, CShape(0x1001) - StoreField v58, :@formatted@0x1002, v15 - WriteBarrier v58, v15 - v63:CShape[0x1003] = Const CShape(0x1003) - StoreField v58, :_shape_id@0x1000, v63 - v46:Class[VMFrozenCore] = Const Value(VALUE(0x1008)) + v60:HeapBasicObject = GuardType v15, HeapBasicObject + v61:CShape = LoadField v60, :_shape_id@0x1003 + v62:CShape[0x1004] = GuardBitEquals v61, CShape(0x1004) + StoreField v60, :@formatted@0x1005, v16 + WriteBarrier v60, v16 + v65:CShape[0x1006] = Const CShape(0x1006) + StoreField v60, :_shape_id@0x1003, v65 + v47:Class[VMFrozenCore] = Const Value(VALUE(0x1008)) PatchPoint NoSingletonClass(Class@0x1010) PatchPoint MethodRedefined(Class@0x1010, lambda@0x1018, cme:0x1020) - v68:BasicObject = CCallWithFrame v46, :RubyVM::FrozenCore.lambda@0x1048, block=0x1050 - v49:BasicObject = GetLocal :a, l0, EP@6 - v50:BasicObject = GetLocal :_b, l0, EP@5 - v51:BasicObject = GetLocal :_c, l0, EP@4 - v52:BasicObject = GetLocal :formatted, l0, EP@3 + v70:BasicObject = CCallWithFrame v47, :RubyVM::FrozenCore.lambda@0x1048, block=0x1050 + v50:CPtr = GetEP 0 + v51:BasicObject = LoadField v50, :a@0x1001 + v52:BasicObject = LoadField v50, :_b@0x1002 + v53:BasicObject = LoadField v50, :_c@0x1058 + v54:BasicObject = LoadField v50, :formatted@0x1059 CheckInterrupts - Return v68 + Return v70 "); } @@ -12060,27 +12335,28 @@ mod hir_opt_tests { test o test o "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:9: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :obj, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :obj@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :obj@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint NoSingletonClass(TestDynamic@0x1000) - PatchPoint MethodRedefined(TestDynamic@0x1000, val@0x1008, cme:0x1010) - v22:HeapObject[class_exact:TestDynamic] = GuardType v9, HeapObject[class_exact:TestDynamic] - v25:CShape = LoadField v22, :_shape_id@0x1038 - v26:CShape[0x1039] = GuardBitEquals v25, CShape(0x1039) - v27:BasicObject = LoadField v22, :@val@0x103a + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :obj@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint NoSingletonClass(TestDynamic@0x1008) + PatchPoint MethodRedefined(TestDynamic@0x1008, val@0x1010, cme:0x1018) + v23:HeapObject[class_exact:TestDynamic] = GuardType v10, HeapObject[class_exact:TestDynamic] + v26:CShape = LoadField v23, :_shape_id@0x1040 + v27:CShape[0x1041] = GuardBitEquals v26, CShape(0x1041) + v28:BasicObject = LoadField v23, :@val@0x1042 CheckInterrupts - Return v27 + Return v28 "); } @@ -12388,22 +12664,23 @@ mod hir_opt_tests { // The output should NOT have NoSingletonClass patchpoint for String, and should // fall back to SendWithoutBlock instead of the optimized CCall path. - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :s, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :s@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :s@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = Send v9, :length # SendFallbackReason: Singleton class previously created for receiver class + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :s@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = Send v10, :length # SendFallbackReason: Singleton class previously created for receiver class CheckInterrupts - Return v15 + Return v16 "); } @@ -12442,7 +12719,7 @@ mod hir_opt_tests { Jump bb3(v4) bb3(v6:BasicObject): PatchPoint MethodRedefined(A@0x1000, foo@0x1008, cme:0x1010) - v18:CPtr = GetLEP + v18:CPtr = GetEP 0 v19:RubyValue = LoadField v18, :_ep_method_entry@0x1038 v20:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v19, Value(VALUE(0x1040)) v21:RubyValue = LoadField v18, :_ep_specval@0x1048 @@ -12504,28 +12781,29 @@ mod hir_opt_tests { bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - PatchPoint MethodRedefined(A@0x1000, foo@0x1008, cme:0x1010) - v27:CPtr = GetLEP - v28:RubyValue = LoadField v27, :_ep_method_entry@0x1038 - v29:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v28, Value(VALUE(0x1040)) - v30:RubyValue = LoadField v27, :_ep_specval@0x1048 - v31:FalseClass = GuardBitEquals v30, Value(false) - v32:BasicObject = SendDirect v8, 0x1050, :foo (0x1060), v9 - v17:Fixnum[1] = Const Value(1) - PatchPoint MethodRedefined(Integer@0x1068, +@0x1070, cme:0x1078) - v35:Fixnum = GuardType v32, Fixnum - v36:Fixnum = FixnumAdd v35, v17 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + PatchPoint MethodRedefined(A@0x1008, foo@0x1010, cme:0x1018) + v28:CPtr = GetEP 0 + v29:RubyValue = LoadField v28, :_ep_method_entry@0x1040 + v30:CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v29, Value(VALUE(0x1048)) + v31:RubyValue = LoadField v28, :_ep_specval@0x1050 + v32:FalseClass = GuardBitEquals v31, Value(false) + v33:BasicObject = SendDirect v9, 0x1058, :foo (0x1068), v10 + v18:Fixnum[1] = Const Value(1) + PatchPoint MethodRedefined(Integer@0x1070, +@0x1078, cme:0x1080) + v36:Fixnum = GuardType v33, Fixnum + v37:Fixnum = FixnumAdd v36, v18 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v36 + Return v37 "); } @@ -12551,23 +12829,24 @@ mod hir_opt_tests { assert!(hir.contains("InvokeSuper "), "Expected unoptimized InvokeSuper but got:\n{hir}"); assert!(!hir.contains("SendDirect"), "Should not optimize to SendDirect for explicit blockarg:\n{hir}"); - assert_snapshot!(hir, @r" + assert_snapshot!(hir, @" fn foo@:10: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:ArrayExact = GetLocal :x, l0, SP@4, * - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:ArrayExact = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:ArrayExact = ToArray v9 - v17:BasicObject = InvokeSuper v8, 0x1000, v15 # SendFallbackReason: super: complex argument passing to `super` call + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:ArrayExact = ToArray v10 + v18:BasicObject = InvokeSuper v9, 0x1008, v16 # SendFallbackReason: super: complex argument passing to `super` call CheckInterrupts - Return v17 + Return v18 "); } @@ -12638,7 +12917,7 @@ mod hir_opt_tests { Jump bb3(v4) bb3(v6:BasicObject): PatchPoint MethodRedefined(Hash@0x1000, size@0x1008, cme:0x1010) - v18:CPtr = GetLEP + v18:CPtr = GetEP 0 v19:RubyValue = LoadField v18, :_ep_method_entry@0x1038 v20:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v19, Value(VALUE(0x1040)) v21:RubyValue = LoadField v18, :_ep_specval@0x1048 @@ -12673,7 +12952,7 @@ mod hir_opt_tests { Jump bb3(v4) bb3(v6:BasicObject): PatchPoint MethodRedefined(BasicObject@0x1000, initialize@0x1008, cme:0x1010) - v18:CPtr = GetLEP + v18:CPtr = GetEP 0 v19:RubyValue = LoadField v18, :_ep_method_entry@0x1038 v20:CallableMethodEntry[VALUE(0x1040)] = GuardBitEquals v19, Value(VALUE(0x1040)) v21:RubyValue = LoadField v18, :_ep_specval@0x1048 @@ -12706,38 +12985,39 @@ mod hir_opt_tests { bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :needle, l0, SP@5 - v3:BasicObject = GetLocal :offset, l0, SP@4 - v4:CPtr = LoadPC - v5:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v6:CBool = IsBitEqual v4, v5 - IfTrue v6, bb3(v1, v2, v3) - Jump bb5(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :needle@0x1000 + v4:BasicObject = LoadField v2, :offset@0x1001 + v5:CPtr = LoadPC + v6:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v7:CBool = IsBitEqual v5, v6 + IfTrue v7, bb3(v1, v3, v4) + Jump bb5(v1, v3, v4) bb2(): EntryPoint JIT(0) - v10:BasicObject = LoadArg :self@0 - v11:BasicObject = LoadArg :needle@1 - v12:NilClass = Const Value(nil) - Jump bb3(v10, v11, v12) - bb3(v19:BasicObject, v20:BasicObject, v21:BasicObject): - v24:Fixnum[0] = Const Value(0) - Jump bb5(v19, v20, v24) + v11:BasicObject = LoadArg :self@0 + v12:BasicObject = LoadArg :needle@1 + v13:NilClass = Const Value(nil) + Jump bb3(v11, v12, v13) + bb3(v20:BasicObject, v21:BasicObject, v22:BasicObject): + v25:Fixnum[0] = Const Value(0) + Jump bb5(v20, v21, v25) bb4(): EntryPoint JIT(1) - v15:BasicObject = LoadArg :self@0 - v16:BasicObject = LoadArg :needle@1 - v17:BasicObject = LoadArg :offset@2 - Jump bb5(v15, v16, v17) - bb5(v27:BasicObject, v28:BasicObject, v29:BasicObject): - PatchPoint MethodRedefined(String@0x1010, byteindex@0x1018, cme:0x1020) - v43:CPtr = GetLEP - v44:RubyValue = LoadField v43, :_ep_method_entry@0x1048 - v45:CallableMethodEntry[VALUE(0x1050)] = GuardBitEquals v44, Value(VALUE(0x1050)) - v46:RubyValue = LoadField v43, :_ep_specval@0x1058 - v47:FalseClass = GuardBitEquals v46, Value(false) - v48:BasicObject = CCallVariadic v27, :String#byteindex@0x1060, v28, v29 + v16:BasicObject = LoadArg :self@0 + v17:BasicObject = LoadArg :needle@1 + v18:BasicObject = LoadArg :offset@2 + Jump bb5(v16, v17, v18) + bb5(v28:BasicObject, v29:BasicObject, v30:BasicObject): + PatchPoint MethodRedefined(String@0x1018, byteindex@0x1020, cme:0x1028) + v44:CPtr = GetEP 0 + v45:RubyValue = LoadField v44, :_ep_method_entry@0x1050 + v46:CallableMethodEntry[VALUE(0x1058)] = GuardBitEquals v45, Value(VALUE(0x1058)) + v47:RubyValue = LoadField v44, :_ep_specval@0x1060 + v48:FalseClass = GuardBitEquals v47, Value(false) + v49:BasicObject = CCallVariadic v28, :String#byteindex@0x1068, v29, v30 CheckInterrupts - Return v48 + Return v49 "); } @@ -12764,31 +13044,34 @@ mod hir_opt_tests { assert!(hir.contains("InvokeSuper "), "Expected unoptimized InvokeSuper but got:\n{hir}"); assert!(!hir.contains("SendDirect"), "Should not optimize to SendDirect for explicit blockarg:\n{hir}"); - assert_snapshot!(hir, @r" + assert_snapshot!(hir, @" fn foo@:10: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :blk, l0, SP@5 - v3:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :blk@0x1000 + v4:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :blk@1 - v8:NilClass = Const Value(nil) - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:NilClass): - PatchPoint NoSingletonClass(B@0x1000) - PatchPoint MethodRedefined(B@0x1000, proc@0x1008, cme:0x1010) - v36:HeapObject[class_exact:B] = GuardType v10, HeapObject[class_exact:B] - v37:BasicObject = CCallWithFrame v36, :Kernel#proc@0x1038, block=0x1040 - v18:BasicObject = GetLocal :blk, l0, EP@4 - SetLocal :other_block, l0, EP@3, v37 - v25:BasicObject = GetLocal :other_block, l0, EP@3 - v27:BasicObject = InvokeSuper v10, 0x1048, v25 # SendFallbackReason: super: complex argument passing to `super` call + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :blk@1 + v9:NilClass = Const Value(nil) + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:NilClass): + PatchPoint NoSingletonClass(B@0x1008) + PatchPoint MethodRedefined(B@0x1008, proc@0x1010, cme:0x1018) + v39:HeapObject[class_exact:B] = GuardType v11, HeapObject[class_exact:B] + v40:BasicObject = CCallWithFrame v39, :Kernel#proc@0x1040, block=0x1048 + v19:CPtr = GetEP 0 + v20:BasicObject = LoadField v19, :blk@0x1050 + SetLocal :other_block, l0, EP@3, v40 + v27:CPtr = GetEP 0 + v28:BasicObject = LoadField v27, :other_block@0x1051 + v30:BasicObject = InvokeSuper v11, 0x1058, v28 # SendFallbackReason: super: complex argument passing to `super` call CheckInterrupts - Return v27 + Return v30 "); } @@ -12814,23 +13097,24 @@ mod hir_opt_tests { assert!(hir.contains("InvokeSuper "), "Expected unoptimized InvokeSuper but got:\n{hir}"); assert!(!hir.contains("SendDirect"), "Should not optimize to SendDirect for symbol-to-proc:\n{hir}"); - assert_snapshot!(hir, @r" + assert_snapshot!(hir, @" fn foo@:10: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :items, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :items@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :items@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:StaticSymbol[:succ] = Const Value(VALUE(0x1000)) - v17:BasicObject = InvokeSuper v8, 0x1008, v9, v15 # SendFallbackReason: super: complex argument passing to `super` call + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :items@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:StaticSymbol[:succ] = Const Value(VALUE(0x1008)) + v18:BasicObject = InvokeSuper v9, 0x1010, v10, v16 # SendFallbackReason: super: complex argument passing to `super` call CheckInterrupts - Return v17 + Return v18 "); } @@ -12855,35 +13139,36 @@ mod hir_opt_tests { let hir = hir_string_proc("B.new.method(:foo)"); assert!(hir.contains("InvokeSuper "), "Expected unoptimized InvokeSuper but got:\n{hir}"); - assert_snapshot!(hir, @r" + assert_snapshot!(hir, @" fn foo@:9: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :content, l0, SP@4 - v3:CPtr = LoadPC - v4:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v5:CBool = IsBitEqual v3, v4 - IfTrue v5, bb3(v1, v2) - Jump bb5(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :content@0x1000 + v4:CPtr = LoadPC + v5:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v6:CBool = IsBitEqual v4, v5 + IfTrue v6, bb3(v1, v3) + Jump bb5(v1, v3) bb2(): EntryPoint JIT(0) - v9:BasicObject = LoadArg :self@0 - v10:NilClass = Const Value(nil) - Jump bb3(v9, v10) - bb3(v16:BasicObject, v17:BasicObject): - v20:StringExact[VALUE(0x1010)] = Const Value(VALUE(0x1010)) - v21:StringExact = StringCopy v20 - Jump bb5(v16, v21) + v10:BasicObject = LoadArg :self@0 + v11:NilClass = Const Value(nil) + Jump bb3(v10, v11) + bb3(v17:BasicObject, v18:BasicObject): + v21:StringExact[VALUE(0x1018)] = Const Value(VALUE(0x1018)) + v22:StringExact = StringCopy v21 + Jump bb5(v17, v22) bb4(): EntryPoint JIT(1) - v13:BasicObject = LoadArg :self@0 - v14:BasicObject = LoadArg :content@1 - Jump bb5(v13, v14) - bb5(v24:BasicObject, v25:BasicObject): - v31:BasicObject = InvokeSuper v24, 0x1018, v25 # SendFallbackReason: super: complex argument passing to `super` call + v14:BasicObject = LoadArg :self@0 + v15:BasicObject = LoadArg :content@1 + Jump bb5(v14, v15) + bb5(v25:BasicObject, v26:BasicObject): + v32:BasicObject = InvokeSuper v25, 0x1020, v26 # SendFallbackReason: super: complex argument passing to `super` call CheckInterrupts - Return v31 + Return v32 "); } @@ -12906,35 +13191,36 @@ mod hir_opt_tests { end end "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - v15:CBool = Test v9 - v16:Falsy = RefineType v9, Falsy - IfFalse v15, bb6(v8, v16) - v18:Truthy = RefineType v9, Truthy + v16:CBool = Test v10 + v17:Falsy = RefineType v10, Falsy + IfFalse v16, bb6(v9, v17) + v19:Truthy = RefineType v10, Truthy CheckInterrupts - v26:Truthy = RefineType v18, Truthy + v27:Truthy = RefineType v19, Truthy CheckInterrupts - v34:Truthy = RefineType v26, Truthy - v37:Fixnum[3] = Const Value(3) + v35:Truthy = RefineType v27, Truthy + v38:Fixnum[3] = Const Value(3) CheckInterrupts - Return v37 - bb6(v42:BasicObject, v43:Falsy): - v47:Fixnum[6] = Const Value(6) + Return v38 + bb6(v43:BasicObject, v44:Falsy): + v48:Fixnum[6] = Const Value(6) CheckInterrupts - Return v47 + Return v48 "); } @@ -12956,45 +13242,46 @@ mod hir_opt_tests { test C.new; test D.new; test C.new; test D.new "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:11: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:CBool = HasType v9, HeapObject[class_exact:C] - IfTrue v14, bb5(v8, v9, v9) - v23:CBool = HasType v9, HeapObject[class_exact:D] - IfTrue v23, bb6(v8, v9, v9) - v32:BasicObject = Send v9, :foo # SendFallbackReason: SendWithoutBlock: polymorphic fallback - Jump bb4(v8, v9, v32) - bb5(v15:BasicObject, v16:BasicObject, v17:BasicObject): - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, foo@0x1008, cme:0x1010) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:CBool = HasType v10, HeapObject[class_exact:C] + IfTrue v15, bb5(v9, v10, v10) + v24:CBool = HasType v10, HeapObject[class_exact:D] + IfTrue v24, bb6(v9, v10, v10) + v33:BasicObject = Send v10, :foo # SendFallbackReason: SendWithoutBlock: polymorphic fallback + Jump bb4(v9, v10, v33) + bb5(v16:BasicObject, v17:BasicObject, v18:BasicObject): + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, foo@0x1010, cme:0x1018) IncrCounter inline_iseq_optimized_send_count - v55:Fixnum[3] = Const Value(3) - Jump bb4(v15, v16, v55) - bb6(v24:BasicObject, v25:BasicObject, v26:BasicObject): - PatchPoint NoSingletonClass(D@0x1038) - PatchPoint MethodRedefined(D@0x1038, foo@0x1008, cme:0x1040) + v56:Fixnum[3] = Const Value(3) + Jump bb4(v16, v17, v56) + bb6(v25:BasicObject, v26:BasicObject, v27:BasicObject): + PatchPoint NoSingletonClass(D@0x1040) + PatchPoint MethodRedefined(D@0x1040, foo@0x1010, cme:0x1048) IncrCounter inline_iseq_optimized_send_count - v57:Fixnum[4] = Const Value(4) - Jump bb4(v24, v25, v57) - bb4(v34:BasicObject, v35:BasicObject, v36:BasicObject): - v39:Fixnum[2] = Const Value(2) - PatchPoint MethodRedefined(Integer@0x1068, +@0x1070, cme:0x1078) - v60:Fixnum = GuardType v36, Fixnum - v61:Fixnum = FixnumAdd v60, v39 + v58:Fixnum[4] = Const Value(4) + Jump bb4(v25, v26, v58) + bb4(v35:BasicObject, v36:BasicObject, v37:BasicObject): + v40:Fixnum[2] = Const Value(2) + PatchPoint MethodRedefined(Integer@0x1070, +@0x1078, cme:0x1080) + v61:Fixnum = GuardType v37, Fixnum + v62:Fixnum = FixnumAdd v61, v40 IncrCounter inline_cfunc_optimized_send_count CheckInterrupts - Return v61 + Return v62 "); } @@ -13010,39 +13297,40 @@ mod hir_opt_tests { test C.new; test 3; test C.new; test 4 "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :o@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:CBool = HasType v9, HeapObject[class_exact:C] - IfTrue v14, bb5(v8, v9, v9) - v23:CBool = HasType v9, Fixnum - IfTrue v23, bb6(v8, v9, v9) - v32:BasicObject = Send v9, :itself # SendFallbackReason: SendWithoutBlock: polymorphic fallback - Jump bb4(v8, v9, v32) - bb5(v15:BasicObject, v16:BasicObject, v17:BasicObject): - v19:HeapObject[class_exact:C] = RefineType v17, HeapObject[class_exact:C] - PatchPoint NoSingletonClass(C@0x1000) - PatchPoint MethodRedefined(C@0x1000, itself@0x1008, cme:0x1010) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :o@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:CBool = HasType v10, HeapObject[class_exact:C] + IfTrue v15, bb5(v9, v10, v10) + v24:CBool = HasType v10, Fixnum + IfTrue v24, bb6(v9, v10, v10) + v33:BasicObject = Send v10, :itself # SendFallbackReason: SendWithoutBlock: polymorphic fallback + Jump bb4(v9, v10, v33) + bb5(v16:BasicObject, v17:BasicObject, v18:BasicObject): + v20:HeapObject[class_exact:C] = RefineType v18, HeapObject[class_exact:C] + PatchPoint NoSingletonClass(C@0x1008) + PatchPoint MethodRedefined(C@0x1008, itself@0x1010, cme:0x1018) IncrCounter inline_cfunc_optimized_send_count - Jump bb4(v15, v16, v19) - bb6(v24:BasicObject, v25:BasicObject, v26:BasicObject): - v28:Fixnum = RefineType v26, Fixnum - PatchPoint MethodRedefined(Integer@0x1038, itself@0x1008, cme:0x1010) + Jump bb4(v16, v17, v20) + bb6(v25:BasicObject, v26:BasicObject, v27:BasicObject): + v29:Fixnum = RefineType v27, Fixnum + PatchPoint MethodRedefined(Integer@0x1040, itself@0x1010, cme:0x1018) IncrCounter inline_cfunc_optimized_send_count - Jump bb4(v24, v25, v28) - bb4(v34:BasicObject, v35:BasicObject, v36:BasicObject): + Jump bb4(v25, v26, v29) + bb4(v35:BasicObject, v36:BasicObject, v37:BasicObject): CheckInterrupts - Return v36 + Return v37 "); } @@ -13126,84 +13414,89 @@ mod hir_opt_tests { test_ep_escape([1], lambda { }) { |x| } } "); - assert_snapshot!(hir_string("test_ep_escape"), @r" + assert_snapshot!(hir_string("test_ep_escape"), @" fn test_ep_escape@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :list, l0, SP@7 - v3:BasicObject = GetLocal :sep, l0, SP@6 - v4:BasicObject = GetLocal :iter_method, l0, SP@5 - v5:NilClass = Const Value(nil) - v6:CPtr = LoadPC - v7:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v8:CBool = IsBitEqual v6, v7 - IfTrue v8, bb3(v1, v2, v3, v4, v5) - v10:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v11:CBool = IsBitEqual v6, v10 - IfTrue v11, bb5(v1, v2, v3, v4, v5) - Jump bb7(v1, v2, v3, v4, v5) - bb2(): - EntryPoint JIT(0) - v15:BasicObject = LoadArg :self@0 - v16:BasicObject = LoadArg :list@1 - v17:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :list@0x1000 + v4:BasicObject = LoadField v2, :sep@0x1001 + v5:BasicObject = LoadField v2, :iter_method@0x1002 + v6:NilClass = Const Value(nil) + v7:CPtr = LoadPC + v8:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v9:CBool = IsBitEqual v7, v8 + IfTrue v9, bb3(v1, v3, v4, v5, v6) + v11:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v12:CBool = IsBitEqual v7, v11 + IfTrue v12, bb5(v1, v3, v4, v5, v6) + Jump bb7(v1, v3, v4, v5, v6) + bb2(): + EntryPoint JIT(0) + v16:BasicObject = LoadArg :self@0 + v17:BasicObject = LoadArg :list@1 v18:NilClass = Const Value(nil) v19:NilClass = Const Value(nil) - Jump bb3(v15, v16, v17, v18, v19) - bb3(v35:BasicObject, v36:BasicObject, v37:BasicObject, v38:BasicObject, v39:NilClass): - v42:NilClass = Const Value(nil) - SetLocal :sep, l0, EP@5, v42 - Jump bb5(v35, v36, v42, v38, v39) + v20:NilClass = Const Value(nil) + Jump bb3(v16, v17, v18, v19, v20) + bb3(v36:BasicObject, v37:BasicObject, v38:BasicObject, v39:BasicObject, v40:NilClass): + v43:NilClass = Const Value(nil) + SetLocal :sep, l0, EP@5, v43 + Jump bb5(v36, v37, v43, v39, v40) bb4(): EntryPoint JIT(1) - v22:BasicObject = LoadArg :self@0 - v23:BasicObject = LoadArg :list@1 - v24:BasicObject = LoadArg :sep@2 - v25:NilClass = Const Value(nil) + v23:BasicObject = LoadArg :self@0 + v24:BasicObject = LoadArg :list@1 + v25:BasicObject = LoadArg :sep@2 v26:NilClass = Const Value(nil) - Jump bb5(v22, v23, v24, v25, v26) - bb5(v46:BasicObject, v47:BasicObject, v48:BasicObject, v49:BasicObject, v50:NilClass): - v53:StaticSymbol[:each] = Const Value(VALUE(0x1010)) - SetLocal :iter_method, l0, EP@4, v53 - Jump bb7(v46, v47, v48, v53, v50) + v27:NilClass = Const Value(nil) + Jump bb5(v23, v24, v25, v26, v27) + bb5(v47:BasicObject, v48:BasicObject, v49:BasicObject, v50:BasicObject, v51:NilClass): + v54:StaticSymbol[:each] = Const Value(VALUE(0x1018)) + SetLocal :iter_method, l0, EP@4, v54 + Jump bb7(v47, v48, v49, v54, v51) bb6(): EntryPoint JIT(2) - v29:BasicObject = LoadArg :self@0 - v30:BasicObject = LoadArg :list@1 - v31:BasicObject = LoadArg :sep@2 - v32:BasicObject = LoadArg :iter_method@3 - v33:NilClass = Const Value(nil) - Jump bb7(v29, v30, v31, v32, v33) - bb7(v57:BasicObject, v58:BasicObject, v59:BasicObject, v60:BasicObject, v61:NilClass): - CheckInterrupts - v67:CBool = Test v59 - v68:Truthy = RefineType v59, Truthy - IfTrue v67, bb8(v57, v58, v68, v60, v61) - v70:Falsy = RefineType v59, Falsy - PatchPoint NoSingletonClass(Object@0x1018) - PatchPoint MethodRedefined(Object@0x1018, lambda@0x1020, cme:0x1028) - v114:HeapObject[class_exact*:Object@VALUE(0x1018)] = GuardType v57, HeapObject[class_exact*:Object@VALUE(0x1018)] - v115:BasicObject = CCallWithFrame v114, :Kernel#lambda@0x1050, block=0x1058 - v74:BasicObject = GetLocal :list, l0, EP@6 - v76:BasicObject = GetLocal :iter_method, l0, EP@4 - v77:BasicObject = GetLocal :kwsplat, l0, EP@3 - SetLocal :sep, l0, EP@5, v115 - Jump bb8(v57, v74, v115, v76, v77) - bb8(v81:BasicObject, v82:BasicObject, v83:BasicObject, v84:BasicObject, v85:BasicObject): + v30:BasicObject = LoadArg :self@0 + v31:BasicObject = LoadArg :list@1 + v32:BasicObject = LoadArg :sep@2 + v33:BasicObject = LoadArg :iter_method@3 + v34:NilClass = Const Value(nil) + Jump bb7(v30, v31, v32, v33, v34) + bb7(v58:BasicObject, v59:BasicObject, v60:BasicObject, v61:BasicObject, v62:NilClass): + CheckInterrupts + v68:CBool = Test v60 + v69:Truthy = RefineType v60, Truthy + IfTrue v68, bb8(v58, v59, v69, v61, v62) + v71:Falsy = RefineType v60, Falsy + PatchPoint NoSingletonClass(Object@0x1020) + PatchPoint MethodRedefined(Object@0x1020, lambda@0x1028, cme:0x1030) + v119:HeapObject[class_exact*:Object@VALUE(0x1020)] = GuardType v58, HeapObject[class_exact*:Object@VALUE(0x1020)] + v120:BasicObject = CCallWithFrame v119, :Kernel#lambda@0x1058, block=0x1060 + v75:CPtr = GetEP 0 + v76:BasicObject = LoadField v75, :list@0x1001 + v78:BasicObject = LoadField v75, :iter_method@0x1068 + v79:BasicObject = LoadField v75, :kwsplat@0x1069 + SetLocal :sep, l0, EP@5, v120 + Jump bb8(v58, v76, v120, v78, v79) + bb8(v83:BasicObject, v84:BasicObject, v85:BasicObject, v86:BasicObject, v87:BasicObject): PatchPoint SingleRactorMode - PatchPoint StableConstantNames(0x1060, CONST) - v110:HashExact[VALUE(0x1068)] = Const Value(VALUE(0x1068)) - SetLocal :kwsplat, l0, EP@3, v110 - v94:BasicObject = GetLocal :list, l0, EP@6 - v96:BasicObject = GetLocal :iter_method, l0, EP@4 - v98:BasicObject = Send v94, 0x1070, :__send__, v96 # SendFallbackReason: Send: unsupported method type Optimized - v99:BasicObject = GetLocal :list, l0, EP@6 - v100:BasicObject = GetLocal :sep, l0, EP@5 - v101:BasicObject = GetLocal :iter_method, l0, EP@4 - v102:BasicObject = GetLocal :kwsplat, l0, EP@3 - CheckInterrupts - Return v98 + PatchPoint StableConstantNames(0x1070, CONST) + v115:HashExact[VALUE(0x1078)] = Const Value(VALUE(0x1078)) + SetLocal :kwsplat, l0, EP@3, v115 + v96:CPtr = GetEP 0 + v97:BasicObject = LoadField v96, :list@0x1001 + v99:CPtr = GetEP 0 + v100:BasicObject = LoadField v99, :iter_method@0x1068 + v102:BasicObject = Send v97, 0x1080, :__send__, v100 # SendFallbackReason: Send: unsupported method type Optimized + v103:CPtr = GetEP 0 + v104:BasicObject = LoadField v103, :list@0x1001 + v105:BasicObject = LoadField v103, :sep@0x1002 + v106:BasicObject = LoadField v103, :iter_method@0x1068 + v107:BasicObject = LoadField v103, :kwsplat@0x1069 + CheckInterrupts + Return v102 "); } diff --git a/zjit/src/hir/tests.rs b/zjit/src/hir/tests.rs index 2f868b02fc36d8..2e4a457a47e131 100644 --- a/zjit/src/hir/tests.rs +++ b/zjit/src/hir/tests.rs @@ -62,33 +62,34 @@ mod snapshot_tests { #[test] fn test_new_array_with_elements() { eval("def test(a, b) = [a, b]"); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb0(): Entries bb1, bb2 bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v13:Any = Snapshot FrameState { pc: 0x1000, stack: [], locals: [a=v11, b=v12] } - v14:Any = Snapshot FrameState { pc: 0x1008, stack: [], locals: [a=v11, b=v12] } + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v14:Any = Snapshot FrameState { pc: 0x1008, stack: [], locals: [a=v12, b=v13] } + v15:Any = Snapshot FrameState { pc: 0x1010, stack: [], locals: [a=v12, b=v13] } PatchPoint NoTracePoint - v16:Any = Snapshot FrameState { pc: 0x1010, stack: [v11], locals: [a=v11, b=v12] } - v17:Any = Snapshot FrameState { pc: 0x1018, stack: [v11, v12], locals: [a=v11, b=v12] } - v18:ArrayExact = NewArray v11, v12 - v19:Any = Snapshot FrameState { pc: 0x1020, stack: [v18], locals: [a=v11, b=v12] } + v17:Any = Snapshot FrameState { pc: 0x1018, stack: [v12], locals: [a=v12, b=v13] } + v18:Any = Snapshot FrameState { pc: 0x1020, stack: [v12, v13], locals: [a=v12, b=v13] } + v19:ArrayExact = NewArray v12, v13 + v20:Any = Snapshot FrameState { pc: 0x1028, stack: [v19], locals: [a=v12, b=v13] } PatchPoint NoTracePoint CheckInterrupts - Return v18 + Return v19 "); } @@ -212,6 +213,7 @@ mod snapshot_tests { #[cfg(test)] pub mod hir_build_tests { use super::*; + use crate::options::set_call_threshold; use insta::assert_snapshot; fn iseq_contains_opcode(iseq: IseqPtr, expected_opcode: u32) -> bool { @@ -288,34 +290,35 @@ pub mod hir_build_tests { #[test] fn test_compile_optional() { eval("def test(x=1) = 123"); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - v3:CPtr = LoadPC - v4:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v5:CBool = IsBitEqual v3, v4 - IfTrue v5, bb3(v1, v2) - Jump bb5(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:CPtr = LoadPC + v5:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v6:CBool = IsBitEqual v4, v5 + IfTrue v6, bb3(v1, v3) + Jump bb5(v1, v3) bb2(): EntryPoint JIT(0) - v9:BasicObject = LoadArg :self@0 - v10:NilClass = Const Value(nil) - Jump bb3(v9, v10) - bb3(v16:BasicObject, v17:BasicObject): - v20:Fixnum[1] = Const Value(1) - Jump bb5(v16, v20) + v10:BasicObject = LoadArg :self@0 + v11:NilClass = Const Value(nil) + Jump bb3(v10, v11) + bb3(v17:BasicObject, v18:BasicObject): + v21:Fixnum[1] = Const Value(1) + Jump bb5(v17, v21) bb4(): EntryPoint JIT(1) - v13:BasicObject = LoadArg :self@0 - v14:BasicObject = LoadArg :x@1 - Jump bb5(v13, v14) - bb5(v23:BasicObject, v24:BasicObject): - v28:Fixnum[123] = Const Value(123) + v14:BasicObject = LoadArg :self@0 + v15:BasicObject = LoadArg :x@1 + Jump bb5(v14, v15) + bb5(v24:BasicObject, v25:BasicObject): + v29:Fixnum[123] = Const Value(123) CheckInterrupts - Return v28 + Return v29 "); } @@ -365,22 +368,23 @@ pub mod hir_build_tests { fn test_new_array_with_element() { eval("def test(a) = [a]"); assert_contains_opcode("test", YARVINSN_newarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:ArrayExact = NewArray v9 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:ArrayExact = NewArray v10 CheckInterrupts - Return v14 + Return v15 "); } @@ -388,24 +392,25 @@ pub mod hir_build_tests { fn test_new_array_with_elements() { eval("def test(a, b) = [a, b]"); assert_contains_opcode("test", YARVINSN_newarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:ArrayExact = NewArray v11, v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:ArrayExact = NewArray v12, v13 CheckInterrupts - Return v18 + Return v19 "); } @@ -413,23 +418,24 @@ pub mod hir_build_tests { fn test_new_range_inclusive_with_one_element() { eval("def test(a) = (a..10)"); assert_contains_opcode("test", YARVINSN_newrange); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[10] = Const Value(10) - v16:RangeExact = NewRange v9 NewRangeInclusive v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[10] = Const Value(10) + v17:RangeExact = NewRange v10 NewRangeInclusive v15 CheckInterrupts - Return v16 + Return v17 "); } @@ -437,24 +443,25 @@ pub mod hir_build_tests { fn test_new_range_inclusive_with_two_elements() { eval("def test(a, b) = (a..b)"); assert_contains_opcode("test", YARVINSN_newrange); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:RangeExact = NewRange v11 NewRangeInclusive v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:RangeExact = NewRange v12 NewRangeInclusive v13 CheckInterrupts - Return v18 + Return v19 "); } @@ -462,23 +469,24 @@ pub mod hir_build_tests { fn test_new_range_exclusive_with_one_element() { eval("def test(a) = (a...10)"); assert_contains_opcode("test", YARVINSN_newrange); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[10] = Const Value(10) - v16:RangeExact = NewRange v9 NewRangeExclusive v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[10] = Const Value(10) + v17:RangeExact = NewRange v10 NewRangeExclusive v15 CheckInterrupts - Return v16 + Return v17 "); } @@ -486,24 +494,25 @@ pub mod hir_build_tests { fn test_new_range_exclusive_with_two_elements() { eval("def test(a, b) = (a...b)"); assert_contains_opcode("test", YARVINSN_newrange); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:RangeExact = NewRange v11 NewRangeExclusive v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:RangeExact = NewRange v12 NewRangeExclusive v13 CheckInterrupts - Return v18 + Return v19 "); } @@ -576,26 +585,27 @@ pub mod hir_build_tests { fn test_new_hash_with_elements() { eval("def test(aval, bval) = {a: aval, b: bval}"); assert_contains_opcode("test", YARVINSN_newhash); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :aval, l0, SP@5 - v3:BasicObject = GetLocal :bval, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :aval@0x1000 + v4:BasicObject = LoadField v2, :bval@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :aval@1 - v8:BasicObject = LoadArg :bval@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v16:StaticSymbol[:a] = Const Value(VALUE(0x1000)) - v19:StaticSymbol[:b] = Const Value(VALUE(0x1008)) - v22:HashExact = NewHash v16: v11, v19: v12 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :aval@1 + v9:BasicObject = LoadArg :bval@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v17:StaticSymbol[:a] = Const Value(VALUE(0x1008)) + v20:StaticSymbol[:b] = Const Value(VALUE(0x1010)) + v23:HashExact = NewHash v17: v12, v20: v13 CheckInterrupts - Return v22 + Return v23 "); } @@ -1008,37 +1018,38 @@ pub mod hir_build_tests { def test(a = (b = 1)) = [a, b] "); assert_contains_opcode("test", YARVINSN_setlocal_WC_0); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:NilClass = Const Value(nil) - v4:CPtr = LoadPC - v5:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v6:CBool = IsBitEqual v4, v5 - IfTrue v6, bb3(v1, v2, v3) - Jump bb5(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:NilClass = Const Value(nil) + v5:CPtr = LoadPC + v6:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v7:CBool = IsBitEqual v5, v6 + IfTrue v7, bb3(v1, v3, v4) + Jump bb5(v1, v3, v4) bb2(): EntryPoint JIT(0) - v10:BasicObject = LoadArg :self@0 - v11:NilClass = Const Value(nil) + v11:BasicObject = LoadArg :self@0 v12:NilClass = Const Value(nil) - Jump bb3(v10, v11, v12) - bb3(v19:BasicObject, v20:BasicObject, v21:NilClass): - v25:Fixnum[1] = Const Value(1) - Jump bb5(v19, v25, v25) + v13:NilClass = Const Value(nil) + Jump bb3(v11, v12, v13) + bb3(v20:BasicObject, v21:BasicObject, v22:NilClass): + v26:Fixnum[1] = Const Value(1) + Jump bb5(v20, v26, v26) bb4(): EntryPoint JIT(1) - v15:BasicObject = LoadArg :self@0 - v16:BasicObject = LoadArg :a@1 - v17:NilClass = Const Value(nil) - Jump bb5(v15, v16, v17) - bb5(v30:BasicObject, v31:BasicObject, v32:NilClass|Fixnum): - v38:ArrayExact = NewArray v31, v32 + v16:BasicObject = LoadArg :self@0 + v17:BasicObject = LoadArg :a@1 + v18:NilClass = Const Value(nil) + Jump bb5(v16, v17, v18) + bb5(v31:BasicObject, v32:BasicObject, v33:NilClass|Fixnum): + v39:ArrayExact = NewArray v32, v33 CheckInterrupts - Return v38 + Return v39 "); } @@ -1049,36 +1060,37 @@ pub mod hir_build_tests { TracePoint.new(:line) {}.enable test "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:NilClass = Const Value(nil) - v4:CPtr = LoadPC - v5:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v6:CBool = IsBitEqual v4, v5 - IfTrue v6, bb3(v1, v2, v3) - Jump bb5(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:NilClass = Const Value(nil) + v5:CPtr = LoadPC + v6:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v7:CBool = IsBitEqual v5, v6 + IfTrue v7, bb3(v1, v3, v4) + Jump bb5(v1, v3, v4) bb2(): EntryPoint JIT(0) - v10:BasicObject = LoadArg :self@0 - v11:NilClass = Const Value(nil) + v11:BasicObject = LoadArg :self@0 v12:NilClass = Const Value(nil) - Jump bb3(v10, v11, v12) - bb3(v19:BasicObject, v20:BasicObject, v21:NilClass): + v13:NilClass = Const Value(nil) + Jump bb3(v11, v12, v13) + bb3(v20:BasicObject, v21:BasicObject, v22:NilClass): SideExit UnhandledYARVInsn(trace_putobject_INT2FIX_1_) bb4(): EntryPoint JIT(1) - v15:BasicObject = LoadArg :self@0 - v16:BasicObject = LoadArg :a@1 - v17:NilClass = Const Value(nil) - Jump bb5(v15, v16, v17) - bb5(v26:BasicObject, v27:BasicObject, v28:NilClass): - v34:ArrayExact = NewArray v27, v28 + v16:BasicObject = LoadArg :self@0 + v17:BasicObject = LoadArg :a@1 + v18:NilClass = Const Value(nil) + Jump bb5(v16, v17, v18) + bb5(v27:BasicObject, v28:BasicObject, v29:NilClass): + v35:ArrayExact = NewArray v28, v29 CheckInterrupts - Return v34 + Return v35 "); } @@ -1087,32 +1099,33 @@ pub mod hir_build_tests { eval(" def test(a = (def foo = nil)) = a "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - v3:CPtr = LoadPC - v4:CPtr[CPtr(0x1000)] = Const CPtr(0x1008) - v5:CBool = IsBitEqual v3, v4 - IfTrue v5, bb3(v1, v2) - Jump bb5(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:CPtr = LoadPC + v5:CPtr[CPtr(0x1008)] = Const CPtr(0x1010) + v6:CBool = IsBitEqual v4, v5 + IfTrue v6, bb3(v1, v3) + Jump bb5(v1, v3) bb2(): EntryPoint JIT(0) - v9:BasicObject = LoadArg :self@0 - v10:NilClass = Const Value(nil) - Jump bb3(v9, v10) - bb3(v16:BasicObject, v17:BasicObject): + v10:BasicObject = LoadArg :self@0 + v11:NilClass = Const Value(nil) + Jump bb3(v10, v11) + bb3(v17:BasicObject, v18:BasicObject): SideExit UnhandledYARVInsn(definemethod) bb4(): EntryPoint JIT(1) - v13:BasicObject = LoadArg :self@0 - v14:BasicObject = LoadArg :a@1 - Jump bb5(v13, v14) - bb5(v22:BasicObject, v23:BasicObject): + v14:BasicObject = LoadArg :self@0 + v15:BasicObject = LoadArg :a@1 + Jump bb5(v14, v15) + bb5(v23:BasicObject, v24:BasicObject): CheckInterrupts - Return v23 + Return v24 "); } @@ -1121,26 +1134,27 @@ pub mod hir_build_tests { eval(" def test = proc { |a=a| a } "); - assert_snapshot!(hir_string_proc("test"), @r" + assert_snapshot!(hir_string_proc("test"), @" fn block in test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:NilClass = Const Value(nil) - Jump bb3(v5, v6) + v6:BasicObject = LoadArg :self@0 + v7:NilClass = Const Value(nil) + Jump bb3(v6, v7) bb4(): EntryPoint JIT(1) - v9:BasicObject = LoadArg :self@0 - v10:BasicObject = LoadArg :a@1 - Jump bb3(v9, v10) - bb3(v12:BasicObject, v13:BasicObject): + v10:BasicObject = LoadArg :self@0 + v11:BasicObject = LoadArg :a@1 + Jump bb3(v10, v11) + bb3(v13:BasicObject, v14:BasicObject): CheckInterrupts - Return v13 + Return v14 "); } @@ -1294,31 +1308,32 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_leave); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :cond, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :cond@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :cond@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :cond@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - v15:CBool = Test v9 - v16:Falsy = RefineType v9, Falsy - IfFalse v15, bb4(v8, v16) - v18:Truthy = RefineType v9, Truthy - v21:Fixnum[3] = Const Value(3) + v16:CBool = Test v10 + v17:Falsy = RefineType v10, Falsy + IfFalse v16, bb4(v9, v17) + v19:Truthy = RefineType v10, Truthy + v22:Fixnum[3] = Const Value(3) CheckInterrupts - Return v21 - bb4(v26:BasicObject, v27:Falsy): - v31:Fixnum[4] = Const Value(4) + Return v22 + bb4(v27:BasicObject, v28:Falsy): + v32:Fixnum[4] = Const Value(4) CheckInterrupts - Return v31 + Return v32 "); } @@ -1334,35 +1349,36 @@ pub mod hir_build_tests { result end "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :cond, l0, SP@5 - v3:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :cond@0x1000 + v4:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :cond@1 - v8:NilClass = Const Value(nil) - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:NilClass): + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :cond@1 + v9:NilClass = Const Value(nil) + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:NilClass): CheckInterrupts - v18:CBool = Test v11 - v19:Falsy = RefineType v11, Falsy - IfFalse v18, bb4(v10, v19, v12) - v21:Truthy = RefineType v11, Truthy - v24:Fixnum[3] = Const Value(3) + v19:CBool = Test v12 + v20:Falsy = RefineType v12, Falsy + IfFalse v19, bb4(v11, v20, v13) + v22:Truthy = RefineType v12, Truthy + v25:Fixnum[3] = Const Value(3) CheckInterrupts - Jump bb5(v10, v21, v24) - bb4(v29:BasicObject, v30:Falsy, v31:NilClass): - v35:Fixnum[4] = Const Value(4) - Jump bb5(v29, v30, v35) - bb5(v38:BasicObject, v39:BasicObject, v40:Fixnum): + Jump bb5(v11, v22, v25) + bb4(v30:BasicObject, v31:Falsy, v32:NilClass): + v36:Fixnum[4] = Const Value(4) + Jump bb5(v30, v31, v36) + bb5(v39:BasicObject, v40:BasicObject, v41:Fixnum): CheckInterrupts - Return v40 + Return v41 "); } @@ -1373,24 +1389,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_plus); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :+, v12 # SendFallbackReason: Uncategorized(opt_plus) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :+, v13 # SendFallbackReason: Uncategorized(opt_plus) CheckInterrupts - Return v19 + Return v20 "); } @@ -1401,24 +1418,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_minus); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :-, v12 # SendFallbackReason: Uncategorized(opt_minus) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :-, v13 # SendFallbackReason: Uncategorized(opt_minus) CheckInterrupts - Return v19 + Return v20 "); } @@ -1429,24 +1447,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_mult); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :*, v12 # SendFallbackReason: Uncategorized(opt_mult) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :*, v13 # SendFallbackReason: Uncategorized(opt_mult) CheckInterrupts - Return v19 + Return v20 "); } @@ -1457,24 +1476,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_div); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :/, v12 # SendFallbackReason: Uncategorized(opt_div) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :/, v13 # SendFallbackReason: Uncategorized(opt_div) CheckInterrupts - Return v19 + Return v20 "); } @@ -1485,24 +1505,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_mod); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :%, v12 # SendFallbackReason: Uncategorized(opt_mod) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :%, v13 # SendFallbackReason: Uncategorized(opt_mod) CheckInterrupts - Return v19 + Return v20 "); } @@ -1513,24 +1534,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_eq); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :==, v12 # SendFallbackReason: Uncategorized(opt_eq) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :==, v13 # SendFallbackReason: Uncategorized(opt_eq) CheckInterrupts - Return v19 + Return v20 "); } @@ -1541,24 +1563,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_neq); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :!=, v12 # SendFallbackReason: Uncategorized(opt_neq) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :!=, v13 # SendFallbackReason: Uncategorized(opt_neq) CheckInterrupts - Return v19 + Return v20 "); } @@ -1569,24 +1592,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_lt); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :<, v12 # SendFallbackReason: Uncategorized(opt_lt) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :<, v13 # SendFallbackReason: Uncategorized(opt_lt) CheckInterrupts - Return v19 + Return v20 "); } @@ -1597,24 +1621,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_le); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :<=, v12 # SendFallbackReason: Uncategorized(opt_le) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :<=, v13 # SendFallbackReason: Uncategorized(opt_le) CheckInterrupts - Return v19 + Return v20 "); } @@ -1625,24 +1650,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_gt); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :>, v12 # SendFallbackReason: Uncategorized(opt_gt) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :>, v13 # SendFallbackReason: Uncategorized(opt_gt) CheckInterrupts - Return v19 + Return v20 "); } @@ -1706,24 +1732,25 @@ pub mod hir_build_tests { test(1, 2); test(1, 2) "); assert_contains_opcode("test", YARVINSN_opt_ge); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :>=, v12 # SendFallbackReason: Uncategorized(opt_ge) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :>=, v13 # SendFallbackReason: Uncategorized(opt_ge) CheckInterrupts - Return v19 + Return v20 "); } @@ -1809,23 +1836,25 @@ pub mod hir_build_tests { test([1,2,3]) "); assert_contains_opcode("test", YARVINSN_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:BasicObject = Send v9, 0x1000, :each # SendFallbackReason: Uncategorized(send) - v15:BasicObject = GetLocal :a, l0, EP@3 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:BasicObject = Send v10, 0x1008, :each # SendFallbackReason: Uncategorized(send) + v16:CPtr = GetEP 0 + v17:BasicObject = LoadField v16, :a@0x1030 CheckInterrupts - Return v14 + Return v15 "); } @@ -1894,23 +1923,24 @@ pub mod hir_build_tests { eval(" def test(a) = foo(*a) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:ArrayExact = ToArray v9 - v17:BasicObject = Send v8, :foo, v15 # SendFallbackReason: Uncategorized(opt_send_without_block) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:ArrayExact = ToArray v10 + v18:BasicObject = Send v9, :foo, v16 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v17 + Return v18 "); } @@ -1919,22 +1949,23 @@ pub mod hir_build_tests { eval(" def test(a) = foo(&a) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = Send v8, 0x1000, :foo, v9 # SendFallbackReason: Uncategorized(send) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = Send v9, 0x1008, :foo, v10 # SendFallbackReason: Uncategorized(send) CheckInterrupts - Return v15 + Return v16 "); } @@ -1943,23 +1974,24 @@ pub mod hir_build_tests { eval(" def test(a) = foo(a: 1) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - v16:BasicObject = Send v8, :foo, v14 # SendFallbackReason: Uncategorized(opt_send_without_block) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + v17:BasicObject = Send v9, :foo, v15 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v16 + Return v17 "); } @@ -1968,22 +2000,23 @@ pub mod hir_build_tests { eval(" def test(a) = foo(**a) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = Send v8, :foo, v9 # SendFallbackReason: Uncategorized(opt_send_without_block) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = Send v9, :foo, v10 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v15 + Return v16 "); } @@ -2061,22 +2094,23 @@ pub mod hir_build_tests { eval(" def test(...) = super(...) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :..., l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :...@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :...@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = InvokeSuperForward v8, 0x1000, v9 # SendFallbackReason: Uncategorized(invokesuperforward) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :...@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: Uncategorized(invokesuperforward) CheckInterrupts - Return v15 + Return v16 "); } @@ -2085,23 +2119,25 @@ pub mod hir_build_tests { eval(" def test(...) = super { |x| x } "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :..., l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :...@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :...@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = InvokeSuperForward v8, 0x1000, v9 # SendFallbackReason: Uncategorized(invokesuperforward) - v16:BasicObject = GetLocal :..., l0, EP@3 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :...@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: Uncategorized(invokesuperforward) + v17:CPtr = GetEP 0 + v18:BasicObject = LoadField v17, :...@0x1010 CheckInterrupts - Return v15 + Return v16 "); } @@ -2110,24 +2146,25 @@ pub mod hir_build_tests { eval(" def test(...) = super(...) + 1 "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :..., l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :...@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :...@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = InvokeSuperForward v8, 0x1000, v9 # SendFallbackReason: Uncategorized(invokesuperforward) - v17:Fixnum[1] = Const Value(1) - v20:BasicObject = Send v15, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :...@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: Uncategorized(invokesuperforward) + v18:Fixnum[1] = Const Value(1) + v21:BasicObject = Send v16, :+, v18 # SendFallbackReason: Uncategorized(opt_plus) CheckInterrupts - Return v20 + Return v21 "); } @@ -2136,45 +2173,47 @@ pub mod hir_build_tests { eval(" def test(...) = super(1, ...) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :..., l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :...@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :...@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Fixnum[1] = Const Value(1) - v17:BasicObject = InvokeSuperForward v8, 0x1000, v14, v9 # SendFallbackReason: Uncategorized(invokesuperforward) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :...@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Fixnum[1] = Const Value(1) + v18:BasicObject = InvokeSuperForward v9, 0x1008, v15, v10 # SendFallbackReason: Uncategorized(invokesuperforward) CheckInterrupts - Return v17 + Return v18 "); } #[test] fn test_compile_forwardable() { eval("def forwardable(...) = nil"); - assert_snapshot!(hir_string("forwardable"), @r" + assert_snapshot!(hir_string("forwardable"), @" fn forwardable@:1: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :..., l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :...@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :...@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:NilClass = Const Value(nil) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :...@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:NilClass = Const Value(nil) CheckInterrupts - Return v13 + Return v14 "); } @@ -2185,30 +2224,31 @@ pub mod hir_build_tests { eval(" def test(a) = foo **a, b: 1 "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:Class[VMFrozenCore] = Const Value(VALUE(0x1000)) - v16:HashExact = NewHash + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:Class[VMFrozenCore] = Const Value(VALUE(0x1008)) + v17:HashExact = NewHash PatchPoint NoEPEscape(test) - v21:BasicObject = Send v14, :core#hash_merge_kwd, v16, v9 # SendFallbackReason: Uncategorized(opt_send_without_block) - v23:Class[VMFrozenCore] = Const Value(VALUE(0x1000)) - v26:StaticSymbol[:b] = Const Value(VALUE(0x1008)) - v28:Fixnum[1] = Const Value(1) - v30:BasicObject = Send v23, :core#hash_merge_ptr, v21, v26, v28 # SendFallbackReason: Uncategorized(opt_send_without_block) - v32:BasicObject = Send v8, :foo, v30 # SendFallbackReason: Uncategorized(opt_send_without_block) + v22:BasicObject = Send v15, :core#hash_merge_kwd, v17, v10 # SendFallbackReason: Uncategorized(opt_send_without_block) + v24:Class[VMFrozenCore] = Const Value(VALUE(0x1008)) + v27:StaticSymbol[:b] = Const Value(VALUE(0x1010)) + v29:Fixnum[1] = Const Value(1) + v31:BasicObject = Send v24, :core#hash_merge_ptr, v22, v27, v29 # SendFallbackReason: Uncategorized(opt_send_without_block) + v33:BasicObject = Send v9, :foo, v31 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v32 + Return v33 "); } @@ -2217,25 +2257,26 @@ pub mod hir_build_tests { eval(" def test(*) = foo *, 1 "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:ArrayExact = GetLocal :*, l0, SP@4, * - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:ArrayExact = LoadField v2, :*@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :*@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:ArrayExact = ToNewArray v9 - v17:Fixnum[1] = Const Value(1) - ArrayPush v15, v17 - v21:BasicObject = Send v8, :foo, v15 # SendFallbackReason: Uncategorized(opt_send_without_block) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :*@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:ArrayExact = ToNewArray v10 + v18:Fixnum[1] = Const Value(1) + ArrayPush v16, v18 + v22:BasicObject = Send v9, :foo, v16 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v21 + Return v22 "); } @@ -2244,22 +2285,23 @@ pub mod hir_build_tests { eval(" def test(...) = foo(...) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :..., l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :...@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :...@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = SendForward v8, 0x1000, :foo, v9 # SendFallbackReason: Uncategorized(sendforward) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :...@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = SendForward v9, 0x1008, :foo, v10 # SendFallbackReason: Uncategorized(sendforward) CheckInterrupts - Return v15 + Return v16 "); } @@ -2268,36 +2310,37 @@ pub mod hir_build_tests { eval(" def test(a, ...) = foo(a, ...) "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@8 - v3:ArrayExact = GetLocal :*, l0, SP@7, * - v4:BasicObject = GetLocal :**, l0, SP@6 - v5:BasicObject = GetLocal :&, l0, SP@5 - v6:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5, v6) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:ArrayExact = LoadField v2, :*@0x1001 + v5:BasicObject = LoadField v2, :**@0x1002 + v6:BasicObject = LoadField v2, :&@0x1003 + v7:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6, v7) bb2(): EntryPoint JIT(0) - v9:BasicObject = LoadArg :self@0 - v10:BasicObject = LoadArg :a@1 - v11:BasicObject = LoadArg :*@2 - v12:BasicObject = LoadArg :**@3 - v13:BasicObject = LoadArg :&@4 - v14:NilClass = Const Value(nil) - Jump bb3(v9, v10, v11, v12, v13, v14) - bb3(v16:BasicObject, v17:BasicObject, v18:BasicObject, v19:BasicObject, v20:BasicObject, v21:NilClass): - v28:ArrayExact = ToArray v18 + v10:BasicObject = LoadArg :self@0 + v11:BasicObject = LoadArg :a@1 + v12:BasicObject = LoadArg :*@2 + v13:BasicObject = LoadArg :**@3 + v14:BasicObject = LoadArg :&@4 + v15:NilClass = Const Value(nil) + Jump bb3(v10, v11, v12, v13, v14, v15) + bb3(v17:BasicObject, v18:BasicObject, v19:BasicObject, v20:BasicObject, v21:BasicObject, v22:NilClass): + v29:ArrayExact = ToArray v19 PatchPoint NoEPEscape(test) - v33:CPtr = GetEP 0 - v34:CInt64 = LoadField v33, :_env_data_index_flags@0x1000 - v35:CInt64 = GuardNoBitsSet v34, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) - v36:CInt64 = LoadField v33, :_env_data_index_specval@0x1001 - v37:CInt64 = GuardAnyBitSet v36, CUInt64(1) - v38:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) - SideExit UnhandledYARVInsn(splatkw) + v34:CPtr = GetEP 0 + v35:CInt64 = LoadField v34, :_env_data_index_flags@0x1004 + v36:CInt64 = GuardNoBitsSet v35, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v37:CInt64 = LoadField v34, :_env_data_index_specval@0x1005 + v38:CInt64 = GuardAnyBitSet v37, CUInt64(1) + v39:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + SideExit SplatKwNotProfiled "); } @@ -2367,25 +2410,26 @@ pub mod hir_build_tests { def test(a,b) = [a,b].max "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): PatchPoint BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_MAX) - v19:BasicObject = ArrayMax v11, v12 + v20:BasicObject = ArrayMax v12, v13 CheckInterrupts - Return v19 + Return v20 "); } @@ -2402,21 +2446,22 @@ pub mod hir_build_tests { def test(a,b) = [a,b].max "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:9: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): SideExit PatchPoint(BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_MAX)) "); } @@ -2432,26 +2477,27 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) SideExit UnhandledNewarraySend(MIN) "); } @@ -2467,35 +2513,36 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) PatchPoint BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_HASH) - v32:Fixnum = ArrayHash v15, v16 + v33:Fixnum = ArrayHash v16, v17 PatchPoint NoEPEscape(test) - v39:ArrayExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v40:ArrayExact = ArrayDup v39 - v42:BasicObject = Send v14, :puts, v40 # SendFallbackReason: Uncategorized(opt_send_without_block) + v40:ArrayExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v41:ArrayExact = ArrayDup v40 + v43:BasicObject = Send v15, :puts, v41 # SendFallbackReason: Uncategorized(opt_send_without_block) PatchPoint NoEPEscape(test) CheckInterrupts - Return v32 + Return v33 "); } @@ -2512,26 +2559,27 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:5: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) SideExit PatchPoint(BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_HASH)) "); } @@ -2547,28 +2595,29 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) - v31:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v32:StringExact = StringCopy v31 + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) + v32:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v33:StringExact = StringCopy v32 SideExit UnhandledNewarraySend(PACK) "); } @@ -2584,36 +2633,38 @@ pub mod hir_build_tests { end "#); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) - v29:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v30:StringExact = StringCopy v29 - v36:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) - v37:StringExact = StringCopy v36 - v39:BasicObject = GetLocal :buf, l0, EP@3 + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) + v30:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v31:StringExact = StringCopy v30 + v37:StringExact[VALUE(0x1010)] = Const Value(VALUE(0x1010)) + v38:StringExact = StringCopy v37 + v40:CPtr = GetEP 0 + v41:BasicObject = LoadField v40, :buf@0x1018 PatchPoint BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_PACK) - v42:String = ArrayPackBuffer v15, v16, fmt: v37, buf: v39 + v44:String = ArrayPackBuffer v16, v17, fmt: v38, buf: v41 PatchPoint NoEPEscape(test) CheckInterrupts - Return v30 + Return v31 "); } @@ -2631,31 +2682,33 @@ pub mod hir_build_tests { end "#); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:6: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) - v29:StringExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v30:StringExact = StringCopy v29 - v36:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) - v37:StringExact = StringCopy v36 - v39:BasicObject = GetLocal :buf, l0, EP@3 + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) + v30:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v31:StringExact = StringCopy v30 + v37:StringExact[VALUE(0x1010)] = Const Value(VALUE(0x1010)) + v38:StringExact = StringCopy v37 + v40:CPtr = GetEP 0 + v41:BasicObject = LoadField v40, :buf@0x1018 SideExit PatchPoint(BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_PACK)) "); } @@ -2671,35 +2724,36 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) PatchPoint BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_INCLUDE_P) - v33:BoolExact = ArrayInclude v15, v16 | v16 + v34:BoolExact = ArrayInclude v16, v17 | v17 PatchPoint NoEPEscape(test) - v40:ArrayExact[VALUE(0x1000)] = Const Value(VALUE(0x1000)) - v41:ArrayExact = ArrayDup v40 - v43:BasicObject = Send v14, :puts, v41 # SendFallbackReason: Uncategorized(opt_send_without_block) + v41:ArrayExact[VALUE(0x1008)] = Const Value(VALUE(0x1008)) + v42:ArrayExact = ArrayDup v41 + v44:BasicObject = Send v15, :puts, v42 # SendFallbackReason: Uncategorized(opt_send_without_block) PatchPoint NoEPEscape(test) CheckInterrupts - Return v33 + Return v34 "); } @@ -2721,26 +2775,27 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_newarray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:10: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@7 - v3:BasicObject = GetLocal :b, l0, SP@6 - v4:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :a@1 - v10:BasicObject = LoadArg :b@2 - v11:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :a@1 + v11:BasicObject = LoadArg :b@2 v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass): - v25:BasicObject = Send v15, :+, v16 # SendFallbackReason: Uncategorized(opt_plus) + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:NilClass, v19:NilClass): + v26:BasicObject = Send v16, :+, v17 # SendFallbackReason: Uncategorized(opt_plus) SideExit PatchPoint(BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_INCLUDE_P)) "); } @@ -2753,23 +2808,24 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_duparray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): PatchPoint BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_INCLUDE_P) - v15:BoolExact = DupArrayInclude VALUE(0x1000) | v9 + v16:BoolExact = DupArrayInclude VALUE(0x1008) | v10 CheckInterrupts - Return v15 + Return v16 "); } @@ -2787,19 +2843,20 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_opt_duparray_send); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:9: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): SideExit PatchPoint(BOPRedefined(ARRAY_REDEFINED_OP_FLAG, BOP_INCLUDE_P)) "); } @@ -2810,25 +2867,26 @@ pub mod hir_build_tests { def test(a,b) = [a,b].length "); assert_contains_opcode("test", YARVINSN_opt_length); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:ArrayExact = NewArray v11, v12 - v21:BasicObject = Send v18, :length # SendFallbackReason: Uncategorized(opt_length) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:ArrayExact = NewArray v12, v13 + v22:BasicObject = Send v19, :length # SendFallbackReason: Uncategorized(opt_length) CheckInterrupts - Return v21 + Return v22 "); } @@ -2838,25 +2896,26 @@ pub mod hir_build_tests { def test(a,b) = [a,b].size "); assert_contains_opcode("test", YARVINSN_opt_size); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:ArrayExact = NewArray v11, v12 - v21:BasicObject = Send v18, :size # SendFallbackReason: Uncategorized(opt_size) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:ArrayExact = NewArray v12, v13 + v22:BasicObject = Send v19, :size # SendFallbackReason: Uncategorized(opt_size) CheckInterrupts - Return v21 + Return v22 "); } @@ -2868,23 +2927,24 @@ pub mod hir_build_tests { end "); assert_contains_opcode("test", YARVINSN_getconstant); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :klass, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :klass@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :klass@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:FalseClass = Const Value(false) - v16:BasicObject = GetConstant v9, :ARGV, v14 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :klass@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:FalseClass = Const Value(false) + v17:BasicObject = GetConstant v10, :ARGV, v15 CheckInterrupts - Return v16 + Return v17 "); } @@ -3076,32 +3136,34 @@ pub mod hir_build_tests { eval(" def test(&block) = block "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :block, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :block@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :block@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:CPtr = GetEP 0 - v14:CBool = IsBlockParamModified v13 - IfTrue v14, bb4(v8, v9) - Jump bb5(v8, v9) - bb4(v15:BasicObject, v16:BasicObject): - v23:BasicObject = GetLocal :block, l0, EP@3 - Jump bb6(v15, v23, v23) - bb5(v18:BasicObject, v19:BasicObject): - v25:BasicObject = GetBlockParam :block, l0, EP@3 - Jump bb6(v18, v25, v25) - bb6(v27:BasicObject, v28:BasicObject, v29:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :block@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:CPtr = GetEP 0 + v15:CBool = IsBlockParamModified v14 + IfTrue v15, bb4(v9, v10) + Jump bb5(v9, v10) + bb4(v16:BasicObject, v17:BasicObject): + v24:CPtr = GetEP 0 + v25:BasicObject = LoadField v24, :block@0x1001 + Jump bb6(v16, v25, v25) + bb5(v19:BasicObject, v20:BasicObject): + v27:BasicObject = GetBlockParam :block, l0, EP@3 + Jump bb6(v19, v27, v27) + bb6(v29:BasicObject, v30:BasicObject, v31:BasicObject): CheckInterrupts - Return v29 + Return v31 "); } @@ -3114,7 +3176,7 @@ pub mod hir_build_tests { end end "); - assert_snapshot!(hir_string_proc("test"), @r" + assert_snapshot!(hir_string_proc("test"), @" fn block in test@:4: bb1(): EntryPoint interpreter @@ -3143,82 +3205,317 @@ pub mod hir_build_tests { } #[test] - fn test_splatarray_mut() { + fn test_splatkw_unprofiled_side_exits() { eval(" - def test(a) = [*a] + def foo(**kw, &b) = kw + def test(**kw, &b) = foo(**kw, &b) "); - assert_contains_opcode("test", YARVINSN_splatarray); + assert_contains_opcode("test", YARVINSN_splatkw); assert_snapshot!(hir_string("test"), @r" - fn test@:2: + fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :kw@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:ArrayExact = ToNewArray v9 - CheckInterrupts - Return v14 + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :kw@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:CPtr = GetEP 0 + v20:CInt64 = LoadField v19, :_env_data_index_flags@0x1002 + v21:CInt64 = GuardNoBitsSet v20, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v22:CInt64 = LoadField v19, :_env_data_index_specval@0x1003 + v23:CInt64 = GuardAnyBitSet v22, CUInt64(1) + v24:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + SideExit SplatKwNotProfiled "); } #[test] - fn test_concattoarray() { + fn test_splatkw_nil_guards_nil() { eval(" - def test(a) = [1, *a] + def foo(a, ...) = a + def test(a, ...) = foo(a, ...) + test(1) "); - assert_contains_opcode("test", YARVINSN_concattoarray); + assert_contains_opcode("test", YARVINSN_splatkw); assert_snapshot!(hir_string("test"), @r" - fn test@:2: + fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:ArrayExact = LoadField v2, :*@0x1001 + v5:BasicObject = LoadField v2, :**@0x1002 + v6:BasicObject = LoadField v2, :&@0x1003 + v7:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6, v7) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:Fixnum[1] = Const Value(1) - v15:ArrayExact = NewArray v13 - v18:ArrayExact = ToArray v9 - ArrayExtend v15, v18 + v10:BasicObject = LoadArg :self@0 + v11:BasicObject = LoadArg :a@1 + v12:BasicObject = LoadArg :*@2 + v13:BasicObject = LoadArg :**@3 + v14:BasicObject = LoadArg :&@4 + v15:NilClass = Const Value(nil) + Jump bb3(v10, v11, v12, v13, v14, v15) + bb3(v17:BasicObject, v18:BasicObject, v19:BasicObject, v20:BasicObject, v21:BasicObject, v22:NilClass): + v29:ArrayExact = ToArray v19 + PatchPoint NoEPEscape(test) + v34:CPtr = GetEP 0 + v35:CInt64 = LoadField v34, :_env_data_index_flags@0x1004 + v36:CInt64 = GuardNoBitsSet v35, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v37:CInt64 = LoadField v34, :_env_data_index_specval@0x1005 + v38:CInt64[0] = GuardBitEquals v37, CInt64(0) + v39:NilClass = Const Value(nil) + v41:NilClass = GuardType v20, NilClass + v43:BasicObject = Send v17, 0x1004, :foo, v18, v29, v41, v39 # SendFallbackReason: Uncategorized(send) + CheckInterrupts + Return v43 + "); + } + + #[test] + fn test_splatkw_empty_hash_guards_hash() { + eval(" + def foo(**kw, &b) = kw + def test(**kw, &b) = foo(**kw, &b) + test(&proc {}) + "); + assert_contains_opcode("test", YARVINSN_splatkw); + assert_snapshot!(hir_string("test"), @r" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :kw@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) + bb2(): + EntryPoint JIT(0) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :kw@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:CPtr = GetEP 0 + v20:CInt64 = LoadField v19, :_env_data_index_flags@0x1002 + v21:CInt64 = GuardNoBitsSet v20, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v22:CInt64 = LoadField v19, :_env_data_index_specval@0x1003 + v23:CInt64 = GuardAnyBitSet v22, CUInt64(1) + v24:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + v26:HashExact = GuardType v12, HashExact + v28:BasicObject = Send v11, 0x1002, :foo, v26, v24 # SendFallbackReason: Uncategorized(send) + CheckInterrupts + Return v28 + "); + } + + #[test] + fn test_splatkw_hash_guards_hash() { + eval(" + def foo(**kw, &b) = kw + def test(**kw, &b) = foo(**kw, &b) + test(a: 1, &proc {}) + "); + assert_contains_opcode("test", YARVINSN_splatkw); + assert_snapshot!(hir_string("test"), @r" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :kw@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) + bb2(): + EntryPoint JIT(0) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :kw@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:CPtr = GetEP 0 + v20:CInt64 = LoadField v19, :_env_data_index_flags@0x1002 + v21:CInt64 = GuardNoBitsSet v20, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v22:CInt64 = LoadField v19, :_env_data_index_specval@0x1003 + v23:CInt64 = GuardAnyBitSet v22, CUInt64(1) + v24:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + v26:HashExact = GuardType v12, HashExact + v28:BasicObject = Send v11, 0x1002, :foo, v26, v24 # SendFallbackReason: Uncategorized(send) + CheckInterrupts + Return v28 + "); + } + + #[test] + fn test_splatkw_polymorphic_side_exits() { + set_call_threshold(3); + eval(" + def foo(a, ...) = a + def test(a, ...) = foo(a, ...) + test(1) + test(1, b: 2) + "); + assert_contains_opcode("test", YARVINSN_splatkw); + assert_snapshot!(hir_string("test"), @r" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:ArrayExact = LoadField v2, :*@0x1001 + v5:BasicObject = LoadField v2, :**@0x1002 + v6:BasicObject = LoadField v2, :&@0x1003 + v7:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6, v7) + bb2(): + EntryPoint JIT(0) + v10:BasicObject = LoadArg :self@0 + v11:BasicObject = LoadArg :a@1 + v12:BasicObject = LoadArg :*@2 + v13:BasicObject = LoadArg :**@3 + v14:BasicObject = LoadArg :&@4 + v15:NilClass = Const Value(nil) + Jump bb3(v10, v11, v12, v13, v14, v15) + bb3(v17:BasicObject, v18:BasicObject, v19:BasicObject, v20:BasicObject, v21:BasicObject, v22:NilClass): + v29:ArrayExact = ToArray v19 + PatchPoint NoEPEscape(test) + v34:CPtr = GetEP 0 + v35:CInt64 = LoadField v34, :_env_data_index_flags@0x1004 + v36:CInt64 = GuardNoBitsSet v35, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v37:CInt64 = LoadField v34, :_env_data_index_specval@0x1005 + v38:CInt64[0] = GuardBitEquals v37, CInt64(0) + v39:NilClass = Const Value(nil) + SideExit SplatKwPolymorphic + "); + } + + #[test] + fn test_splatkw_with_non_hash_side_exits() { + eval(" + def foo(a:) = a + def test(obj, &block) = foo(**obj, &block) + obj = Object.new + def obj.to_hash = { a: 1 } + test(obj) { 2 } + "); + assert_contains_opcode("test", YARVINSN_splatkw); + assert_snapshot!(hir_string("test"), @r" + fn test@:3: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :obj@0x1000 + v4:BasicObject = LoadField v2, :block@0x1001 + Jump bb3(v1, v3, v4) + bb2(): + EntryPoint JIT(0) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :obj@1 + v9:BasicObject = LoadArg :block@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:CPtr = GetEP 0 + v20:CInt64 = LoadField v19, :_env_data_index_flags@0x1002 + v21:CInt64 = GuardNoBitsSet v20, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v22:CInt64 = LoadField v19, :_env_data_index_specval@0x1003 + v23:CInt64 = GuardAnyBitSet v22, CUInt64(1) + v24:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) + SideExit SplatKwNotNilOrHash + "); + } + + #[test] + fn test_splatarray_mut() { + eval(" + def test(a) = [*a] + "); + assert_contains_opcode("test", YARVINSN_splatarray); + assert_snapshot!(hir_string("test"), @" + fn test@:2: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) + bb2(): + EntryPoint JIT(0) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:ArrayExact = ToNewArray v10 CheckInterrupts Return v15 "); } + #[test] + fn test_concattoarray() { + eval(" + def test(a) = [1, *a] + "); + assert_contains_opcode("test", YARVINSN_concattoarray); + assert_snapshot!(hir_string("test"), @" + fn test@:2: + bb1(): + EntryPoint interpreter + v1:BasicObject = LoadSelf + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) + bb2(): + EntryPoint JIT(0) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:Fixnum[1] = Const Value(1) + v16:ArrayExact = NewArray v14 + v19:ArrayExact = ToArray v10 + ArrayExtend v16, v19 + CheckInterrupts + Return v16 + "); + } + #[test] fn test_pushtoarray_one_element() { eval(" def test(a) = [*a, 1] "); assert_contains_opcode("test", YARVINSN_pushtoarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:ArrayExact = ToNewArray v9 - v16:Fixnum[1] = Const Value(1) - ArrayPush v14, v16 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:ArrayExact = ToNewArray v10 + v17:Fixnum[1] = Const Value(1) + ArrayPush v15, v17 CheckInterrupts - Return v14 + Return v15 "); } @@ -3228,28 +3525,29 @@ pub mod hir_build_tests { def test(a) = [*a, 1, 2, 3] "); assert_contains_opcode("test", YARVINSN_pushtoarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :a@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v14:ArrayExact = ToNewArray v9 - v16:Fixnum[1] = Const Value(1) - v18:Fixnum[2] = Const Value(2) - v20:Fixnum[3] = Const Value(3) - ArrayPush v14, v16 - ArrayPush v14, v18 - ArrayPush v14, v20 + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :a@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v15:ArrayExact = ToNewArray v10 + v17:Fixnum[1] = Const Value(1) + v19:Fixnum[2] = Const Value(2) + v21:Fixnum[3] = Const Value(3) + ArrayPush v15, v17 + ArrayPush v15, v19 + ArrayPush v15, v21 CheckInterrupts - Return v14 + Return v15 "); } @@ -3259,26 +3557,27 @@ pub mod hir_build_tests { def test(a, b) = a[b] = 1 "); assert_contains_opcode("test", YARVINSN_opt_aset); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v16:NilClass = Const Value(nil) - v20:Fixnum[1] = Const Value(1) - v24:BasicObject = Send v11, :[]=, v12, v20 # SendFallbackReason: Uncategorized(opt_aset) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v17:NilClass = Const Value(nil) + v21:Fixnum[1] = Const Value(1) + v25:BasicObject = Send v12, :[]=, v13, v21 # SendFallbackReason: Uncategorized(opt_aset) CheckInterrupts - Return v20 + Return v21 "); } @@ -3288,24 +3587,25 @@ pub mod hir_build_tests { def test(a, b) = a[b] "); assert_contains_opcode("test", YARVINSN_opt_aref); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :a, l0, SP@5 - v3:BasicObject = GetLocal :b, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :a@0x1000 + v4:BasicObject = LoadField v2, :b@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :a@1 - v8:BasicObject = LoadArg :b@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :[], v12 # SendFallbackReason: Uncategorized(opt_aref) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :a@1 + v9:BasicObject = LoadArg :b@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :[], v13 # SendFallbackReason: Uncategorized(opt_aref) CheckInterrupts - Return v19 + Return v20 "); } @@ -3315,22 +3615,23 @@ pub mod hir_build_tests { def test(x) = x.empty? "); assert_contains_opcode("test", YARVINSN_opt_empty_p); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = Send v9, :empty? # SendFallbackReason: Uncategorized(opt_empty_p) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = Send v10, :empty? # SendFallbackReason: Uncategorized(opt_empty_p) CheckInterrupts - Return v15 + Return v16 "); } @@ -3340,22 +3641,23 @@ pub mod hir_build_tests { def test(x) = x.succ "); assert_contains_opcode("test", YARVINSN_opt_succ); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = Send v9, :succ # SendFallbackReason: Uncategorized(opt_succ) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = Send v10, :succ # SendFallbackReason: Uncategorized(opt_succ) CheckInterrupts - Return v15 + Return v16 "); } @@ -3365,24 +3667,25 @@ pub mod hir_build_tests { def test(x, y) = x & y "); assert_contains_opcode("test", YARVINSN_opt_and); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :&, v12 # SendFallbackReason: Uncategorized(opt_and) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :&, v13 # SendFallbackReason: Uncategorized(opt_and) CheckInterrupts - Return v19 + Return v20 "); } @@ -3392,24 +3695,25 @@ pub mod hir_build_tests { def test(x, y) = x | y "); assert_contains_opcode("test", YARVINSN_opt_or); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :|, v12 # SendFallbackReason: Uncategorized(opt_or) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :|, v13 # SendFallbackReason: Uncategorized(opt_or) CheckInterrupts - Return v19 + Return v20 "); } @@ -3419,22 +3723,23 @@ pub mod hir_build_tests { def test(x) = !x "); assert_contains_opcode("test", YARVINSN_opt_not); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v15:BasicObject = Send v9, :! # SendFallbackReason: Uncategorized(opt_not) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v16:BasicObject = Send v10, :! # SendFallbackReason: Uncategorized(opt_not) CheckInterrupts - Return v15 + Return v16 "); } @@ -3444,24 +3749,25 @@ pub mod hir_build_tests { def test(regexp, matchee) = regexp =~ matchee "); assert_contains_opcode("test", YARVINSN_opt_regexpmatch2); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :regexp, l0, SP@5 - v3:BasicObject = GetLocal :matchee, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :regexp@0x1000 + v4:BasicObject = LoadField v2, :matchee@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :regexp@1 - v8:BasicObject = LoadArg :matchee@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v19:BasicObject = Send v11, :=~, v12 # SendFallbackReason: Uncategorized(opt_regexpmatch2) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :regexp@1 + v9:BasicObject = LoadArg :matchee@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v20:BasicObject = Send v12, :=~, v13 # SendFallbackReason: Uncategorized(opt_regexpmatch2) CheckInterrupts - Return v19 + Return v20 "); } @@ -3578,29 +3884,30 @@ pub mod hir_build_tests { def test(x) = x&.itself "); assert_contains_opcode("test", YARVINSN_branchnil); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - v16:CBool = IsNil v9 - v17:NilClass = Const Value(nil) - IfTrue v16, bb4(v8, v17, v17) - v19:NotNil = RefineType v9, NotNil - v21:BasicObject = Send v19, :itself # SendFallbackReason: Uncategorized(opt_send_without_block) - Jump bb4(v8, v19, v21) - bb4(v23:BasicObject, v24:BasicObject, v25:BasicObject): + v17:CBool = IsNil v10 + v18:NilClass = Const Value(nil) + IfTrue v17, bb4(v9, v18, v18) + v20:NotNil = RefineType v10, NotNil + v22:BasicObject = Send v20, :itself # SendFallbackReason: Uncategorized(opt_send_without_block) + Jump bb4(v9, v20, v22) + bb4(v24:BasicObject, v25:BasicObject, v26:BasicObject): CheckInterrupts - Return v25 + Return v26 "); } @@ -3617,38 +3924,39 @@ pub mod hir_build_tests { "); assert_contains_opcode("test", YARVINSN_branchnil); // Note that IsNil has as its operand a value that we know statically *cannot* be nil - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - v15:CBool = Test v9 - v16:Falsy = RefineType v9, Falsy - IfFalse v15, bb4(v8, v16) - v18:Truthy = RefineType v9, Truthy + v16:CBool = Test v10 + v17:Falsy = RefineType v10, Falsy + IfFalse v16, bb4(v9, v17) + v19:Truthy = RefineType v10, Truthy CheckInterrupts - v24:CBool[false] = IsNil v18 - v25:NilClass = Const Value(nil) - IfTrue v24, bb5(v8, v25, v25) - v27:Truthy = RefineType v18, NotNil - v29:BasicObject = Send v27, :itself # SendFallbackReason: Uncategorized(opt_send_without_block) + v25:CBool[false] = IsNil v19 + v26:NilClass = Const Value(nil) + IfTrue v25, bb5(v9, v26, v26) + v28:Truthy = RefineType v19, NotNil + v30:BasicObject = Send v28, :itself # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v29 - bb4(v34:BasicObject, v35:Falsy): - v39:Fixnum[4] = Const Value(4) - Jump bb5(v34, v35, v39) - bb5(v41:BasicObject, v42:Falsy, v43:Fixnum[4]): + Return v30 + bb4(v35:BasicObject, v36:Falsy): + v40:Fixnum[4] = Const Value(4) + Jump bb5(v35, v36, v40) + bb5(v42:BasicObject, v43:Falsy, v44:Fixnum[4]): CheckInterrupts - Return v43 + Return v44 "); } @@ -3671,77 +3979,80 @@ pub mod hir_build_tests { end end "); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): CheckInterrupts - v15:CBool = Test v9 - v16:Falsy = RefineType v9, Falsy - IfFalse v15, bb6(v8, v16) - v18:Truthy = RefineType v9, Truthy + v16:CBool = Test v10 + v17:Falsy = RefineType v10, Falsy + IfFalse v16, bb6(v9, v17) + v19:Truthy = RefineType v10, Truthy CheckInterrupts - v23:CBool[true] = Test v18 - v24 = RefineType v18, Falsy - IfFalse v23, bb5(v8, v24) - v26:Truthy = RefineType v18, Truthy + v24:CBool[true] = Test v19 + v25 = RefineType v19, Falsy + IfFalse v24, bb5(v9, v25) + v27:Truthy = RefineType v19, Truthy CheckInterrupts - v31:CBool[true] = Test v26 - v32 = RefineType v26, Falsy - IfFalse v31, bb4(v8, v32) - v34:Truthy = RefineType v26, Truthy - v37:Fixnum[3] = Const Value(3) + v32:CBool[true] = Test v27 + v33 = RefineType v27, Falsy + IfFalse v32, bb4(v9, v33) + v35:Truthy = RefineType v27, Truthy + v38:Fixnum[3] = Const Value(3) CheckInterrupts - Return v37 - bb6(v42:BasicObject, v43:Falsy): - v47:Fixnum[6] = Const Value(6) + Return v38 + bb6(v43:BasicObject, v44:Falsy): + v48:Fixnum[6] = Const Value(6) CheckInterrupts - Return v47 - bb5(v52, v53): - v57 = Const Value(5) + Return v48 + bb5(v53, v54): + v58 = Const Value(5) CheckInterrupts - Return v57 - bb4(v62, v63): - v67 = Const Value(4) + Return v58 + bb4(v63, v64): + v68 = Const Value(4) CheckInterrupts - Return v67 + Return v68 "); } #[test] fn test_invokebuiltin_delegate_annotated() { assert_contains_opcode("Float", YARVINSN_opt_invokebuiltin_delegate_leave); - assert_snapshot!(hir_string("Float"), @r" + assert_snapshot!(hir_string("Float"), @" fn Float@: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :arg, l0, SP@6 - v3:BasicObject = GetLocal :exception, l0, SP@5 - v4:BasicObject = GetLocal , l0, SP@4 - Jump bb3(v1, v2, v3, v4) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :arg@0x1000 + v4:BasicObject = LoadField v2, :exception@0x1001 + v5:BasicObject = LoadField v2, :@0x1002 + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :arg@1 - v9:BasicObject = LoadArg :exception@2 - v10:BasicObject = GetLocal , l0, EP@3 - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject, v15:BasicObject): - v19:Float = InvokeBuiltin rb_f_float, v12, v13, v14 - Jump bb4(v12, v13, v14, v15, v19) - bb4(v21:BasicObject, v22:BasicObject, v23:BasicObject, v24:BasicObject, v25:Float): + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :arg@1 + v10:BasicObject = LoadArg :exception@2 + v11:CPtr = GetEP 0 + v12:BasicObject = LoadField v11, :@0x1003 + Jump bb3(v8, v9, v10, v12) + bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:BasicObject): + v21:Float = InvokeBuiltin rb_f_float, v14, v15, v16 + Jump bb4(v14, v15, v16, v17, v21) + bb4(v23:BasicObject, v24:BasicObject, v25:BasicObject, v26:BasicObject, v27:Float): CheckInterrupts - Return v25 + Return v27 "); } @@ -3773,47 +4084,49 @@ pub mod hir_build_tests { let iseq = crate::cruby::with_rubyvm(|| get_method_iseq("Dir", "open")); assert!(iseq_contains_opcode(iseq, YARVINSN_opt_invokebuiltin_delegate), "iseq Dir.open does not contain invokebuiltin"); let function = iseq_to_hir(iseq).unwrap(); - assert_snapshot!(hir_string_function(&function), @r" + assert_snapshot!(hir_string_function(&function), @" fn open@: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :name, l0, SP@8 - v3:BasicObject = GetLocal :encoding, l0, SP@7 - v4:BasicObject = GetLocal , l0, SP@6 - v5:BasicObject = GetLocal :block, l0, SP@5 - v6:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5, v6) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :name@0x1000 + v4:BasicObject = LoadField v2, :encoding@0x1001 + v5:BasicObject = LoadField v2, :@0x1002 + v6:BasicObject = LoadField v2, :block@0x1003 + v7:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6, v7) bb2(): EntryPoint JIT(0) - v9:BasicObject = LoadArg :self@0 - v10:BasicObject = LoadArg :name@1 - v11:BasicObject = LoadArg :encoding@2 - v12:BasicObject = GetLocal , l0, EP@5 - v13:BasicObject = LoadArg :block@3 - v14:NilClass = Const Value(nil) - Jump bb3(v9, v10, v11, v12, v13, v14) - bb3(v16:BasicObject, v17:BasicObject, v18:BasicObject, v19:BasicObject, v20:BasicObject, v21:NilClass): - v25:BasicObject = InvokeBuiltin dir_s_open, v16, v17, v18 + v10:BasicObject = LoadArg :self@0 + v11:BasicObject = LoadArg :name@1 + v12:BasicObject = LoadArg :encoding@2 + v13:CPtr = GetEP 0 + v14:BasicObject = LoadField v13, :@0x1003 + v15:BasicObject = LoadArg :block@3 + v16:NilClass = Const Value(nil) + Jump bb3(v10, v11, v12, v14, v15, v16) + bb3(v18:BasicObject, v19:BasicObject, v20:BasicObject, v21:BasicObject, v22:BasicObject, v23:NilClass): + v27:BasicObject = InvokeBuiltin dir_s_open, v18, v19, v20 PatchPoint NoEPEscape(open) - v31:CPtr = GetEP 0 - v32:CInt64 = LoadField v31, :_env_data_index_flags@0x1000 - v33:CInt64 = GuardNoBitsSet v32, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) - v34:CInt64 = LoadField v31, :_env_data_index_specval@0x1001 - v35:CInt64 = GuardAnyBitSet v34, CUInt64(1) - v36:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) - CheckInterrupts - v39:CBool[true] = Test v36 - v40 = RefineType v36, Falsy - IfFalse v39, bb4(v16, v17, v18, v19, v20, v25) - v42:HeapObject[BlockParamProxy] = RefineType v36, Truthy - v46:BasicObject = InvokeBlock, v25 # SendFallbackReason: Uncategorized(invokeblock) - v49:BasicObject = InvokeBuiltin dir_s_close, v16, v25 + v33:CPtr = GetEP 0 + v34:CInt64 = LoadField v33, :_env_data_index_flags@0x1004 + v35:CInt64 = GuardNoBitsSet v34, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM=CUInt64(512) + v36:CInt64 = LoadField v33, :_env_data_index_specval@0x1005 + v37:CInt64 = GuardAnyBitSet v36, CUInt64(1) + v38:HeapObject[BlockParamProxy] = Const Value(VALUE(0x1008)) CheckInterrupts - Return v46 - bb4(v55, v56, v57, v58, v59, v60): + v41:CBool[true] = Test v38 + v42 = RefineType v38, Falsy + IfFalse v41, bb4(v18, v19, v20, v21, v22, v27) + v44:HeapObject[BlockParamProxy] = RefineType v38, Truthy + v48:BasicObject = InvokeBlock, v27 # SendFallbackReason: Uncategorized(invokeblock) + v51:BasicObject = InvokeBuiltin dir_s_close, v18, v27 + CheckInterrupts + Return v48 + bb4(v57, v58, v59, v60, v61, v62): CheckInterrupts - Return v60 + Return v62 "); } @@ -3846,29 +4159,31 @@ pub mod hir_build_tests { let iseq = crate::cruby::with_rubyvm(|| get_method_iseq("GC", "start")); assert!(iseq_contains_opcode(iseq, YARVINSN_invokebuiltin), "iseq GC.start does not contain invokebuiltin"); let function = iseq_to_hir(iseq).unwrap(); - assert_snapshot!(hir_string_function(&function), @r" + assert_snapshot!(hir_string_function(&function), @" fn start@: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :full_mark, l0, SP@7 - v3:BasicObject = GetLocal :immediate_mark, l0, SP@6 - v4:BasicObject = GetLocal :immediate_sweep, l0, SP@5 - v5:BasicObject = GetLocal , l0, SP@4 - Jump bb3(v1, v2, v3, v4, v5) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :full_mark@0x1000 + v4:BasicObject = LoadField v2, :immediate_mark@0x1001 + v5:BasicObject = LoadField v2, :immediate_sweep@0x1002 + v6:BasicObject = LoadField v2, :@0x1003 + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :full_mark@1 - v10:BasicObject = LoadArg :immediate_mark@2 - v11:BasicObject = LoadArg :immediate_sweep@3 - v12:BasicObject = GetLocal , l0, EP@3 - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:BasicObject, v17:BasicObject, v18:BasicObject): - v25:FalseClass = Const Value(false) - v27:BasicObject = InvokeBuiltin gc_start_internal, v14, v15, v16, v17, v25 + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :full_mark@1 + v11:BasicObject = LoadArg :immediate_mark@2 + v12:BasicObject = LoadArg :immediate_sweep@3 + v13:CPtr = GetEP 0 + v14:BasicObject = LoadField v13, :@0x1004 + Jump bb3(v9, v10, v11, v12, v14) + bb3(v16:BasicObject, v17:BasicObject, v18:BasicObject, v19:BasicObject, v20:BasicObject): + v27:FalseClass = Const Value(false) + v29:BasicObject = InvokeBuiltin gc_start_internal, v16, v17, v18, v19, v27 CheckInterrupts - Return v27 + Return v29 "); } @@ -3924,35 +4239,36 @@ pub mod hir_build_tests { def test(x) = (x[0, 1] ||= 2) "); assert_contains_opcode("test", YARVINSN_dupn); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@4 - Jump bb3(v1, v2) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + Jump bb3(v1, v3) bb2(): EntryPoint JIT(0) - v5:BasicObject = LoadArg :self@0 - v6:BasicObject = LoadArg :x@1 - Jump bb3(v5, v6) - bb3(v8:BasicObject, v9:BasicObject): - v13:NilClass = Const Value(nil) - v16:Fixnum[0] = Const Value(0) - v18:Fixnum[1] = Const Value(1) - v21:BasicObject = Send v9, :[], v16, v18 # SendFallbackReason: Uncategorized(opt_send_without_block) + v6:BasicObject = LoadArg :self@0 + v7:BasicObject = LoadArg :x@1 + Jump bb3(v6, v7) + bb3(v9:BasicObject, v10:BasicObject): + v14:NilClass = Const Value(nil) + v17:Fixnum[0] = Const Value(0) + v19:Fixnum[1] = Const Value(1) + v22:BasicObject = Send v10, :[], v17, v19 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - v25:CBool = Test v21 - v26:Truthy = RefineType v21, Truthy - IfTrue v25, bb4(v8, v9, v13, v9, v16, v18, v26) - v28:Falsy = RefineType v21, Falsy - v31:Fixnum[2] = Const Value(2) - v34:BasicObject = Send v9, :[]=, v16, v18, v31 # SendFallbackReason: Uncategorized(opt_send_without_block) + v26:CBool = Test v22 + v27:Truthy = RefineType v22, Truthy + IfTrue v26, bb4(v9, v10, v14, v10, v17, v19, v27) + v29:Falsy = RefineType v22, Falsy + v32:Fixnum[2] = Const Value(2) + v35:BasicObject = Send v10, :[]=, v17, v19, v32 # SendFallbackReason: Uncategorized(opt_send_without_block) CheckInterrupts - Return v31 - bb4(v40:BasicObject, v41:BasicObject, v42:NilClass, v43:BasicObject, v44:Fixnum[0], v45:Fixnum[1], v46:Truthy): + Return v32 + bb4(v41:BasicObject, v42:BasicObject, v43:NilClass, v44:BasicObject, v45:Fixnum[0], v46:Fixnum[1], v47:Truthy): CheckInterrupts - Return v46 + Return v47 "); } @@ -4171,24 +4487,25 @@ pub mod hir_build_tests { yield x, y end "#); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :x, l0, SP@5 - v3:BasicObject = GetLocal :y, l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :x@0x1000 + v4:BasicObject = LoadField v2, :y@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :x@1 - v8:BasicObject = LoadArg :y@2 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v18:BasicObject = InvokeBlock, v11, v12 # SendFallbackReason: Uncategorized(invokeblock) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :x@1 + v9:BasicObject = LoadArg :y@2 + Jump bb3(v7, v8, v9) + bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): + v19:BasicObject = InvokeBlock, v12, v13 # SendFallbackReason: Uncategorized(invokeblock) CheckInterrupts - Return v18 + Return v19 "); } @@ -4200,34 +4517,35 @@ pub mod hir_build_tests { end "#); assert_contains_opcode("test", YARVINSN_expandarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@6 - v3:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 v4:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4) + v5:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :o@1 - v9:NilClass = Const Value(nil) + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :o@1 v10:NilClass = Const Value(nil) - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:NilClass, v15:NilClass): - v21:ArrayExact = GuardType v13, ArrayExact - v22:CInt64 = ArrayLength v21 - v23:CInt64[2] = Const CInt64(2) - v24:CInt64 = GuardGreaterEq v22, v23 - v25:CInt64[1] = Const CInt64(1) - v26:BasicObject = ArrayAref v21, v25 - v27:CInt64[0] = Const CInt64(0) - v28:BasicObject = ArrayAref v21, v27 + v11:NilClass = Const Value(nil) + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:NilClass, v16:NilClass): + v22:ArrayExact = GuardType v14, ArrayExact + v23:CInt64 = ArrayLength v22 + v24:CInt64[2] = Const CInt64(2) + v25:CInt64 = GuardGreaterEq v23, v24 + v26:CInt64[1] = Const CInt64(1) + v27:BasicObject = ArrayAref v22, v26 + v28:CInt64[0] = Const CInt64(0) + v29:BasicObject = ArrayAref v22, v28 PatchPoint NoEPEscape(test) CheckInterrupts - Return v13 + Return v14 "); } @@ -4239,23 +4557,24 @@ pub mod hir_build_tests { end "#); assert_contains_opcode("test", YARVINSN_expandarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@6 - v3:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 v4:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4) + v5:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5) bb2(): EntryPoint JIT(0) - v7:BasicObject = LoadArg :self@0 - v8:BasicObject = LoadArg :o@1 - v9:NilClass = Const Value(nil) + v8:BasicObject = LoadArg :self@0 + v9:BasicObject = LoadArg :o@1 v10:NilClass = Const Value(nil) - Jump bb3(v7, v8, v9, v10) - bb3(v12:BasicObject, v13:BasicObject, v14:NilClass, v15:NilClass): + v11:NilClass = Const Value(nil) + Jump bb3(v8, v9, v10, v11) + bb3(v13:BasicObject, v14:BasicObject, v15:NilClass, v16:NilClass): SideExit UnhandledYARVInsn(expandarray) "); } @@ -4268,25 +4587,26 @@ pub mod hir_build_tests { end "#); assert_contains_opcode("test", YARVINSN_expandarray); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:3: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :o, l0, SP@7 - v3:NilClass = Const Value(nil) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :o@0x1000 v4:NilClass = Const Value(nil) v5:NilClass = Const Value(nil) - Jump bb3(v1, v2, v3, v4, v5) + v6:NilClass = Const Value(nil) + Jump bb3(v1, v3, v4, v5, v6) bb2(): EntryPoint JIT(0) - v8:BasicObject = LoadArg :self@0 - v9:BasicObject = LoadArg :o@1 - v10:NilClass = Const Value(nil) + v9:BasicObject = LoadArg :self@0 + v10:BasicObject = LoadArg :o@1 v11:NilClass = Const Value(nil) v12:NilClass = Const Value(nil) - Jump bb3(v8, v9, v10, v11, v12) - bb3(v14:BasicObject, v15:BasicObject, v16:NilClass, v17:NilClass, v18:NilClass): + v13:NilClass = Const Value(nil) + Jump bb3(v9, v10, v11, v12, v13) + bb3(v15:BasicObject, v16:BasicObject, v17:NilClass, v18:NilClass, v19:NilClass): SideExit UnhandledYARVInsn(expandarray) "); } @@ -4297,34 +4617,36 @@ pub mod hir_build_tests { def test(kw: 1 + 1) = kw "#); assert_contains_opcode("test", YARVINSN_checkkeyword); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :kw, l0, SP@5 - v3:BasicObject = GetLocal , l0, SP@4 - Jump bb3(v1, v2, v3) + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :kw@0x1000 + v4:BasicObject = LoadField v2, :@0x1001 + Jump bb3(v1, v3, v4) bb2(): EntryPoint JIT(0) - v6:BasicObject = LoadArg :self@0 - v7:BasicObject = LoadArg :kw@1 - v8:BasicObject = GetLocal , l0, EP@3 - Jump bb3(v6, v7, v8) - bb3(v10:BasicObject, v11:BasicObject, v12:BasicObject): - v15:BoolExact = FixnumBitCheck v12, 0 - CheckInterrupts - v18:CBool = Test v15 - v19:TrueClass = RefineType v15, Truthy - IfTrue v18, bb4(v10, v11, v12) - v21:FalseClass = RefineType v15, Falsy - v23:Fixnum[1] = Const Value(1) + v7:BasicObject = LoadArg :self@0 + v8:BasicObject = LoadArg :kw@1 + v9:CPtr = GetEP 0 + v10:BasicObject = LoadField v9, :@0x1002 + Jump bb3(v7, v8, v10) + bb3(v12:BasicObject, v13:BasicObject, v14:BasicObject): + v17:BoolExact = FixnumBitCheck v14, 0 + CheckInterrupts + v20:CBool = Test v17 + v21:TrueClass = RefineType v17, Truthy + IfTrue v20, bb4(v12, v13, v14) + v23:FalseClass = RefineType v17, Falsy v25:Fixnum[1] = Const Value(1) - v28:BasicObject = Send v23, :+, v25 # SendFallbackReason: Uncategorized(opt_plus) - Jump bb4(v10, v28, v12) - bb4(v31:BasicObject, v32:BasicObject, v33:BasicObject): + v27:Fixnum[1] = Const Value(1) + v30:BasicObject = Send v25, :+, v27 # SendFallbackReason: Uncategorized(opt_plus) + Jump bb4(v12, v30, v14) + bb4(v33:BasicObject, v34:BasicObject, v35:BasicObject): CheckInterrupts - Return v32 + Return v34 "); } @@ -4340,85 +4662,87 @@ pub mod hir_build_tests { k32: k32, k33: k33) = k1 "#); assert_contains_opcode("test", YARVINSN_checkkeyword); - assert_snapshot!(hir_string("test"), @r" + assert_snapshot!(hir_string("test"), @" fn test@:2: bb1(): EntryPoint interpreter v1:BasicObject = LoadSelf - v2:BasicObject = GetLocal :k1, l0, SP@37 - v3:BasicObject = GetLocal :k2, l0, SP@36 - v4:BasicObject = GetLocal :k3, l0, SP@35 - v5:BasicObject = GetLocal :k4, l0, SP@34 - v6:BasicObject = GetLocal :k5, l0, SP@33 - v7:BasicObject = GetLocal :k6, l0, SP@32 - v8:BasicObject = GetLocal :k7, l0, SP@31 - v9:BasicObject = GetLocal :k8, l0, SP@30 - v10:BasicObject = GetLocal :k9, l0, SP@29 - v11:BasicObject = GetLocal :k10, l0, SP@28 - v12:BasicObject = GetLocal :k11, l0, SP@27 - v13:BasicObject = GetLocal :k12, l0, SP@26 - v14:BasicObject = GetLocal :k13, l0, SP@25 - v15:BasicObject = GetLocal :k14, l0, SP@24 - v16:BasicObject = GetLocal :k15, l0, SP@23 - v17:BasicObject = GetLocal :k16, l0, SP@22 - v18:BasicObject = GetLocal :k17, l0, SP@21 - v19:BasicObject = GetLocal :k18, l0, SP@20 - v20:BasicObject = GetLocal :k19, l0, SP@19 - v21:BasicObject = GetLocal :k20, l0, SP@18 - v22:BasicObject = GetLocal :k21, l0, SP@17 - v23:BasicObject = GetLocal :k22, l0, SP@16 - v24:BasicObject = GetLocal :k23, l0, SP@15 - v25:BasicObject = GetLocal :k24, l0, SP@14 - v26:BasicObject = GetLocal :k25, l0, SP@13 - v27:BasicObject = GetLocal :k26, l0, SP@12 - v28:BasicObject = GetLocal :k27, l0, SP@11 - v29:BasicObject = GetLocal :k28, l0, SP@10 - v30:BasicObject = GetLocal :k29, l0, SP@9 - v31:BasicObject = GetLocal :k30, l0, SP@8 - v32:BasicObject = GetLocal :k31, l0, SP@7 - v33:BasicObject = GetLocal :k32, l0, SP@6 - v34:BasicObject = GetLocal :k33, l0, SP@5 - v35:BasicObject = GetLocal , l0, SP@4 - Jump bb3(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) - bb2(): - EntryPoint JIT(0) - v38:BasicObject = LoadArg :self@0 - v39:BasicObject = LoadArg :k1@1 - v40:BasicObject = LoadArg :k2@2 - v41:BasicObject = LoadArg :k3@3 - v42:BasicObject = LoadArg :k4@4 - v43:BasicObject = LoadArg :k5@5 - v44:BasicObject = LoadArg :k6@6 - v45:BasicObject = LoadArg :k7@7 - v46:BasicObject = LoadArg :k8@8 - v47:BasicObject = LoadArg :k9@9 - v48:BasicObject = LoadArg :k10@10 - v49:BasicObject = LoadArg :k11@11 - v50:BasicObject = LoadArg :k12@12 - v51:BasicObject = LoadArg :k13@13 - v52:BasicObject = LoadArg :k14@14 - v53:BasicObject = LoadArg :k15@15 - v54:BasicObject = LoadArg :k16@16 - v55:BasicObject = LoadArg :k17@17 - v56:BasicObject = LoadArg :k18@18 - v57:BasicObject = LoadArg :k19@19 - v58:BasicObject = LoadArg :k20@20 - v59:BasicObject = LoadArg :k21@21 - v60:BasicObject = LoadArg :k22@22 - v61:BasicObject = LoadArg :k23@23 - v62:BasicObject = LoadArg :k24@24 - v63:BasicObject = LoadArg :k25@25 - v64:BasicObject = LoadArg :k26@26 - v65:BasicObject = LoadArg :k27@27 - v66:BasicObject = LoadArg :k28@28 - v67:BasicObject = LoadArg :k29@29 - v68:BasicObject = LoadArg :k30@30 - v69:BasicObject = LoadArg :k31@31 - v70:BasicObject = LoadArg :k32@32 - v71:BasicObject = LoadArg :k33@33 - v72:BasicObject = GetLocal , l0, EP@3 - Jump bb3(v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v70, v71, v72) - bb3(v74:BasicObject, v75:BasicObject, v76:BasicObject, v77:BasicObject, v78:BasicObject, v79:BasicObject, v80:BasicObject, v81:BasicObject, v82:BasicObject, v83:BasicObject, v84:BasicObject, v85:BasicObject, v86:BasicObject, v87:BasicObject, v88:BasicObject, v89:BasicObject, v90:BasicObject, v91:BasicObject, v92:BasicObject, v93:BasicObject, v94:BasicObject, v95:BasicObject, v96:BasicObject, v97:BasicObject, v98:BasicObject, v99:BasicObject, v100:BasicObject, v101:BasicObject, v102:BasicObject, v103:BasicObject, v104:BasicObject, v105:BasicObject, v106:BasicObject, v107:BasicObject, v108:BasicObject): + v2:CPtr = LoadSP + v3:BasicObject = LoadField v2, :k1@0x1000 + v4:BasicObject = LoadField v2, :k2@0x1001 + v5:BasicObject = LoadField v2, :k3@0x1002 + v6:BasicObject = LoadField v2, :k4@0x1003 + v7:BasicObject = LoadField v2, :k5@0x1004 + v8:BasicObject = LoadField v2, :k6@0x1005 + v9:BasicObject = LoadField v2, :k7@0x1006 + v10:BasicObject = LoadField v2, :k8@0x1007 + v11:BasicObject = LoadField v2, :k9@0x1008 + v12:BasicObject = LoadField v2, :k10@0x1009 + v13:BasicObject = LoadField v2, :k11@0x100a + v14:BasicObject = LoadField v2, :k12@0x100b + v15:BasicObject = LoadField v2, :k13@0x100c + v16:BasicObject = LoadField v2, :k14@0x100d + v17:BasicObject = LoadField v2, :k15@0x100e + v18:BasicObject = LoadField v2, :k16@0x100f + v19:BasicObject = LoadField v2, :k17@0x1010 + v20:BasicObject = LoadField v2, :k18@0x1011 + v21:BasicObject = LoadField v2, :k19@0x1012 + v22:BasicObject = LoadField v2, :k20@0x1013 + v23:BasicObject = LoadField v2, :k21@0x1014 + v24:BasicObject = LoadField v2, :k22@0x1015 + v25:BasicObject = LoadField v2, :k23@0x1016 + v26:BasicObject = LoadField v2, :k24@0x1017 + v27:BasicObject = LoadField v2, :k25@0x1018 + v28:BasicObject = LoadField v2, :k26@0x1019 + v29:BasicObject = LoadField v2, :k27@0x101a + v30:BasicObject = LoadField v2, :k28@0x101b + v31:BasicObject = LoadField v2, :k29@0x101c + v32:BasicObject = LoadField v2, :k30@0x101d + v33:BasicObject = LoadField v2, :k31@0x101e + v34:BasicObject = LoadField v2, :k32@0x101f + v35:BasicObject = LoadField v2, :k33@0x1020 + v36:BasicObject = LoadField v2, :@0x1021 + Jump bb3(v1, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) + bb2(): + EntryPoint JIT(0) + v39:BasicObject = LoadArg :self@0 + v40:BasicObject = LoadArg :k1@1 + v41:BasicObject = LoadArg :k2@2 + v42:BasicObject = LoadArg :k3@3 + v43:BasicObject = LoadArg :k4@4 + v44:BasicObject = LoadArg :k5@5 + v45:BasicObject = LoadArg :k6@6 + v46:BasicObject = LoadArg :k7@7 + v47:BasicObject = LoadArg :k8@8 + v48:BasicObject = LoadArg :k9@9 + v49:BasicObject = LoadArg :k10@10 + v50:BasicObject = LoadArg :k11@11 + v51:BasicObject = LoadArg :k12@12 + v52:BasicObject = LoadArg :k13@13 + v53:BasicObject = LoadArg :k14@14 + v54:BasicObject = LoadArg :k15@15 + v55:BasicObject = LoadArg :k16@16 + v56:BasicObject = LoadArg :k17@17 + v57:BasicObject = LoadArg :k18@18 + v58:BasicObject = LoadArg :k19@19 + v59:BasicObject = LoadArg :k20@20 + v60:BasicObject = LoadArg :k21@21 + v61:BasicObject = LoadArg :k22@22 + v62:BasicObject = LoadArg :k23@23 + v63:BasicObject = LoadArg :k24@24 + v64:BasicObject = LoadArg :k25@25 + v65:BasicObject = LoadArg :k26@26 + v66:BasicObject = LoadArg :k27@27 + v67:BasicObject = LoadArg :k28@28 + v68:BasicObject = LoadArg :k29@29 + v69:BasicObject = LoadArg :k30@30 + v70:BasicObject = LoadArg :k31@31 + v71:BasicObject = LoadArg :k32@32 + v72:BasicObject = LoadArg :k33@33 + v73:CPtr = GetEP 0 + v74:BasicObject = LoadField v73, :@0x1022 + Jump bb3(v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v70, v71, v72, v74) + bb3(v76:BasicObject, v77:BasicObject, v78:BasicObject, v79:BasicObject, v80:BasicObject, v81:BasicObject, v82:BasicObject, v83:BasicObject, v84:BasicObject, v85:BasicObject, v86:BasicObject, v87:BasicObject, v88:BasicObject, v89:BasicObject, v90:BasicObject, v91:BasicObject, v92:BasicObject, v93:BasicObject, v94:BasicObject, v95:BasicObject, v96:BasicObject, v97:BasicObject, v98:BasicObject, v99:BasicObject, v100:BasicObject, v101:BasicObject, v102:BasicObject, v103:BasicObject, v104:BasicObject, v105:BasicObject, v106:BasicObject, v107:BasicObject, v108:BasicObject, v109:BasicObject, v110:BasicObject): SideExit TooManyKeywordParameters "); } diff --git a/zjit/src/profile.rs b/zjit/src/profile.rs index ad6da06c71e91b..98dd5d5490edcd 100644 --- a/zjit/src/profile.rs +++ b/zjit/src/profile.rs @@ -99,6 +99,7 @@ fn profile_insn(bare_opcode: ruby_vminsn_type, ec: EcPtr) { // Profile all the arguments and self (+1). profile_operands(profiler, profile, (argc + 1) as usize); } + YARVINSN_splatkw => profile_operands(profiler, profile, 2), _ => {} } diff --git a/zjit/src/stats.rs b/zjit/src/stats.rs index 059964b8e8dd07..9f7a703ed48b07 100644 --- a/zjit/src/stats.rs +++ b/zjit/src/stats.rs @@ -225,6 +225,9 @@ make_counters! { exit_block_param_proxy_not_nil, exit_block_param_wb_required, exit_too_many_keyword_parameters, + exit_splatkw_not_nil_or_hash, + exit_splatkw_polymorphic, + exit_splatkw_not_profiled, } // Send fallback counters that are summed as dynamic_send_count @@ -423,7 +426,6 @@ make_counters! { vm_write_locals_count, vm_write_stack_count, vm_write_to_parent_iseq_local_count, - vm_read_from_parent_iseq_local_count, // TODO(max): Implement // vm_reify_stack_count, @@ -585,6 +587,9 @@ pub fn side_exit_counter(reason: crate::hir::SideExitReason) -> Counter { BlockParamProxyNotNil => exit_block_param_proxy_not_nil, BlockParamWbRequired => exit_block_param_wb_required, TooManyKeywordParameters => exit_too_many_keyword_parameters, + SplatKwNotNilOrHash => exit_splatkw_not_nil_or_hash, + SplatKwPolymorphic => exit_splatkw_polymorphic, + SplatKwNotProfiled => exit_splatkw_not_profiled, PatchPoint(Invariant::BOPRedefined { .. }) => exit_patchpoint_bop_redefined, PatchPoint(Invariant::MethodRedefined { .. })