summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2024-01-30 19:45:16 +0000
committerMatt Valentine-House <matt@eightbitraptor.com>2024-01-30 22:22:39 +0000
commit1142ed2f50359d8cab7903e5cc1f0ec9a2ed3e6e (patch)
tree0cd1b83d05884f655f1e7e5b9d10d82a9a16fbee
parentdddef93bbd0327e24dff8c87caeb66b6f64800e6 (diff)
[PRISM] Remove unneccessary uses of cond_seq
As this is compiled into only on the recursive call and then added, we can just use `ret` directly
-rw-r--r--prism_compile.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 8d8ad656a2..2bde291c38 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -549,6 +549,7 @@ pm_compile_flip_flop(pm_flip_flop_node_t *flip_flop_node, LABEL *else_label, LAB
}
void pm_compile_defined_expr(rb_iseq_t *iseq, const pm_node_t *defined_node, LINK_ANCHOR *const ret, const uint8_t *src, bool popped, pm_scope_node_t *scope_node, NODE dummy_line_node, int lineno, bool in_condition);
+
static void
pm_compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const pm_node_t *cond,
LABEL *then_label, LABEL *else_label, const uint8_t *src, bool popped, pm_scope_node_t *scope_node)
@@ -597,11 +598,7 @@ again:
break;
}
default: {
- DECL_ANCHOR(cond_seq);
- INIT_ANCHOR(cond_seq);
-
- pm_compile_node(iseq, cond, cond_seq, src, false, scope_node);
- ADD_SEQ(ret, cond_seq);
+ pm_compile_node(iseq, cond, ret, src, false, scope_node);
break;
}
}
@@ -615,17 +612,13 @@ pm_compile_if(rb_iseq_t *iseq, const int line, pm_statements_node_t *node_body,
{
NODE dummy_line_node = generate_dummy_line_node(line, line);
- DECL_ANCHOR(cond_seq);
-
LABEL *then_label, *else_label, *end_label;
- INIT_ANCHOR(cond_seq);
then_label = NEW_LABEL(line);
else_label = NEW_LABEL(line);
end_label = 0;
- pm_compile_branch_condition(iseq, cond_seq, predicate, then_label, else_label, src, false, scope_node);
- ADD_SEQ(ret, cond_seq);
+ pm_compile_branch_condition(iseq, ret, predicate, then_label, else_label, src, false, scope_node);
if (then_label->refcnt) {
ADD_LABEL(ret, then_label);