This commit is contained in:
2026-02-19 01:23:41 -06:00
parent 3f206d80dd
commit 85ef711229
12 changed files with 63609 additions and 58305 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1321,21 +1321,21 @@
["jump_false", 4, "rel_ni_114", 67, 17],
"_nop_tc_1",
"_nop_tc_2",
["lt_int", 5, 2, 3, 67, 17],
["lt_int", 4, 2, 3, 67, 17],
["jump", "rel_done_116", 67, 17],
"rel_ni_114",
["is_num", 4, 2, 67, 17],
["jump_false", 4, "rel_nn_115", 67, 17],
"_nop_tc_3",
"_nop_tc_4",
["lt_float", 5, 2, 3, 67, 17],
"_nop_tc_5",
"_nop_tc_6",
["lt_float", 4, 2, 3, 67, 17],
["jump", "rel_done_116", 67, 17],
"rel_nn_115",
["is_text", 4, 2, 67, 17],
["jump_false", 4, "rel_err_117", 67, 17],
"_nop_tc_5",
"_nop_tc_7",
["jump", "rel_err_117", 67, 17],
["lt_text", 5, 2, 3, 67, 17],
"_nop_tc_8",
["jump", "rel_err_117", 67, 17],
["lt_text", 4, 2, 3, 67, 17],
["jump", "rel_done_116", 67, 17],
"rel_err_117",
[
@@ -1349,19 +1349,19 @@
67,
17
],
["access", 4, "error", 67, 17],
["access", 5, "error", 67, 17],
["access", 6, "cannot compare with '<': operands must be same type", 67, 17],
["array", 7, 0, 67, 17],
["push", 7, 6, 67, 17],
["frame", 6, 3, 2, 67, 17],
["null", 3, 67, 17],
["setarg", 6, 0, 3, 67, 17],
["setarg", 6, 1, 4, 67, 17],
["setarg", 6, 1, 5, 67, 17],
["setarg", 6, 2, 7, 67, 17],
["invoke", 6, 3, 67, 17],
["disrupt", 67, 17],
"rel_done_116",
["move", 3, 5, 67, 17],
["move", 3, 4, 67, 17],
["jump_false", 3, "and_end_113", 67, 17],
["get", 4, 3, 1, 67, 22],
["get", 5, 4, 1, 67, 28],
@@ -1430,8 +1430,8 @@
["access", 3, 16, 68, 25],
["is_num", 4, 1, 68, 25],
["jump_false", 4, "num_err_122", 68, 25],
"_nop_tc_6",
"_nop_tc_7",
"_nop_tc_9",
"_nop_tc_10",
["multiply", 4, 1, 3, 68, 25],
["jump", "num_done_123", 68, 25],
"num_err_122",
@@ -1469,15 +1469,15 @@
["setarg", 6, 0, 5, 68, 30],
["setarg", 6, 1, 3, 68, 30],
["invoke", 6, 3, 68, 30],
"_nop_tc_8",
"_nop_tc_11",
["jump", "add_cn_125", 68, 30],
["is_text", 5, 3, 68, 30],
["jump_false", 5, "add_cn_125", 68, 30],
["concat", 6, 4, 3, 68, 30],
["jump", "add_done_124", 68, 30],
"add_cn_125",
"_nop_tc_9",
"_nop_tc_10",
"_nop_tc_12",
"_nop_tc_13",
["is_num", 5, 3, 68, 30],
["jump_false", 5, "add_err_126", 68, 30],
["add", 6, 4, 3, 68, 30],
@@ -1508,10 +1508,10 @@
"add_done_124",
["move", 1, 6, 68, 30],
["access", 3, 1, 69, 17],
["is_num", 4, 2, 69, 17],
["jump_false", 4, "num_err_127", 69, 17],
"_nop_tc_11",
"_nop_tc_12",
"_nop_tc_14",
"_nop_tc_15",
"_nop_tc_16",
"_nop_tc_17",
["add", 4, 2, 3, 69, 17],
["jump", "num_done_128", 69, 17],
"num_err_127",
@@ -2369,8 +2369,8 @@
["setarg", 12, 2, 2, 106, 42],
["setarg", 12, 3, 10, 106, 42],
["invoke", 12, 9, 106, 42],
["is_array", 10, 6, 106, 42],
["jump_false", 10, "push_err_220", 106, 42],
"_nop_tc_7",
"_nop_tc_8",
["push", 6, 9, 106, 42],
["jump", "push_done_221", 106, 42],
"push_err_220",
@@ -2424,35 +2424,35 @@
"ne_ni_226",
["is_int", 11, 8, 110, 24],
["jump_false", 11, "ne_nn_227", 110, 24],
"_nop_tc_7",
"_nop_tc_9",
["jump", "ne_nn_227", 110, 24],
["ne_int", 10, 8, 9, 110, 24],
["jump", "ne_done_224", 110, 24],
"ne_nn_227",
["is_num", 11, 8, 110, 24],
["jump_false", 11, "ne_nt_228", 110, 24],
"_nop_tc_8",
"_nop_tc_10",
["jump", "ne_nt_228", 110, 24],
["ne_float", 10, 8, 9, 110, 24],
["jump", "ne_done_224", 110, 24],
"ne_nt_228",
["is_text", 11, 8, 110, 24],
["jump_false", 11, "ne_nnl_229", 110, 24],
"_nop_tc_9",
"_nop_tc_11",
["jump", "ne_nnl_229", 110, 24],
["ne_text", 10, 8, 9, 110, 24],
["jump", "ne_done_224", 110, 24],
"ne_nnl_229",
["is_null", 11, 8, 110, 24],
["jump_false", 11, "ne_nb_230", 110, 24],
"_nop_tc_10",
"_nop_tc_11",
"_nop_tc_12",
"_nop_tc_13",
["false", 10, 110, 24],
["jump", "ne_done_224", 110, 24],
"ne_nb_230",
["is_bool", 11, 8, 110, 24],
["jump_false", 11, "ne_mis_231", 110, 24],
"_nop_tc_12",
"_nop_tc_14",
["jump", "ne_mis_231", 110, 24],
["ne_bool", 10, 8, 9, 110, 24],
["jump", "ne_done_224", 110, 24],
@@ -2460,8 +2460,8 @@
["true", 10, 110, 24],
"ne_done_224",
["jump_false", 10, "if_else_222", 110, 24],
["is_array", 9, 6, 110, 44],
["jump_false", 9, "push_err_232", 110, 44],
"_nop_tc_15",
"_nop_tc_16",
["push", 6, 8, 110, 44],
["jump", "push_done_233", 110, 44],
"push_err_232",
@@ -2495,35 +2495,35 @@
["jump_true", 10, "eq_done_236", 111, 25],
["is_int", 11, 7, 111, 25],
["jump_false", 11, "eq_ni_237", 111, 25],
"_nop_tc_13",
"_nop_tc_17",
["jump", "eq_ni_237", 111, 25],
["eq_int", 10, 7, 9, 111, 25],
["jump", "eq_done_236", 111, 25],
"eq_ni_237",
["is_num", 11, 7, 111, 25],
["jump_false", 11, "eq_nn_238", 111, 25],
"_nop_tc_14",
"_nop_tc_18",
["jump", "eq_nn_238", 111, 25],
["eq_float", 10, 7, 9, 111, 25],
["jump", "eq_done_236", 111, 25],
"eq_nn_238",
["is_text", 11, 7, 111, 25],
["jump_false", 11, "eq_nt_239", 111, 25],
"_nop_tc_15",
"_nop_tc_16",
"_nop_tc_19",
"_nop_tc_20",
["eq_text", 10, 7, 9, 111, 25],
["jump", "eq_done_236", 111, 25],
"eq_nt_239",
["is_null", 11, 7, 111, 25],
["jump_false", 11, "eq_nnl_240", 111, 25],
"_nop_tc_17",
"_nop_tc_21",
["jump", "eq_nnl_240", 111, 25],
["true", 10, 111, 25],
["jump", "eq_done_236", 111, 25],
"eq_nnl_240",
["is_bool", 11, 7, 111, 25],
["jump_false", 11, "eq_nb_241", 111, 25],
"_nop_tc_18",
"_nop_tc_22",
["jump", "eq_nb_241", 111, 25],
["eq_bool", 10, 7, 9, 111, 25],
["jump", "eq_done_236", 111, 25],
@@ -2536,8 +2536,8 @@
["null", 9, 111, 44],
["setarg", 10, 0, 9, 111, 44],
["invoke", 10, 9, 111, 44],
["is_array", 10, 6, 111, 44],
["jump_false", 10, "push_err_242", 111, 44],
"_nop_tc_23",
"_nop_tc_24",
["push", 6, 9, 111, 44],
["jump", "push_done_243", 111, 44],
"push_err_242",
@@ -2566,8 +2566,8 @@
"push_done_243",
["jump", "if_end_235", 111, 44],
"if_else_234",
["is_array", 9, 6, 112, 28],
["jump_false", 9, "push_err_244", 112, 28],
"_nop_tc_25",
"_nop_tc_26",
["push", 6, 7, 112, 28],
["jump", "push_done_245", 112, 28],
"push_err_244",
@@ -2674,8 +2674,8 @@
["setarg", 10, 2, 2, 118, 38],
["setarg", 10, 3, 8, 118, 38],
["invoke", 10, 2, 118, 38],
["is_array", 7, 6, 118, 38],
["jump_false", 7, "push_err_252", 118, 38],
"_nop_tc_27",
"_nop_tc_28",
["push", 6, 2, 118, 38],
["jump", "push_done_253", 118, 38],
"push_err_252",
@@ -3143,8 +3143,8 @@
["setarg", 13, 2, 1, 142, 42],
["setarg", 13, 3, 11, 142, 42],
["invoke", 13, 10, 142, 42],
["is_array", 11, 5, 142, 42],
["jump_false", 11, "push_err_298", 142, 42],
"_nop_tc_18",
"_nop_tc_19",
["push", 5, 10, 142, 42],
["jump", "push_done_299", 142, 42],
"push_err_298",
@@ -3180,8 +3180,8 @@
["access", 13, 2, 143, 42],
["is_num", 14, 12, 143, 42],
["jump_false", 14, "num_err_300", 143, 42],
"_nop_tc_18",
"_nop_tc_19",
"_nop_tc_20",
"_nop_tc_21",
["add", 14, 12, 13, 143, 42],
["jump", "num_done_301", 143, 42],
"num_err_300",
@@ -3226,8 +3226,8 @@
["setarg", 13, 2, 11, 143, 21],
["setarg", 13, 3, 14, 143, 21],
["invoke", 13, 10, 143, 21],
["is_array", 11, 5, 143, 21],
["jump_false", 11, "push_err_302", 143, 21],
"_nop_tc_22",
"_nop_tc_23",
["push", 5, 10, 143, 21],
["jump", "push_done_303", 143, 21],
"push_err_302",
@@ -3278,35 +3278,35 @@
["jump_true", 12, "eq_done_308", 146, 26],
["is_int", 13, 10, 146, 26],
["jump_false", 13, "eq_ni_309", 146, 26],
"_nop_tc_20",
"_nop_tc_24",
["jump", "eq_ni_309", 146, 26],
["eq_int", 12, 10, 11, 146, 26],
["jump", "eq_done_308", 146, 26],
"eq_ni_309",
["is_num", 13, 10, 146, 26],
["jump_false", 13, "eq_nn_310", 146, 26],
"_nop_tc_21",
"_nop_tc_25",
["jump", "eq_nn_310", 146, 26],
["eq_float", 12, 10, 11, 146, 26],
["jump", "eq_done_308", 146, 26],
"eq_nn_310",
["is_text", 13, 10, 146, 26],
["jump_false", 13, "eq_nt_311", 146, 26],
"_nop_tc_22",
"_nop_tc_23",
"_nop_tc_26",
"_nop_tc_27",
["eq_text", 12, 10, 11, 146, 26],
["jump", "eq_done_308", 146, 26],
"eq_nt_311",
["is_null", 13, 10, 146, 26],
["jump_false", 13, "eq_nnl_312", 146, 26],
"_nop_tc_24",
"_nop_tc_28",
["jump", "eq_nnl_312", 146, 26],
["true", 12, 146, 26],
["jump", "eq_done_308", 146, 26],
"eq_nnl_312",
["is_bool", 13, 10, 146, 26],
["jump_false", 13, "eq_nb_313", 146, 26],
"_nop_tc_25",
"_nop_tc_29",
["jump", "eq_nb_313", 146, 26],
["eq_bool", 12, 10, 11, 146, 26],
["jump", "eq_done_308", 146, 26],
@@ -3319,8 +3319,8 @@
["access", 12, 1, 146, 39],
["is_num", 13, 11, 146, 39],
["jump_false", 13, "num_err_314", 146, 39],
"_nop_tc_26",
"_nop_tc_27",
"_nop_tc_30",
"_nop_tc_31",
["add", 13, 11, 12, 146, 39],
["jump", "num_done_315", 146, 39],
"num_err_314",
@@ -3355,14 +3355,14 @@
["lt_int", 14, 13, 11, 146, 43],
["jump", "rel_done_318", 146, 43],
"rel_ni_316",
"_nop_tc_28",
"_nop_tc_29",
"_nop_tc_32",
"_nop_tc_33",
["is_num", 12, 11, 146, 43],
["jump_false", 12, "rel_nn_317", 146, 43],
["lt_float", 14, 13, 11, 146, 43],
["jump", "rel_done_318", 146, 43],
"rel_nn_317",
"_nop_tc_30",
"_nop_tc_34",
["jump", "rel_err_319", 146, 43],
["is_text", 12, 11, 146, 43],
["jump_false", 12, "rel_err_319", 146, 43],
@@ -3408,35 +3408,35 @@
["jump_true", 13, "eq_done_320", 146, 62],
["is_int", 14, 10, 146, 62],
["jump_false", 14, "eq_ni_321", 146, 62],
"_nop_tc_31",
"_nop_tc_35",
["jump", "eq_ni_321", 146, 62],
["eq_int", 13, 10, 12, 146, 62],
["jump", "eq_done_320", 146, 62],
"eq_ni_321",
["is_num", 14, 10, 146, 62],
["jump_false", 14, "eq_nn_322", 146, 62],
"_nop_tc_32",
"_nop_tc_36",
["jump", "eq_nn_322", 146, 62],
["eq_float", 13, 10, 12, 146, 62],
["jump", "eq_done_320", 146, 62],
"eq_nn_322",
["is_text", 14, 10, 146, 62],
["jump_false", 14, "eq_nt_323", 146, 62],
"_nop_tc_33",
"_nop_tc_34",
"_nop_tc_37",
"_nop_tc_38",
["eq_text", 13, 10, 12, 146, 62],
["jump", "eq_done_320", 146, 62],
"eq_nt_323",
["is_null", 14, 10, 146, 62],
["jump_false", 14, "eq_nnl_324", 146, 62],
"_nop_tc_35",
"_nop_tc_39",
["jump", "eq_nnl_324", 146, 62],
["true", 13, 146, 62],
["jump", "eq_done_320", 146, 62],
"eq_nnl_324",
["is_bool", 14, 10, 146, 62],
["jump_false", 14, "eq_nb_325", 146, 62],
"_nop_tc_36",
"_nop_tc_40",
["jump", "eq_nb_325", 146, 62],
["eq_bool", 13, 10, 12, 146, 62],
["jump", "eq_done_320", 146, 62],
@@ -3512,8 +3512,8 @@
["setarg", 13, 2, 1, 147, 42],
["setarg", 13, 3, 11, 147, 42],
["invoke", 13, 10, 147, 42],
["is_array", 11, 5, 147, 42],
["jump_false", 11, "push_err_332", 147, 42],
"_nop_tc_41",
"_nop_tc_42",
["push", 5, 10, 147, 42],
["jump", "push_done_333", 147, 42],
"push_err_332",
@@ -3608,23 +3608,23 @@
["access", 11, 0, 151, 37],
["is_int", 12, 6, 151, 37],
["jump_false", 12, "rel_ni_341", 151, 37],
"_nop_tc_37",
"_nop_tc_38",
["gt_int", 13, 6, 11, 151, 37],
"_nop_tc_43",
"_nop_tc_44",
["gt_int", 12, 6, 11, 151, 37],
["jump", "rel_done_343", 151, 37],
"rel_ni_341",
["is_num", 12, 6, 151, 37],
["jump_false", 12, "rel_nn_342", 151, 37],
"_nop_tc_39",
"_nop_tc_40",
["gt_float", 13, 6, 11, 151, 37],
"_nop_tc_45",
"_nop_tc_46",
"_nop_tc_47",
"_nop_tc_48",
["gt_float", 12, 6, 11, 151, 37],
["jump", "rel_done_343", 151, 37],
"rel_nn_342",
["is_text", 12, 6, 151, 37],
["jump_false", 12, "rel_err_344", 151, 37],
"_nop_tc_41",
"_nop_tc_49",
["jump", "rel_err_344", 151, 37],
["gt_text", 13, 6, 11, 151, 37],
"_nop_tc_50",
["jump", "rel_err_344", 151, 37],
["gt_text", 12, 6, 11, 151, 37],
["jump", "rel_done_343", 151, 37],
"rel_err_344",
[
@@ -3638,19 +3638,19 @@
151,
37
],
["access", 12, "error", 151, 37],
["access", 13, "error", 151, 37],
["access", 14, "cannot compare with '>': operands must be same type", 151, 37],
["array", 15, 0, 151, 37],
["push", 15, 14, 151, 37],
["frame", 14, 11, 2, 151, 37],
["null", 11, 151, 37],
["setarg", 14, 0, 11, 151, 37],
["setarg", 14, 1, 12, 151, 37],
["setarg", 14, 1, 13, 151, 37],
["setarg", 14, 2, 15, 151, 37],
["invoke", 14, 11, 151, 37],
["disrupt", 151, 37],
"rel_done_343",
["move", 10, 13, 151, 37],
["move", 10, 12, 151, 37],
"and_end_336",
["jump_false", 10, "while_end_335", 151, 37],
["get", 10, 11, 1, 152, 16],
@@ -3664,35 +3664,35 @@
["jump_true", 11, "eq_done_347", 153, 21],
["is_int", 12, 7, 153, 21],
["jump_false", 12, "eq_ni_348", 153, 21],
"_nop_tc_42",
"_nop_tc_51",
["jump", "eq_ni_348", 153, 21],
["eq_int", 11, 7, 10, 153, 21],
["jump", "eq_done_347", 153, 21],
"eq_ni_348",
["is_num", 12, 7, 153, 21],
["jump_false", 12, "eq_nn_349", 153, 21],
"_nop_tc_43",
"_nop_tc_52",
["jump", "eq_nn_349", 153, 21],
["eq_float", 11, 7, 10, 153, 21],
["jump", "eq_done_347", 153, 21],
"eq_nn_349",
["is_text", 12, 7, 153, 21],
["jump_false", 12, "eq_nt_350", 153, 21],
"_nop_tc_44",
"_nop_tc_45",
"_nop_tc_53",
"_nop_tc_54",
["eq_text", 11, 7, 10, 153, 21],
["jump", "eq_done_347", 153, 21],
"eq_nt_350",
["is_null", 12, 7, 153, 21],
["jump_false", 12, "eq_nnl_351", 153, 21],
"_nop_tc_46",
"_nop_tc_55",
["jump", "eq_nnl_351", 153, 21],
["true", 11, 153, 21],
["jump", "eq_done_347", 153, 21],
"eq_nnl_351",
["is_bool", 12, 7, 153, 21],
["jump_false", 12, "eq_nb_352", 153, 21],
"_nop_tc_47",
"_nop_tc_56",
["jump", "eq_nb_352", 153, 21],
["eq_bool", 11, 7, 10, 153, 21],
["jump", "eq_done_347", 153, 21],
@@ -3701,10 +3701,10 @@
"eq_done_347",
["jump_false", 11, "if_else_345", 153, 21],
["access", 10, 1, 153, 44],
["is_num", 11, 6, 153, 44],
["jump_false", 11, "num_err_353", 153, 44],
"_nop_tc_48",
"_nop_tc_49",
"_nop_tc_57",
"_nop_tc_58",
"_nop_tc_59",
"_nop_tc_60",
["add", 11, 6, 10, 153, 44],
["jump", "num_done_354", 153, 44],
"num_err_353",
@@ -3744,35 +3744,35 @@
["jump_true", 11, "eq_done_357", 154, 26],
["is_int", 12, 7, 154, 26],
["jump_false", 12, "eq_ni_358", 154, 26],
"_nop_tc_50",
"_nop_tc_61",
["jump", "eq_ni_358", 154, 26],
["eq_int", 11, 7, 10, 154, 26],
["jump", "eq_done_357", 154, 26],
"eq_ni_358",
["is_num", 12, 7, 154, 26],
["jump_false", 12, "eq_nn_359", 154, 26],
"_nop_tc_51",
"_nop_tc_62",
["jump", "eq_nn_359", 154, 26],
["eq_float", 11, 7, 10, 154, 26],
["jump", "eq_done_357", 154, 26],
"eq_nn_359",
["is_text", 12, 7, 154, 26],
["jump_false", 12, "eq_nt_360", 154, 26],
"_nop_tc_52",
"_nop_tc_53",
"_nop_tc_63",
"_nop_tc_64",
["eq_text", 11, 7, 10, 154, 26],
["jump", "eq_done_357", 154, 26],
"eq_nt_360",
["is_null", 12, 7, 154, 26],
["jump_false", 12, "eq_nnl_361", 154, 26],
"_nop_tc_54",
"_nop_tc_65",
["jump", "eq_nnl_361", 154, 26],
["true", 11, 154, 26],
["jump", "eq_done_357", 154, 26],
"eq_nnl_361",
["is_bool", 12, 7, 154, 26],
["jump_false", 12, "eq_nb_362", 154, 26],
"_nop_tc_55",
"_nop_tc_66",
["jump", "eq_nb_362", 154, 26],
["eq_bool", 11, 7, 10, 154, 26],
["jump", "eq_done_357", 154, 26],
@@ -3781,10 +3781,10 @@
"eq_done_357",
["jump_false", 11, "if_else_355", 154, 26],
["access", 10, 1, 155, 29],
["is_num", 11, 6, 155, 29],
["jump_false", 11, "num_err_363", 155, 29],
"_nop_tc_56",
"_nop_tc_57",
"_nop_tc_67",
"_nop_tc_68",
"_nop_tc_69",
"_nop_tc_70",
["subtract", 6, 6, 10, 155, 29],
["jump", "num_done_364", 155, 29],
"num_err_363",
@@ -3823,35 +3823,35 @@
["jump_true", 11, "eq_done_369", 158, 26],
["is_int", 12, 7, 158, 26],
["jump_false", 12, "eq_ni_370", 158, 26],
"_nop_tc_58",
"_nop_tc_71",
["jump", "eq_ni_370", 158, 26],
["eq_int", 11, 7, 10, 158, 26],
["jump", "eq_done_369", 158, 26],
"eq_ni_370",
["is_num", 12, 7, 158, 26],
["jump_false", 12, "eq_nn_371", 158, 26],
"_nop_tc_59",
"_nop_tc_72",
["jump", "eq_nn_371", 158, 26],
["eq_float", 11, 7, 10, 158, 26],
["jump", "eq_done_369", 158, 26],
"eq_nn_371",
["is_text", 12, 7, 158, 26],
["jump_false", 12, "eq_nt_372", 158, 26],
"_nop_tc_60",
"_nop_tc_61",
"_nop_tc_73",
"_nop_tc_74",
["eq_text", 11, 7, 10, 158, 26],
["jump", "eq_done_369", 158, 26],
"eq_nt_372",
["is_null", 12, 7, 158, 26],
["jump_false", 12, "eq_nnl_373", 158, 26],
"_nop_tc_62",
"_nop_tc_75",
["jump", "eq_nnl_373", 158, 26],
["true", 11, 158, 26],
["jump", "eq_done_369", 158, 26],
"eq_nnl_373",
["is_bool", 12, 7, 158, 26],
["jump_false", 12, "eq_nb_374", 158, 26],
"_nop_tc_63",
"_nop_tc_76",
["jump", "eq_nb_374", 158, 26],
["eq_bool", 11, 7, 10, 158, 26],
["jump", "eq_done_369", 158, 26],
@@ -3865,35 +3865,35 @@
["jump_true", 12, "eq_done_375", 158, 39],
["is_int", 13, 7, 158, 39],
["jump_false", 13, "eq_ni_376", 158, 39],
"_nop_tc_64",
"_nop_tc_77",
["jump", "eq_ni_376", 158, 39],
["eq_int", 12, 7, 11, 158, 39],
["jump", "eq_done_375", 158, 39],
"eq_ni_376",
["is_num", 13, 7, 158, 39],
["jump_false", 13, "eq_nn_377", 158, 39],
"_nop_tc_65",
"_nop_tc_78",
["jump", "eq_nn_377", 158, 39],
["eq_float", 12, 7, 11, 158, 39],
["jump", "eq_done_375", 158, 39],
"eq_nn_377",
["is_text", 13, 7, 158, 39],
["jump_false", 13, "eq_nt_378", 158, 39],
"_nop_tc_66",
"_nop_tc_67",
"_nop_tc_79",
"_nop_tc_80",
["eq_text", 12, 7, 11, 158, 39],
["jump", "eq_done_375", 158, 39],
"eq_nt_378",
["is_null", 13, 7, 158, 39],
["jump_false", 13, "eq_nnl_379", 158, 39],
"_nop_tc_68",
"_nop_tc_81",
["jump", "eq_nnl_379", 158, 39],
["true", 12, 158, 39],
["jump", "eq_done_375", 158, 39],
"eq_nnl_379",
["is_bool", 13, 7, 158, 39],
["jump_false", 13, "eq_nb_380", 158, 39],
"_nop_tc_69",
"_nop_tc_82",
["jump", "eq_nb_380", 158, 39],
["eq_bool", 12, 7, 11, 158, 39],
["jump", "eq_done_375", 158, 39],
@@ -3909,35 +3909,35 @@
["jump_true", 12, "eq_done_381", 158, 53],
["is_int", 13, 7, 158, 53],
["jump_false", 13, "eq_ni_382", 158, 53],
"_nop_tc_70",
"_nop_tc_83",
["jump", "eq_ni_382", 158, 53],
["eq_int", 12, 7, 10, 158, 53],
["jump", "eq_done_381", 158, 53],
"eq_ni_382",
["is_num", 13, 7, 158, 53],
["jump_false", 13, "eq_nn_383", 158, 53],
"_nop_tc_71",
"_nop_tc_84",
["jump", "eq_nn_383", 158, 53],
["eq_float", 12, 7, 10, 158, 53],
["jump", "eq_done_381", 158, 53],
"eq_nn_383",
["is_text", 13, 7, 158, 53],
["jump_false", 13, "eq_nt_384", 158, 53],
"_nop_tc_72",
"_nop_tc_73",
"_nop_tc_85",
"_nop_tc_86",
["eq_text", 12, 7, 10, 158, 53],
["jump", "eq_done_381", 158, 53],
"eq_nt_384",
["is_null", 13, 7, 158, 53],
["jump_false", 13, "eq_nnl_385", 158, 53],
"_nop_tc_74",
"_nop_tc_87",
["jump", "eq_nnl_385", 158, 53],
["true", 12, 158, 53],
["jump", "eq_done_381", 158, 53],
"eq_nnl_385",
["is_bool", 13, 7, 158, 53],
["jump_false", 13, "eq_nb_386", 158, 53],
"_nop_tc_75",
"_nop_tc_88",
["jump", "eq_nb_386", 158, 53],
["eq_bool", 12, 7, 10, 158, 53],
["jump", "eq_done_381", 158, 53],
@@ -4064,35 +4064,35 @@
["jump_true", 12, "eq_done_405", 161, 27],
["is_int", 13, 10, 161, 27],
["jump_false", 13, "eq_ni_406", 161, 27],
"_nop_tc_76",
"_nop_tc_89",
["jump", "eq_ni_406", 161, 27],
["eq_int", 12, 10, 11, 161, 27],
["jump", "eq_done_405", 161, 27],
"eq_ni_406",
["is_num", 13, 10, 161, 27],
["jump_false", 13, "eq_nn_407", 161, 27],
"_nop_tc_77",
"_nop_tc_90",
["jump", "eq_nn_407", 161, 27],
["eq_float", 12, 10, 11, 161, 27],
["jump", "eq_done_405", 161, 27],
"eq_nn_407",
["is_text", 13, 10, 161, 27],
["jump_false", 13, "eq_nt_408", 161, 27],
"_nop_tc_78",
"_nop_tc_79",
"_nop_tc_91",
"_nop_tc_92",
["eq_text", 12, 10, 11, 161, 27],
["jump", "eq_done_405", 161, 27],
"eq_nt_408",
["is_null", 13, 10, 161, 27],
["jump_false", 13, "eq_nnl_409", 161, 27],
"_nop_tc_80",
"_nop_tc_93",
["jump", "eq_nnl_409", 161, 27],
["true", 12, 161, 27],
["jump", "eq_done_405", 161, 27],
"eq_nnl_409",
["is_bool", 13, 10, 161, 27],
["jump_false", 13, "eq_nb_410", 161, 27],
"_nop_tc_81",
"_nop_tc_94",
["jump", "eq_nb_410", 161, 27],
["eq_bool", 12, 10, 11, 161, 27],
["jump", "eq_done_405", 161, 27],
@@ -4105,8 +4105,8 @@
["access", 12, 1, 161, 41],
["is_num", 13, 11, 161, 41],
["jump_false", 13, "num_err_411", 161, 41],
"_nop_tc_82",
"_nop_tc_83",
"_nop_tc_95",
"_nop_tc_96",
["add", 13, 11, 12, 161, 41],
["jump", "num_done_412", 161, 41],
"num_err_411",
@@ -4141,14 +4141,14 @@
["lt_int", 14, 13, 11, 161, 45],
["jump", "rel_done_415", 161, 45],
"rel_ni_413",
"_nop_tc_84",
"_nop_tc_85",
"_nop_tc_97",
"_nop_tc_98",
["is_num", 12, 11, 161, 45],
["jump_false", 12, "rel_nn_414", 161, 45],
["lt_float", 14, 13, 11, 161, 45],
["jump", "rel_done_415", 161, 45],
"rel_nn_414",
"_nop_tc_86",
"_nop_tc_99",
["jump", "rel_err_416", 161, 45],
["is_text", 12, 11, 161, 45],
["jump_false", 12, "rel_err_416", 161, 45],
@@ -4283,8 +4283,8 @@
["setarg", 13, 2, 9, 167, 21],
["setarg", 13, 3, 11, 167, 21],
["invoke", 13, 10, 167, 21],
["is_array", 11, 5, 167, 21],
["jump_false", 11, "push_err_423", 167, 21],
"_nop_tc_100",
"_nop_tc_101",
["push", 5, 10, 167, 21],
["jump", "push_done_424", 167, 21],
"push_err_423",
@@ -4390,8 +4390,8 @@
["setarg", 9, 2, 1, 173, 38],
["setarg", 9, 3, 7, 173, 38],
["invoke", 9, 1, 173, 38],
["is_array", 6, 5, 173, 38],
["jump_false", 6, "push_err_431", 173, 38],
"_nop_tc_102",
"_nop_tc_103",
["push", 5, 1, 173, 38],
["jump", "push_done_432", 173, 38],
"push_err_431",
@@ -7011,23 +7011,23 @@
"while_start_730",
["is_int", 7, 3, 274, 16],
["jump_false", 7, "rel_ni_732", 274, 16],
["is_int", 8, 2, 274, 16],
["jump_false", 8, "rel_ni_732", 274, 16],
["lt_int", 9, 3, 2, 274, 16],
["is_int", 7, 2, 274, 16],
["jump_false", 7, "rel_ni_732", 274, 16],
["lt_int", 8, 3, 2, 274, 16],
["jump", "rel_done_734", 274, 16],
"rel_ni_732",
["is_num", 7, 3, 274, 16],
"_nop_tc_1",
"_nop_tc_2",
["is_num", 7, 2, 274, 16],
["jump_false", 7, "rel_nn_733", 274, 16],
["is_num", 8, 2, 274, 16],
["jump_false", 8, "rel_nn_733", 274, 16],
["lt_float", 9, 3, 2, 274, 16],
["lt_float", 8, 3, 2, 274, 16],
["jump", "rel_done_734", 274, 16],
"rel_nn_733",
["is_text", 7, 3, 274, 16],
"_nop_tc_3",
["jump", "rel_err_735", 274, 16],
["is_text", 7, 2, 274, 16],
["jump_false", 7, "rel_err_735", 274, 16],
["is_text", 8, 2, 274, 16],
["jump_false", 8, "rel_err_735", 274, 16],
["lt_text", 9, 3, 2, 274, 16],
["lt_text", 8, 3, 2, 274, 16],
["jump", "rel_done_734", 274, 16],
"rel_err_735",
[
@@ -7041,29 +7041,29 @@
274,
16
],
["access", 8, "error", 274, 16],
["access", 9, "error", 274, 16],
["access", 10, "cannot compare with '<': operands must be same type", 274, 16],
["array", 11, 0, 274, 16],
["push", 11, 10, 274, 16],
["frame", 10, 7, 2, 274, 16],
["null", 7, 274, 16],
["setarg", 10, 0, 7, 274, 16],
["setarg", 10, 1, 8, 274, 16],
["setarg", 10, 1, 9, 274, 16],
["setarg", 10, 2, 11, 274, 16],
["invoke", 10, 7, 274, 16],
["disrupt", 274, 16],
"rel_done_734",
["jump_false", 9, "while_end_731", 274, 16],
["jump_false", 8, "while_end_731", 274, 16],
["get", 7, 13, 1, 274, 25],
["frame", 8, 7, 0, 274, 25],
["null", 7, 274, 25],
["setarg", 8, 0, 7, 274, 25],
["invoke", 8, 7, 274, 25],
["access", 7, 1, 274, 40],
["is_num", 8, 3, 274, 40],
["jump_false", 8, "num_err_736", 274, 40],
"_nop_tc_1",
"_nop_tc_2",
"_nop_tc_4",
"_nop_tc_5",
"_nop_tc_6",
"_nop_tc_7",
["add", 8, 3, 7, 274, 40],
["jump", "num_done_737", 274, 40],
"num_err_736",
@@ -7153,23 +7153,23 @@
"while_start_740",
["is_int", 6, 2, 287, 16],
["jump_false", 6, "rel_ni_742", 287, 16],
["is_int", 7, 1, 287, 16],
["jump_false", 7, "rel_ni_742", 287, 16],
["lt_int", 8, 2, 1, 287, 16],
["is_int", 6, 1, 287, 16],
["jump_false", 6, "rel_ni_742", 287, 16],
["lt_int", 7, 2, 1, 287, 16],
["jump", "rel_done_744", 287, 16],
"rel_ni_742",
["is_num", 6, 2, 287, 16],
"_nop_tc_1",
"_nop_tc_2",
["is_num", 6, 1, 287, 16],
["jump_false", 6, "rel_nn_743", 287, 16],
["is_num", 7, 1, 287, 16],
["jump_false", 7, "rel_nn_743", 287, 16],
["lt_float", 8, 2, 1, 287, 16],
["lt_float", 7, 2, 1, 287, 16],
["jump", "rel_done_744", 287, 16],
"rel_nn_743",
["is_text", 6, 2, 287, 16],
"_nop_tc_3",
["jump", "rel_err_745", 287, 16],
["is_text", 6, 1, 287, 16],
["jump_false", 6, "rel_err_745", 287, 16],
["is_text", 7, 1, 287, 16],
["jump_false", 7, "rel_err_745", 287, 16],
["lt_text", 8, 2, 1, 287, 16],
["lt_text", 7, 2, 1, 287, 16],
["jump", "rel_done_744", 287, 16],
"rel_err_745",
[
@@ -7183,29 +7183,29 @@
287,
16
],
["access", 7, "error", 287, 16],
["access", 8, "error", 287, 16],
["access", 9, "cannot compare with '<': operands must be same type", 287, 16],
["array", 10, 0, 287, 16],
["push", 10, 9, 287, 16],
["frame", 9, 6, 2, 287, 16],
["null", 6, 287, 16],
["setarg", 9, 0, 6, 287, 16],
["setarg", 9, 1, 7, 287, 16],
["setarg", 9, 1, 8, 287, 16],
["setarg", 9, 2, 10, 287, 16],
["invoke", 9, 6, 287, 16],
["disrupt", 287, 16],
"rel_done_744",
["jump_false", 8, "while_end_741", 287, 16],
["jump_false", 7, "while_end_741", 287, 16],
["get", 6, 13, 1, 287, 25],
["frame", 7, 6, 0, 287, 25],
["null", 6, 287, 25],
["setarg", 7, 0, 6, 287, 25],
["invoke", 7, 6, 287, 25],
["access", 6, 1, 287, 40],
["is_num", 7, 2, 287, 40],
["jump_false", 7, "num_err_746", 287, 40],
"_nop_tc_1",
"_nop_tc_2",
"_nop_tc_4",
"_nop_tc_5",
"_nop_tc_6",
"_nop_tc_7",
["add", 7, 2, 6, 287, 40],
["jump", "num_done_747", 287, 40],
"num_err_746",
@@ -12508,23 +12508,23 @@
"while_start_1420",
["is_int", 7, 3, 444, 16],
["jump_false", 7, "rel_ni_1422", 444, 16],
["is_int", 31, 4, 444, 16],
["jump_false", 31, "rel_ni_1422", 444, 16],
["lt_int", 32, 3, 4, 444, 16],
"_nop_tc_1",
"_nop_tc_2",
["lt_int", 31, 3, 4, 444, 16],
["jump", "rel_done_1424", 444, 16],
"rel_ni_1422",
["is_num", 7, 3, 444, 16],
["jump_false", 7, "rel_nn_1423", 444, 16],
["is_num", 31, 4, 444, 16],
["jump_false", 31, "rel_nn_1423", 444, 16],
["lt_float", 32, 3, 4, 444, 16],
"_nop_tc_3",
"_nop_tc_4",
["lt_float", 31, 3, 4, 444, 16],
["jump", "rel_done_1424", 444, 16],
"rel_nn_1423",
["is_text", 7, 3, 444, 16],
["jump_false", 7, "rel_err_1425", 444, 16],
["is_text", 31, 4, 444, 16],
["jump_false", 31, "rel_err_1425", 444, 16],
["lt_text", 32, 3, 4, 444, 16],
"_nop_tc_5",
["jump", "rel_err_1425", 444, 16],
["lt_text", 31, 3, 4, 444, 16],
["jump", "rel_done_1424", 444, 16],
"rel_err_1425",
[
@@ -12538,19 +12538,19 @@
444,
16
],
["access", 31, "error", 444, 16],
["access", 32, "error", 444, 16],
["access", 33, "cannot compare with '<': operands must be same type", 444, 16],
["array", 34, 0, 444, 16],
["push", 34, 33, 444, 16],
["frame", 33, 7, 2, 444, 16],
["null", 7, 444, 16],
["setarg", 33, 0, 7, 444, 16],
["setarg", 33, 1, 31, 444, 16],
["setarg", 33, 1, 32, 444, 16],
["setarg", 33, 2, 34, 444, 16],
["invoke", 33, 7, 444, 16],
["disrupt", 444, 16],
"rel_done_1424",
["jump_false", 32, "while_end_1421", 444, 16],
["jump_false", 31, "while_end_1421", 444, 16],
["frame", 7, 30, 0, 445, 5],
["null", 31, 445, 5],
["setarg", 7, 0, 31, 445, 5],
@@ -12565,8 +12565,8 @@
["store_field", 7, 6, "from_column", 449, 68],
["store_field", 7, 5, "to_row", 449, 81],
["store_field", 7, 6, "to_column", 449, 97],
["is_array", 30, 8, 449, 97],
["jump_false", 30, "push_err_1426", 449, 97],
"_nop_tc_6",
"_nop_tc_7",
["push", 8, 7, 449, 97],
["jump", "push_done_1427", 449, 97],
"push_err_1426",

