opt_new needs to happen after safe navigation
If safe navigation instructions happen first, we get a stack inconsistency error.
This commit is contained in:
parent
e6974be545
commit
203614080f
Notes:
git
2025-04-29 20:33:42 +00:00
@ -3621,8 +3621,6 @@ pm_compile_call(rb_iseq_t *iseq, const pm_call_node_t *call_node, LINK_ANCHOR *c
|
|||||||
|
|
||||||
const pm_node_location_t location = PM_LOCATION_START_LOCATION(scope_node->parser, message_loc, call_node->base.node_id);
|
const pm_node_location_t location = PM_LOCATION_START_LOCATION(scope_node->parser, message_loc, call_node->base.node_id);
|
||||||
|
|
||||||
LINK_ELEMENT *opt_new_prelude = LAST_ELEMENT(ret);
|
|
||||||
|
|
||||||
LABEL *else_label = NEW_LABEL(location.line);
|
LABEL *else_label = NEW_LABEL(location.line);
|
||||||
LABEL *end_label = NEW_LABEL(location.line);
|
LABEL *end_label = NEW_LABEL(location.line);
|
||||||
LABEL *retry_end_l = NEW_LABEL(location.line);
|
LABEL *retry_end_l = NEW_LABEL(location.line);
|
||||||
@ -3661,6 +3659,8 @@ pm_compile_call(rb_iseq_t *iseq, const pm_call_node_t *call_node, LINK_ANCHOR *c
|
|||||||
add_trace_branch_coverage(iseq, ret, &code_location, node_id, 0, "then", branches);
|
add_trace_branch_coverage(iseq, ret, &code_location, node_id, 0, "then", branches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LINK_ELEMENT *opt_new_prelude = LAST_ELEMENT(ret);
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
struct rb_callinfo_kwarg *kw_arg = NULL;
|
struct rb_callinfo_kwarg *kw_arg = NULL;
|
||||||
|
|
||||||
|
@ -1216,6 +1216,11 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_opt_new_with_safe_navigation
|
||||||
|
payload = nil
|
||||||
|
assert_nil payload&.new
|
||||||
|
end
|
||||||
|
|
||||||
def test_opt_new
|
def test_opt_new
|
||||||
pos_initialize = "
|
pos_initialize = "
|
||||||
def initialize a, b
|
def initialize a, b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user