mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-compiler: remove traditional word/symbol array codegen paths
Remove unused codegen_words and codegen_symbols functions along with their corresponding cases in the main codegen switch. These became dead code after converting new_words and new_symbols to always use variable-sized nodes. Also remove var_nodes_enabled conditions from new_words and new_symbols, completing the transition to always using variable-sized nodes for word and symbol arrays. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4314,17 +4314,7 @@ codegen_xstr(codegen_scope *s, node *tree, int val)
|
||||
if (val) push();
|
||||
}
|
||||
|
||||
static void
|
||||
codegen_words(codegen_scope *s, node *tree, int val)
|
||||
{
|
||||
gen_literal_array(s, tree, FALSE, val);
|
||||
}
|
||||
|
||||
static void
|
||||
codegen_symbols(codegen_scope *s, node *tree, int val)
|
||||
{
|
||||
gen_literal_array(s, tree, TRUE, val);
|
||||
}
|
||||
|
||||
/* codegen_cons_list_string forward declaration moved to top of file */
|
||||
|
||||
@@ -5976,22 +5966,14 @@ static void
|
||||
gen_words_var(codegen_scope *s, node *varnode, int val)
|
||||
{
|
||||
struct mrb_ast_words_node *n = words_node(varnode);
|
||||
// Create stack-allocated node structure for traditional codegen
|
||||
struct mrb_ast_head_node stack_node = {0};
|
||||
stack_node.car = (node*)NODE_WORDS;
|
||||
stack_node.cdr = n->args;
|
||||
codegen_words(s, (node*)&stack_node, val);
|
||||
gen_literal_array(s, n->args, FALSE, val);
|
||||
}
|
||||
|
||||
static void
|
||||
gen_symbols_var(codegen_scope *s, node *varnode, int val)
|
||||
{
|
||||
struct mrb_ast_symbols_node *n = symbols_node(varnode);
|
||||
// Create stack-allocated node structure for traditional codegen
|
||||
struct mrb_ast_head_node stack_node = {0};
|
||||
stack_node.car = (node*)NODE_SYMBOLS;
|
||||
stack_node.cdr = n->args;
|
||||
codegen_symbols(s, (node*)&stack_node, val);
|
||||
gen_literal_array(s, n->args, TRUE, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -6681,13 +6663,6 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
codegen_heredoc_str(s, tree, val);
|
||||
break;
|
||||
|
||||
case NODE_WORDS:
|
||||
codegen_words(s, tree, val);
|
||||
break;
|
||||
|
||||
case NODE_SYMBOLS:
|
||||
codegen_symbols(s, tree, val);
|
||||
break;
|
||||
|
||||
case NODE_XSTR:
|
||||
codegen_xstr(s, tree, val);
|
||||
|
||||
@@ -2300,10 +2300,6 @@ new_str_empty(parser_state *p)
|
||||
static node*
|
||||
new_words(parser_state *p, node *a)
|
||||
{
|
||||
if (!p->var_nodes_enabled) {
|
||||
return cons_head((node*)NODE_WORDS, a);
|
||||
}
|
||||
|
||||
size_t total_size = sizeof(struct mrb_ast_words_node);
|
||||
enum mrb_ast_size_class class = size_to_class(total_size);
|
||||
struct mrb_ast_words_node *words_node = (struct mrb_ast_words_node*)parser_alloc_var(p, total_size, class);
|
||||
@@ -2316,10 +2312,6 @@ new_words(parser_state *p, node *a)
|
||||
static node*
|
||||
new_symbols(parser_state *p, node *a)
|
||||
{
|
||||
if (!p->var_nodes_enabled) {
|
||||
return cons_head((node*)NODE_SYMBOLS, a);
|
||||
}
|
||||
|
||||
size_t total_size = sizeof(struct mrb_ast_symbols_node);
|
||||
enum mrb_ast_size_class class = size_to_class(total_size);
|
||||
struct mrb_ast_symbols_node *symbols_node = (struct mrb_ast_symbols_node*)parser_alloc_var(p, total_size, class);
|
||||
|
||||
+1441
-1449
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user