Commit 04008070
040080709c79Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
feat: self-hosting works - fib(34) compiles through self-hosted binary
Major changes to enable self-hosting:
- Add infer_class_body_call_types: scans class method bodies for calls to other same-class methods and propagates parameter types
- Add scan_cls_method_calls for class-internal call site type inference
- Add scan_locals_first_type (no poly marking) for inference passes
- Fix scan_locals to not mark poly when new type is fallback "int"
- Add locals declaration in infer_all_returns for class methods
- Fix sp_str_split to return empty array for empty input (Ruby compat)
- Fix ARGV[] type inference to return "string"
- Add GC rooting (SP_GC_ROOT) for pointer-typed local variables
- Increase GC stack max and initial threshold for compiler workloads
- Convert [] initializers to "".split(",") for StrArray consistency
Pipeline: ruby spinel_parse.rb spinel_codegen.rb | ruby spinel_codegen.rb -> C binary that reads AST and generates correct C for fib(34)=5702887
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 040080709c79
- Parent
- 7e134de5b6d8
spinel_codegen.rbmodifiedView file
@@ -1372,6 +1372,9 @@
13721372
if rt == "str_str_hash"13731373
return "string"13741374
end1375+
if rt == "argv"1376+
return "string"1377+
end13751378
end13761379
return "int"13771380
end@@ -3037,7 +3040,7 @@
30373040
all_params = @cls_meth_params[init_ci].split("|")30383041
if init_idx < all_ptypes.length30393042
ptypes = all_ptypes[init_idx].split(",")3040-
pnames = []3043+
pnames = "".split(",")30413044
if init_idx < all_params.length30423045
pnames = all_params[init_idx].split(",")30433046
end@@ -3200,8 +3203,9 @@
32003203
# Synthetic struct - update ivar types from init param types32013204
all_params = @cls_meth_params[i].split("|")32023205
all_ptypes = @cls_meth_ptypes[i].split("|")3203-
pnames = []3204-
ptypes = []3206+
pnames = "".split(",")3207+
ptypes = "".split(",")3208+
32053209
if init_idx2 < all_params.length32063210
pnames = all_params[init_idx2].split(",")32073211
end@@ -3232,8 +3236,9 @@
32323236
init_idx = mi32333237
all_params = @cls_meth_params[i].split("|")32343238
all_ptypes = @cls_meth_ptypes[i].split("|")3235-
pnames = []3236-
ptypes = []3239+
pnames = "".split(",")3240+
ptypes = "".split(",")3241+
32373242
if init_idx < all_params.length32383243
pnames = all_params[init_idx].split(",")32393244
end@@ -3307,8 +3312,9 @@
33073312
j = 033083313
while j < mnames.length33093314
if mnames[j] != "initialize"3310-
pnames = []3311-
ptypes = []3315+
pnames = "".split(",")3316+
ptypes = "".split(",")3317+
33123318
if j < all_params.length33133319
pnames = all_params[j].split(",")33143320
end@@ -3455,8 +3461,9 @@
34553461
j = j + 134563462
end34573463
if @meth_body_ids[i] >= 03458-
ml = []3459-
mt = []3464+
ml = "".split(",")3465+
mt = "".split(",")3466+
34603467
scan_locals(@meth_body_ids[i], ml, mt, pnames)34613468
lk = 034623469
while lk < ml.length@@ -3615,8 +3622,9 @@
36153622
j = 036163623
while j < mnames.length36173624
push_scope3618-
pnames = []3619-
ptypes = []3625+
pnames = "".split(",")3626+
ptypes = "".split(",")3627+
36203628
if j < all_params.length36213629
pnames = all_params[j].split(",")36223630
end@@ -3657,6 +3665,28 @@
36573665
if j < bodies.length36583666
bid = bodies[j].to_i36593667
end3668+
# Declare locals for better return type inference3669+
if bid >= 03670+
rlnames = "".split(",")3671+
rltypes = "".split(",")3672+
scan_locals_first_type(bid, rlnames, rltypes, pnames)3673+
rlk = 03674+
while rlk < rlnames.length3675+
declare_var(rlnames[rlk], rltypes[rlk])3676+
rlk = rlk + 13677+
end3678+
# Second pass with locals in scope3679+
rlnames2 = "".split(",")3680+
rltypes2 = "".split(",")3681+
scan_locals_first_type(bid, rlnames2, rltypes2, pnames)3682+
rlk2 = 03683+
while rlk2 < rlnames2.length3684+
if rltypes2[rlk2] != "int"3685+
set_var_type(rlnames2[rlk2], rltypes2[rlk2])3686+
end3687+
rlk2 = rlk2 + 13688+
end3689+
end36603690
rt = "int"36613691
if mnames[j] == "initialize"36623692
rt = "void"@@ -4456,10 +4486,268 @@
44564486
end44574487
end44584488
4489+
def scan_locals_first_type(nid, names, types, params)4490+
# Like scan_locals but never marks poly - just keeps first type seen4491+
if nid < 04492+
return4493+
end4494+
if @nd_type[nid] == "LocalVariableWriteNode"4495+
lname = @nd_name[nid]4496+
if not_in(lname, names) == 14497+
if not_in(lname, params) == 14498+
names.push(lname)4499+
types.push(infer_type(@nd_expression[nid]))4500+
end4501+
end4502+
end4503+
if @nd_type[nid] == "LocalVariableOperatorWriteNode"4504+
lname = @nd_name[nid]4505+
if not_in(lname, names) == 14506+
if not_in(lname, params) == 14507+
names.push(lname)4508+
types.push("int")4509+
end4510+
end4511+
end4512+
if @nd_type[nid] == "MultiWriteNode"4513+
targets = parse_id_list(@nd_targets[nid])4514+
k = 04515+
while k < targets.length4516+
tid = targets[k]4517+
if @nd_type[tid] == "LocalVariableTargetNode"4518+
lname = @nd_name[tid]4519+
if not_in(lname, names) == 14520+
if not_in(lname, params) == 14521+
names.push(lname)4522+
types.push("int")4523+
end4524+
end4525+
end4526+
k = k + 14527+
end4528+
end4529+
# Recurse4530+
if @nd_body[nid] >= 04531+
scan_locals_first_type(@nd_body[nid], names, types, params)4532+
end4533+
stmts = parse_id_list(@nd_stmts[nid])4534+
k = 04535+
while k < stmts.length4536+
scan_locals_first_type(stmts[k], names, types, params)4537+
k = k + 14538+
end4539+
if @nd_expression[nid] >= 04540+
scan_locals_first_type(@nd_expression[nid], names, types, params)4541+
end4542+
if @nd_predicate[nid] >= 04543+
scan_locals_first_type(@nd_predicate[nid], names, types, params)4544+
end4545+
if @nd_subsequent[nid] >= 04546+
scan_locals_first_type(@nd_subsequent[nid], names, types, params)4547+
end4548+
if @nd_else_clause[nid] >= 04549+
scan_locals_first_type(@nd_else_clause[nid], names, types, params)4550+
end4551+
if @nd_receiver[nid] >= 04552+
scan_locals_first_type(@nd_receiver[nid], names, types, params)4553+
end4554+
if @nd_arguments[nid] >= 04555+
scan_locals_first_type(@nd_arguments[nid], names, types, params)4556+
end4557+
args = parse_id_list(@nd_args[nid])4558+
k = 04559+
while k < args.length4560+
scan_locals_first_type(args[k], names, types, params)4561+
k = k + 14562+
end4563+
conds = parse_id_list(@nd_conditions[nid])4564+
k = 04565+
while k < conds.length4566+
scan_locals_first_type(conds[k], names, types, params)4567+
k = k + 14568+
end4569+
if @nd_left[nid] >= 04570+
scan_locals_first_type(@nd_left[nid], names, types, params)4571+
end4572+
if @nd_right[nid] >= 04573+
scan_locals_first_type(@nd_right[nid], names, types, params)4574+
end4575+
if @nd_block[nid] >= 04576+
scan_locals_first_type(@nd_block[nid], names, types, params)4577+
end4578+
end4579+
4580+
def infer_class_body_call_types4581+
# Scan class method bodies for calls to other methods in the same class.4582+
# Update called method param types from argument types at call sites.4583+
# Run multiple passes for propagation.4584+
pass = 04585+
while pass < 34586+
ci = 04587+
while ci < @cls_names.length4588+
mnames = @cls_meth_names[ci].split(";")4589+
all_params = @cls_meth_params[ci].split("|")4590+
all_ptypes = @cls_meth_ptypes[ci].split("|")4591+
bodies = @cls_meth_bodies[ci].split(";")4592+
mi = 04593+
while mi < mnames.length4594+
bid = -14595+
if mi < bodies.length4596+
bid = bodies[mi].to_i4597+
end4598+
if bid >= 04599+
@current_class_idx = ci4600+
push_scope4601+
# Declare params in scope with current types4602+
pnames_arr = "".split(",")4603+
if mi < all_params.length4604+
pnames_arr = all_params[mi].split(",")4605+
end4606+
ptypes_arr = "".split(",")4607+
if mi < all_ptypes.length4608+
ptypes_arr = all_ptypes[mi].split(",")4609+
end4610+
pk = 04611+
while pk < pnames_arr.length4612+
pt = "int"4613+
if pk < ptypes_arr.length4614+
pt = ptypes_arr[pk]4615+
end4616+
if pnames_arr[pk] != ""4617+
declare_var(pnames_arr[pk], pt)4618+
end4619+
pk = pk + 14620+
end4621+
# Scan locals using first-type-only (no poly marking)4622+
lnames = "".split(",")4623+
ltypes = "".split(",")4624+
scan_locals_first_type(bid, lnames, ltypes, pnames_arr)4625+
lk = 04626+
while lk < lnames.length4627+
declare_var(lnames[lk], ltypes[lk])4628+
lk = lk + 14629+
end4630+
# Second pass: rescan with locals now in scope for better inference4631+
lnames2 = "".split(",")4632+
ltypes2 = "".split(",")4633+
scan_locals_first_type(bid, lnames2, ltypes2, pnames_arr)4634+
lk2 = 04635+
while lk2 < lnames2.length4636+
if ltypes2[lk2] != "int"4637+
set_var_type(lnames2[lk2], ltypes2[lk2])4638+
end4639+
lk2 = lk2 + 14640+
end4641+
# Scan for calls to other methods in same class4642+
scan_cls_method_calls(ci, bid)4643+
pop_scope4644+
@current_class_idx = -14645+
end4646+
mi = mi + 14647+
end4648+
ci = ci + 14649+
end4650+
pass = pass + 14651+
end4652+
end4653+
4654+
def scan_cls_method_calls(ci, nid)4655+
if nid < 04656+
return4657+
end4658+
if @nd_type[nid] == "CallNode"4659+
mname = @nd_name[nid]4660+
# Handle implicit self calls (no receiver) to same-class methods4661+
if @nd_receiver[nid] < 04662+
midx = cls_find_method_direct(ci, mname)4663+
if midx >= 04664+
args_id = @nd_arguments[nid]4665+
if args_id >= 04666+
arg_ids = get_args(args_id)4667+
all_ptypes = @cls_meth_ptypes[ci].split("|")4668+
if midx < all_ptypes.length4669+
ptypes = all_ptypes[midx].split(",")4670+
kk = 04671+
while kk < arg_ids.length4672+
at = infer_type(arg_ids[kk])4673+
if kk < ptypes.length4674+
if ptypes[kk] == "int"4675+
if at != "int"4676+
ptypes[kk] = at4677+
end4678+
end4679+
end4680+
kk = kk + 14681+
end4682+
all_ptypes[midx] = join_sep(ptypes, ",")4683+
@cls_meth_ptypes[ci] = join_sep(all_ptypes, "|")4684+
end4685+
end4686+
end4687+
end4688+
end4689+
# Recurse into children4690+
if @nd_body[nid] >= 04691+
scan_cls_method_calls(ci, @nd_body[nid])4692+
end4693+
stmts = parse_id_list(@nd_stmts[nid])4694+
k = 04695+
while k < stmts.length4696+
scan_cls_method_calls(ci, stmts[k])4697+
k = k + 14698+
end4699+
if @nd_receiver[nid] >= 04700+
scan_cls_method_calls(ci, @nd_receiver[nid])4701+
end4702+
if @nd_arguments[nid] >= 04703+
scan_cls_method_calls(ci, @nd_arguments[nid])4704+
end4705+
args = parse_id_list(@nd_args[nid])4706+
k = 04707+
while k < args.length4708+
scan_cls_method_calls(ci, args[k])4709+
k = k + 14710+
end4711+
if @nd_expression[nid] >= 04712+
scan_cls_method_calls(ci, @nd_expression[nid])4713+
end4714+
if @nd_predicate[nid] >= 04715+
scan_cls_method_calls(ci, @nd_predicate[nid])4716+
end4717+
if @nd_subsequent[nid] >= 04718+
scan_cls_method_calls(ci, @nd_subsequent[nid])4719+
end4720+
if @nd_else_clause[nid] >= 04721+
scan_cls_method_calls(ci, @nd_else_clause[nid])4722+
end4723+
if @nd_left[nid] >= 04724+
scan_cls_method_calls(ci, @nd_left[nid])4725+
end4726+
if @nd_right[nid] >= 04727+
scan_cls_method_calls(ci, @nd_right[nid])4728+
end4729+
if @nd_block[nid] >= 04730+
scan_cls_method_calls(ci, @nd_block[nid])4731+
end4732+
elems = parse_id_list(@nd_elements[nid])4733+
k = 04734+
while k < elems.length4735+
scan_cls_method_calls(ci, elems[k])4736+
k = k + 14737+
end4738+
conds = parse_id_list(@nd_conditions[nid])4739+
k = 04740+
while k < conds.length4741+
scan_cls_method_calls(ci, conds[k])4742+
k = k + 14743+
end4744+
end4745+
44594746
def compile44604747
collect_all44614748
infer_main_call_types44624749
infer_function_body_call_types4750+
infer_class_body_call_types44634751
detect_poly_params44644752
detect_poly_locals44654753
# Re-infer return types after main call type fixes@@ -4589,8 +4877,8 @@
45894877
45904878
def emit_gc_runtime45914879
emit_raw("typedef struct sp_gc_hdr { struct sp_gc_hdr *next; void (*finalize)(void *); void (*scan)(void *); unsigned marked : 1; } sp_gc_hdr;")4592-
emit_raw("static sp_gc_hdr *sp_gc_heap = NULL; static size_t sp_gc_bytes = 0; static size_t sp_gc_threshold = 256*1024;")4593-
emit_raw("#define SP_GC_STACK_MAX 8192")4880+
emit_raw("static sp_gc_hdr *sp_gc_heap = NULL; static size_t sp_gc_bytes = 0; static size_t sp_gc_threshold = 4*1024*1024;")4881+
emit_raw("#define SP_GC_STACK_MAX 65536")45944882
emit_raw("static void **sp_gc_roots[SP_GC_STACK_MAX]; static int sp_gc_nroots = 0;")45954883
emit_raw("#define SP_GC_SAVE() int _gc_saved = sp_gc_nroots")45964884
emit_raw("#define SP_GC_ROOT(v) do{if(sp_gc_nroots<SP_GC_STACK_MAX)sp_gc_roots[sp_gc_nroots++]=(void**)&(v);}while(0)")@@ -4680,7 +4968,7 @@
46804968
emit_raw("static mrb_bool sp_str_include(const char*s,const char*sub){return strstr(s,sub)!=NULL;}")46814969
emit_raw("static mrb_bool sp_str_start_with(const char*s,const char*p){return strncmp(s,p,strlen(p))==0;}")46824970
emit_raw("static mrb_bool sp_str_end_with(const char*s,const char*suf){size_t ls=strlen(s),lsuf=strlen(suf);if(lsuf>ls)return FALSE;return strcmp(s+ls-lsuf,suf)==0;}")4683-
emit_raw("static sp_StrArray*sp_str_split(const char*s,const char*sep){sp_StrArray*a=sp_StrArray_new();size_t sl=strlen(sep);if(sl==0){for(size_t i=0;s[i];i++){char*c=(char*)malloc(2);c[0]=s[i];c[1]=0;sp_StrArray_push(a,c);}return a;}const char*p=s;while(1){const char*f=strstr(p,sep);if(!f){char*r=(char*)malloc(strlen(p)+1);strcpy(r,p);sp_StrArray_push(a,r);break;}size_t n=f-p;char*r=(char*)malloc(n+1);memcpy(r,p,n);r[n]=0;sp_StrArray_push(a,r);p=f+sl;}return a;}")4971+
emit_raw("static sp_StrArray*sp_str_split(const char*s,const char*sep){sp_StrArray*a=sp_StrArray_new();if(*s==0)return a;size_t sl=strlen(sep);if(sl==0){for(size_t i=0;s[i];i++){char*c=(char*)malloc(2);c[0]=s[i];c[1]=0;sp_StrArray_push(a,c);}return a;}const char*p=s;while(1){const char*f=strstr(p,sep);if(!f){char*r=(char*)malloc(strlen(p)+1);strcpy(r,p);sp_StrArray_push(a,r);break;}size_t n=f-p;char*r=(char*)malloc(n+1);memcpy(r,p,n);r[n]=0;sp_StrArray_push(a,r);p=f+sl;}return a;}")46844972
emit_raw("static const char*sp_str_gsub(const char*s,const char*pat,const char*rep){size_t pl=strlen(pat),rl=strlen(rep),sl=strlen(s);if(pl==0)return s;size_t cap=sl*2+1;char*out=(char*)malloc(cap);size_t ol=0;const char*p=s;while(*p){const char*f=strstr(p,pat);if(!f){size_t n=strlen(p);if(ol+n>=cap){cap=(ol+n)*2+1;out=(char*)realloc(out,cap);}memcpy(out+ol,p,n);ol+=n;break;}size_t n=f-p;if(ol+n+rl>=cap){cap=(ol+n+rl)*2+1;out=(char*)realloc(out,cap);}memcpy(out+ol,p,n);ol+=n;memcpy(out+ol,rep,rl);ol+=rl;p=f+pl;}out[ol]=0;return out;}")46854973
emit_raw("static mrb_int sp_str_index(const char*s,const char*sub){const char*f=strstr(s,sub);if(!f)return -1;return(mrb_int)(f-s);}")46864974
emit_raw("static const char*sp_str_sub_range(const char*s,mrb_int start,mrb_int len){mrb_int sl=(mrb_int)strlen(s);if(start<0)start+=sl;if(start<0)start=0;if(start>=sl)return\"\";if(len<0)len=0;if(start+len>sl)len=sl-start;char*r=(char*)malloc(len+1);memcpy(r,s+start,len);r[len]=0;return r;}")@@ -5099,8 +5387,9 @@
50995387
init_idx = cls_find_method_direct(init_ci, "initialize")51005388
all_params = @cls_meth_params[init_ci].split("|")51015389
all_ptypes = @cls_meth_ptypes[init_ci].split("|")5102-
pnames = []5103-
ptypes = []5390+
pnames = "".split(",")5391+
ptypes = "".split(",")5392+
51045393
if init_idx < all_params.length51055394
pnames = all_params[init_idx].split(",")51065395
end@@ -5137,8 +5426,9 @@
51375426
end51385427
all_params = @cls_meth_params[init_ci].split("|")51395428
all_ptypes = @cls_meth_ptypes[init_ci].split("|")5140-
pnames = []5141-
ptypes = []5429+
pnames = "".split(",")5430+
ptypes = "".split(",")5431+
51425432
if init_idx < all_params.length51435433
pnames = all_params[init_idx].split(",")51445434
end@@ -5159,8 +5449,9 @@
51595449
end51605450
51615451
def method_with_self_params(midx, all_params, all_ptypes)5162-
pnames = []5163-
ptypes = []5452+
pnames = "".split(",")5453+
ptypes = "".split(",")5454+
51645455
if midx < all_params.length51655456
pnames = all_params[midx].split(",")51665457
end@@ -5181,8 +5472,9 @@
51815472
end51825473
51835474
def cls_method_params_decl(midx, all_params, all_ptypes)5184-
pnames = []5185-
ptypes = []5475+
pnames = "".split(",")5476+
ptypes = "".split(",")5477+
51865478
if midx < all_params.length51875479
pnames = all_params[midx].split(",")51885480
end@@ -5229,8 +5521,8 @@
52295521
if j < bodies.length52305522
bid = bodies[j].to_i52315523
end5232-
pnames = []5233-
ptypes = []5524+
pnames = "".split(",")5525+
ptypes = "".split(",")52345526
if j < all_params.length52355527
pnames = all_params[j].split(",")52365528
end@@ -5257,8 +5549,9 @@
52575549
if j < cm_bodies.length52585550
bid = cm_bodies[j].to_i52595551
end5260-
pnames = []5261-
ptypes = []5552+
pnames = "".split(",")5553+
ptypes = "".split(",")5554+
52625555
if j < cm_params.length52635556
pnames = cm_params[j].split(",")52645557
end@@ -5295,7 +5588,7 @@
52955588
if bid == -252965589
# Synthetic struct constructor52975590
all_params = @cls_meth_params[ci].split("|")5298-
pnames2 = []5591+
pnames2 = "".split(",")52995592
if init_idx < all_params.length53005593
pnames2 = all_params[init_idx].split(",")53015594
end@@ -5309,8 +5602,9 @@
53095602
@current_class_idx = ci53105603
all_params = @cls_meth_params[ci].split("|")53115604
all_ptypes = @cls_meth_ptypes[ci].split("|")5312-
pnames = []5313-
ptypes = []5605+
pnames = "".split(",")5606+
ptypes = "".split(",")5607+
53145608
if init_idx < all_params.length53155609
pnames = all_params[init_idx].split(",")53165610
end@@ -5370,7 +5664,7 @@
53705664
# Build param forwarding: forward all constructor params to parent init53715665
pi_params = @cls_meth_params[init_ci].split("|")53725666
pi_idx = cls_find_method_direct(init_ci, "initialize")5373-
pnames = []5667+
pnames = "".split(",")53745668
if pi_idx >= 053755669
if pi_idx < pi_params.length53765670
pnames = pi_params[pi_idx].split(",")@@ -5407,8 +5701,9 @@
54075701
@current_class_idx = ci54085702
all_params = @cls_meth_params[ci].split("|")54095703
all_ptypes = @cls_meth_ptypes[ci].split("|")5410-
pnames = []5411-
ptypes = []5704+
pnames = "".split(",")5705+
ptypes = "".split(",")5706+
54125707
if init_idx < all_params.length54135708
pnames = all_params[init_idx].split(",")54145709
end@@ -5644,8 +5939,9 @@
56445939
end56455940
56465941
def declare_method_locals(bid, params)5647-
lnames = []5648-
ltypes = []5942+
lnames = "".split(",")5943+
ltypes = "".split(",")5944+
56495945
scan_locals(bid, lnames, ltypes, params)56505946
# Declare all locals first so block param inference can see them56515947
j = 0@@ -5654,8 +5950,9 @@
56545950
j = j + 156555951
end56565952
# Second pass: re-scan with types now in scope for better block param inference5657-
lnames2 = []5658-
ltypes2 = []5953+
lnames2 = "".split(",")5954+
ltypes2 = "".split(",")5955+
56595956
scan_locals(bid, lnames2, ltypes2, params)56605957
# Update types that may have improved56615958
j = 0@@ -5674,12 +5971,36 @@
56745971
end56755972
j = j + 156765973
end5677-
# Emit declarations5974+
# Emit declarations and GC rooting for pointer locals5975+
has_gc_locals = 05976+
j = 05977+
while j < lnames.length5978+
if type_is_pointer(ltypes[j]) == 15979+
has_gc_locals = 15980+
end5981+
j = j + 15982+
end5983+
if has_gc_locals == 15984+
if @needs_gc == 15985+
emit(" SP_GC_SAVE();")5986+
end5987+
end56785988
j = 056795989
while j < lnames.length56805990
emit(" " + c_type(ltypes[j]) + " lv_" + lnames[j] + " = " + c_default_val(ltypes[j]) + ";")56815991
j = j + 156825992
end5993+
if has_gc_locals == 15994+
if @needs_gc == 15995+
j = 05996+
while j < lnames.length5997+
if type_is_pointer(ltypes[j]) == 15998+
emit(" SP_GC_ROOT(lv_" + lnames[j] + ");")5999+
end6000+
j = j + 16001+
end6002+
end6003+
end56836004
end56846005
56856006
def scan_locals(nid, names, types, params)@@ -5723,8 +6044,15 @@
57236044
if names[ki] == lname57246045
if types[ki] != at57256046
if types[ki] != "poly"5726-
types[ki] = "poly"5727-
@needs_rb_value = 16047+
# Don't mark poly if new type is fallback "int" and existing is richer6048+
if at != "int"6049+
if types[ki] == "int"6050+
types[ki] = at6051+
else6052+
types[ki] = "poly"6053+
@needs_rb_value = 16054+
end6055+
end57286056
end57296057
end57306058
end@@ -5984,9 +6312,10 @@
59846312
push_scope59856313
59866314
# Pre-declare main locals5987-
lnames = []5988-
ltypes = []5989-
empty_params = []6315+
lnames = "".split(",")6316+
ltypes = "".split(",")6317+
6318+
empty_params = "".split(",")59906319
i = 059916320
while i < stmts.length59926321
sid = stmts[i]@@ -6007,8 +6336,9 @@
60076336
j = j + 160086337
end60096338
# Second pass with vars in scope6010-
lnames2 = []6011-
ltypes2 = []6339+
lnames2 = "".split(",")6340+
ltypes2 = "".split(",")6341+
60126342
i = 060136343
while i < stmts.length60146344
sid = stmts[i]@@ -6437,7 +6767,7 @@
64376767
return "\"\""64386768
end64396769
fmt = ""6440-
arg_exprs = []6770+
arg_exprs = "".split(",")64416771
i = 064426772
while i < parts.length64436773
pid = parts[i]@@ -8244,7 +8574,7 @@
82448574
return compile_call_args(nid)82458575
end82468576
all_params = @cls_meth_params[init_ci].split("|")8247-
pnames = []8577+
pnames = "".split(",")82488578
if init_idx < all_params.length82498579
pnames = all_params[init_idx].split(",")82508580
end