Commit 995f8980
995f89809716Merged
Richard Ramsden <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
Cleanup dead code
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 995f89809716
- Parent
- fdceb0c5ecd8
spinel_codegen.rbmodifiedView file
@@ -179,7 +179,6 @@
179179
@needs_str_poly_hash = 0180180
@needs_sym_poly_hash = 0181181
@needs_sym_intern = 0182-
@needs_string_helpers = 0183182
@needs_setjmp = 0184183
@needs_file_io = 0185184
@needs_mutable_str = 0@@ -7050,7 +7049,6 @@
70507049
end70517050
if t == "InterpolatedXStringNode"70527051
@needs_file_io = 17053-
@needs_string_helpers = 170547052
end70557053
if t == "RegularExpressionNode"70567054
@needs_regexp = 1@@ -7114,10 +7112,8 @@
71147112
@needs_str_array = 171157113
end71167114
if t == "InterpolatedStringNode"7117-
@needs_string_helpers = 171187115
end71197116
if t == "SymbolNode"7120-
@needs_string_helpers = 171217117
end71227118
if t == "GlobalVariableWriteNode"71237119
gname = @nd_name[nid]@@ -7159,14 +7155,12 @@
71597155
mname == "gsub" || mname == "index" || mname == "sub" || mname == "tr" ||71607156
mname == "ljust" || mname == "rjust" || mname == "capitalize" ||71617157
mname == "count" || mname == "<<"7162-
@needs_string_helpers = 171637158
end71647159
if mname == "rand" || mname == "srand" || mname == "sample" ||71657160
mname == "shuffle" || mname == "shuffle!"71667161
@needs_rand = 171677162
end71687163
if mname == "split"7169-
@needs_string_helpers = 171707164
@needs_str_array = 171717165
@needs_gc = 171727166
end@@ -7183,7 +7177,6 @@
71837177
if @nd_receiver[nid] >= 071847178
rt = infer_type(@nd_receiver[nid])71857179
if rt == "string"7186-
@needs_string_helpers = 171877180
# Long string concat chains emit SP_GC_ROOT temps, so the71887181
# enclosing function needs SP_GC_SAVE() in its header.71897182
if mname == "+"@@ -7193,7 +7186,6 @@
71937186
end71947187
end71957188
if mname == "[]"7196-
@needs_string_helpers = 171977189
end71987190
if mname == "new"71997191
if @nd_receiver[nid] >= 0@@ -7307,10 +7299,8 @@
73077299
if rn == "File"73087300
@needs_file_io = 173097301
if mname == "join"7310-
@needs_string_helpers = 173117302
end73127303
if mname == "basename"7313-
@needs_string_helpers = 173147304
end73157305
end73167306
end@@ -12414,7 +12404,6 @@
1241412404
end1241512405
if t == "InterpolatedXStringNode"1241612406
@needs_file_io = 112417-
@needs_string_helpers = 11241812407
interp = compile_interpolated(nid)1241912408
return "sp_backtick(" + interp + ")"1242012409
end@@ -12627,7 +12616,6 @@
1262712616
end1262812617
1262912618
def compile_interpolated(nid)12630-
@needs_string_helpers = 11263112619
parts = parse_id_list(@nd_parts[nid])1263212620
if parts.length == 01263312621
return "(&(\"\\xff\")[1])"@@ -13682,11 +13670,9 @@
1368213670
return "0"1368313671
end1368413672
if mname == "format"13685-
@needs_string_helpers = 11368613673
return compile_sprintf_call(nid)1368713674
end1368813675
if mname == "sprintf"13689-
@needs_string_helpers = 11369013676
return compile_sprintf_call(nid)1369113677
end1369213678
if mname == "putc"@@ -13734,7 +13720,6 @@
1373413720
if st != ""1373513721
# Redirect as self.mname - string methods1373613722
if st == "string"13737-
@needs_string_helpers = 11373813723
if mname == "upcase"1373913724
return "sp_str_upcase(self)"1374013725
end@@ -13775,7 +13760,6 @@
1377513760
# int methods1377613761
if st == "int"1377713762
if mname == "to_s"13778-
@needs_string_helpers = 11377913763
return "sp_int_to_s(self)"1378013764
end1378113765
if mname == "to_f"@@ -13791,7 +13775,6 @@
1379113775
return "(mrb_int)(self)"1379213776
end1379313777
if mname == "to_s"13794-
@needs_string_helpers = 11379513778
return "sp_float_to_s(self)"1379613779
end1379713780
end@@ -13977,10 +13960,8 @@
1397713960
if at == "string"1397813961
parts.push(compile_expr(aargs[0]))1397913962
elsif at == "int"13980-
@needs_string_helpers = 11398113963
parts.push("sp_int_to_s(" + compile_expr(aargs[0]) + ")")1398213964
elsif at == "float"13983-
@needs_string_helpers = 11398413965
parts.push("sp_float_to_s(" + compile_expr(aargs[0]) + ")")1398513966
else1398613967
parts.push(compile_expr(aargs[0]))@@ -14058,11 +14039,9 @@
1405814039
if mname == "+"1405914040
lt = infer_type(recv)1406014041
if lt == "mutable_str"14061-
@needs_string_helpers = 11406214042
return "sp_str_concat(" + compile_expr(recv) + "->data, " + compile_arg0(nid) + ")"1406314043
end1406414044
if lt == "string"14065-
@needs_string_helpers = 11406614045
# Flatten chained string concat: a + b + c → sp_str_concat3(a,b,c)1406714046
parts = collect_concat_chain(nid)1406814047
if parts.length == 3@@ -14104,7 +14083,6 @@
1410414083
end1410514084
if lt == "poly"1410614085
@needs_rb_value = 114107-
@needs_string_helpers = 11410814086
return "sp_poly_add(" + compile_expr(recv) + ", " + box_expr_to_poly(@nd_arguments[nid] >= 0 ? get_args(@nd_arguments[nid])[0] : -1) + ")"1410914087
end1411014088
if is_array_type(lt) == 1@@ -14135,7 +14113,6 @@
1413514113
if mname == "*"1413614114
lt = infer_type(recv)1413714115
if lt == "string"14138-
@needs_string_helpers = 11413914116
return "sp_str_repeat(" + compile_expr(recv) + ", " + compile_arg0(nid) + ")"1414014117
end1414114118
if lt == "poly"@@ -14351,7 +14328,6 @@
1435114328
return "(sp_String_append(" + rc + ", " + val + "), " + rc + ")"1435214329
end1435314330
if lt == "string"14354-
@needs_string_helpers = 11435514331
return "sp_str_concat(" + compile_expr(recv) + ", " + compile_arg0(nid) + ")"1435614332
end1435714333
return "(" + compile_expr(recv) + " << " + compile_arg0(nid) + ")"@@ -14600,7 +14576,6 @@
1460014576
end1460114577
1460214578
def compile_string_method_expr(nid, mname, rc)14603-
@needs_string_helpers = 11460414579
if mname == "length"1460514580
# Only use hoisted length if the receiver matches (otherwise we'd1460614581
# return the wrong string's length).@@ -14862,7 +14837,6 @@
1486214837
return fn + "(" + lprefix + ", " + compile_arg0(nid) + ", 1)"1486314838
end1486414839
if mname == "reverse"14865-
@needs_string_helpers = 11486614840
return "sp_str_reverse(" + rc + ")"1486714841
end1486814842
if mname == "freeze"@@ -15050,7 +15024,6 @@
1505015024
return rc1505115025
end1505215026
if mname == "inspect"15053-
@needs_string_helpers = 11505415027
return "sp_str_concat(\":\", sp_sym_to_s(" + rc + "))"1505515028
end1505615029
if mname == "length" || mname == "size"@@ -15110,7 +15083,6 @@
1511015083
1511115084
def compile_int_method_expr(nid, mname, rc)1511215085
if mname == "to_s"15113-
@needs_string_helpers = 11511415086
if @nd_arguments[nid] >= 01511515087
aargs = get_args(@nd_arguments[nid])1511615088
if aargs.length > 0@@ -15188,7 +15160,6 @@
1518815160
return "TRUE"1518915161
end1519015162
if mname == "chr"15191-
@needs_string_helpers = 11519215163
return "sp_int_chr(" + rc + ")"1519315164
end1519415165
if mname == "succ" || mname == "next"@@ -15205,7 +15176,6 @@
1520515176
return rc1520615177
end1520715178
if mname == "to_s"15208-
@needs_string_helpers = 11520915179
return "sp_float_to_s(" + rc + ")"1521015180
end1521115181
if mname == "inspect"@@ -15673,7 +15643,6 @@
1567315643
return "sp_IntArray_uniq(" + rc + ")"1567415644
end1567515645
if mname == "join"15676-
@needs_string_helpers = 11567715646
jarg = compile_arg0(nid)1567815647
if jarg == "0"1567915648
jarg = "\"\""@@ -15884,7 +15853,6 @@
1588415853
return "sp_StrArray_get(" + rc + ", sp_StrArray_length(" + rc + ") - 1)"1588515854
end1588615855
if mname == "join"15887-
@needs_string_helpers = 11588815856
jarg = compile_arg0(nid)1588915857
if jarg == "0"1589015858
jarg = "\"\""@@ -16420,7 +16388,6 @@
1642016388
return "(sp_file_delete(" + compile_arg0(nid) + "), 0)"1642116389
end1642216390
if mname == "join"16423-
@needs_string_helpers = 11642416391
args_id = @nd_arguments[nid]1642516392
if args_id >= 01642616393
arg_ids = get_args(args_id)@@ -16431,7 +16398,6 @@
1643116398
return "\"\""1643216399
end1643316400
if mname == "basename"16434-
@needs_string_helpers = 11643516401
return "sp_file_basename(" + compile_arg0(nid) + ")"1643616402
end1643716403
end@@ -17658,7 +17624,6 @@
1765817624
end1765917625
if ht == "str_str_hash"1766017626
@needs_str_str_hash = 117661-
@needs_string_helpers = 11766217627
tmp = new_temp1766317628
emit(" sp_StrStrHash *" + tmp + " = sp_StrStrHash_new();")1766417629
elems.each { |el|@@ -17905,7 +17870,6 @@
1790517870
end1790617871
if op == "+"1790717872
if vt == "string" && infer_type(@nd_expression[nid]) == "string"17908-
@needs_string_helpers = 11790917873
emit(" " + vref + " = sp_str_concat(" + vref + ", " + val + ");")1791017874
else1791117875
emit(" " + vref + " += " + val + ";")@@ -19005,7 +18969,6 @@
1900518969
return 11900618970
end1900718971
if rt == "string"19008-
@needs_string_helpers = 11900918972
rc = compile_expr_gc_rooted(recv)1901018973
val = compile_arg0(nid)1901118974
# If receiver is a local variable, reassign@@ -19328,7 +19291,6 @@
1932819291
bp = "_c"1932919292
end1933019293
declare_var(bp, "string")19331-
@needs_string_helpers = 11933219294
tmp = new_temp1933319295
src = rc1933419296
if rt == "mutable_str"@@ -22644,7 +22606,6 @@
2264422606
end2264522607
2264622608
def compile_sprintf_call(nid)22647-
@needs_string_helpers = 12264822609
args_id = @nd_arguments[nid]2264922610
if args_id < 02265022611
return "\"\""