diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/prebuilt/wasm-ast-parser-gen.c | 1414 | ||||
-rw-r--r-- | src/wasm-ast-checker.c | 17 | ||||
-rw-r--r-- | src/wasm-ast-parser.y | 88 | ||||
-rw-r--r-- | src/wasm-ast.c | 19 | ||||
-rw-r--r-- | src/wasm-ast.h | 11 |
5 files changed, 850 insertions, 699 deletions
diff --git a/src/prebuilt/wasm-ast-parser-gen.c b/src/prebuilt/wasm-ast-parser-gen.c index 5526995a..9e73e875 100644 --- a/src/prebuilt/wasm-ast-parser-gen.c +++ b/src/prebuilt/wasm-ast-parser-gen.c @@ -84,6 +84,8 @@ #include "wasm-binary-reader.h" #include "wasm-literal.h" +#define INVALID_VAR_INDEX (-1) + /* the default value for YYMAXDEPTH is 10000, which can be easily hit since our grammar is right-recursive. @@ -220,7 +222,7 @@ static void on_read_binary_error(uint32_t offset, const char* error, #define wasm_ast_parser_lex wasm_ast_lexer_lex -#line 224 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:339 */ +#line 226 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -366,7 +368,7 @@ int wasm_ast_parser_parse (WasmAstLexer* lexer, WasmAstParser* parser); /* Copy the second part of user declarations. */ -#line 370 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:358 */ +#line 372 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:358 */ #ifdef short # undef short @@ -610,7 +612,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 10 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 750 +#define YYLAST 758 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 73 @@ -672,23 +674,23 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 277, 277, 283, 293, 294, 298, 316, 317, 323, - 326, 331, 338, 341, 342, 346, 351, 358, 361, 364, - 369, 376, 382, 393, 397, 401, 408, 413, 420, 421, - 427, 428, 431, 435, 436, 440, 441, 451, 452, 463, - 464, 465, 468, 471, 474, 477, 480, 484, 488, 493, - 496, 500, 504, 508, 512, 516, 520, 524, 530, 536, - 548, 552, 556, 560, 564, 567, 572, 577, 582, 587, - 595, 603, 607, 610, 616, 622, 631, 637, 642, 648, - 653, 659, 667, 668, 676, 677, 685, 690, 691, 697, - 703, 713, 719, 725, 735, 790, 799, 806, 813, 823, - 826, 830, 836, 847, 853, 873, 880, 892, 899, 920, - 943, 950, 963, 970, 976, 982, 988, 996, 1001, 1008, - 1014, 1020, 1026, 1035, 1043, 1048, 1053, 1058, 1065, 1072, - 1076, 1079, 1090, 1094, 1101, 1105, 1108, 1116, 1124, 1141, - 1157, 1168, 1175, 1182, 1188, 1228, 1238, 1260, 1270, 1295, - 1296, 1300, 1308, 1318, 1324, 1330, 1336, 1342, 1347, 1356, - 1361, 1362, 1368, 1376, 1377, 1385, 1397, 1398, 1405, 1414 + 0, 279, 279, 285, 295, 296, 300, 318, 319, 325, + 328, 333, 340, 343, 344, 348, 353, 360, 363, 366, + 371, 378, 384, 395, 399, 403, 410, 415, 422, 423, + 429, 430, 433, 437, 438, 442, 443, 453, 454, 465, + 466, 467, 470, 473, 476, 479, 482, 486, 490, 495, + 498, 502, 506, 510, 514, 518, 522, 526, 532, 538, + 550, 554, 558, 562, 566, 569, 574, 579, 584, 589, + 597, 605, 609, 612, 618, 624, 633, 639, 644, 650, + 655, 661, 669, 670, 678, 679, 687, 692, 693, 699, + 705, 715, 721, 727, 737, 792, 801, 808, 815, 825, + 828, 832, 838, 849, 855, 875, 882, 894, 901, 922, + 945, 952, 965, 972, 978, 984, 990, 998, 1003, 1010, + 1016, 1022, 1028, 1037, 1045, 1050, 1055, 1060, 1067, 1074, + 1078, 1081, 1092, 1096, 1103, 1107, 1110, 1118, 1126, 1143, + 1159, 1170, 1177, 1184, 1190, 1230, 1240, 1262, 1272, 1298, + 1303, 1311, 1319, 1329, 1335, 1341, 1347, 1353, 1358, 1367, + 1372, 1373, 1379, 1387, 1388, 1396, 1408, 1409, 1416, 1474 }; #endif @@ -740,10 +742,10 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -289 +#define YYPACT_NINF -278 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-289))) + (!!((Yystate) == (-278))) #define YYTABLE_NINF -30 @@ -754,45 +756,45 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -289, 73, -289, 93, 80, -289, -289, -289, -289, -289, - -289, 94, 97, 94, 94, 109, 109, 109, 125, 125, - 125, -289, 158, -289, 94, 97, 97, 85, 97, 97, - 97, -1, -289, 122, 97, -289, 67, 82, 177, -289, - 187, 203, 206, 219, 191, -289, 220, -289, -289, 117, - -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, - -289, -289, 209, -289, -289, -289, -289, 196, -289, -289, - -289, 226, 118, 39, 226, 226, 99, 226, 99, 97, - 97, -289, 224, -289, 361, -289, -289, -289, -289, 232, - 199, 242, 245, 33, 246, 282, 249, -289, -289, 256, - 249, 158, 97, 257, -289, -289, -289, 262, 241, -289, - -289, 226, 226, 226, 118, 118, -289, 118, 118, -289, - 118, 118, 118, 118, 118, 252, 252, 224, -289, -289, - -289, -289, -289, -289, -289, -289, 394, 427, -289, -289, - -289, -289, -289, -289, 273, 285, 460, -289, 290, -289, - 294, 23, -289, 427, 44, 44, 157, 289, 59, -289, - 226, 226, 226, 427, 304, 331, -289, 146, 123, 289, - 289, 315, 158, 309, 332, 334, 133, 335, -289, 118, - 226, -289, 226, 97, 97, -289, -289, -289, -289, -289, - -289, 118, -289, -289, -289, -289, -289, -289, -289, -289, - 308, 308, -289, 565, 342, 705, -289, -289, 194, 343, - 349, 526, 394, 359, 171, 373, -289, 369, -289, 376, - 374, 392, 427, 406, 401, 289, -289, 410, 415, -289, - -289, -289, 425, 304, -289, -289, 197, -289, -289, 158, - 439, -289, 441, 389, 448, -289, 144, 458, 118, 118, - 118, 118, -289, 472, 103, 468, 148, 149, 469, 97, - 481, 328, 479, 151, 495, 130, -289, -289, -289, -289, - -289, -289, -289, -289, 505, -289, -289, 508, -289, -289, - 514, -289, -289, -289, 473, -289, -289, 53, -289, -289, - -289, -289, 525, -289, -289, 158, -289, 226, 226, 226, - 226, -289, 538, 540, 541, 547, -289, 394, -289, 557, - 493, 493, 558, 568, -289, -289, -289, -289, 427, -289, - 150, 174, -289, -289, -289, -289, 639, 570, -289, 577, - 579, 285, 44, 289, 289, -289, -289, -289, -289, -289, - 394, 604, -289, -289, 493, -289, 574, 581, -289, 200, - 427, 672, 304, -289, 596, 597, 607, 608, 609, 616, - -289, -289, -289, 572, 619, 625, 427, -289, -289, -289, - -289, -289, -289, -289, -289, -289, 636, 646, 189, 621, - 648, -289, 427, 645, 654, 427, -289, 670, -289 + -278, 41, -278, 59, 69, -278, -278, -278, -278, -278, + -278, 60, 74, 76, 76, 90, 90, 90, 104, 104, + 104, -278, 115, -278, -278, 76, -278, 74, 74, 65, + 74, 74, 74, 78, -278, 124, 74, -278, 102, 217, + 148, -278, 150, 158, 160, 167, 248, -278, 169, -278, + -278, 122, -278, -278, -278, -278, -278, -278, -278, -278, + -278, -278, -278, -278, 251, -278, -278, -278, -278, 151, + -278, -278, -278, 60, 175, 71, 60, 60, 40, 60, + 40, 74, 74, -278, 221, 369, -278, -278, -278, 192, + 152, 210, 230, 98, 233, 290, 245, -278, -278, 253, + 245, 115, 74, 255, -278, -278, -278, 257, 249, -278, + -278, 60, 60, 60, 175, 175, -278, 175, 175, -278, + 175, 175, 175, 175, 175, 250, 250, 221, -278, -278, + -278, -278, -278, -278, -278, -278, 402, 435, -278, -278, + -278, -278, -278, -278, 261, 281, 468, -278, 292, -278, + 297, 24, -278, 435, 109, 109, 200, 291, 110, -278, + 60, 60, 60, 435, 299, 302, -278, 190, 156, 291, + 291, 312, 115, 317, 322, 333, 16, 334, -278, 175, + 60, -278, 60, 74, 74, -278, -278, -278, -278, -278, + -278, 175, -278, -278, -278, -278, -278, -278, -278, -278, + 301, 301, -278, 573, 337, 713, -278, -278, 193, 338, + 339, 534, 402, 340, 218, 341, -278, 330, -278, 343, + 342, 348, 435, 351, 350, 291, -278, 368, 381, -278, + -278, -278, 383, 299, -278, -278, 196, -278, -278, 115, + 384, -278, 390, 347, 414, -278, 93, 416, 175, 175, + 175, 175, -278, 417, 138, 427, 157, 162, 441, 74, + 423, 336, 437, 45, 438, 199, -278, -278, -278, -278, + -278, -278, -278, -278, 456, -278, -278, 466, -278, -278, + 480, -278, -278, -278, 431, -278, -278, 117, -278, -278, + -278, -278, 483, -278, -278, 115, -278, 60, 60, 60, + 60, -278, 489, 499, 513, 515, -278, 402, -278, 516, + 501, 501, 522, 532, -278, -278, -278, -278, 435, -278, + 179, 181, -278, -278, -278, -278, 647, 547, -278, 533, + 548, 281, 109, 291, 291, -278, -278, -278, -278, -278, + 402, 612, -278, -278, 501, -278, 537, 556, -278, 198, + 435, 680, 299, -278, 565, 566, 576, 577, 585, 587, + -278, -278, -278, 542, 594, 604, 435, -278, -278, -278, + -278, -278, -278, -278, -278, -278, 606, 615, 183, 601, + 618, -278, 435, 609, 626, 435, -278, 627, -278 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -801,14 +803,14 @@ static const yytype_int16 yypact[] = static const yytype_uint8 yydefact[] = { 163, 168, 169, 0, 0, 148, 161, 159, 160, 164, - 1, 149, 0, 149, 149, 0, 0, 0, 0, 0, - 0, 150, 135, 6, 149, 0, 0, 0, 0, 0, - 0, 0, 166, 0, 0, 2, 0, 0, 0, 166, - 0, 0, 0, 0, 0, 157, 0, 147, 3, 0, - 146, 140, 141, 138, 142, 139, 137, 144, 145, 136, - 143, 162, 0, 152, 153, 154, 155, 0, 156, 167, - 158, 30, 0, 0, 30, 30, 0, 30, 0, 0, - 0, 151, 0, 32, 82, 31, 22, 27, 26, 0, + 1, 30, 0, 149, 149, 0, 0, 0, 0, 0, + 0, 32, 135, 31, 6, 149, 150, 0, 0, 0, + 0, 0, 0, 0, 166, 0, 0, 2, 0, 0, + 0, 166, 0, 0, 0, 0, 0, 157, 0, 147, + 3, 0, 146, 140, 141, 138, 142, 139, 137, 144, + 145, 136, 143, 162, 0, 152, 153, 154, 155, 0, + 156, 167, 158, 30, 0, 0, 30, 30, 0, 30, + 0, 0, 0, 151, 0, 82, 22, 27, 26, 0, 0, 0, 0, 0, 129, 0, 0, 100, 28, 129, 0, 4, 0, 0, 23, 24, 25, 0, 0, 43, 44, 33, 33, 33, 0, 0, 28, 0, 0, 49, @@ -844,25 +846,25 @@ static const yytype_uint8 yydefact[] = /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -289, 653, -155, -22, -152, 464, -129, 599, -139, -145, - -159, -137, -123, -119, 580, -23, -106, -59, -46, -40, - 571, 507, -289, -94, -289, -142, -76, -289, -289, -132, - 488, -126, -288, -270, -102, -289, -19, -289, -289, -289, - -289, -289, -289, -289, 31, -289, -289, 624, 38, -289, - -289, -289, 313, -289, 55, 314, -289, -289, -289, -289, - 685, -289, -289 + -278, 625, -152, -24, -157, 413, -126, 567, -139, -143, + -159, -137, -119, -123, 521, -26, -106, -60, -36, -57, + 540, 457, -278, -94, -278, -150, -78, -278, -278, -132, + 439, -122, -277, -245, -96, -278, -29, -278, -278, -278, + -278, -278, -278, -278, 57, -278, -278, 583, 64, -278, + -278, -278, 214, -278, 28, 226, -278, -278, -278, -278, + 642, -278, -278 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 173, 174, 24, 261, 227, 153, 91, 209, 223, - 240, 224, 136, 88, 107, 238, 167, 84, 85, 186, + -1, 173, 174, 25, 261, 227, 153, 91, 209, 223, + 240, 224, 136, 88, 107, 238, 167, 22, 23, 186, 200, 267, 137, 138, 139, 262, 140, 165, 328, 141, - 234, 219, 142, 143, 144, 51, 98, 52, 53, 54, - 55, 56, 247, 57, 145, 177, 58, 158, 146, 59, - 60, 37, 5, 6, 22, 7, 8, 9, 1, 69, - 44, 2, 3 + 234, 219, 142, 143, 144, 53, 98, 54, 55, 56, + 57, 58, 247, 59, 145, 177, 60, 158, 146, 61, + 62, 39, 5, 6, 27, 7, 8, 9, 1, 71, + 46, 2, 3 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -870,162 +872,162 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 97, 164, 97, 39, 40, 206, 41, 42, 43, 215, - 191, 242, 46, 228, 164, 93, 94, 244, 99, 339, - 97, 218, 210, 212, 97, 221, 222, 92, 254, 256, - 257, 218, 241, 241, 204, 217, 151, 232, 225, 225, - 342, 343, 90, 152, 213, 263, 264, 220, 83, 89, - 225, 225, 360, 96, 152, 100, 326, 102, 103, 101, - 236, 13, 14, 308, 86, 185, 185, 185, 25, 26, - 226, 47, 187, 188, 361, 48, 4, 166, 287, 38, - 175, 172, 183, 184, 292, 49, 50, 286, 233, 288, - 218, 189, 190, 10, 192, 193, 280, 194, 195, 196, - 197, 198, 95, 21, 86, 23, 283, 307, 87, 164, - 274, 164, 27, 308, 185, 185, 185, 164, 320, 321, - 229, 230, 231, 86, 154, 157, 45, 87, 31, 315, - 169, 155, 159, 11, 255, -29, 258, 171, 11, -29, - 330, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 237, 86, 310, 311, 347, 87, 253, 233, 308, 308, - 308, 259, 260, 71, 72, 73, 35, 317, 265, 74, - 318, 75, 76, 77, 78, 359, 79, 80, 348, 248, - 239, 61, 183, 184, 308, 249, 346, 250, 358, 251, - 297, 63, 355, 381, 67, 68, 298, 241, 299, 308, - 300, 291, 86, 357, 364, 86, 87, 64, 356, 87, - 65, 327, 67, 81, 225, 225, 183, 184, 365, 349, - 270, 271, 378, 66, 70, 302, 303, 304, 305, 104, - 105, 106, 164, 82, 377, 83, 147, 313, 331, 332, - 333, 334, 179, 270, 271, 148, 149, 164, 90, 156, - 384, 352, 95, 387, 109, 110, 160, 164, 161, 168, - 176, 162, 114, 115, 116, 117, 178, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 367, 207, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 199, 208, 179, - 180, 181, 182, 214, 86, 109, 110, 160, 216, 161, - 183, 184, 162, 114, 115, 116, 117, 205, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 48, 243, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 28, 29, - 30, 205, 32, 33, 34, 235, 245, 246, 308, 252, - 163, 109, 110, 111, 266, 112, 269, 272, 113, 114, - 115, 116, 117, 273, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 275, 108, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 109, 110, 111, 276, 112, 277, - 278, 113, 114, 115, 116, 117, 217, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 279, 203, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 109, 110, 111, - 281, 112, 226, 284, 113, 114, 115, 116, 117, 285, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 289, - 205, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 109, 110, 111, 293, 112, 294, 295, 113, 114, 115, - 116, 117, 296, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 301, 211, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 109, 110, 111, 306, 112, 309, 312, - 113, 114, 115, 116, 117, 314, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 316, 341, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 109, 110, 111, 322, - 112, 319, 323, 113, 114, 115, 116, 117, 324, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 325, 329, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 109, - 110, 160, 335, 161, 336, 337, 162, 114, 115, 116, - 117, 338, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 340, 344, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 345, 351, 179, 180, 181, 182, 109, 110, - 160, 353, 161, 354, 363, 162, 114, 115, 116, 117, - 362, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 368, 369, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 370, 371, 372, 180, 181, 182, 109, 110, 160, - 373, 161, 374, 375, 162, 114, 115, 116, 117, 376, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 379, - 382, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 380, 383, 109, 110, 160, 182, 161, 350, 386, 162, - 114, 115, 116, 117, 385, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 388, 36, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 109, 110, 160, 282, 161, - 366, 150, 162, 114, 115, 116, 117, 201, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 202, 268, 127, + 97, 164, 97, 41, 42, 206, 43, 44, 45, 215, + 191, 242, 48, 85, 164, 228, 93, 94, 97, 99, + 244, 218, 97, 254, 256, 257, 210, 212, 221, 222, + 339, 218, 241, 241, 225, 225, 217, 263, 264, 92, + 204, 232, 28, 95, 4, 86, 225, 225, 89, 87, + 213, 101, 96, 40, 100, 187, 188, 102, 103, 10, + 236, 317, 248, 360, 318, 342, 343, 166, 249, 21, + 250, 172, 251, 287, 90, 185, 185, 185, 175, 286, + 21, 288, 24, 183, 184, 26, 233, 292, 189, 190, + 218, 192, 193, 29, 194, 195, 196, 197, 198, 361, + 280, 151, 283, 229, 230, 231, 49, 33, 152, 164, + 50, 164, 220, 320, 321, 86, 274, 164, 11, 152, + 326, 226, 11, 37, 185, 185, 185, 308, 47, 315, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 297, + 13, 14, 307, 330, 255, 298, 258, 299, 308, 300, + 154, 157, 63, 253, 65, 233, 169, 155, 159, 259, + 260, 310, 66, 171, 67, 265, 311, 308, 73, 74, + 75, 68, 308, 72, 76, 359, 77, 78, 79, 80, + 86, 81, 82, 347, 87, 348, 346, 381, 84, 308, + 358, 308, 355, 308, 237, 86, 147, 241, 148, 87, + 291, 86, 364, 86, -29, 87, 357, 87, -29, 327, + 225, 225, 356, 239, 149, 183, 184, 378, 365, 349, + 51, 52, 302, 303, 304, 305, 104, 105, 106, 30, + 31, 32, 164, 90, 377, 313, 156, 331, 332, 333, + 334, 179, 270, 271, 34, 35, 36, 164, 95, 352, + 384, 69, 70, 387, 69, 83, 168, 164, 176, 183, + 184, 178, 109, 110, 160, 207, 161, 270, 271, 162, + 114, 115, 116, 117, 367, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 208, 199, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 214, 86, 179, 180, 181, + 182, 216, 205, 109, 110, 160, 235, 161, 183, 184, + 162, 114, 115, 116, 117, 243, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 50, 245, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 246, 266, 252, 205, + 277, 269, 272, 273, 275, 276, 308, 278, 163, 109, + 110, 111, 279, 112, 217, 281, 113, 114, 115, 116, + 117, 226, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 284, 108, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 109, 110, 111, 285, 112, 289, 293, 113, + 114, 115, 116, 117, 294, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 295, 203, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 109, 110, 111, 296, 112, + 301, 306, 113, 114, 115, 116, 117, 314, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 309, 205, 127, 128, 129, 130, 131, 132, 133, 134, 135, 109, 110, - 160, 290, 161, 170, 62, 162, 114, 115, 116, 117, - 0, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 0, 0, 127, 128, 129, 130, 131, 132, 133, 134, - 135 + 111, 312, 112, 316, 319, 113, 114, 115, 116, 117, + 322, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 323, 211, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 109, 110, 111, 324, 112, 325, 329, 113, 114, + 115, 116, 117, 335, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 336, 341, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 109, 110, 111, 337, 112, 338, + 340, 113, 114, 115, 116, 117, 344, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 345, 353, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 109, 110, 160, + 351, 161, 354, 362, 162, 114, 115, 116, 117, 363, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 368, + 369, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 370, 371, 179, 180, 181, 182, 109, 110, 160, 372, + 161, 373, 374, 162, 114, 115, 116, 117, 375, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 376, 379, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 380, + 382, 383, 180, 181, 182, 109, 110, 160, 385, 161, + 386, 388, 162, 114, 115, 116, 117, 282, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 38, 202, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 268, 150, + 109, 110, 160, 182, 161, 350, 201, 162, 114, 115, + 116, 117, 290, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 170, 64, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 109, 110, 160, 0, 161, 366, 0, + 162, 114, 115, 116, 117, 0, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 0, 0, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 109, 110, 160, 0, + 161, 0, 0, 162, 114, 115, 116, 117, 0, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 0, 0, + 127, 128, 129, 130, 131, 132, 133, 134, 135 }; static const yytype_int16 yycheck[] = { - 76, 95, 78, 25, 26, 137, 28, 29, 30, 148, - 116, 170, 34, 158, 108, 74, 75, 172, 77, 307, - 96, 153, 145, 146, 100, 154, 155, 73, 180, 181, - 182, 163, 169, 170, 136, 12, 3, 163, 157, 158, - 310, 311, 3, 10, 146, 187, 188, 3, 9, 72, - 169, 170, 340, 76, 10, 78, 3, 79, 80, 78, - 166, 62, 63, 10, 5, 111, 112, 113, 13, 14, - 11, 4, 112, 113, 344, 8, 3, 96, 230, 24, - 102, 100, 59, 60, 239, 3, 4, 229, 164, 231, - 222, 114, 115, 0, 117, 118, 222, 120, 121, 122, - 123, 124, 3, 9, 5, 8, 225, 4, 9, 203, - 212, 205, 3, 10, 160, 161, 162, 211, 270, 271, - 160, 161, 162, 5, 93, 94, 4, 9, 3, 261, - 99, 93, 94, 53, 180, 5, 182, 99, 53, 9, - 295, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 4, 5, 4, 4, 4, 9, 179, 233, 10, 10, - 10, 183, 184, 46, 47, 48, 8, 16, 191, 52, - 19, 54, 55, 56, 57, 334, 59, 60, 4, 46, - 57, 4, 59, 60, 10, 52, 318, 54, 333, 56, - 46, 4, 331, 4, 3, 4, 52, 334, 54, 10, - 56, 4, 5, 332, 4, 5, 9, 4, 331, 9, - 4, 287, 3, 4, 333, 334, 59, 60, 350, 325, - 49, 50, 374, 4, 4, 248, 249, 250, 251, 5, - 6, 7, 326, 37, 366, 9, 4, 259, 297, 298, - 299, 300, 48, 49, 50, 46, 4, 341, 3, 3, - 382, 327, 3, 385, 13, 14, 15, 351, 17, 3, - 3, 20, 21, 22, 23, 24, 4, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 352, 4, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 35, 3, 48, - 49, 50, 51, 3, 5, 13, 14, 15, 4, 17, - 59, 60, 20, 21, 22, 23, 24, 3, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 8, 3, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 15, 16, - 17, 3, 18, 19, 20, 4, 4, 3, 10, 4, - 58, 13, 14, 15, 36, 17, 4, 4, 20, 21, + 78, 95, 80, 27, 28, 137, 30, 31, 32, 148, + 116, 170, 36, 73, 108, 158, 76, 77, 96, 79, + 172, 153, 100, 180, 181, 182, 145, 146, 154, 155, + 307, 163, 169, 170, 157, 158, 12, 187, 188, 75, + 136, 163, 14, 3, 3, 5, 169, 170, 74, 9, + 146, 80, 78, 25, 80, 112, 113, 81, 82, 0, + 166, 16, 46, 340, 19, 310, 311, 96, 52, 9, + 54, 100, 56, 230, 3, 111, 112, 113, 102, 229, + 9, 231, 8, 59, 60, 9, 164, 239, 114, 115, + 222, 117, 118, 3, 120, 121, 122, 123, 124, 344, + 222, 3, 225, 160, 161, 162, 4, 3, 10, 203, + 8, 205, 3, 270, 271, 5, 212, 211, 53, 10, + 3, 11, 53, 8, 160, 161, 162, 10, 4, 261, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 46, + 62, 63, 4, 295, 180, 52, 182, 54, 10, 56, + 93, 94, 4, 179, 4, 233, 99, 93, 94, 183, + 184, 4, 4, 99, 4, 191, 4, 10, 46, 47, + 48, 4, 10, 4, 52, 334, 54, 55, 56, 57, + 5, 59, 60, 4, 9, 4, 318, 4, 37, 10, + 333, 10, 331, 10, 4, 5, 4, 334, 46, 9, + 4, 5, 4, 5, 5, 9, 332, 9, 9, 287, + 333, 334, 331, 57, 4, 59, 60, 374, 350, 325, + 3, 4, 248, 249, 250, 251, 5, 6, 7, 15, + 16, 17, 326, 3, 366, 259, 3, 297, 298, 299, + 300, 48, 49, 50, 18, 19, 20, 341, 3, 327, + 382, 3, 4, 385, 3, 4, 3, 351, 3, 59, + 60, 4, 13, 14, 15, 4, 17, 49, 50, 20, + 21, 22, 23, 24, 352, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 3, 35, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 3, 5, 48, 49, 50, + 51, 4, 3, 13, 14, 15, 4, 17, 59, 60, + 20, 21, 22, 23, 24, 3, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 8, 4, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 3, 36, 4, 3, + 10, 4, 4, 4, 4, 4, 10, 4, 58, 13, + 14, 15, 4, 17, 12, 4, 20, 21, 22, 23, + 24, 11, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 3, 3, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 13, 14, 15, 4, 17, 4, 4, 20, + 21, 22, 23, 24, 4, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 57, 3, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 13, 14, 15, 4, 17, + 4, 4, 20, 21, 22, 23, 24, 4, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 10, 3, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 13, 14, + 15, 10, 17, 16, 16, 20, 21, 22, 23, 24, + 4, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 4, 3, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 13, 14, 15, 4, 17, 55, 4, 20, 21, 22, 23, 24, 4, 26, 27, 28, 29, 30, 31, 32, 33, 34, 4, 3, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 13, 14, 15, 4, 17, 10, - 4, 20, 21, 22, 23, 24, 12, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 4, 3, 37, 38, + 42, 43, 44, 45, 13, 14, 15, 4, 17, 4, + 4, 20, 21, 22, 23, 24, 4, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 4, 4, 37, 38, 39, 40, 41, 42, 43, 44, 45, 13, 14, 15, - 4, 17, 11, 3, 20, 21, 22, 23, 24, 4, + 3, 17, 4, 16, 20, 21, 22, 23, 24, 3, 26, 27, 28, 29, 30, 31, 32, 33, 34, 4, - 3, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 13, 14, 15, 4, 17, 4, 57, 20, 21, 22, - 23, 24, 4, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 4, 3, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 13, 14, 15, 4, 17, 10, 10, - 20, 21, 22, 23, 24, 4, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 16, 3, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 13, 14, 15, 4, - 17, 16, 4, 20, 21, 22, 23, 24, 4, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 55, 4, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 13, - 14, 15, 4, 17, 4, 4, 20, 21, 22, 23, - 24, 4, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 4, 4, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 4, 3, 48, 49, 50, 51, 13, 14, - 15, 4, 17, 4, 3, 20, 21, 22, 23, 24, - 16, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 4, 4, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 4, 4, 4, 49, 50, 51, 13, 14, 15, - 4, 17, 50, 4, 20, 21, 22, 23, 24, 4, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 3, - 19, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 4, 3, 13, 14, 15, 51, 17, 18, 4, 20, - 21, 22, 23, 24, 19, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 4, 22, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 13, 14, 15, 224, 17, - 18, 92, 20, 21, 22, 23, 24, 126, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 127, 201, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 13, 14, - 15, 233, 17, 99, 39, 20, 21, 22, 23, 24, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, - -1, -1, 37, 38, 39, 40, 41, 42, 43, 44, - 45 + 4, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 4, 4, 48, 49, 50, 51, 13, 14, 15, 4, + 17, 4, 50, 20, 21, 22, 23, 24, 4, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 4, 3, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 4, + 19, 3, 49, 50, 51, 13, 14, 15, 19, 17, + 4, 4, 20, 21, 22, 23, 24, 224, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 22, 127, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 201, 92, + 13, 14, 15, 51, 17, 18, 126, 20, 21, 22, + 23, 24, 233, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 99, 41, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 13, 14, 15, -1, 17, 18, -1, + 20, 21, 22, 23, 24, -1, 26, 27, 28, 29, + 30, 31, 32, 33, 34, -1, -1, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 13, 14, 15, -1, + 17, -1, -1, 20, 21, 22, 23, 24, -1, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + 37, 38, 39, 40, 41, 42, 43, 44, 45 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1034,13 +1036,13 @@ static const yytype_uint8 yystos[] = { 0, 131, 134, 135, 3, 125, 126, 128, 129, 130, 0, 53, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 9, 127, 8, 76, 127, 127, 3, 125, 125, - 125, 3, 128, 128, 128, 8, 74, 124, 127, 76, - 76, 76, 76, 76, 133, 4, 76, 4, 8, 3, - 4, 108, 110, 111, 112, 113, 114, 116, 119, 122, - 123, 4, 133, 4, 4, 4, 4, 3, 4, 132, - 4, 46, 47, 48, 52, 54, 55, 56, 57, 59, - 60, 4, 37, 9, 90, 91, 5, 9, 86, 88, + 69, 9, 90, 91, 8, 76, 9, 127, 127, 3, + 125, 125, 125, 3, 128, 128, 128, 8, 74, 124, + 127, 76, 76, 76, 76, 76, 133, 4, 76, 4, + 8, 3, 4, 108, 110, 111, 112, 113, 114, 116, + 119, 122, 123, 4, 133, 4, 4, 4, 4, 3, + 4, 132, 4, 46, 47, 48, 52, 54, 55, 56, + 57, 59, 60, 4, 37, 90, 5, 9, 86, 88, 3, 80, 91, 90, 90, 3, 88, 99, 109, 90, 88, 109, 76, 76, 5, 6, 7, 87, 3, 13, 14, 15, 17, 20, 21, 22, 23, 24, 26, 27, @@ -1611,333 +1613,333 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio switch (yytype) { case 5: /* NAT */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1617 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1619 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 6: /* INT */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1623 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1625 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 7: /* FLOAT */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1629 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1631 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 8: /* TEXT */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1635 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1637 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 9: /* VAR */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1641 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1643 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 35: /* OFFSET_EQ_NAT */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1647 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1649 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 36: /* ALIGN_EQ_NAT */ -#line 238 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ {} -#line 1653 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1655 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 74: /* non_empty_text_list */ -#line 261 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_text_list(parser->allocator, &((*yyvaluep).text_list)); } -#line 1659 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1661 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 75: /* text_list */ -#line 261 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_text_list(parser->allocator, &((*yyvaluep).text_list)); } -#line 1665 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1667 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 76: /* quoted_text */ -#line 260 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 262 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); } -#line 1671 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1673 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 77: /* value_type_list */ -#line 262 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 264 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_type_vector(parser->allocator, &((*yyvaluep).types)); } -#line 1677 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1679 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 80: /* func_type */ -#line 252 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 254 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_func_signature(parser->allocator, &((*yyvaluep).func_sig)); } -#line 1683 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1685 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 81: /* func_sig */ -#line 252 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 254 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_func_signature(parser->allocator, &((*yyvaluep).func_sig)); } -#line 1689 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1691 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 85: /* type_use */ -#line 264 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 266 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_var(parser->allocator, &((*yyvaluep).var)); } -#line 1695 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1697 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 87: /* literal */ -#line 258 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 260 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).literal).text); } -#line 1701 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1703 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 88: /* var */ -#line 264 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 266 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_var(parser->allocator, &((*yyvaluep).var)); } -#line 1707 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1709 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 89: /* var_list */ -#line 263 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 265 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_var_vector_and_elements(parser->allocator, &((*yyvaluep).vars)); } -#line 1713 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1715 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 90: /* bind_var_opt */ -#line 260 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 262 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); } -#line 1719 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1721 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 91: /* bind_var */ -#line 260 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 262 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); } -#line 1725 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1727 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 92: /* labeling_opt */ -#line 260 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 262 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); } -#line 1731 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1733 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 95: /* instr */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1737 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1739 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 96: /* plain_instr */ -#line 248 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 250 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr(parser->allocator, ((*yyvaluep).expr)); } -#line 1743 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1745 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 97: /* block_instr */ -#line 248 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 250 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr(parser->allocator, ((*yyvaluep).expr)); } -#line 1749 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1751 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 98: /* block */ -#line 239 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 241 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_block(parser->allocator, &((*yyvaluep).block)); } -#line 1755 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1757 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 99: /* expr */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1761 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1763 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 100: /* expr1 */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1767 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1769 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 101: /* if_ */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1773 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1775 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 102: /* instr_list */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1779 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1781 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 103: /* expr_list */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1785 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1787 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 104: /* const_expr */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1791 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1793 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 105: /* func_fields */ -#line 250 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_func_fields(parser->allocator, ((*yyvaluep).func_fields)); } -#line 1797 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1799 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 106: /* func_body */ -#line 250 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_func_fields(parser->allocator, ((*yyvaluep).func_fields)); } -#line 1803 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1805 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 107: /* func_info */ -#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 253 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_func(parser->allocator, ((*yyvaluep).func)); wasm_free(parser->allocator, ((*yyvaluep).func)); } -#line 1809 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1811 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 108: /* func */ -#line 245 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 247 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_exported_func(parser->allocator, &((*yyvaluep).exported_func)); } -#line 1815 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1817 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 109: /* offset */ -#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 251 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_expr_list(parser->allocator, ((*yyvaluep).expr_list).first); } -#line 1821 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1823 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 110: /* elem */ -#line 243 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 245 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_elem_segment(parser->allocator, &((*yyvaluep).elem_segment)); } -#line 1827 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1829 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 111: /* table */ -#line 247 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 249 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_exported_table(parser->allocator, &((*yyvaluep).exported_table)); } -#line 1833 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1835 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 112: /* data */ -#line 255 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 257 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_data_segment(parser->allocator, &((*yyvaluep).data_segment)); } -#line 1839 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1841 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 113: /* memory */ -#line 246 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 248 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_exported_memory(parser->allocator, &((*yyvaluep).exported_memory)); } -#line 1845 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1847 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 115: /* import_kind */ -#line 254 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 256 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_import(parser->allocator, ((*yyvaluep).import)); wasm_free(parser->allocator, ((*yyvaluep).import)); } -#line 1851 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1853 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 116: /* import */ -#line 254 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 256 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_import(parser->allocator, ((*yyvaluep).import)); wasm_free(parser->allocator, ((*yyvaluep).import)); } -#line 1857 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1859 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 117: /* inline_import */ -#line 254 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 256 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_import(parser->allocator, ((*yyvaluep).import)); wasm_free(parser->allocator, ((*yyvaluep).import)); } -#line 1863 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1865 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 118: /* export_kind */ -#line 244 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 246 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_export(parser->allocator, &((*yyvaluep).export_)); } -#line 1869 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1871 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 119: /* export */ -#line 244 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 246 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_export(parser->allocator, &((*yyvaluep).export_)); } -#line 1875 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1877 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 122: /* type_def */ -#line 253 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 255 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_func_type(parser->allocator, &((*yyvaluep).func_type)); } -#line 1881 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1883 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 123: /* start */ -#line 264 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 266 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_var(parser->allocator, &((*yyvaluep).var)); } -#line 1887 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1889 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 124: /* module_fields */ -#line 256 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 258 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_module(parser->allocator, ((*yyvaluep).module)); wasm_free(parser->allocator, ((*yyvaluep).module)); } -#line 1893 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1895 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 125: /* raw_module */ -#line 257 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 259 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_raw_module(parser->allocator, &((*yyvaluep).raw_module)); } -#line 1899 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1901 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 126: /* module */ -#line 256 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 258 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_module(parser->allocator, ((*yyvaluep).module)); wasm_free(parser->allocator, ((*yyvaluep).module)); } -#line 1905 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1907 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 127: /* script_var_opt */ -#line 260 "src/wasm-ast-parser.y" /* yacc.c:1257 */ - { wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); } -#line 1911 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 266 "src/wasm-ast-parser.y" /* yacc.c:1257 */ + { wasm_destroy_var(parser->allocator, &((*yyvaluep).var)); } +#line 1913 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 129: /* assertion */ -#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 242 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_command(parser->allocator, ((*yyvaluep).command)); wasm_free(parser->allocator, ((*yyvaluep).command)); } -#line 1917 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1919 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 130: /* cmd */ -#line 240 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 242 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_command(parser->allocator, ((*yyvaluep).command)); wasm_free(parser->allocator, ((*yyvaluep).command)); } -#line 1923 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1925 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 131: /* cmd_list */ -#line 241 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 243 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_command_vector_and_elements(parser->allocator, &((*yyvaluep).commands)); } -#line 1929 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1931 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 133: /* const_list */ -#line 242 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 244 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_const_vector(parser->allocator, &((*yyvaluep).consts)); } -#line 1935 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1937 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; case 134: /* script */ -#line 259 "src/wasm-ast-parser.y" /* yacc.c:1257 */ +#line 261 "src/wasm-ast-parser.y" /* yacc.c:1257 */ { wasm_destroy_script(&((*yyvaluep).script)); } -#line 1941 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ +#line 1943 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */ break; @@ -2229,18 +2231,18 @@ yyreduce: switch (yyn) { case 2: -#line 277 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 279 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmTextListNode* node = new_text_list_node(parser->allocator); DUPTEXT(node->text, (yyvsp[0].text)); node->next = NULL; (yyval.text_list).first = (yyval.text_list).last = node; } -#line 2240 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2242 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 3: -#line 283 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 285 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.text_list) = (yyvsp[-1].text_list); WasmTextListNode* node = new_text_list_node(parser->allocator); @@ -2249,17 +2251,17 @@ yyreduce: (yyval.text_list).last->next = node; (yyval.text_list).last = node; } -#line 2253 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2255 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 4: -#line 293 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 295 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.text_list).first = (yyval.text_list).last = NULL; } -#line 2259 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2261 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 6: -#line 298 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 300 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmTextListNode node; node.text = (yyvsp[0].text); @@ -2273,130 +2275,130 @@ yyreduce: (yyval.text).start = data; (yyval.text).length = size; } -#line 2277 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2279 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 7: -#line 316 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 318 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.types)); } -#line 2283 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2285 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 8: -#line 317 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 319 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.types) = (yyvsp[-1].types); wasm_append_type_value(parser->allocator, &(yyval.types), &(yyvsp[0].type)); } -#line 2292 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2294 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 9: -#line 323 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 325 "src/wasm-ast-parser.y" /* yacc.c:1646 */ {} -#line 2298 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2300 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 10: -#line 326 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 328 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.global)); (yyval.global).type = (yyvsp[0].type); (yyval.global).mutable_ = WASM_FALSE; } -#line 2308 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2310 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 11: -#line 331 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 333 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.global)); (yyval.global).type = (yyvsp[-1].type); (yyval.global).mutable_ = WASM_TRUE; } -#line 2318 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2320 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 12: -#line 338 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 340 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_sig) = (yyvsp[-1].func_sig); } -#line 2324 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2326 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 13: -#line 341 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 343 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.func_sig)); } -#line 2330 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2332 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 14: -#line 342 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 344 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).param_types = (yyvsp[-1].types); } -#line 2339 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2341 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 15: -#line 346 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 348 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).param_types = (yyvsp[-5].types); (yyval.func_sig).result_types = (yyvsp[-1].types); } -#line 2349 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2351 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 16: -#line 351 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 353 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).result_types = (yyvsp[-1].types); } -#line 2358 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2360 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 17: -#line 358 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 360 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.table).elem_limits = (yyvsp[-1].limits); } -#line 2364 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2366 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 18: -#line 361 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 363 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.memory).page_limits = (yyvsp[0].limits); } -#line 2370 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2372 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 19: -#line 364 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 366 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.limits).has_max = WASM_FALSE; (yyval.limits).initial = (yyvsp[0].u64); (yyval.limits).max = 0; } -#line 2380 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2382 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 20: -#line 369 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 371 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.limits).has_max = WASM_TRUE; (yyval.limits).initial = (yyvsp[-1].u64); (yyval.limits).max = (yyvsp[0].u64); } -#line 2390 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2392 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 21: -#line 376 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 378 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.var) = (yyvsp[-1].var); } -#line 2396 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2398 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 22: -#line 382 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 384 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { if (WASM_FAILED(wasm_parse_uint64((yyvsp[0].literal).text.start, (yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &(yyval.u64)))) { @@ -2405,97 +2407,97 @@ yyreduce: WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text)); } } -#line 2409 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2411 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 23: -#line 393 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 395 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.literal).type = (yyvsp[0].literal).type; DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text); } -#line 2418 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2420 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 24: -#line 397 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 399 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.literal).type = (yyvsp[0].literal).type; DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text); } -#line 2427 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2429 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 25: -#line 401 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 403 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.literal).type = (yyvsp[0].literal).type; DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text); } -#line 2436 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2438 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 26: -#line 408 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 410 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.var).loc = (yylsp[0]); (yyval.var).type = WASM_VAR_TYPE_INDEX; (yyval.var).index = (yyvsp[0].u64); } -#line 2446 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2448 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 27: -#line 413 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 415 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.var).loc = (yylsp[0]); (yyval.var).type = WASM_VAR_TYPE_NAME; DUPTEXT((yyval.var).name, (yyvsp[0].text)); } -#line 2456 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2458 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 28: -#line 420 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 422 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.vars)); } -#line 2462 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2464 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 29: -#line 421 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 423 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.vars) = (yyvsp[-1].vars); wasm_append_var_value(parser->allocator, &(yyval.vars), &(yyvsp[0].var)); } -#line 2471 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2473 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 30: -#line 427 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 429 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.text)); } -#line 2477 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2479 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 32: -#line 431 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 433 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { DUPTEXT((yyval.text), (yyvsp[0].text)); } -#line 2483 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2485 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 33: -#line 435 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 437 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.text)); } -#line 2489 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2491 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 35: -#line 440 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 442 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.u64) = 0; } -#line 2495 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2497 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 36: -#line 441 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 443 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { if (WASM_FAILED(wasm_parse_int64((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u64), WASM_PARSE_SIGNED_AND_UNSIGNED))) { @@ -2504,17 +2506,17 @@ yyreduce: WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].text))); } } -#line 2508 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2510 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 37: -#line 451 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 453 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.u32) = USE_NATURAL_ALIGNMENT; } -#line 2514 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2516 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 38: -#line 452 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 454 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { if (WASM_FAILED(wasm_parse_int32((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u32), WASM_PARSE_UNSIGNED_ONLY))) { @@ -2523,182 +2525,182 @@ yyreduce: WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].text))); } } -#line 2527 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2529 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 39: -#line 463 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 465 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = join_exprs1(&(yylsp[0]), (yyvsp[0].expr)); } -#line 2533 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2535 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 40: -#line 464 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 466 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = join_exprs1(&(yylsp[0]), (yyvsp[0].expr)); } -#line 2539 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2541 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 41: -#line 465 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 467 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[0].expr_list); } -#line 2545 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2547 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 42: -#line 468 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 470 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_unreachable_expr(parser->allocator); } -#line 2553 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2555 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 43: -#line 471 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 473 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_nop_expr(parser->allocator); } -#line 2561 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2563 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 44: -#line 474 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 476 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_drop_expr(parser->allocator); } -#line 2569 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2571 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 45: -#line 477 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 479 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_select_expr(parser->allocator); } -#line 2577 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2579 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 46: -#line 480 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 482 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_br_expr(parser->allocator); (yyval.expr)->br.var = (yyvsp[0].var); } -#line 2586 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2588 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 47: -#line 484 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 486 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_br_if_expr(parser->allocator); (yyval.expr)->br_if.var = (yyvsp[0].var); } -#line 2595 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2597 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 48: -#line 488 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 490 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_br_table_expr(parser->allocator); (yyval.expr)->br_table.targets = (yyvsp[-1].vars); (yyval.expr)->br_table.default_target = (yyvsp[0].var); } -#line 2605 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2607 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 49: -#line 493 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 495 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_return_expr(parser->allocator); } -#line 2613 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2615 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 50: -#line 496 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 498 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_call_expr(parser->allocator); (yyval.expr)->call.var = (yyvsp[0].var); } -#line 2622 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2624 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 51: -#line 500 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 502 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_call_indirect_expr(parser->allocator); (yyval.expr)->call_indirect.var = (yyvsp[0].var); } -#line 2631 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2633 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 52: -#line 504 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 506 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_get_local_expr(parser->allocator); (yyval.expr)->get_local.var = (yyvsp[0].var); } -#line 2640 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2642 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 53: -#line 508 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 510 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_set_local_expr(parser->allocator); (yyval.expr)->set_local.var = (yyvsp[0].var); } -#line 2649 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2651 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 54: -#line 512 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 514 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_tee_local_expr(parser->allocator); (yyval.expr)->tee_local.var = (yyvsp[0].var); } -#line 2658 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2660 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 55: -#line 516 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 518 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_get_global_expr(parser->allocator); (yyval.expr)->get_global.var = (yyvsp[0].var); } -#line 2667 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2669 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 56: -#line 520 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 522 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_set_global_expr(parser->allocator); (yyval.expr)->set_global.var = (yyvsp[0].var); } -#line 2676 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2678 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 57: -#line 524 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 526 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_load_expr(parser->allocator); (yyval.expr)->load.opcode = (yyvsp[-2].opcode); (yyval.expr)->load.offset = (yyvsp[-1].u64); (yyval.expr)->load.align = (yyvsp[0].u32); } -#line 2687 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2689 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 58: -#line 530 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 532 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_store_expr(parser->allocator); (yyval.expr)->store.opcode = (yyvsp[-2].opcode); (yyval.expr)->store.offset = (yyvsp[-1].u64); (yyval.expr)->store.align = (yyvsp[0].u32); } -#line 2698 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2700 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 59: -#line 536 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 538 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_const_expr(parser->allocator); (yyval.expr)->const_.loc = (yylsp[-1]); @@ -2711,150 +2713,150 @@ yyreduce: } wasm_free(parser->allocator, (char*)(yyvsp[0].literal).text.start); } -#line 2715 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2717 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 60: -#line 548 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 550 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_unary_expr(parser->allocator); (yyval.expr)->unary.opcode = (yyvsp[0].opcode); } -#line 2724 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2726 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 61: -#line 552 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 554 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_binary_expr(parser->allocator); (yyval.expr)->binary.opcode = (yyvsp[0].opcode); } -#line 2733 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2735 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 62: -#line 556 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 558 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_compare_expr(parser->allocator); (yyval.expr)->compare.opcode = (yyvsp[0].opcode); } -#line 2742 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2744 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 63: -#line 560 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 562 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_convert_expr(parser->allocator); (yyval.expr)->convert.opcode = (yyvsp[0].opcode); } -#line 2751 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2753 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 64: -#line 564 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 566 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_current_memory_expr(parser->allocator); } -#line 2759 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2761 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 65: -#line 567 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 569 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_grow_memory_expr(parser->allocator); } -#line 2767 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2769 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 66: -#line 572 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 574 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_block_expr(parser->allocator); (yyval.expr)->block = (yyvsp[-1].block); (yyval.expr)->block.label = (yyvsp[-2].text); } -#line 2777 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2779 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 67: -#line 577 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 579 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_loop_expr(parser->allocator); (yyval.expr)->loop = (yyvsp[-1].block); (yyval.expr)->loop.label = (yyvsp[-2].text); } -#line 2787 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2789 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 68: -#line 582 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 584 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_if_expr(parser->allocator); (yyval.expr)->if_.true_ = (yyvsp[-1].block); (yyval.expr)->if_.true_.label = (yyvsp[-2].text); } -#line 2797 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2799 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 69: -#line 587 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 589 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = wasm_new_if_expr(parser->allocator); (yyval.expr)->if_.true_ = (yyvsp[-3].block); (yyval.expr)->if_.true_.label = (yyvsp[-4].text); (yyval.expr)->if_.false_ = (yyvsp[-1].expr_list).first; } -#line 2808 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2810 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 70: -#line 595 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 597 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.block)); (yyval.block).sig = (yyvsp[-1].types); (yyval.block).first = (yyvsp[0].expr_list).first; } -#line 2818 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2820 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 71: -#line 603 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 605 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[-1].expr_list); } -#line 2824 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2826 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 72: -#line 607 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 609 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = join_exprs2(&(yylsp[-1]), &(yyvsp[0].expr_list), (yyvsp[-1].expr)); } -#line 2832 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2834 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 73: -#line 610 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 612 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_block_expr(parser->allocator); expr->block = (yyvsp[0].block); expr->block.label = (yyvsp[-1].text); (yyval.expr_list) = join_exprs1(&(yylsp[-2]), expr); } -#line 2843 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2845 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 74: -#line 616 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 618 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_loop_expr(parser->allocator); expr->loop = (yyvsp[0].block); expr->loop.label = (yyvsp[-1].text); (yyval.expr_list) = join_exprs1(&(yylsp[-2]), expr); } -#line 2854 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2856 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 75: -#line 622 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 624 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[0].expr_list); WasmExpr* if_ = (yyvsp[0].expr_list).last; @@ -2862,130 +2864,130 @@ yyreduce: if_->if_.true_.label = (yyvsp[-2].text); if_->if_.true_.sig = (yyvsp[-1].types); } -#line 2866 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2868 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 76: -#line 631 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 633 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_if_expr(parser->allocator); expr->if_.true_.first = (yyvsp[-5].expr_list).first; expr->if_.false_ = (yyvsp[-1].expr_list).first; (yyval.expr_list) = join_exprs1(&(yylsp[-7]), expr); } -#line 2877 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2879 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 77: -#line 637 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 639 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_if_expr(parser->allocator); expr->if_.true_.first = (yyvsp[-1].expr_list).first; (yyval.expr_list) = join_exprs1(&(yylsp[-3]), expr); } -#line 2887 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2889 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 78: -#line 642 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 644 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_if_expr(parser->allocator); expr->if_.true_.first = (yyvsp[-5].expr_list).first; expr->if_.false_ = (yyvsp[-1].expr_list).first; (yyval.expr_list) = join_exprs2(&(yylsp[-8]), &(yyvsp[-8].expr_list), expr); } -#line 2898 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2900 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 79: -#line 648 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 650 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_if_expr(parser->allocator); expr->if_.true_.first = (yyvsp[-1].expr_list).first; (yyval.expr_list) = join_exprs2(&(yylsp[-4]), &(yyvsp[-4].expr_list), expr); } -#line 2908 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2910 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 80: -#line 653 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 655 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_if_expr(parser->allocator); expr->if_.true_.first = (yyvsp[-1].expr_list).first; expr->if_.false_ = (yyvsp[0].expr_list).first; (yyval.expr_list) = join_exprs2(&(yylsp[-2]), &(yyvsp[-2].expr_list), expr); } -#line 2919 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2921 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 81: -#line 659 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 661 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_if_expr(parser->allocator); expr->if_.true_.first = (yyvsp[0].expr_list).first; (yyval.expr_list) = join_exprs2(&(yylsp[-1]), &(yyvsp[-1].expr_list), expr); } -#line 2929 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2931 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 82: -#line 667 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 669 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.expr_list)); } -#line 2935 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2937 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 83: -#line 668 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 670 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list).first = (yyvsp[-1].expr_list).first; (yyvsp[-1].expr_list).last->next = (yyvsp[0].expr_list).first; (yyval.expr_list).last = (yyvsp[0].expr_list).last ? (yyvsp[0].expr_list).last : (yyvsp[-1].expr_list).last; (yyval.expr_list).size = (yyvsp[-1].expr_list).size + (yyvsp[0].expr_list).size; } -#line 2946 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2948 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 84: -#line 676 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 678 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.expr_list)); } -#line 2952 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2954 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 85: -#line 677 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 679 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list).first = (yyvsp[-1].expr_list).first; (yyvsp[-1].expr_list).last->next = (yyvsp[0].expr_list).first; (yyval.expr_list).last = (yyvsp[0].expr_list).last ? (yyvsp[0].expr_list).last : (yyvsp[-1].expr_list).last; (yyval.expr_list).size = (yyvsp[-1].expr_list).size + (yyvsp[0].expr_list).size; } -#line 2963 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2965 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 88: -#line 691 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 693 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(parser->allocator); (yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_RESULT_TYPES; (yyval.func_fields)->types = (yyvsp[-2].types); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 2974 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2976 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 89: -#line 697 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 699 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(parser->allocator); (yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_PARAM_TYPES; (yyval.func_fields)->types = (yyvsp[-2].types); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 2985 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 2987 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 90: -#line 703 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 705 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(parser->allocator); (yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_BOUND_PARAM; @@ -2994,33 +2996,33 @@ yyreduce: (yyval.func_fields)->bound_type.type = (yyvsp[-2].type); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 2998 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3000 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 91: -#line 713 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 715 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(parser->allocator); (yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_EXPRS; (yyval.func_fields)->first_expr = (yyvsp[0].expr_list).first; (yyval.func_fields)->next = NULL; } -#line 3009 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3011 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 92: -#line 719 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 721 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(parser->allocator); (yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_LOCAL_TYPES; (yyval.func_fields)->types = (yyvsp[-2].types); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3020 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3022 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 93: -#line 725 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 727 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(parser->allocator); (yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_BOUND_LOCAL; @@ -3029,11 +3031,11 @@ yyreduce: (yyval.func_fields)->bound_type.type = (yyvsp[-2].type); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3033 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3035 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 94: -#line 735 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 737 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func) = new_func(parser->allocator); WasmFuncField* field = (yyvsp[0].func_fields); @@ -3087,11 +3089,11 @@ yyreduce: field = next; } } -#line 3091 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3093 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 95: -#line 790 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 792 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); @@ -3100,11 +3102,11 @@ yyreduce: (yyval.exported_func).func->name = (yyvsp[-4].text); (yyval.exported_func).export_ = (yyvsp[-3].optional_export); } -#line 3104 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3106 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 96: -#line 799 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 801 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); @@ -3112,51 +3114,51 @@ yyreduce: (yyval.exported_func).func->decl.type_var = (yyvsp[-2].var); (yyval.exported_func).func->name = (yyvsp[-3].text); } -#line 3116 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3118 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 97: -#line 806 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 808 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); (yyval.exported_func).func->name = (yyvsp[-3].text); (yyval.exported_func).export_ = (yyvsp[-2].optional_export); } -#line 3127 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3129 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 98: -#line 813 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 815 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); (yyval.exported_func).func->name = (yyvsp[-2].text); } -#line 3137 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3139 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 99: -#line 823 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 825 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[-1].expr_list); } -#line 3145 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3147 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 101: -#line 830 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 832 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.elem_segment)); (yyval.elem_segment).table_var = (yyvsp[-3].var); (yyval.elem_segment).offset = (yyvsp[-2].expr_list).first; (yyval.elem_segment).vars = (yyvsp[-1].vars); } -#line 3156 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3158 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 102: -#line 836 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 838 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.elem_segment)); (yyval.elem_segment).table_var.loc = (yylsp[-3]); @@ -3165,22 +3167,22 @@ yyreduce: (yyval.elem_segment).offset = (yyvsp[-2].expr_list).first; (yyval.elem_segment).vars = (yyvsp[-1].vars); } -#line 3169 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3171 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 103: -#line 847 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 849 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.exported_table).table = (yyvsp[-1].table); (yyval.exported_table).table.name = (yyvsp[-3].text); (yyval.exported_table).has_elem_segment = WASM_FALSE; (yyval.exported_table).export_ = (yyvsp[-2].optional_export); } -#line 3180 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3182 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 104: -#line 854 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 856 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_const_expr(parser->allocator); expr->loc = (yylsp[-8]); @@ -3197,11 +3199,11 @@ yyreduce: (yyval.exported_table).elem_segment.vars = (yyvsp[-2].vars); (yyval.exported_table).export_ = (yyvsp[-6].optional_export); } -#line 3201 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3203 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 105: -#line 873 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 875 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.data_segment)); (yyval.data_segment).memory_var = (yyvsp[-3].var); @@ -3209,11 +3211,11 @@ yyreduce: dup_text_list(parser->allocator, &(yyvsp[-1].text_list), &(yyval.data_segment).data, &(yyval.data_segment).size); wasm_destroy_text_list(parser->allocator, &(yyvsp[-1].text_list)); } -#line 3213 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3215 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 106: -#line 880 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 882 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.data_segment)); (yyval.data_segment).memory_var.loc = (yylsp[-3]); @@ -3223,11 +3225,11 @@ yyreduce: dup_text_list(parser->allocator, &(yyvsp[-1].text_list), &(yyval.data_segment).data, &(yyval.data_segment).size); wasm_destroy_text_list(parser->allocator, &(yyvsp[-1].text_list)); } -#line 3227 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3229 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 107: -#line 892 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 894 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_memory)); (yyval.exported_memory).memory = (yyvsp[-1].memory); @@ -3235,11 +3237,11 @@ yyreduce: (yyval.exported_memory).has_data_segment = WASM_FALSE; (yyval.exported_memory).export_ = (yyvsp[-2].optional_export); } -#line 3239 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3241 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 108: -#line 899 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 901 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_const_expr(parser->allocator); expr->loc = (yylsp[-7]); @@ -3260,11 +3262,11 @@ yyreduce: (yyval.exported_memory).memory.page_limits.has_max = WASM_TRUE; (yyval.exported_memory).export_ = (yyvsp[-5].optional_export); } -#line 3264 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3266 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 109: -#line 920 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 922 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WasmExpr* expr = wasm_new_const_expr(parser->allocator); expr->loc = (yylsp[-6]); @@ -3285,11 +3287,11 @@ yyreduce: (yyval.exported_memory).memory.page_limits.has_max = WASM_TRUE; (yyval.exported_memory).export_.has_export = WASM_FALSE; } -#line 3289 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3291 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 110: -#line 943 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 945 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_global)); (yyval.exported_global).global = (yyvsp[-2].global); @@ -3297,11 +3299,11 @@ yyreduce: (yyval.exported_global).global.init_expr = (yyvsp[-1].expr_list).first; (yyval.exported_global).export_ = (yyvsp[-3].optional_export); } -#line 3301 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3303 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 111: -#line 950 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 952 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.exported_global)); (yyval.exported_global).global = (yyvsp[-2].global); @@ -3309,11 +3311,11 @@ yyreduce: (yyval.exported_global).global.init_expr = (yyvsp[-1].expr_list).first; (yyval.exported_global).export_.has_export = WASM_FALSE; } -#line 3313 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3315 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 112: -#line 963 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 965 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(parser->allocator); (yyval.import)->kind = WASM_EXTERNAL_KIND_FUNC; @@ -3321,65 +3323,65 @@ yyreduce: (yyval.import)->func.decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE; (yyval.import)->func.decl.type_var = (yyvsp[-1].var); } -#line 3325 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3327 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 113: -#line 970 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 972 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(parser->allocator); (yyval.import)->kind = WASM_EXTERNAL_KIND_FUNC; (yyval.import)->func.name = (yyvsp[-2].text); (yyval.import)->func.decl.sig = (yyvsp[-1].func_sig); } -#line 3336 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3338 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 114: -#line 976 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 978 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(parser->allocator); (yyval.import)->kind = WASM_EXTERNAL_KIND_TABLE; (yyval.import)->table = (yyvsp[-1].table); (yyval.import)->table.name = (yyvsp[-2].text); } -#line 3347 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3349 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 115: -#line 982 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 984 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(parser->allocator); (yyval.import)->kind = WASM_EXTERNAL_KIND_MEMORY; (yyval.import)->memory = (yyvsp[-1].memory); (yyval.import)->memory.name = (yyvsp[-2].text); } -#line 3358 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3360 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 116: -#line 988 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 990 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(parser->allocator); (yyval.import)->kind = WASM_EXTERNAL_KIND_GLOBAL; (yyval.import)->global = (yyvsp[-1].global); (yyval.import)->global.name = (yyvsp[-2].text); } -#line 3369 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3371 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 117: -#line 996 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 998 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-1].import); (yyval.import)->module_name = (yyvsp[-3].text); (yyval.import)->field_name = (yyvsp[-2].text); } -#line 3379 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3381 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 118: -#line 1001 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1003 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = WASM_EXTERNAL_KIND_FUNC; @@ -3387,165 +3389,165 @@ yyreduce: (yyval.import)->func.decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE; (yyval.import)->func.decl.type_var = (yyvsp[-1].var); } -#line 3391 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3393 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 119: -#line 1008 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1010 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = WASM_EXTERNAL_KIND_FUNC; (yyval.import)->func.name = (yyvsp[-3].text); (yyval.import)->func.decl.sig = (yyvsp[-1].func_sig); } -#line 3402 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3404 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 120: -#line 1014 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1016 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = WASM_EXTERNAL_KIND_TABLE; (yyval.import)->table = (yyvsp[-1].table); (yyval.import)->table.name = (yyvsp[-3].text); } -#line 3413 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3415 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 121: -#line 1020 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1022 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = WASM_EXTERNAL_KIND_MEMORY; (yyval.import)->memory = (yyvsp[-1].memory); (yyval.import)->memory.name = (yyvsp[-3].text); } -#line 3424 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3426 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 122: -#line 1026 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1028 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = WASM_EXTERNAL_KIND_GLOBAL; (yyval.import)->global = (yyvsp[-1].global); (yyval.import)->global.name = (yyvsp[-3].text); } -#line 3435 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3437 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 123: -#line 1035 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1037 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(parser->allocator); (yyval.import)->module_name = (yyvsp[-2].text); (yyval.import)->field_name = (yyvsp[-1].text); } -#line 3445 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3447 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 124: -#line 1043 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1045 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = WASM_EXTERNAL_KIND_FUNC; (yyval.export_).var = (yyvsp[-1].var); } -#line 3455 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3457 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 125: -#line 1048 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1050 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = WASM_EXTERNAL_KIND_TABLE; (yyval.export_).var = (yyvsp[-1].var); } -#line 3465 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3467 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 126: -#line 1053 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1055 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = WASM_EXTERNAL_KIND_MEMORY; (yyval.export_).var = (yyvsp[-1].var); } -#line 3475 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3477 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 127: -#line 1058 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1060 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = WASM_EXTERNAL_KIND_GLOBAL; (yyval.export_).var = (yyvsp[-1].var); } -#line 3485 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3487 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 128: -#line 1065 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1067 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.export_) = (yyvsp[-1].export_); (yyval.export_).name = (yyvsp[-2].text); } -#line 3494 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3496 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 129: -#line 1072 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1074 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.optional_export)); (yyval.optional_export).has_export = WASM_FALSE; } -#line 3503 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3505 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 131: -#line 1079 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1081 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.optional_export)); (yyval.optional_export).has_export = WASM_TRUE; (yyval.optional_export).export_.name = (yyvsp[-1].text); } -#line 3513 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3515 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 132: -#line 1090 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1092 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.func_type)); (yyval.func_type).sig = (yyvsp[-1].func_sig); } -#line 3522 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3524 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 133: -#line 1094 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1096 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.func_type).name = (yyvsp[-2].text); (yyval.func_type).sig = (yyvsp[-1].func_sig); } -#line 3531 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3533 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 134: -#line 1101 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1103 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.var) = (yyvsp[-1].var); } -#line 3537 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3539 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 135: -#line 1105 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1107 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = new_module(parser->allocator); } -#line 3545 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3547 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 136: -#line 1108 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1110 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3554,11 +3556,11 @@ yyreduce: &field->func_type); INSERT_BINDING((yyval.module), func_type, func_types, (yylsp[0]), (yyvsp[0].func_type).name); } -#line 3558 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3560 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 137: -#line 1116 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1118 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3567,11 +3569,11 @@ yyreduce: INSERT_BINDING((yyval.module), global, globals, (yylsp[0]), (yyvsp[0].exported_global).global.name); APPEND_INLINE_EXPORT((yyval.module), GLOBAL, (yylsp[0]), (yyvsp[0].exported_global), (yyval.module)->globals.size - 1); } -#line 3571 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3573 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 138: -#line 1124 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1126 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3589,11 +3591,11 @@ yyreduce: } } -#line 3593 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3595 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 139: -#line 1141 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1143 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3610,11 +3612,11 @@ yyreduce: &data_segment_field->data_segment); } } -#line 3614 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3616 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 140: -#line 1157 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1159 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3626,11 +3628,11 @@ yyreduce: APPEND_INLINE_EXPORT((yyval.module), FUNC, (yylsp[0]), (yyvsp[0].exported_func), (yyval.module)->funcs.size - 1); wasm_free(parser->allocator, (yyvsp[0].exported_func).func); } -#line 3630 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3632 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 141: -#line 1168 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1170 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3638,11 +3640,11 @@ yyreduce: APPEND_ITEM_TO_VECTOR((yyval.module), ElemSegment, elem_segment, elem_segments, &field->elem_segment); } -#line 3642 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3644 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 142: -#line 1175 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1177 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3650,22 +3652,22 @@ yyreduce: APPEND_ITEM_TO_VECTOR((yyval.module), DataSegment, data_segment, data_segments, &field->data_segment); } -#line 3654 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3656 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 143: -#line 1182 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1184 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; APPEND_FIELD_TO_LIST((yyval.module), field, START, start, (yylsp[0]), (yyvsp[0].var)); (yyval.module)->start = &field->start; } -#line 3665 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3667 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 144: -#line 1188 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1190 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field; @@ -3706,11 +3708,11 @@ yyreduce: wasm_free(parser->allocator, (yyvsp[0].import)); APPEND_ITEM_TO_VECTOR((yyval.module), Import, import, imports, &field->import); } -#line 3710 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3712 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 145: -#line 1228 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1230 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module)); @@ -3718,16 +3720,16 @@ yyreduce: APPEND_ITEM_TO_VECTOR((yyval.module), Export, export, exports, &field->export_); INSERT_BINDING((yyval.module), export, exports, (yylsp[0]), (yyvsp[0].export_).name); } -#line 3722 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3724 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 146: -#line 1238 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1240 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.raw_module).type = WASM_RAW_MODULE_TYPE_TEXT; (yyval.raw_module).text = (yyvsp[-1].module); (yyval.raw_module).text->name = (yyvsp[-2].text); - (yyval.raw_module).loc = (yylsp[-3]); + (yyval.raw_module).text->loc = (yylsp[-3]); /* resolve func type variables where the signature was not specified * explicitly */ @@ -3745,23 +3747,23 @@ yyreduce: } } } -#line 3749 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3751 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 147: -#line 1260 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1262 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.raw_module).type = WASM_RAW_MODULE_TYPE_BINARY; (yyval.raw_module).binary.name = (yyvsp[-2].text); - (yyval.raw_module).loc = (yylsp[-3]); + (yyval.raw_module).binary.loc = (yylsp[-3]); dup_text_list(parser->allocator, &(yyvsp[-1].text_list), &(yyval.raw_module).binary.data, &(yyval.raw_module).binary.size); wasm_destroy_text_list(parser->allocator, &(yyvsp[-1].text_list)); } -#line 3761 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3763 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 148: -#line 1270 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1272 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { if ((yyvsp[0].raw_module).type == WASM_RAW_MODULE_TYPE_TEXT) { (yyval.module) = (yyvsp[0].raw_module).text; @@ -3770,7 +3772,7 @@ yyreduce: (yyval.module) = new_module(parser->allocator); WasmReadBinaryOptions options = WASM_READ_BINARY_OPTIONS_DEFAULT; BinaryErrorCallbackData user_data; - user_data.loc = &(yyvsp[0].raw_module).loc; + user_data.loc = &(yyvsp[0].raw_module).binary.loc; user_data.lexer = lexer; user_data.parser = parser; WasmBinaryErrorHandler error_handler; @@ -3780,163 +3782,172 @@ yyreduce: &options, &error_handler, (yyval.module)); wasm_free(parser->allocator, (yyvsp[0].raw_module).binary.data); (yyval.module)->name = (yyvsp[0].raw_module).binary.name; + (yyval.module)->loc = (yyvsp[0].raw_module).binary.loc; } } -#line 3786 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3789 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 149: -#line 1295 "src/wasm-ast-parser.y" /* yacc.c:1646 */ - { WASM_ZERO_MEMORY((yyval.text)); } -#line 3792 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 1298 "src/wasm-ast-parser.y" /* yacc.c:1646 */ + { + WASM_ZERO_MEMORY((yyval.var)); + (yyval.var).type = WASM_VAR_TYPE_INDEX; + (yyval.var).index = INVALID_VAR_INDEX; + } +#line 3799 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 150: -#line 1296 "src/wasm-ast-parser.y" /* yacc.c:1646 */ - { DUPTEXT((yyval.text), (yyvsp[0].text)); } -#line 3798 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 1303 "src/wasm-ast-parser.y" /* yacc.c:1646 */ + { + WASM_ZERO_MEMORY((yyval.var)); + (yyval.var).type = WASM_VAR_TYPE_NAME; + DUPTEXT((yyval.var).name, (yyvsp[0].text)); + } +#line 3809 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 151: -#line 1300 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1311 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.action)); (yyval.action).loc = (yylsp[-4]); - (yyval.action).module_var_name = (yyvsp[-3].text); + (yyval.action).module_var = (yyvsp[-3].var); (yyval.action).type = WASM_ACTION_TYPE_INVOKE; (yyval.action).invoke.name = (yyvsp[-2].text); (yyval.action).invoke.args = (yyvsp[-1].consts); } -#line 3811 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3822 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 152: -#line 1308 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1319 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.action)); (yyval.action).loc = (yylsp[-3]); - (yyval.action).module_var_name = (yyvsp[-2].text); + (yyval.action).module_var = (yyvsp[-2].var); (yyval.action).type = WASM_ACTION_TYPE_GET; (yyval.action).invoke.name = (yyvsp[-1].text); } -#line 3823 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3834 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 153: -#line 1318 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1329 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_MALFORMED; (yyval.command)->assert_malformed.module = (yyvsp[-2].raw_module); (yyval.command)->assert_malformed.text = (yyvsp[-1].text); } -#line 3834 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3845 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 154: -#line 1324 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1335 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_INVALID; (yyval.command)->assert_invalid.module = (yyvsp[-2].raw_module); (yyval.command)->assert_invalid.text = (yyvsp[-1].text); } -#line 3845 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3856 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 155: -#line 1330 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1341 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_UNLINKABLE; (yyval.command)->assert_unlinkable.module = (yyvsp[-2].raw_module); (yyval.command)->assert_unlinkable.text = (yyvsp[-1].text); } -#line 3856 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3867 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 156: -#line 1336 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1347 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_RETURN; (yyval.command)->assert_return.action = (yyvsp[-2].action); (yyval.command)->assert_return.expected = (yyvsp[-1].consts); } -#line 3867 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3878 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 157: -#line 1342 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1353 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_RETURN_NAN; (yyval.command)->assert_return_nan.action = (yyvsp[-1].action); } -#line 3877 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3888 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 158: -#line 1347 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1358 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_TRAP; (yyval.command)->assert_trap.action = (yyvsp[-2].action); (yyval.command)->assert_trap.text = (yyvsp[-1].text); } -#line 3888 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3899 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 159: -#line 1356 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1367 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_ACTION; (yyval.command)->action = (yyvsp[0].action); } -#line 3898 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3909 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 161: -#line 1362 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1373 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_MODULE; (yyval.command)->module = *(yyvsp[0].module); wasm_free(parser->allocator, (yyvsp[0].module)); } -#line 3909 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3920 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 162: -#line 1368 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1379 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(parser->allocator); (yyval.command)->type = WASM_COMMAND_TYPE_REGISTER; (yyval.command)->register_.module_name = (yyvsp[-2].text); - (yyval.command)->register_.module_var_name = (yyvsp[-1].text); + (yyval.command)->register_.var = (yyvsp[-1].var); } -#line 3920 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3931 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 163: -#line 1376 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1387 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.commands)); } -#line 3926 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3937 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 164: -#line 1377 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1388 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.commands) = (yyvsp[-1].commands); wasm_append_command_value(parser->allocator, &(yyval.commands), (yyvsp[0].command)); wasm_free(parser->allocator, (yyvsp[0].command)); } -#line 3936 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3947 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 165: -#line 1385 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1396 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.const_).loc = (yylsp[-2]); if (WASM_FAILED(parse_const((yyvsp[-2].type), (yyvsp[-1].literal).type, (yyvsp[-1].literal).text.start, @@ -3947,35 +3958,84 @@ yyreduce: } wasm_free(parser->allocator, (char*)(yyvsp[-1].literal).text.start); } -#line 3951 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3962 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 166: -#line 1397 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1408 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { WASM_ZERO_MEMORY((yyval.consts)); } -#line 3957 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3968 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 167: -#line 1398 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1409 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { (yyval.consts) = (yyvsp[-1].consts); wasm_append_const_value(parser->allocator, &(yyval.consts), &(yyvsp[0].const_)); } -#line 3966 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 3977 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; case 168: -#line 1405 "src/wasm-ast-parser.y" /* yacc.c:1646 */ +#line 1416 "src/wasm-ast-parser.y" /* yacc.c:1646 */ { + WASM_ZERO_MEMORY((yyval.script)); + (yyval.script).allocator = parser->allocator; (yyval.script).commands = (yyvsp[0].commands); + + int last_module_index = -1; + size_t i; + for (i = 0; i < (yyval.script).commands.size; ++i) { + WasmCommand* command = &(yyval.script).commands.data[0]; + WasmAction* action = NULL; + switch (command->type) { + case WASM_COMMAND_TYPE_MODULE: { + /* Wire up module name bindings. */ + WasmModule* module = &command->module; + if (module->name.length == 0) + continue; + WasmStringSlice module_name = + wasm_dup_string_slice(parser->allocator, module->name); + INSERT_BINDING(&(yyval.script), module, commands, module->loc, module_name); + last_module_index = i; + break; + } + + case WASM_COMMAND_TYPE_ASSERT_RETURN: + action = &command->assert_return.action; + goto has_action; + case WASM_COMMAND_TYPE_ASSERT_RETURN_NAN: + action = &command->assert_return_nan.action; + goto has_action; + case WASM_COMMAND_TYPE_ASSERT_TRAP: + action = &command->assert_trap.action; + goto has_action; + case WASM_COMMAND_TYPE_ACTION: + action = &command->action; + goto has_action; + + has_action: { + /* Resolve actions with an invalid index to use the preceding + * module. */ + WasmVar* var = &action->module_var; + if (var->type == WASM_VAR_TYPE_INDEX && + var->index == INVALID_VAR_INDEX) { + var->index = last_module_index; + } + break; + } + + default: + break; + } + } parser->script = (yyval.script); } -#line 3975 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 4035 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ break; -#line 3979 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ +#line 4039 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4210,7 +4270,7 @@ yyreturn: #endif return yyresult; } -#line 1417 "src/wasm-ast-parser.y" /* yacc.c:1906 */ +#line 1477 "src/wasm-ast-parser.y" /* yacc.c:1906 */ static void append_expr_list(WasmExprList* expr_list, WasmExprList* expr) { @@ -4381,10 +4441,10 @@ WasmResult wasm_parse_ast(WasmAstLexer* lexer, WASM_ZERO_MEMORY(parser); WasmAllocator* allocator = wasm_ast_lexer_get_allocator(lexer); parser.allocator = allocator; + parser.script.allocator = allocator; parser.error_handler = error_handler; - out_script->allocator = allocator; int result = wasm_ast_parser_parse(lexer, &parser); - out_script->commands = parser.script.commands; + *out_script = parser.script; return result == 0 && parser.errors == 0 ? WASM_OK : WASM_ERROR; } diff --git a/src/wasm-ast-checker.c b/src/wasm-ast-checker.c index b07e4df5..35d961e6 100644 --- a/src/wasm-ast-checker.c +++ b/src/wasm-ast-checker.c @@ -1225,7 +1225,7 @@ static WasmResult read_raw_module(Context* ctx, WasmReadBinaryOptions options = WASM_READ_BINARY_OPTIONS_DEFAULT; BinaryErrorCallbackData user_data; user_data.ctx = ctx; - user_data.loc = &raw->loc; + user_data.loc = &raw->binary.loc; WasmBinaryErrorHandler error_handler; error_handler.on_error = on_read_binary_error; error_handler.user_data = &user_data; @@ -1430,6 +1430,16 @@ WasmResult wasm_check_ast(WasmAllocator* allocator, return ctx.result; } +static WasmLocation* get_raw_module_location(WasmRawModule* raw) { + switch (raw->type) { + case WASM_RAW_MODULE_TYPE_BINARY: return &raw->binary.loc; + case WASM_RAW_MODULE_TYPE_TEXT: return &raw->text->loc; + default: + assert(0); + return NULL; + } +} + WasmResult wasm_check_assert_invalid_and_malformed( WasmAllocator* allocator, WasmAstLexer* lexer, @@ -1465,7 +1475,8 @@ WasmResult wasm_check_assert_invalid_and_malformed( check_raw_module(&ctx2, &command->assert_invalid.module); wasm_destroy_context(&ctx2); if (WASM_SUCCEEDED(ctx2.result)) { - print_error(&ctx, CHECK_STYLE_FULL, &command->assert_invalid.module.loc, + print_error(&ctx, CHECK_STYLE_FULL, + get_raw_module_location(&command->assert_invalid.module), "expected module to be invalid"); } } else if (command->type == WASM_COMMAND_TYPE_ASSERT_MALFORMED) { @@ -1476,7 +1487,7 @@ WasmResult wasm_check_assert_invalid_and_malformed( wasm_destroy_context(&ctx2); if (WASM_SUCCEEDED(ctx2.result)) { print_error(&ctx, CHECK_STYLE_FULL, - &command->assert_malformed.module.loc, + get_raw_module_location(&command->assert_malformed.module), "expected module to be malformed"); } } diff --git a/src/wasm-ast-parser.y b/src/wasm-ast-parser.y index 9bb5c3dd..ca4bcc51 100644 --- a/src/wasm-ast-parser.y +++ b/src/wasm-ast-parser.y @@ -27,6 +27,8 @@ #include "wasm-binary-reader.h" #include "wasm-literal.h" +#define INVALID_VAR_INDEX (-1) + /* the default value for YYMAXDEPTH is 10000, which can be easily hit since our grammar is right-recursive. @@ -225,13 +227,13 @@ static void on_read_binary_error(uint32_t offset, const char* error, %type<literal> literal %type<script> script %type<table> table_sig -%type<text> bind_var bind_var_opt labeling_opt quoted_text script_var_opt +%type<text> bind_var bind_var_opt labeling_opt quoted_text %type<text_list> non_empty_text_list text_list %type<types> value_type_list %type<u32> align_opt %type<u64> nat offset_opt %type<vars> var_list -%type<var> start type_use var +%type<var> start type_use var script_var_opt /* These non-terminals use the types below that have destructors, but the * memory is shared with the lexer, so should not be destroyed. */ @@ -1235,11 +1237,11 @@ module_fields : ; raw_module : - LPAR MODULE script_var_opt module_fields RPAR { + LPAR MODULE bind_var_opt module_fields RPAR { $$.type = WASM_RAW_MODULE_TYPE_TEXT; $$.text = $4; $$.text->name = $3; - $$.loc = @2; + $$.text->loc = @2; /* resolve func type variables where the signature was not specified * explicitly */ @@ -1257,10 +1259,10 @@ raw_module : } } } - | LPAR MODULE script_var_opt non_empty_text_list RPAR { + | LPAR MODULE bind_var_opt non_empty_text_list RPAR { $$.type = WASM_RAW_MODULE_TYPE_BINARY; $$.binary.name = $3; - $$.loc = @2; + $$.binary.loc = @2; dup_text_list(parser->allocator, &$4, &$$.binary.data, &$$.binary.size); wasm_destroy_text_list(parser->allocator, &$4); } @@ -1275,7 +1277,7 @@ module : $$ = new_module(parser->allocator); WasmReadBinaryOptions options = WASM_READ_BINARY_OPTIONS_DEFAULT; BinaryErrorCallbackData user_data; - user_data.loc = &$1.loc; + user_data.loc = &$1.binary.loc; user_data.lexer = lexer; user_data.parser = parser; WasmBinaryErrorHandler error_handler; @@ -1285,6 +1287,7 @@ module : &options, &error_handler, $$); wasm_free(parser->allocator, $1.binary.data); $$->name = $1.binary.name; + $$->loc = $1.binary.loc; } } ; @@ -1292,15 +1295,23 @@ module : /* Scripts */ script_var_opt : - /* empty */ { WASM_ZERO_MEMORY($$); } - | VAR { DUPTEXT($$, $1); } + /* empty */ { + WASM_ZERO_MEMORY($$); + $$.type = WASM_VAR_TYPE_INDEX; + $$.index = INVALID_VAR_INDEX; + } + | VAR { + WASM_ZERO_MEMORY($$); + $$.type = WASM_VAR_TYPE_NAME; + DUPTEXT($$.name, $1); + } ; action : LPAR INVOKE script_var_opt quoted_text const_list RPAR { WASM_ZERO_MEMORY($$); $$.loc = @2; - $$.module_var_name = $3; + $$.module_var = $3; $$.type = WASM_ACTION_TYPE_INVOKE; $$.invoke.name = $4; $$.invoke.args = $5; @@ -1308,7 +1319,7 @@ action : | LPAR GET script_var_opt quoted_text RPAR { WASM_ZERO_MEMORY($$); $$.loc = @2; - $$.module_var_name = $3; + $$.module_var = $3; $$.type = WASM_ACTION_TYPE_GET; $$.invoke.name = $4; } @@ -1369,7 +1380,7 @@ cmd : $$ = new_command(parser->allocator); $$->type = WASM_COMMAND_TYPE_REGISTER; $$->register_.module_name = $3; - $$->register_.module_var_name = $4; + $$->register_.var = $4; } ; cmd_list : @@ -1403,7 +1414,56 @@ const_list : script : cmd_list { + WASM_ZERO_MEMORY($$); + $$.allocator = parser->allocator; $$.commands = $1; + + int last_module_index = -1; + size_t i; + for (i = 0; i < $$.commands.size; ++i) { + WasmCommand* command = &$$.commands.data[0]; + WasmAction* action = NULL; + switch (command->type) { + case WASM_COMMAND_TYPE_MODULE: { + /* Wire up module name bindings. */ + WasmModule* module = &command->module; + if (module->name.length == 0) + continue; + WasmStringSlice module_name = + wasm_dup_string_slice(parser->allocator, module->name); + INSERT_BINDING(&$$, module, commands, module->loc, module_name); + last_module_index = i; + break; + } + + case WASM_COMMAND_TYPE_ASSERT_RETURN: + action = &command->assert_return.action; + goto has_action; + case WASM_COMMAND_TYPE_ASSERT_RETURN_NAN: + action = &command->assert_return_nan.action; + goto has_action; + case WASM_COMMAND_TYPE_ASSERT_TRAP: + action = &command->assert_trap.action; + goto has_action; + case WASM_COMMAND_TYPE_ACTION: + action = &command->action; + goto has_action; + + has_action: { + /* Resolve actions with an invalid index to use the preceding + * module. */ + WasmVar* var = &action->module_var; + if (var->type == WASM_VAR_TYPE_INDEX && + var->index == INVALID_VAR_INDEX) { + var->index = last_module_index; + } + break; + } + + default: + break; + } + } parser->script = $$; } ; @@ -1584,10 +1644,10 @@ WasmResult wasm_parse_ast(WasmAstLexer* lexer, WASM_ZERO_MEMORY(parser); WasmAllocator* allocator = wasm_ast_lexer_get_allocator(lexer); parser.allocator = allocator; + parser.script.allocator = allocator; parser.error_handler = error_handler; - out_script->allocator = allocator; int result = wasm_ast_parser_parse(lexer, &parser); - out_script->commands = parser.script.commands; + *out_script = parser.script; return result == 0 && parser.errors == 0 ? WASM_OK : WASM_ERROR; } diff --git a/src/wasm-ast.c b/src/wasm-ast.c index 780f595f..748c6e2f 100644 --- a/src/wasm-ast.c +++ b/src/wasm-ast.c @@ -73,6 +73,10 @@ int wasm_get_local_index_by_var(const WasmFunc* func, const WasmVar* var) { return func->decl.sig.param_types.size + result; } +int wasm_get_module_index_by_var(const WasmScript* script, const WasmVar* var) { + return wasm_get_index_from_var(&script->module_bindings, var); +} + WasmFuncPtr wasm_get_func_by_var(const WasmModule* module, const WasmVar* var) { int index = wasm_get_index_from_var(&module->func_bindings, var); if (index < 0 || (size_t)index >= module->funcs.size) @@ -140,6 +144,16 @@ WasmModule* wasm_get_first_module(const WasmScript* script) { return NULL; } +WasmModule* wasm_get_module_by_var(const WasmScript* script, + const WasmVar* var) { + int index = wasm_get_index_from_var(&script->module_bindings, var); + if (index < 0 || (size_t)index >= script->commands.size) + return NULL; + WasmCommand* command = &script->commands.data[index]; + assert(command->type == WASM_COMMAND_TYPE_MODULE); + return &command->module; +} + void wasm_make_type_binding_reverse_mapping( struct WasmAllocator* allocator, const WasmTypeVector* types, @@ -496,7 +510,7 @@ void wasm_destroy_raw_module(WasmAllocator* allocator, WasmRawModule* raw) { } void wasm_destroy_action(WasmAllocator* allocator, WasmAction* action) { - wasm_destroy_string_slice(allocator, &action->module_var_name); + wasm_destroy_var(allocator, &action->module_var); switch (action->type) { case WASM_ACTION_TYPE_INVOKE: wasm_destroy_string_slice(allocator, &action->invoke.name); @@ -518,7 +532,7 @@ void wasm_destroy_command(WasmAllocator* allocator, WasmCommand* command) { break; case WASM_COMMAND_TYPE_REGISTER: wasm_destroy_string_slice(allocator, &command->register_.module_name); - wasm_destroy_string_slice(allocator, &command->register_.module_var_name); + wasm_destroy_var(allocator, &command->register_.var); break; case WASM_COMMAND_TYPE_ASSERT_MALFORMED: wasm_destroy_raw_module(allocator, &command->assert_malformed.module); @@ -564,6 +578,7 @@ void wasm_destroy_elem_segment(WasmAllocator* allocator, void wasm_destroy_script(WasmScript* script) { WASM_DESTROY_VECTOR_AND_ELEMENTS(script->allocator, script->commands, command); + wasm_destroy_binding_hash(script->allocator, &script->module_bindings); } #define CHECK_RESULT(expr) \ diff --git a/src/wasm-ast.h b/src/wasm-ast.h index 5d6b6f2d..bc30eef7 100644 --- a/src/wasm-ast.h +++ b/src/wasm-ast.h @@ -246,6 +246,7 @@ typedef struct WasmModuleField { } WasmModuleField; typedef struct WasmModule { + WasmLocation loc; WasmStringSlice name; WasmModuleField* first_field; WasmModuleField* last_field; @@ -287,11 +288,11 @@ typedef enum WasmRawModuleType { * when parsing text, as assert_invalid always assumes that text parsing * succeeds. */ typedef struct WasmRawModule { - WasmLocation loc; WasmRawModuleType type; union { WasmModule* text; struct { + WasmLocation loc; WasmStringSlice name; void* data; size_t size; @@ -316,7 +317,7 @@ typedef struct WasmActionGet { typedef struct WasmAction { WasmLocation loc; WasmActionType type; - WasmStringSlice module_var_name; + WasmVar module_var; union { WasmActionInvoke invoke; WasmActionGet get; @@ -341,7 +342,7 @@ typedef struct WasmCommand { union { WasmModule module; WasmAction action; - struct { WasmStringSlice module_name, module_var_name; } register_; + struct { WasmStringSlice module_name; WasmVar var; } register_; struct { WasmAction action; WasmConstVector expected; } assert_return; struct { WasmAction action; } assert_return_nan; struct { WasmAction action; WasmStringSlice text; } assert_trap; @@ -356,6 +357,7 @@ WASM_DEFINE_VECTOR(command, WasmCommand); typedef struct WasmScript { struct WasmAllocator* allocator; WasmCommandVector commands; + WasmBindingHash module_bindings; } WasmScript; typedef struct WasmExprVisitor { @@ -474,6 +476,7 @@ int wasm_get_table_index_by_var(const WasmModule* module, const WasmVar* var); int wasm_get_memory_index_by_var(const WasmModule* module, const WasmVar* var); int wasm_get_import_index_by_var(const WasmModule* module, const WasmVar* var); int wasm_get_local_index_by_var(const WasmFunc* func, const WasmVar* var); +int wasm_get_module_index_by_var(const WasmScript* script, const WasmVar* var); WasmFuncPtr wasm_get_func_by_var(const WasmModule* module, const WasmVar* var); WasmGlobalPtr wasm_get_global_by_var(const WasmModule* func, @@ -489,6 +492,8 @@ WasmImportPtr wasm_get_import_by_var(const WasmModule* module, WasmExportPtr wasm_get_export_by_name(const WasmModule* module, const WasmStringSlice* name); WasmModule* wasm_get_first_module(const WasmScript* script); +WasmModule* wasm_get_module_by_var(const WasmScript* script, + const WasmVar* var); void wasm_make_type_binding_reverse_mapping( struct WasmAllocator*, |