View File

@@ -1053,25 +1053,39 @@ var mcode = function(ast) {
var i = alloc_slot()
var check = alloc_slot()
var item = alloc_slot()
var fn_arity = alloc_slot()
var arity_is_one = alloc_slot()
var null_s = alloc_slot()
var one = alloc_slot()
var f = alloc_slot()
var discard = alloc_slot()
var loop_label = gen_label("arrfor_loop")
var done_label = gen_label("arrfor_done")
var call_two_label = gen_label("arrfor_call_two")
var call_done_label = gen_label("arrfor_call_done")
emit_2("length", len, arr_slot)
emit_2("int", i, 0)
emit_2("int", one, 1)
emit_1("null", null_s)
emit_2("length", fn_arity, fn_slot)
emit_label(loop_label)
emit_3("lt_int", check, i, len)
emit_jump_cond("jump_false", check, done_label)
emit_3("load_index", item, arr_slot, i)
emit_3("eq_int", arity_is_one, fn_arity, one)
emit_jump_cond("jump_false", arity_is_one, call_two_label)
emit_3("frame", f, fn_slot, 1)
emit_3("setarg", f, 0, null_s)
emit_3("setarg", f, 1, item)
emit_2("invoke", f, discard)
emit_jump(call_done_label)
emit_label(call_two_label)
emit_3("frame", f, fn_slot, 2)
emit_3("setarg", f, 0, null_s)
emit_3("setarg", f, 1, item)
emit_3("setarg", f, 2, i)
emit_2("invoke", f, discard)
emit_label(call_done_label)
emit_3("add", i, i, one)
emit_jump(loop_label)
emit_label(done_label)
@@ -1162,11 +1176,15 @@ var mcode = function(ast) {
var i = alloc_slot()
var check = alloc_slot()
var item = alloc_slot()
var fn_arity = alloc_slot()
var arity_is_one = alloc_slot()
var null_s = alloc_slot()
var one = alloc_slot()
var f = alloc_slot()
var val = alloc_slot()
var loop_label = gen_label("filter_loop")
var call_two_label = gen_label("filter_call_two")
var call_done_label = gen_label("filter_call_done")
var skip_label = gen_label("filter_skip")
var done_label = gen_label("filter_done")
add_instr(["array", result, 0])
@@ -1174,15 +1192,25 @@ var mcode = function(ast) {
emit_2("int", i, 0)
emit_2("int", one, 1)
emit_1("null", null_s)
emit_2("length", fn_arity, fn_slot)
emit_label(loop_label)
emit_3("lt_int", check, i, len)
emit_jump_cond("jump_false", check, done_label)
emit_3("load_index", item, arr_slot, i)
emit_3("eq_int", arity_is_one, fn_arity, one)
emit_jump_cond("jump_false", arity_is_one, call_two_label)
emit_3("frame", f, fn_slot, 1)
emit_3("setarg", f, 0, null_s)
emit_3("setarg", f, 1, item)
emit_2("invoke", f, val)
emit_jump(call_done_label)
emit_label(call_two_label)
emit_3("frame", f, fn_slot, 2)
emit_3("setarg", f, 0, null_s)
emit_3("setarg", f, 1, item)
emit_3("setarg", f, 2, i)
emit_2("invoke", f, val)
emit_label(call_done_label)
emit_jump_cond("jump_false", val, skip_label)
emit_2("push", result, item)
emit_label(skip_label)

View File

@@ -13,6 +13,7 @@
#define BOOTSTRAP_MCODE "boot/bootstrap.cm.mcode"
#define ENGINE_SRC "internal/engine.cm"
#define ENGINE_CACHE_VERSION "engine-cache-v2"
#define CELL_SHOP_DIR ".cell"
#define CELL_CORE_DIR "packages/core"
@@ -222,7 +223,18 @@ static char *try_engine_cache(size_t *out_size) {
char *src = load_core_file(ENGINE_SRC, &src_size);
if (!src) return NULL;
char *hex = compute_blake2_hex(src, src_size);
size_t ver_len = strlen(ENGINE_CACHE_VERSION);
size_t salted_size = src_size + 1 + ver_len;
char *salted = malloc(salted_size);
if (!salted) {
free(src);
return NULL;
}
memcpy(salted, src, src_size);
salted[src_size] = '\n';
memcpy(salted + src_size + 1, ENGINE_CACHE_VERSION, ver_len);
char *hex = compute_blake2_hex(salted, salted_size);
free(salted);
free(src);
if (!hex) return NULL;
char *cpath = build_cache_path(hex);

View File

@@ -82,6 +82,19 @@ static JSValue *mach_materialize_cpool(JSContext *ctx, MachCPoolEntry *entries,
return cpool;
}
static int mach_check_call_arity(JSContext *ctx, JSFunction *fn, int argc) {
if (unlikely(fn->length >= 0 && argc > fn->length)) {
char buf[KEY_GET_STR_BUF_SIZE];
fprintf(stderr, "[arity-mach] callee=%s expected=%d got=%d\n",
JS_KeyGetStr(ctx, buf, KEY_GET_STR_BUF_SIZE, fn->name),
fn->length, argc);
JS_RaiseDisrupt(ctx, "too many arguments for %s: expected %d, got %d",
JS_KeyGetStr(ctx, buf, KEY_GET_STR_BUF_SIZE, fn->name), fn->length, argc);
return 0;
}
return 1;
}
/* ---- Link pass: resolve GETNAME to GETINTRINSIC or GETENV ---- */
static void mach_link_code(JSContext *ctx, JSCodeRegister *code, JSValue env) {
@@ -2170,6 +2183,13 @@ vm_dispatch:
int c_argc = (nr >= 2) ? nr - 2 : 0;
JSValue fn_val = fr->function;
JSFunction *fn = JS_VALUE_GET_FUNCTION(fn_val);
if (!mach_check_call_arity(ctx, fn, c_argc)) {
fprintf(stderr, "[arity-mach] caller=%s file=%s pc=%u op=invoke argc=%d\n",
code->name_cstr ? code->name_cstr : "?",
code->filename_cstr ? code->filename_cstr : "?",
(unsigned)(pc > 0 ? pc - 1 : 0), c_argc);
goto disrupt;
}
if (fn->kind == JS_FUNC_KIND_REGISTER) {
/* Register function: switch frames inline (fast path) */
@@ -2241,6 +2261,13 @@ vm_dispatch:
int c_argc = (nr >= 2) ? nr - 2 : 0;
JSValue fn_val = fr->function;
JSFunction *fn = JS_VALUE_GET_FUNCTION(fn_val);
if (!mach_check_call_arity(ctx, fn, c_argc)) {
fprintf(stderr, "[arity-mach] caller=%s file=%s pc=%u op=goinvoke argc=%d\n",
code->name_cstr ? code->name_cstr : "?",
code->filename_cstr ? code->filename_cstr : "?",
(unsigned)(pc > 0 ? pc - 1 : 0), c_argc);
goto disrupt;
}
if (fn->kind == JS_FUNC_KIND_REGISTER) {
JSCodeRegister *fn_code = JS_VALUE_GET_CODE(fn->u.cell.code)->u.reg.code;

View File

@@ -768,6 +768,20 @@ void cell_rt_signal_tail_call(JSContext *ctx, void *fp, int64_t frame_slot) {
st->pending_is_tail = 1;
}
static int cell_check_call_arity(JSContext *ctx, JSFunction *fn, int argc) {
if (unlikely(fn->length >= 0 && argc > fn->length)) {
char buf[KEY_GET_STR_BUF_SIZE];
fprintf(stderr, "[arity-qbe] callee=%s expected=%d got=%d\n",
JS_KeyGetStr(ctx, buf, KEY_GET_STR_BUF_SIZE, fn->name),
fn->length, argc);
JS_RaiseDisrupt(ctx, "too many arguments for %s: expected %d, got %d",
JS_KeyGetStr(ctx, buf, KEY_GET_STR_BUF_SIZE, fn->name),
fn->length, argc);
return 0;
}
return 1;
}
/* Entry point called from JS_CallInternal / JS_Call / MACH_INVOKE
for JS_FUNC_KIND_NATIVE functions. */
JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
@@ -788,6 +802,9 @@ JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
return (v); \
} while (0)
if (!cell_check_call_arity(ctx, f, argc))
RETURN_DISPATCH(JS_EXCEPTION);
/* Root func_obj across allocation — GC can move it */
JSGCRef func_ref;
JS_PushGCRef(ctx, &func_ref);
@@ -865,10 +882,13 @@ JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
continue;
}
JSGCRef callee_fn_ref;
JS_PushGCRef(ctx, &callee_fn_ref);
callee_fn_ref.val = callee_fn_val;
JSFunction *callee_fn = JS_VALUE_GET_FUNCTION(callee_fn_ref.val);
JSFunction *callee_fn = JS_VALUE_GET_FUNCTION(callee_fn_val);
if (!cell_check_call_arity(ctx, callee_fn, callee_argc)) {
JSFunction *exc_fn = JS_VALUE_GET_FUNCTION(frame->function);
fn = (cell_compiled_fn)JS_VALUE_GET_CODE(exc_fn->u.cell.code)->u.native.fn_ptr;
JS_PopGCRef(ctx, &callee_ref);
continue;
}
if (callee_fn->kind == JS_FUNC_KIND_NATIVE) {
/* Native-to-native call — no C stack growth */
@@ -882,13 +902,11 @@ JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
cell_rt_leave_frame(ctx);
callee_fr = (JSFrameRegister *)JS_VALUE_GET_PTR(callee_ref.val);
callee_fn_val = callee_fn_ref.val;
callee_fr->function = callee_fn_val;
callee_fr->caller = saved_caller;
callee_fr->address = JS_NewInt32(ctx, 0);
if (!cell_rt_push_existing_frame(ctx, callee_ref.val)) {
JS_PopGCRef(ctx, &callee_fn_ref);
JS_PopGCRef(ctx, &callee_ref);
RETURN_DISPATCH(JS_EXCEPTION);
}
@@ -905,7 +923,6 @@ JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
frame->address = JS_NewInt32(ctx, (resume_seg << 16) | ret_slot);
callee_fr = (JSFrameRegister *)JS_VALUE_GET_PTR(callee_ref.val);
callee_fn_val = callee_fn_ref.val;
callee_fr->function = callee_fn_val;
callee_fr->caller = JS_MKPTR(frame);
callee_fr->address = JS_NewInt32(ctx, 0);
@@ -917,7 +934,6 @@ JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
fp = (JSValue *)frame->slots;
JSFunction *exc_fn = JS_VALUE_GET_FUNCTION(frame->function);
fn = (cell_compiled_fn)JS_VALUE_GET_CODE(exc_fn->u.cell.code)->u.native.fn_ptr;
JS_PopGCRef(ctx, &callee_fn_ref);
JS_PopGCRef(ctx, &callee_ref);
continue;
}
@@ -997,7 +1013,6 @@ JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj,
fn = (cell_compiled_fn)JS_VALUE_GET_CODE(cur_fn->u.cell.code)->u.native.fn_ptr;
}
}
JS_PopGCRef(ctx, &callee_fn_ref);
JS_PopGCRef(ctx, &callee_ref);
continue;
}
@@ -1167,6 +1182,8 @@ JSValue cell_rt_invoke(JSContext *ctx, JSValue frame_val) {
JSFunction *fn = JS_VALUE_GET_FUNCTION(fn_val);
JSValue result;
if (!cell_check_call_arity(ctx, fn, c_argc))
return JS_EXCEPTION;
if (fn->kind == JS_FUNC_KIND_C) {
result = js_call_c_function(ctx, fn_val, fr->slots[0], c_argc, &fr->slots[1]);

View File

@@ -357,9 +357,12 @@ return {
if (fn(1, 2, 3) != 6) return "function call with multiple args failed"
},
test_function_call_extra_args: function() {
test_function_call_extra_args_disrupts: function() {
var fn = function(a, b) { return a + b }
if (fn(1, 2, 3, 4) != 3) return "function call with extra args failed"
var caught = false
var _fn = function() { fn(1, 2, 3, 4) } disruption { caught = true }
_fn()
if (!caught) return "function call with extra args should disrupt"
},
test_function_call_missing_args: function() {
@@ -367,6 +370,25 @@ return {
if (fn(1) != 1) return "function call with missing args failed"
},
test_function_closure_extra_args_disrupts: function() {
var mk = function(base) {
return function(x) { return base + x }
}
var add5 = mk(5)
var caught = false
var _fn = function() { add5(1, 2) } disruption { caught = true }
_fn()
if (!caught) return "closure call with extra args should disrupt"
},
test_call_helper_extra_args_disrupts: function() {
var fn = function(a, b) { return a + b }
var caught = false
var _fn = function() { call(fn, null, [1, 2, 3]) } disruption { caught = true }
_fn()
if (!caught) return "call helper should disrupt on extra args"
},
test_function_return: function() {
var fn = function() { return 5 }
if (fn() != 5) return "function return failed"

View File

@@ -334,9 +334,10 @@ run("function call multiple args", function() {
if (fn(1, 2, 3) != 6) fail("function call with multiple args failed")
})
run("function call extra args", function() {
run("function call extra args disrupts", function() {
var fn = function(a, b) { return a + b }
if (fn(1, 2, 3, 4) != 3) fail("function call with extra args failed")
if (!should_disrupt(function() { fn(1, 2, 3, 4) }))
fail("function call with extra args should disrupt")
})
run("function call missing args", function() {
@@ -344,6 +345,21 @@ run("function call missing args", function() {
if (fn(1) != 1) fail("function call with missing args failed")
})
run("closure call extra args disrupts", function() {
var mk = function(base) {
return function(x) { return base + x }
}
var add5 = mk(5)
if (!should_disrupt(function() { add5(1, 2) }))
fail("closure call with extra args should disrupt")
})
run("call helper extra args disrupts", function() {
var fn = function(a, b) { return a + b }
if (!should_disrupt(function() { call(fn, null, [1, 2, 3]) }))
fail("call helper should disrupt on extra args")
})
run("function return", function() {
var fn = function() { return 5 }
if (fn() != 5) fail("function return failed")