diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/array.h | 4 | ||||
-rw-r--r-- | src/ast-lexer.cc | 18 | ||||
-rw-r--r-- | src/ast-parser-lexer-shared.cc | 6 | ||||
-rw-r--r-- | src/ast-parser.y | 94 | ||||
-rw-r--r-- | src/ast.cc | 23 | ||||
-rw-r--r-- | src/ast.h | 4 | ||||
-rw-r--r-- | src/binary-reader-ast.cc | 4 | ||||
-rw-r--r-- | src/binary-reader-interpreter.cc | 5 | ||||
-rw-r--r-- | src/binary-writer-spec.cc | 6 | ||||
-rw-r--r-- | src/common.cc | 6 | ||||
-rw-r--r-- | src/common.h | 23 | ||||
-rw-r--r-- | src/interpreter.cc | 19 | ||||
-rw-r--r-- | src/interpreter.h | 2 | ||||
-rw-r--r-- | src/prebuilt/ast-lexer-gen.cc | 986 | ||||
-rw-r--r-- | src/prebuilt/ast-parser-gen.cc | 1010 | ||||
-rw-r--r-- | src/tools/wasm-interp.cc | 40 | ||||
-rw-r--r-- | src/tools/wasm-link.cc | 6 | ||||
-rw-r--r-- | src/tools/wasm2wast.cc | 4 | ||||
-rw-r--r-- | src/tools/wasmdump.cc | 8 | ||||
-rw-r--r-- | src/tools/wasmopcodecnt.cc | 6 | ||||
-rw-r--r-- | src/vector.cc | 29 | ||||
-rw-r--r-- | src/vector.h | 22 | ||||
-rw-r--r-- | src/writer.cc | 14 | ||||
-rw-r--r-- | src/writer.h | 2 |
24 files changed, 1138 insertions, 1203 deletions
diff --git a/src/array.h b/src/array.h index 6853c655..e75ff95d 100644 --- a/src/array.h +++ b/src/array.h @@ -32,10 +32,10 @@ static WABT_INLINE void new_##name##_array(type##Array* array, size_t size) \ WABT_UNUSED; \ \ - void destroy_##name##_array(type##Array* array) { wabt_free(array->data); } \ + void destroy_##name##_array(type##Array* array) { delete[] array->data; } \ void new_##name##_array(type##Array* array, size_t size) { \ array->size = size; \ - array->data = static_cast<type*>(wabt_alloc_zero(size * sizeof(type))); \ + array->data = new type[size](); \ } #define WABT_DESTROY_ARRAY_AND_ELEMENTS(v, name) \ diff --git a/src/ast-lexer.cc b/src/ast-lexer.cc index 4bf3ba44..b3ae8b7a 100644 --- a/src/ast-lexer.cc +++ b/src/ast-lexer.cc @@ -94,9 +94,9 @@ namespace wabt { static Result fill(Location* loc, - AstLexer* lexer, - AstParser* parser, - size_t need) { + AstLexer* lexer, + AstParser* parser, + size_t need) { if (lexer->eof) return Result::Error; size_t free = lexer->token - lexer->buffer; @@ -113,10 +113,7 @@ static Result fill(Location* loc, while ((new_buffer_size - old_buffer_size) + free < need + YYMAXFILL) new_buffer_size *= 2; - /* TODO(binji): could just alloc instead, because we know we'll need to - * memmove below */ - char* new_buffer = - static_cast<char*>(wabt_realloc(lexer->buffer, new_buffer_size)); + char* new_buffer = new char[new_buffer_size]; if (!new_buffer) { ast_parser_error(loc, lexer, parser, "unable to reallocate lexer buffer."); @@ -131,6 +128,7 @@ static Result fill(Location* loc, lexer->limit = new_buffer + (lexer->limit - old_buffer) - free; lexer->buffer_file_offset += free; free += new_buffer_size - old_buffer_size; + delete [] old_buffer; } else { /* shift everything down to make more room in the buffer */ memmove(lexer->buffer, lexer->token, lexer->limit - lexer->token); @@ -479,7 +477,7 @@ int ast_lexer_lex(WABT_AST_PARSER_STYPE* lval, static AstLexer* new_lexer(AstLexerSourceType type, const char* filename) { - AstLexer* lexer = static_cast<AstLexer*>(wabt_alloc_zero(sizeof(AstLexer))); + AstLexer* lexer = new AstLexer(); lexer->line = 1; lexer->filename = filename; lexer->source.type = type; @@ -510,8 +508,8 @@ AstLexer* new_ast_buffer_lexer(const char* filename, void destroy_ast_lexer(AstLexer* lexer) { if (lexer->source.type == AstLexerSourceType::File && lexer->source.file) fclose(lexer->source.file); - wabt_free(lexer->buffer); - wabt_free(lexer); + delete [] lexer->buffer; + delete lexer; } enum class LineOffsetPosition { diff --git a/src/ast-parser-lexer-shared.cc b/src/ast-parser-lexer-shared.cc index 08d9ad8c..7e5eb0b5 100644 --- a/src/ast-parser-lexer-shared.cc +++ b/src/ast-parser-lexer-shared.cc @@ -81,7 +81,7 @@ void destroy_optional_export(OptionalExport* export_) { void destroy_exported_func(ExportedFunc* exported_func) { destroy_optional_export(&exported_func->export_); destroy_func(exported_func->func); - wabt_free(exported_func->func); + delete exported_func->func; } void destroy_text_list(TextList* text_list) { @@ -89,7 +89,7 @@ void destroy_text_list(TextList* text_list) { while (node) { TextListNode* next = node->next; destroy_string_slice(&node->text); - wabt_free(node); + delete node; node = next; } } @@ -116,7 +116,7 @@ void destroy_func_fields(FuncField* func_field) { break; } - wabt_free(func_field); + delete func_field; func_field = next_func_field; } } diff --git a/src/ast-parser.y b/src/ast-parser.y index 36fbd15d..653ce12a 100644 --- a/src/ast-parser.y +++ b/src/ast-parser.y @@ -28,18 +28,15 @@ #define INVALID_VAR_INDEX (-1) -#define RELOCATE_STACK(type, array, stack_base, old_byte_size, new_size) \ - do { \ - if ((stack_base) == (array)) { \ - (stack_base) = \ - static_cast<type*>(wabt_alloc((new_size) * sizeof(*(stack_base)))); \ - memcpy((stack_base), (array), old_byte_size); \ - } else { \ - (stack_base) = static_cast<type*>( \ - wabt_realloc((stack_base), (new_size) * sizeof(*(stack_base)))); \ - } \ - /* Cache the pointer in the parser struct to be free'd later. */ \ - parser->array = (stack_base); \ +#define RELOCATE_STACK(type, array, stack_base, old_byte_size, new_size) \ + do { \ + type* new_stack = new type[new_size](); \ + memcpy((new_stack), (stack_base), old_byte_size); \ + if ((stack_base) != (array)) { \ + delete[](stack_base); \ + } \ + /* Cache the pointer in the parser struct to be deleted later. */ \ + parser->array = (stack_base) = new_stack; \ } while (0) #define yyoverflow(message, ss, ss_size, vs, vs_size, ls, ls_size, new_size) \ @@ -135,8 +132,8 @@ } \ } while (0) -#define YYMALLOC(size) wabt_alloc(size) -#define YYFREE(p) wabt_free(p) +#define YYMALLOC(size) new char [size] +#define YYFREE(p) delete [] (p) #define USE_NATURAL_ALIGNMENT (~0) @@ -147,36 +144,19 @@ ExprList join_exprs2(Location* loc, ExprList* expr1, Expr* expr2); -FuncField* new_func_field(void) { - return static_cast<FuncField*>(wabt_alloc_zero(sizeof(FuncField))); -} - -Func* new_func(void) { - return static_cast<Func*>(wabt_alloc_zero(sizeof(Func))); -} - -Command* new_command(void) { - return static_cast<Command*>(wabt_alloc_zero(sizeof(Command))); -} - -Module* new_module(void) { - return static_cast<Module*>(wabt_alloc_zero(sizeof(Module))); -} - -Import* new_import(void) { - return static_cast<Import*>(wabt_alloc_zero(sizeof(Import))); -} - -TextListNode* new_text_list_node(void) { - return static_cast<TextListNode*>(wabt_alloc_zero(sizeof(TextListNode))); -} +FuncField* new_func_field(void) { return new FuncField(); } +Func* new_func(void) { return new Func(); } +Command* new_command(void) { return new Command(); } +Module* new_module(void) { return new Module(); } +Import* new_import(void) { return new Import(); } +TextListNode* new_text_list_node(void) { return new TextListNode(); } Result parse_const(Type type, LiteralType literal_type, const char* s, const char* end, Const* out); -void dup_text_list(TextList* text_list, void** out_data, size_t* out_size); +void dup_text_list(TextList* text_list, char** out_data, size_t* out_size); bool is_empty_signature(FuncSignature* sig); @@ -271,7 +251,7 @@ static void on_read_binary_error(uint32_t offset, const char* error, * memory is shared with the lexer, so should not be destroyed. */ %destructor {} ALIGN_EQ_NAT OFFSET_EQ_NAT TEXT VAR NAT INT FLOAT %destructor { destroy_block(&$$); } <block> -%destructor { destroy_command($$); wabt_free($$); } <command> +%destructor { destroy_command($$); delete $$; } <command> %destructor { destroy_command_vector_and_elements(&$$); } <commands> %destructor { destroy_const_vector(&$$); } <consts> %destructor { destroy_elem_segment(&$$); } <elem_segment> @@ -282,12 +262,12 @@ static void on_read_binary_error(uint32_t offset, const char* error, %destructor { destroy_expr($$); } <expr> %destructor { destroy_expr_list($$.first); } <expr_list> %destructor { destroy_func_fields($$); } <func_fields> -%destructor { destroy_func($$); wabt_free($$); } <func> +%destructor { destroy_func($$); delete $$; } <func> %destructor { destroy_func_signature(&$$); } <func_sig> %destructor { destroy_func_type(&$$); } <func_type> -%destructor { destroy_import($$); wabt_free($$); } <import> +%destructor { destroy_import($$); delete $$; } <import> %destructor { destroy_data_segment(&$$); } <data_segment> -%destructor { destroy_module($$); wabt_free($$); } <module> +%destructor { destroy_module($$); delete $$; } <module> %destructor { destroy_raw_module(&$$); } <raw_module> %destructor { destroy_string_slice(&$$.text); } <literal> %destructor { destroy_script(&$$); } <script> @@ -336,10 +316,10 @@ quoted_text : TextList text_list; text_list.first = &node; text_list.last = &node; - void* data; + char* data; size_t size; dup_text_list(&text_list, &data, &size); - $$.start = static_cast<const char*>(data); + $$.start = data; $$.length = size; } ; @@ -577,7 +557,7 @@ plain_instr : "invalid literal \"" PRIstringslice "\"", WABT_PRINTF_STRING_SLICE_ARG($2.text)); } - wabt_free(const_cast<char*>($2.text.start)); + delete [] $2.text.start; } | UNARY { $$ = new_unary_expr(); @@ -818,7 +798,7 @@ func_info : } /* we steal memory from the func field, but not the linked list nodes */ - wabt_free(field); + delete (field); field = next; } } @@ -1197,7 +1177,7 @@ module_fields : APPEND_ITEM_TO_VECTOR($$, Func, func, funcs, &field->func); INSERT_BINDING($$, func, funcs, @2, $2.func->name); APPEND_INLINE_EXPORT($$, Func, @2, $2, $$->funcs.size - 1); - wabt_free($2.func); + delete $2.func; } | module_fields elem { $$ = $1; @@ -1252,7 +1232,7 @@ module_fields : $$->num_global_imports++; break; } - wabt_free($2); + delete $2; APPEND_ITEM_TO_VECTOR($$, Import, import, imports, &field->import); } | module_fields export { @@ -1313,7 +1293,7 @@ module : error_handler.user_data = &user_data; read_binary_ast($1.binary.data, $1.binary.size, &options, &error_handler, $$); - wabt_free($1.binary.data); + delete [] $1.binary.data; $$->name = $1.binary.name; $$->loc = $1.binary.loc; } @@ -1414,7 +1394,7 @@ cmd : $$ = new_command(); $$->type = CommandType::Module; $$->module = *$1; - wabt_free($1); + delete $1; } | LPAR REGISTER quoted_text script_var_opt RPAR { $$ = new_command(); @@ -1429,7 +1409,7 @@ cmd_list : | cmd_list cmd { $$ = $1; append_command_value(&$$, $2); - wabt_free($2); + delete $2; } ; @@ -1442,7 +1422,7 @@ const : "invalid literal \"" PRIstringslice "\"", WABT_PRINTF_STRING_SLICE_ARG($3.text)); } - wabt_free(const_cast<char*>($3.text.start)); + delete [] $3.text.start; } ; const_list : @@ -1631,7 +1611,7 @@ size_t copy_string_contents(StringSlice* text, char* dest) { return dest - dest_start; } -void dup_text_list(TextList* text_list, void** out_data, size_t* out_size) { +void dup_text_list(TextList* text_list, char** out_data, size_t* out_size) { /* walk the linked list to see how much total space is needed */ size_t total_size = 0; TextListNode* node; @@ -1644,7 +1624,7 @@ void dup_text_list(TextList* text_list, void** out_data, size_t* out_size) { size_t size = (end > src) ? (end - src) : 0; total_size += size; } - char* result = (char*)wabt_alloc(total_size); + char* result = new char [total_size]; char* dest = result; for (node = text_list->first; node; node = node->next) { size_t actual_size = copy_string_contents(&node->text, dest); @@ -1683,9 +1663,9 @@ Result parse_ast(AstLexer * lexer, struct Script * out_script, WABT_ZERO_MEMORY(parser); parser.error_handler = error_handler; int result = wabt_ast_parser_parse(lexer, &parser); - wabt_free(parser.yyssa); - wabt_free(parser.yyvsa); - wabt_free(parser.yylsa); + delete [] parser.yyssa; + delete [] parser.yyvsa; + delete [] parser.yylsa; *out_script = parser.script; return result == 0 && parser.errors == 0 ? Result::Ok : Result::Error; } @@ -191,8 +191,7 @@ void find_duplicate_bindings(const BindingHash* bindings, } ModuleField* append_module_field(Module* module) { - ModuleField* result = - static_cast<ModuleField*>(wabt_alloc_zero(sizeof(ModuleField))); + ModuleField* result = new ModuleField(); if (!module->first_field) module->first_field = result; else if (module->last_field) @@ -243,11 +242,11 @@ FuncType* append_implicit_func_type(Location* loc, V(ExprType::Select, select) \ V(ExprType::Unreachable, unreachable) -#define DEFINE_NEW_EXPR(type_, name) \ - Expr* new_##name##_expr(void) { \ - Expr* result = static_cast<Expr*>(wabt_alloc_zero(sizeof(Expr))); \ - result->type = type_; \ - return result; \ +#define DEFINE_NEW_EXPR(type_, name) \ + Expr* new_##name##_expr(void) { \ + Expr* result = new Expr(); \ + result->type = type_; \ + return result; \ } FOREACH_EXPR_TYPE(DEFINE_NEW_EXPR) #undef DEFINE_NEW_EXPR @@ -341,7 +340,7 @@ void destroy_expr(Expr* expr) { case ExprType::Unreachable: break; } - wabt_free(expr); + delete expr; } void destroy_func_declaration(FuncDeclaration* decl) { @@ -396,7 +395,7 @@ void destroy_func_type(FuncType* func_type) { void destroy_data_segment(DataSegment* data) { destroy_var(&data->memory_var); destroy_expr_list(data->offset); - wabt_free(data->data); + delete [] data->data; } void destroy_memory(Memory* memory) { @@ -449,7 +448,7 @@ void destroy_module(Module* module) { while (field) { ModuleField* next_field = field->next; destroy_module_field(field); - wabt_free(field); + delete field; field = next_field; } @@ -475,10 +474,10 @@ void destroy_module(Module* module) { void destroy_raw_module(RawModule* raw) { if (raw->type == RawModuleType::Text) { destroy_module(raw->text); - wabt_free(raw->text); + delete raw->text; } else { destroy_string_slice(&raw->binary.name); - wabt_free(raw->binary.data); + delete [] raw->binary.data; } } @@ -184,7 +184,7 @@ WABT_DEFINE_VECTOR(memory_ptr, MemoryPtr); struct DataSegment { Var memory_var; Expr* offset; - void* data; + char* data; size_t size; }; typedef DataSegment* DataSegmentPtr; @@ -295,7 +295,7 @@ struct RawModule { struct { Location loc; StringSlice name; - void* data; + char* data; size_t size; } binary; }; diff --git a/src/binary-reader-ast.cc b/src/binary-reader-ast.cc index 999e122e..f8cd20c9 100644 --- a/src/binary-reader-ast.cc +++ b/src/binary-reader-ast.cc @@ -105,7 +105,7 @@ static void dup_name(Context* ctx, StringSlice* name, StringSlice* out_name) { static Result append_expr(Context* ctx, Expr* expr) { LabelNode* label; if (WABT_FAILED(top_label(ctx, &label))) { - wabt_free(expr); + delete expr; return Result::Error; } if (*label->first) { @@ -873,7 +873,7 @@ static Result on_data_segment_data(uint32_t index, Context* ctx = static_cast<Context*>(user_data); assert(index == ctx->module->data_segments.size - 1); DataSegment* segment = ctx->module->data_segments.data[index]; - segment->data = wabt_alloc(size); + segment->data = new char[size]; segment->size = size; memcpy(segment->data, data, size); return Result::Ok; diff --git a/src/binary-reader-interpreter.cc b/src/binary-reader-interpreter.cc index 15e28a20..58411493 100644 --- a/src/binary-reader-interpreter.cc +++ b/src/binary-reader-interpreter.cc @@ -726,7 +726,7 @@ static Result on_memory(uint32_t index, InterpreterMemory* memory = append_interpreter_memory(&ctx->env->memories); memory->page_limits = *page_limits; memory->byte_size = page_limits->initial * WABT_PAGE_SIZE; - memory->data = wabt_alloc_zero(memory->byte_size); + memory->data = new char[memory->byte_size](); ctx->module->memory_index = ctx->env->memories.size - 1; return Result::Ok; } @@ -953,8 +953,7 @@ static Result on_data_segment_data(uint32_t index, InterpreterMemory* memory = &ctx->env->memories.data[ctx->module->memory_index]; uint32_t address = ctx->init_expr_value.value.i32; - uint8_t* dst_data = static_cast<uint8_t*>(memory->data); - memcpy(&dst_data[address], src_data, size); + memcpy(memory->data + address, src_data, size); return Result::Ok; } diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc index a0a85405..0903757b 100644 --- a/src/binary-writer-spec.cc +++ b/src/binary-writer-spec.cc @@ -98,7 +98,7 @@ static StringSlice get_basename(const char* s) { static char* get_module_filename(Context* ctx) { size_t buflen = ctx->module_filename_noext.length + 20; - char* str = static_cast<char*>(wabt_alloc(buflen)); + char* str = new char[buflen]; size_t length = snprintf(str, buflen, PRIstringslice ".%" PRIzd ".wasm", WABT_PRINTF_STRING_SLICE_ARG(ctx->module_filename_noext), @@ -327,7 +327,7 @@ static void write_invalid_module(Context* ctx, write_key(ctx, "text"); write_escaped_string_slice(ctx, text); write_raw_module(ctx, filename, module); - wabt_free(filename); + delete [] filename; } static void write_commands(Context* ctx, Script* script) { @@ -364,7 +364,7 @@ static void write_commands(Context* ctx, Script* script) { write_key(ctx, "filename"); write_escaped_string_slice(ctx, get_basename(filename)); write_module(ctx, filename, module); - wabt_free(filename); + delete [] filename; ctx->num_modules++; last_module_index = static_cast<int>(i); break; diff --git a/src/common.cc b/src/common.cc index 0af8b456..b05de5df 100644 --- a/src/common.cc +++ b/src/common.cc @@ -114,10 +114,10 @@ bool string_slices_are_equal(const StringSlice* a, const StringSlice* b) { void destroy_string_slice(StringSlice* str) { assert(str); - wabt_free(const_cast<void*>(static_cast<const void*>(str->start))); + delete [] str->start; } -Result read_file(const char* filename, void** out_data, size_t* out_size) { +Result read_file(const char* filename, char** out_data, size_t* out_size) { FILE* infile = fopen(filename, "rb"); if (!infile) { const char* format = "unable to read file %s"; @@ -143,7 +143,7 @@ Result read_file(const char* filename, void** out_data, size_t* out_size) { return Result::Error; } - void* data = wabt_alloc(size); + char* data = new char [size]; if (size != 0 && fread(data, size, 1, infile) != 1) { perror("fread failed"); return Result::Error; diff --git a/src/common.h b/src/common.h index 36bc3d8f..620b8f0e 100644 --- a/src/common.h +++ b/src/common.h @@ -403,25 +403,6 @@ struct Literal { StringSlice text; }; -static WABT_INLINE void* wabt_alloc(size_t size) { - return malloc(size); -} - -static WABT_INLINE void* wabt_alloc_zero(size_t size) { - return calloc(size, 1); -} - -static WABT_INLINE void* wabt_realloc(void* p, size_t size) { - /* Realloc normally frees if size is 0, but we don't want that behavior. */ - if (size == 0) - return p; - return realloc(p, size); -} - -static WABT_INLINE void wabt_free(void* p) { - free(p); -} - static WABT_INLINE char* wabt_strndup(const char* s, size_t len) { size_t real_len = 0; const char* p = s; @@ -430,7 +411,7 @@ static WABT_INLINE char* wabt_strndup(const char* s, size_t len) { real_len++; } - char* new_s = static_cast<char*>(wabt_alloc(real_len + 1)); + char* new_s = new char[real_len + 1]; memcpy(new_s, s, real_len); new_s[real_len] = 0; return new_s; @@ -458,7 +439,7 @@ StringSlice string_slice_from_cstr(const char* string); bool string_slice_is_empty(const StringSlice*); bool string_slices_are_equal(const StringSlice*, const StringSlice*); void destroy_string_slice(StringSlice*); -Result read_file(const char* filename, void** out_data, size_t* out_size); +Result read_file(const char* filename, char** out_data, size_t* out_size); void default_source_error_callback(const Location*, const char* error, diff --git a/src/interpreter.cc b/src/interpreter.cc index d7e6fe6e..5c6bf598 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -70,7 +70,7 @@ static void destroy_interpreter_func(InterpreterFunc* func) { } static void destroy_interpreter_memory(InterpreterMemory* memory) { - wabt_free(memory->data); + delete [] memory->data; } static void destroy_interpreter_table(InterpreterTable* table) { @@ -783,7 +783,7 @@ InterpreterResult run_interpreter(InterpreterThread* thread, InterpreterEnvironment* env = thread->env; - const uint8_t* istream = static_cast<const uint8_t*>(env->istream.start); + const uint8_t* istream = reinterpret_cast<const uint8_t*>(env->istream.start); const uint8_t* pc = &istream[thread->pc]; uint32_t i; for (i = 0; i < num_instructions; ++i) { @@ -1030,11 +1030,10 @@ InterpreterResult run_interpreter(InterpreterThread* thread, PUSH_NEG_1_AND_BREAK_IF( static_cast<uint64_t>(new_page_size) * WABT_PAGE_SIZE > UINT32_MAX); uint32_t new_byte_size = new_page_size * WABT_PAGE_SIZE; - void* new_data = wabt_realloc(memory->data, new_byte_size); - PUSH_NEG_1_AND_BREAK_IF(!new_data); - memset(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_data) + - old_byte_size), - 0, new_byte_size - old_byte_size); + char* new_data = new char [new_byte_size]; + memcpy(new_data, memory->data, old_byte_size); + memset(new_data + old_byte_size, 0, new_byte_size - old_byte_size); + delete [] memory->data; memory->data = new_data; memory->page_limits.initial = new_page_size; memory->byte_size = new_byte_size; @@ -1689,13 +1688,13 @@ exit_loop: void trace_pc(InterpreterThread* thread, Stream* stream) { const uint8_t* istream = - static_cast<const uint8_t*>(thread->env->istream.start); + reinterpret_cast<const uint8_t*>(thread->env->istream.start); const uint8_t* pc = &istream[thread->pc]; size_t value_stack_depth = thread->value_stack_top - thread->value_stack.data; size_t call_stack_depth = thread->call_stack_top - thread->call_stack.data; writef(stream, "#%" PRIzd ". %4" PRIzd ": V:%-3" PRIzd "| ", call_stack_depth, - pc - static_cast<uint8_t*>(thread->env->istream.start), + pc - reinterpret_cast<uint8_t*>(thread->env->istream.start), value_stack_depth); InterpreterOpcode opcode = static_cast<InterpreterOpcode>(*pc++); @@ -2056,7 +2055,7 @@ void disassemble(InterpreterEnvironment* env, return; if (to > env->istream.size) to = env->istream.size; - const uint8_t* istream = static_cast<const uint8_t*>(env->istream.start); + const uint8_t* istream = reinterpret_cast<const uint8_t*>(env->istream.start); const uint8_t* pc = &istream[from]; while (static_cast<uint32_t>(pc - istream) < to) { diff --git a/src/interpreter.h b/src/interpreter.h index 348d4be9..230a753d 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -116,7 +116,7 @@ struct InterpreterTable { WABT_DEFINE_VECTOR(interpreter_table, InterpreterTable); struct InterpreterMemory { - void* data; + char* data; Limits page_limits; uint32_t byte_size; /* Cached from page_limits. */ }; diff --git a/src/prebuilt/ast-lexer-gen.cc b/src/prebuilt/ast-lexer-gen.cc index a932b1e7..9e2f2517 100644 --- a/src/prebuilt/ast-lexer-gen.cc +++ b/src/prebuilt/ast-lexer-gen.cc @@ -96,9 +96,9 @@ namespace wabt { static Result fill(Location* loc, - AstLexer* lexer, - AstParser* parser, - size_t need) { + AstLexer* lexer, + AstParser* parser, + size_t need) { if (lexer->eof) return Result::Error; size_t free = lexer->token - lexer->buffer; @@ -115,10 +115,7 @@ static Result fill(Location* loc, while ((new_buffer_size - old_buffer_size) + free < need + YYMAXFILL) new_buffer_size *= 2; - /* TODO(binji): could just alloc instead, because we know we'll need to - * memmove below */ - char* new_buffer = - static_cast<char*>(wabt_realloc(lexer->buffer, new_buffer_size)); + char* new_buffer = new char[new_buffer_size]; if (!new_buffer) { ast_parser_error(loc, lexer, parser, "unable to reallocate lexer buffer."); @@ -133,6 +130,7 @@ static Result fill(Location* loc, lexer->limit = new_buffer + (lexer->limit - old_buffer) - free; lexer->buffer_file_offset += free; free += new_buffer_size - old_buffer_size; + delete [] old_buffer; } else { /* shift everything down to make more room in the buffer */ memmove(lexer->buffer, lexer->token, lexer->limit - lexer->token); @@ -185,7 +183,7 @@ int ast_lexer_lex(WABT_AST_PARSER_STYPE* lval, for (;;) { lexer->token = lexer->cursor; -#line 189 "src/prebuilt/ast-lexer-gen.cc" +#line 187 "src/prebuilt/ast-lexer-gen.cc" { unsigned char yych; if (cond < 2) { @@ -224,34 +222,34 @@ YYCOND_BAD_TEXT: } } ++lexer->cursor; -#line 239 "src/ast-lexer.cc" +#line 237 "src/ast-lexer.cc" { ERROR("unexpected EOF"); RETURN(EOF); } -#line 230 "src/prebuilt/ast-lexer-gen.cc" +#line 228 "src/prebuilt/ast-lexer-gen.cc" yy5: ++lexer->cursor; yy6: -#line 240 "src/ast-lexer.cc" +#line 238 "src/ast-lexer.cc" { ERROR("illegal character in string"); continue; } -#line 237 "src/prebuilt/ast-lexer-gen.cc" +#line 235 "src/prebuilt/ast-lexer-gen.cc" yy7: ++lexer->cursor; BEGIN(YYCOND_i); -#line 233 "src/ast-lexer.cc" +#line 231 "src/ast-lexer.cc" { ERROR("newline in string"); NEWLINE; continue; } -#line 244 "src/prebuilt/ast-lexer-gen.cc" +#line 242 "src/prebuilt/ast-lexer-gen.cc" yy9: ++lexer->cursor; -#line 232 "src/ast-lexer.cc" +#line 230 "src/ast-lexer.cc" { continue; } -#line 249 "src/prebuilt/ast-lexer-gen.cc" +#line 247 "src/prebuilt/ast-lexer-gen.cc" yy11: ++lexer->cursor; BEGIN(YYCOND_i); -#line 238 "src/ast-lexer.cc" +#line 236 "src/ast-lexer.cc" { TEXT; RETURN(TEXT); } -#line 255 "src/prebuilt/ast-lexer-gen.cc" +#line 253 "src/prebuilt/ast-lexer-gen.cc" yy13: yych = *++lexer->cursor; if (yych <= '@') { @@ -285,11 +283,11 @@ yy13: yy14: ++lexer->cursor; yy15: -#line 235 "src/ast-lexer.cc" +#line 233 "src/ast-lexer.cc" { ERROR("bad escape \"%.*s\"", static_cast<int>(yyleng), yytext); continue; } -#line 293 "src/prebuilt/ast-lexer-gen.cc" +#line 291 "src/prebuilt/ast-lexer-gen.cc" yy16: ++lexer->cursor; if ((yych = *lexer->cursor) <= '@') { @@ -317,20 +315,20 @@ YYCOND_BLOCK_COMMENT: } yy19: ++lexer->cursor; -#line 467 "src/ast-lexer.cc" +#line 465 "src/ast-lexer.cc" { ERROR("unexpected EOF"); RETURN(EOF); } -#line 323 "src/prebuilt/ast-lexer-gen.cc" +#line 321 "src/prebuilt/ast-lexer-gen.cc" yy21: ++lexer->cursor; yy22: -#line 468 "src/ast-lexer.cc" +#line 466 "src/ast-lexer.cc" { continue; } -#line 329 "src/prebuilt/ast-lexer-gen.cc" +#line 327 "src/prebuilt/ast-lexer-gen.cc" yy23: ++lexer->cursor; -#line 466 "src/ast-lexer.cc" +#line 464 "src/ast-lexer.cc" { NEWLINE; continue; } -#line 334 "src/prebuilt/ast-lexer-gen.cc" +#line 332 "src/prebuilt/ast-lexer-gen.cc" yy25: yych = *++lexer->cursor; if (yych == ';') goto yy27; @@ -341,16 +339,16 @@ yy26: goto yy22; yy27: ++lexer->cursor; -#line 462 "src/ast-lexer.cc" +#line 460 "src/ast-lexer.cc" { COMMENT_NESTING++; continue; } -#line 347 "src/prebuilt/ast-lexer-gen.cc" +#line 345 "src/prebuilt/ast-lexer-gen.cc" yy29: ++lexer->cursor; -#line 463 "src/ast-lexer.cc" +#line 461 "src/ast-lexer.cc" { if (--COMMENT_NESTING == 0) BEGIN(YYCOND_INIT); continue; } -#line 354 "src/prebuilt/ast-lexer-gen.cc" +#line 352 "src/prebuilt/ast-lexer-gen.cc" /* *********************************** */ YYCOND_LINE_COMMENT: { @@ -395,9 +393,9 @@ YYCOND_LINE_COMMENT: } goto yy36; yy33: -#line 460 "src/ast-lexer.cc" +#line 458 "src/ast-lexer.cc" { continue; } -#line 401 "src/prebuilt/ast-lexer-gen.cc" +#line 399 "src/prebuilt/ast-lexer-gen.cc" yy34: ++lexer->cursor; if (lexer->limit <= lexer->cursor) FILL(1); @@ -409,9 +407,9 @@ yy34: yy36: ++lexer->cursor; BEGIN(YYCOND_i); -#line 459 "src/ast-lexer.cc" +#line 457 "src/ast-lexer.cc" { NEWLINE; continue; } -#line 415 "src/prebuilt/ast-lexer-gen.cc" +#line 413 "src/prebuilt/ast-lexer-gen.cc" } /* *********************************** */ YYCOND_i: @@ -553,15 +551,15 @@ YYCOND_i: } yy40: ++lexer->cursor; -#line 474 "src/ast-lexer.cc" +#line 472 "src/ast-lexer.cc" { RETURN(EOF); } -#line 559 "src/prebuilt/ast-lexer-gen.cc" +#line 557 "src/prebuilt/ast-lexer-gen.cc" yy42: ++lexer->cursor; yy43: -#line 475 "src/ast-lexer.cc" +#line 473 "src/ast-lexer.cc" { ERROR("unexpected char"); continue; } -#line 565 "src/prebuilt/ast-lexer-gen.cc" +#line 563 "src/prebuilt/ast-lexer-gen.cc" yy44: ++lexer->cursor; if (lexer->limit <= lexer->cursor) FILL(1); @@ -569,14 +567,14 @@ yy44: if (yybm[0+yych] & 8) { goto yy44; } -#line 470 "src/ast-lexer.cc" +#line 468 "src/ast-lexer.cc" { continue; } -#line 575 "src/prebuilt/ast-lexer-gen.cc" +#line 573 "src/prebuilt/ast-lexer-gen.cc" yy47: ++lexer->cursor; -#line 469 "src/ast-lexer.cc" +#line 467 "src/ast-lexer.cc" { NEWLINE; continue; } -#line 580 "src/prebuilt/ast-lexer-gen.cc" +#line 578 "src/prebuilt/ast-lexer-gen.cc" yy49: ++lexer->cursor; if (lexer->limit <= lexer->cursor) FILL(1); @@ -586,20 +584,20 @@ yy50: goto yy49; } yy51: -#line 471 "src/ast-lexer.cc" +#line 469 "src/ast-lexer.cc" { ERROR("unexpected token \"%.*s\"", static_cast<int>(yyleng), yytext); continue; } -#line 594 "src/prebuilt/ast-lexer-gen.cc" +#line 592 "src/prebuilt/ast-lexer-gen.cc" yy52: yych = *(lexer->marker = ++lexer->cursor); if (yych <= 0x1F) goto yy53; if (yych != 0x7F) goto yy83; yy53: BEGIN(YYCOND_BAD_TEXT); -#line 231 "src/ast-lexer.cc" +#line 229 "src/ast-lexer.cc" { continue; } -#line 603 "src/prebuilt/ast-lexer-gen.cc" +#line 601 "src/prebuilt/ast-lexer-gen.cc" yy54: yych = *++lexer->cursor; if (yych <= ';') { @@ -639,14 +637,14 @@ yy54: yy55: ++lexer->cursor; if ((yych = *lexer->cursor) == ';') goto yy91; -#line 222 "src/ast-lexer.cc" +#line 220 "src/ast-lexer.cc" { RETURN(LPAR); } -#line 645 "src/prebuilt/ast-lexer-gen.cc" +#line 643 "src/prebuilt/ast-lexer-gen.cc" yy57: ++lexer->cursor; -#line 223 "src/ast-lexer.cc" +#line 221 "src/ast-lexer.cc" { RETURN(RPAR); } -#line 650 "src/prebuilt/ast-lexer-gen.cc" +#line 648 "src/prebuilt/ast-lexer-gen.cc" yy59: yych = *++lexer->cursor; if (yych <= 'h') { @@ -703,9 +701,9 @@ yy60: } } yy61: -#line 224 "src/ast-lexer.cc" +#line 222 "src/ast-lexer.cc" { LITERAL(Int); RETURN(NAT); } -#line 709 "src/prebuilt/ast-lexer-gen.cc" +#line 707 "src/prebuilt/ast-lexer-gen.cc" yy62: ++lexer->cursor; if ((lexer->limit - lexer->cursor) < 3) FILL(3); @@ -906,9 +904,9 @@ yy84: goto yy53; yy85: ++lexer->cursor; -#line 230 "src/ast-lexer.cc" +#line 228 "src/ast-lexer.cc" { TEXT; RETURN(TEXT); } -#line 912 "src/prebuilt/ast-lexer-gen.cc" +#line 910 "src/prebuilt/ast-lexer-gen.cc" yy87: ++lexer->cursor; if (lexer->limit <= lexer->cursor) FILL(1); @@ -971,15 +969,15 @@ yy88: } } yy90: -#line 456 "src/ast-lexer.cc" +#line 454 "src/ast-lexer.cc" { TEXT; RETURN(VAR); } -#line 977 "src/prebuilt/ast-lexer-gen.cc" +#line 975 "src/prebuilt/ast-lexer-gen.cc" yy91: ++lexer->cursor; BEGIN(YYCOND_BLOCK_COMMENT); -#line 461 "src/ast-lexer.cc" +#line 459 "src/ast-lexer.cc" { COMMENT_NESTING = 1; continue; } -#line 983 "src/prebuilt/ast-lexer-gen.cc" +#line 981 "src/prebuilt/ast-lexer-gen.cc" yy93: ++lexer->cursor; if ((yych = *lexer->cursor) <= 'D') { @@ -1021,9 +1019,9 @@ yy93: } } yy94: -#line 225 "src/ast-lexer.cc" +#line 223 "src/ast-lexer.cc" { LITERAL(Int); RETURN(INT); } -#line 1027 "src/prebuilt/ast-lexer-gen.cc" +#line 1025 "src/prebuilt/ast-lexer-gen.cc" yy95: ++lexer->cursor; if ((lexer->limit - lexer->cursor) < 3) FILL(3); @@ -1120,9 +1118,9 @@ yy99: } } yy101: -#line 226 "src/ast-lexer.cc" +#line 224 "src/ast-lexer.cc" { LITERAL(Float); RETURN(FLOAT); } -#line 1126 "src/prebuilt/ast-lexer-gen.cc" +#line 1124 "src/prebuilt/ast-lexer-gen.cc" yy102: yych = *++lexer->cursor; if (yych <= ',') { @@ -1143,9 +1141,9 @@ yy103: yy104: ++lexer->cursor; BEGIN(YYCOND_LINE_COMMENT); -#line 458 "src/ast-lexer.cc" +#line 456 "src/ast-lexer.cc" { continue; } -#line 1149 "src/prebuilt/ast-lexer-gen.cc" +#line 1147 "src/prebuilt/ast-lexer-gen.cc" yy106: yych = *++lexer->cursor; if (yych == 'i') goto yy156; @@ -1197,9 +1195,9 @@ yy110: } } yy111: -#line 255 "src/ast-lexer.cc" +#line 253 "src/ast-lexer.cc" { RETURN(BR); } -#line 1203 "src/prebuilt/ast-lexer-gen.cc" +#line 1201 "src/prebuilt/ast-lexer-gen.cc" yy112: yych = *++lexer->cursor; if (yych == 'l') goto yy161; @@ -1296,9 +1294,9 @@ yy127: } } yy128: -#line 250 "src/ast-lexer.cc" +#line 248 "src/ast-lexer.cc" { RETURN(IF); } -#line 1302 "src/prebuilt/ast-lexer-gen.cc" +#line 1300 "src/prebuilt/ast-lexer-gen.cc" yy129: yych = *++lexer->cursor; if (yych == 'p') goto yy184; @@ -1563,9 +1561,9 @@ yy167: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 262 "src/ast-lexer.cc" +#line 260 "src/ast-lexer.cc" { RETURN(END); } -#line 1569 "src/prebuilt/ast-lexer-gen.cc" +#line 1567 "src/prebuilt/ast-lexer-gen.cc" yy169: yych = *++lexer->cursor; if (yych == 'o') goto yy235; @@ -1604,9 +1602,9 @@ yy170: } } yy171: -#line 244 "src/ast-lexer.cc" +#line 242 "src/ast-lexer.cc" { TYPE(F32); RETURN(VALUE_TYPE); } -#line 1610 "src/prebuilt/ast-lexer-gen.cc" +#line 1608 "src/prebuilt/ast-lexer-gen.cc" yy172: ++lexer->cursor; if ((yych = *lexer->cursor) <= ':') { @@ -1641,9 +1639,9 @@ yy172: } } yy173: -#line 245 "src/ast-lexer.cc" +#line 243 "src/ast-lexer.cc" { TYPE(F64); RETURN(VALUE_TYPE); } -#line 1647 "src/prebuilt/ast-lexer-gen.cc" +#line 1645 "src/prebuilt/ast-lexer-gen.cc" yy174: yych = *++lexer->cursor; if (yych == 'c') goto yy238; @@ -1683,9 +1681,9 @@ yy175: } } yy176: -#line 446 "src/ast-lexer.cc" +#line 444 "src/ast-lexer.cc" { RETURN(GET); } -#line 1689 "src/prebuilt/ast-lexer-gen.cc" +#line 1687 "src/prebuilt/ast-lexer-gen.cc" yy177: yych = *++lexer->cursor; if (yych == 'b') goto yy241; @@ -1728,9 +1726,9 @@ yy179: } } yy180: -#line 242 "src/ast-lexer.cc" +#line 240 "src/ast-lexer.cc" { TYPE(I32); RETURN(VALUE_TYPE); } -#line 1734 "src/prebuilt/ast-lexer-gen.cc" +#line 1732 "src/prebuilt/ast-lexer-gen.cc" yy181: ++lexer->cursor; if ((yych = *lexer->cursor) <= ':') { @@ -1765,9 +1763,9 @@ yy181: } } yy182: -#line 243 "src/ast-lexer.cc" +#line 241 "src/ast-lexer.cc" { TYPE(I64); RETURN(VALUE_TYPE); } -#line 1771 "src/prebuilt/ast-lexer-gen.cc" +#line 1769 "src/prebuilt/ast-lexer-gen.cc" yy183: yych = *++lexer->cursor; if (yych == 'e') goto yy245; @@ -1811,9 +1809,9 @@ yy185: } } yy186: -#line 228 "src/ast-lexer.cc" +#line 226 "src/ast-lexer.cc" { LITERAL(Infinity); RETURN(FLOAT); } -#line 1817 "src/prebuilt/ast-lexer-gen.cc" +#line 1815 "src/prebuilt/ast-lexer-gen.cc" yy187: yych = *++lexer->cursor; if (yych == 'u') goto yy248; @@ -1843,9 +1841,9 @@ yy193: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 247 "src/ast-lexer.cc" +#line 245 "src/ast-lexer.cc" { RETURN(MUT); } -#line 1849 "src/prebuilt/ast-lexer-gen.cc" +#line 1847 "src/prebuilt/ast-lexer-gen.cc" yy195: ++lexer->cursor; if ((yych = *lexer->cursor) <= ';') { @@ -1880,17 +1878,17 @@ yy195: } } yy196: -#line 229 "src/ast-lexer.cc" +#line 227 "src/ast-lexer.cc" { LITERAL(Nan); RETURN(FLOAT); } -#line 1886 "src/prebuilt/ast-lexer-gen.cc" +#line 1884 "src/prebuilt/ast-lexer-gen.cc" yy197: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 248 "src/ast-lexer.cc" +#line 246 "src/ast-lexer.cc" { RETURN(NOP); } -#line 1894 "src/prebuilt/ast-lexer-gen.cc" +#line 1892 "src/prebuilt/ast-lexer-gen.cc" yy199: yych = *++lexer->cursor; if (yych == 's') goto yy256; @@ -2112,9 +2110,9 @@ yy224: } } yy225: -#line 258 "src/ast-lexer.cc" +#line 256 "src/ast-lexer.cc" { RETURN(CALL); } -#line 2118 "src/prebuilt/ast-lexer-gen.cc" +#line 2116 "src/prebuilt/ast-lexer-gen.cc" yy226: yych = *++lexer->cursor; if (yych == 'e') goto yy285; @@ -2124,33 +2122,33 @@ yy227: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 440 "src/ast-lexer.cc" +#line 438 "src/ast-lexer.cc" { RETURN(DATA); } -#line 2130 "src/prebuilt/ast-lexer-gen.cc" +#line 2128 "src/prebuilt/ast-lexer-gen.cc" yy229: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 261 "src/ast-lexer.cc" +#line 259 "src/ast-lexer.cc" { RETURN(DROP); } -#line 2138 "src/prebuilt/ast-lexer-gen.cc" +#line 2136 "src/prebuilt/ast-lexer-gen.cc" yy231: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 439 "src/ast-lexer.cc" +#line 437 "src/ast-lexer.cc" { RETURN(ELEM); } -#line 2146 "src/prebuilt/ast-lexer-gen.cc" +#line 2144 "src/prebuilt/ast-lexer-gen.cc" yy233: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 253 "src/ast-lexer.cc" +#line 251 "src/ast-lexer.cc" { RETURN(ELSE); } -#line 2154 "src/prebuilt/ast-lexer-gen.cc" +#line 2152 "src/prebuilt/ast-lexer-gen.cc" yy235: yych = *++lexer->cursor; if (yych == 'r') goto yy286; @@ -2195,9 +2193,9 @@ yy238: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 430 "src/ast-lexer.cc" +#line 428 "src/ast-lexer.cc" { RETURN(FUNC); } -#line 2201 "src/prebuilt/ast-lexer-gen.cc" +#line 2199 "src/prebuilt/ast-lexer-gen.cc" yy240: yych = *++lexer->cursor; if (yych == 'g') goto yy312; @@ -2279,9 +2277,9 @@ yy251: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 254 "src/ast-lexer.cc" +#line 252 "src/ast-lexer.cc" { RETURN(LOOP); } -#line 2285 "src/prebuilt/ast-lexer-gen.cc" +#line 2283 "src/prebuilt/ast-lexer-gen.cc" yy253: yych = *++lexer->cursor; if (yych == 'r') goto yy353; @@ -2344,17 +2342,17 @@ yy267: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 252 "src/ast-lexer.cc" +#line 250 "src/ast-lexer.cc" { RETURN(THEN); } -#line 2350 "src/prebuilt/ast-lexer-gen.cc" +#line 2348 "src/prebuilt/ast-lexer-gen.cc" yy269: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 429 "src/ast-lexer.cc" +#line 427 "src/ast-lexer.cc" { RETURN(TYPE); } -#line 2358 "src/prebuilt/ast-lexer-gen.cc" +#line 2356 "src/prebuilt/ast-lexer-gen.cc" yy271: yych = *++lexer->cursor; if (yych == 'a') goto yy371; @@ -2400,9 +2398,9 @@ yy273: } } yy275: -#line 227 "src/ast-lexer.cc" +#line 225 "src/ast-lexer.cc" { LITERAL(Hexfloat); RETURN(FLOAT); } -#line 2406 "src/prebuilt/ast-lexer-gen.cc" +#line 2404 "src/prebuilt/ast-lexer-gen.cc" yy276: yych = *++lexer->cursor; if (yych == '=') goto yy372; @@ -2420,17 +2418,17 @@ yy279: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 249 "src/ast-lexer.cc" +#line 247 "src/ast-lexer.cc" { RETURN(BLOCK); } -#line 2426 "src/prebuilt/ast-lexer-gen.cc" +#line 2424 "src/prebuilt/ast-lexer-gen.cc" yy281: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 256 "src/ast-lexer.cc" +#line 254 "src/ast-lexer.cc" { RETURN(BR_IF); } -#line 2434 "src/prebuilt/ast-lexer-gen.cc" +#line 2432 "src/prebuilt/ast-lexer-gen.cc" yy283: yych = *++lexer->cursor; if (yych == 'b') goto yy375; @@ -2782,9 +2780,9 @@ yy348: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 454 "src/ast-lexer.cc" +#line 452 "src/ast-lexer.cc" { RETURN(INPUT); } -#line 2788 "src/prebuilt/ast-lexer-gen.cc" +#line 2786 "src/prebuilt/ast-lexer-gen.cc" yy350: yych = *++lexer->cursor; if (yych == 'e') goto yy499; @@ -2794,9 +2792,9 @@ yy351: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 433 "src/ast-lexer.cc" +#line 431 "src/ast-lexer.cc" { RETURN(LOCAL); } -#line 2800 "src/prebuilt/ast-lexer-gen.cc" +#line 2798 "src/prebuilt/ast-lexer-gen.cc" yy353: yych = *++lexer->cursor; if (yych == 'y') goto yy501; @@ -2822,9 +2820,9 @@ yy358: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 431 "src/ast-lexer.cc" +#line 429 "src/ast-lexer.cc" { RETURN(PARAM); } -#line 2828 "src/prebuilt/ast-lexer-gen.cc" +#line 2826 "src/prebuilt/ast-lexer-gen.cc" yy360: yych = *++lexer->cursor; if (yych == 't') goto yy510; @@ -2854,17 +2852,17 @@ yy366: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 438 "src/ast-lexer.cc" +#line 436 "src/ast-lexer.cc" { RETURN(START); } -#line 2860 "src/prebuilt/ast-lexer-gen.cc" +#line 2858 "src/prebuilt/ast-lexer-gen.cc" yy368: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 436 "src/ast-lexer.cc" +#line 434 "src/ast-lexer.cc" { RETURN(TABLE); } -#line 2868 "src/prebuilt/ast-lexer-gen.cc" +#line 2866 "src/prebuilt/ast-lexer-gen.cc" yy370: yych = *++lexer->cursor; if (yych == 'o') goto yy519; @@ -2906,9 +2904,9 @@ yy378: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 443 "src/ast-lexer.cc" +#line 441 "src/ast-lexer.cc" { RETURN(EXPORT); } -#line 2912 "src/prebuilt/ast-lexer-gen.cc" +#line 2910 "src/prebuilt/ast-lexer-gen.cc" yy380: yych = *++lexer->cursor; if (yych == 's') goto yy532; @@ -2939,9 +2937,9 @@ yy386: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 384 "src/ast-lexer.cc" +#line 382 "src/ast-lexer.cc" { OPCODE(F32Eq); RETURN(COMPARE); } -#line 2945 "src/prebuilt/ast-lexer-gen.cc" +#line 2943 "src/prebuilt/ast-lexer-gen.cc" yy388: yych = *++lexer->cursor; if (yych == 'o') goto yy542; @@ -2951,25 +2949,25 @@ yy389: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 394 "src/ast-lexer.cc" +#line 392 "src/ast-lexer.cc" { OPCODE(F32Ge); RETURN(COMPARE); } -#line 2957 "src/prebuilt/ast-lexer-gen.cc" +#line 2955 "src/prebuilt/ast-lexer-gen.cc" yy391: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 392 "src/ast-lexer.cc" +#line 390 "src/ast-lexer.cc" { OPCODE(F32Gt); RETURN(COMPARE); } -#line 2965 "src/prebuilt/ast-lexer-gen.cc" +#line 2963 "src/prebuilt/ast-lexer-gen.cc" yy393: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 390 "src/ast-lexer.cc" +#line 388 "src/ast-lexer.cc" { OPCODE(F32Le); RETURN(COMPARE); } -#line 2973 "src/prebuilt/ast-lexer-gen.cc" +#line 2971 "src/prebuilt/ast-lexer-gen.cc" yy395: yych = *++lexer->cursor; if (yych == 'a') goto yy543; @@ -2979,9 +2977,9 @@ yy396: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 388 "src/ast-lexer.cc" +#line 386 "src/ast-lexer.cc" { OPCODE(F32Lt); RETURN(COMPARE); } -#line 2985 "src/prebuilt/ast-lexer-gen.cc" +#line 2983 "src/prebuilt/ast-lexer-gen.cc" yy398: yych = *++lexer->cursor; if (yych == 'x') goto yy544; @@ -3030,9 +3028,9 @@ yy401: } } yy402: -#line 386 "src/ast-lexer.cc" +#line 384 "src/ast-lexer.cc" { OPCODE(F32Ne); RETURN(COMPARE); } -#line 3036 "src/prebuilt/ast-lexer-gen.cc" +#line 3034 "src/prebuilt/ast-lexer-gen.cc" yy403: yych = *++lexer->cursor; if (yych == 'i') goto yy553; @@ -3079,9 +3077,9 @@ yy413: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 385 "src/ast-lexer.cc" +#line 383 "src/ast-lexer.cc" { OPCODE(F64Eq); RETURN(COMPARE); } -#line 3085 "src/prebuilt/ast-lexer-gen.cc" +#line 3083 "src/prebuilt/ast-lexer-gen.cc" yy415: yych = *++lexer->cursor; if (yych == 'o') goto yy568; @@ -3091,25 +3089,25 @@ yy416: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 395 "src/ast-lexer.cc" +#line 393 "src/ast-lexer.cc" { OPCODE(F64Ge); RETURN(COMPARE); } -#line 3097 "src/prebuilt/ast-lexer-gen.cc" +#line 3095 "src/prebuilt/ast-lexer-gen.cc" yy418: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 393 "src/ast-lexer.cc" +#line 391 "src/ast-lexer.cc" { OPCODE(F64Gt); RETURN(COMPARE); } -#line 3105 "src/prebuilt/ast-lexer-gen.cc" +#line 3103 "src/prebuilt/ast-lexer-gen.cc" yy420: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 391 "src/ast-lexer.cc" +#line 389 "src/ast-lexer.cc" { OPCODE(F64Le); RETURN(COMPARE); } -#line 3113 "src/prebuilt/ast-lexer-gen.cc" +#line 3111 "src/prebuilt/ast-lexer-gen.cc" yy422: yych = *++lexer->cursor; if (yych == 'a') goto yy569; @@ -3119,9 +3117,9 @@ yy423: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 389 "src/ast-lexer.cc" +#line 387 "src/ast-lexer.cc" { OPCODE(F64Lt); RETURN(COMPARE); } -#line 3125 "src/prebuilt/ast-lexer-gen.cc" +#line 3123 "src/prebuilt/ast-lexer-gen.cc" yy425: yych = *++lexer->cursor; if (yych == 'x') goto yy570; @@ -3170,9 +3168,9 @@ yy428: } } yy429: -#line 387 "src/ast-lexer.cc" +#line 385 "src/ast-lexer.cc" { OPCODE(F64Ne); RETURN(COMPARE); } -#line 3176 "src/prebuilt/ast-lexer-gen.cc" +#line 3174 "src/prebuilt/ast-lexer-gen.cc" yy430: yych = *++lexer->cursor; if (yych == 'o') goto yy579; @@ -3210,9 +3208,9 @@ yy438: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 434 "src/ast-lexer.cc" +#line 432 "src/ast-lexer.cc" { RETURN(GLOBAL); } -#line 3216 "src/prebuilt/ast-lexer-gen.cc" +#line 3214 "src/prebuilt/ast-lexer-gen.cc" yy440: yych = *++lexer->cursor; if (yych == 'e') goto yy588; @@ -3276,9 +3274,9 @@ yy447: } } yy448: -#line 364 "src/ast-lexer.cc" +#line 362 "src/ast-lexer.cc" { OPCODE(I32Eq); RETURN(COMPARE); } -#line 3282 "src/prebuilt/ast-lexer-gen.cc" +#line 3280 "src/prebuilt/ast-lexer-gen.cc" yy449: yych = *++lexer->cursor; if (yych == '_') goto yy601; @@ -3308,17 +3306,17 @@ yy455: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 366 "src/ast-lexer.cc" +#line 364 "src/ast-lexer.cc" { OPCODE(I32Ne); RETURN(COMPARE); } -#line 3314 "src/prebuilt/ast-lexer-gen.cc" +#line 3312 "src/prebuilt/ast-lexer-gen.cc" yy457: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 336 "src/ast-lexer.cc" +#line 334 "src/ast-lexer.cc" { OPCODE(I32Or); RETURN(BINARY); } -#line 3322 "src/prebuilt/ast-lexer-gen.cc" +#line 3320 "src/prebuilt/ast-lexer-gen.cc" yy459: yych = *++lexer->cursor; if (yych == 'p') goto yy608; @@ -3416,9 +3414,9 @@ yy474: } } yy475: -#line 365 "src/ast-lexer.cc" +#line 363 "src/ast-lexer.cc" { OPCODE(I64Eq); RETURN(COMPARE); } -#line 3422 "src/prebuilt/ast-lexer-gen.cc" +#line 3420 "src/prebuilt/ast-lexer-gen.cc" yy476: yych = *++lexer->cursor; if (yych == 't') goto yy634; @@ -3452,17 +3450,17 @@ yy483: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 367 "src/ast-lexer.cc" +#line 365 "src/ast-lexer.cc" { OPCODE(I64Ne); RETURN(COMPARE); } -#line 3458 "src/prebuilt/ast-lexer-gen.cc" +#line 3456 "src/prebuilt/ast-lexer-gen.cc" yy485: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 337 "src/ast-lexer.cc" +#line 335 "src/ast-lexer.cc" { OPCODE(I64Or); RETURN(BINARY); } -#line 3466 "src/prebuilt/ast-lexer-gen.cc" +#line 3464 "src/prebuilt/ast-lexer-gen.cc" yy487: yych = *++lexer->cursor; if (yych == 'p') goto yy642; @@ -3506,9 +3504,9 @@ yy496: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 442 "src/ast-lexer.cc" +#line 440 "src/ast-lexer.cc" { RETURN(IMPORT); } -#line 3512 "src/prebuilt/ast-lexer-gen.cc" +#line 3510 "src/prebuilt/ast-lexer-gen.cc" yy498: yych = *++lexer->cursor; if (yych == 't') goto yy657; @@ -3518,25 +3516,25 @@ yy499: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 445 "src/ast-lexer.cc" +#line 443 "src/ast-lexer.cc" { RETURN(INVOKE); } -#line 3524 "src/prebuilt/ast-lexer-gen.cc" +#line 3522 "src/prebuilt/ast-lexer-gen.cc" yy501: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 437 "src/ast-lexer.cc" +#line 435 "src/ast-lexer.cc" { RETURN(MEMORY); } -#line 3532 "src/prebuilt/ast-lexer-gen.cc" +#line 3530 "src/prebuilt/ast-lexer-gen.cc" yy503: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 435 "src/ast-lexer.cc" +#line 433 "src/ast-lexer.cc" { RETURN(MODULE); } -#line 3540 "src/prebuilt/ast-lexer-gen.cc" +#line 3538 "src/prebuilt/ast-lexer-gen.cc" yy505: yych = *++lexer->cursor; if (yych <= '@') { @@ -3583,17 +3581,17 @@ yy506: } } yy507: -#line 441 "src/ast-lexer.cc" +#line 439 "src/ast-lexer.cc" { RETURN(OFFSET); } -#line 3589 "src/prebuilt/ast-lexer-gen.cc" +#line 3587 "src/prebuilt/ast-lexer-gen.cc" yy508: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 455 "src/ast-lexer.cc" +#line 453 "src/ast-lexer.cc" { RETURN(OUTPUT); } -#line 3597 "src/prebuilt/ast-lexer-gen.cc" +#line 3595 "src/prebuilt/ast-lexer-gen.cc" yy510: yych = *++lexer->cursor; if (yych == 'e') goto yy661; @@ -3603,25 +3601,25 @@ yy511: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 432 "src/ast-lexer.cc" +#line 430 "src/ast-lexer.cc" { RETURN(RESULT); } -#line 3609 "src/prebuilt/ast-lexer-gen.cc" +#line 3607 "src/prebuilt/ast-lexer-gen.cc" yy513: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 263 "src/ast-lexer.cc" +#line 261 "src/ast-lexer.cc" { RETURN(RETURN); } -#line 3617 "src/prebuilt/ast-lexer-gen.cc" +#line 3615 "src/prebuilt/ast-lexer-gen.cc" yy515: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 425 "src/ast-lexer.cc" +#line 423 "src/ast-lexer.cc" { RETURN(SELECT); } -#line 3625 "src/prebuilt/ast-lexer-gen.cc" +#line 3623 "src/prebuilt/ast-lexer-gen.cc" yy517: yych = *++lexer->cursor; if (yych == 'o') goto yy662; @@ -3674,9 +3672,9 @@ yy521: } } yy522: -#line 293 "src/ast-lexer.cc" +#line 291 "src/ast-lexer.cc" { TEXT_AT(6); RETURN(ALIGN_EQ_NAT); } -#line 3680 "src/prebuilt/ast-lexer-gen.cc" +#line 3678 "src/prebuilt/ast-lexer-gen.cc" yy523: ++lexer->cursor; if (lexer->limit <= lexer->cursor) FILL(1); @@ -3725,9 +3723,9 @@ yy525: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 246 "src/ast-lexer.cc" +#line 244 "src/ast-lexer.cc" { RETURN(ANYFUNC); } -#line 3731 "src/prebuilt/ast-lexer-gen.cc" +#line 3729 "src/prebuilt/ast-lexer-gen.cc" yy527: yych = *++lexer->cursor; switch (yych) { @@ -3760,17 +3758,17 @@ yy532: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 308 "src/ast-lexer.cc" +#line 306 "src/ast-lexer.cc" { OPCODE(F32Abs); RETURN(UNARY); } -#line 3766 "src/prebuilt/ast-lexer-gen.cc" +#line 3764 "src/prebuilt/ast-lexer-gen.cc" yy534: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 350 "src/ast-lexer.cc" +#line 348 "src/ast-lexer.cc" { OPCODE(F32Add); RETURN(BINARY); } -#line 3774 "src/prebuilt/ast-lexer-gen.cc" +#line 3772 "src/prebuilt/ast-lexer-gen.cc" yy536: yych = *++lexer->cursor; if (yych == 'l') goto yy678; @@ -3793,9 +3791,9 @@ yy540: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 356 "src/ast-lexer.cc" +#line 354 "src/ast-lexer.cc" { OPCODE(F32Div); RETURN(BINARY); } -#line 3799 "src/prebuilt/ast-lexer-gen.cc" +#line 3797 "src/prebuilt/ast-lexer-gen.cc" yy542: yych = *++lexer->cursor; if (yych == 'o') goto yy684; @@ -3809,25 +3807,25 @@ yy544: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 360 "src/ast-lexer.cc" +#line 358 "src/ast-lexer.cc" { OPCODE(F32Max); RETURN(BINARY); } -#line 3815 "src/prebuilt/ast-lexer-gen.cc" +#line 3813 "src/prebuilt/ast-lexer-gen.cc" yy546: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 358 "src/ast-lexer.cc" +#line 356 "src/ast-lexer.cc" { OPCODE(F32Min); RETURN(BINARY); } -#line 3823 "src/prebuilt/ast-lexer-gen.cc" +#line 3821 "src/prebuilt/ast-lexer-gen.cc" yy548: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 354 "src/ast-lexer.cc" +#line 352 "src/ast-lexer.cc" { OPCODE(F32Mul); RETURN(BINARY); } -#line 3831 "src/prebuilt/ast-lexer-gen.cc" +#line 3829 "src/prebuilt/ast-lexer-gen.cc" yy550: yych = *++lexer->cursor; if (yych == 'r') goto yy687; @@ -3837,9 +3835,9 @@ yy551: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 306 "src/ast-lexer.cc" +#line 304 "src/ast-lexer.cc" { OPCODE(F32Neg); RETURN(UNARY); } -#line 3843 "src/prebuilt/ast-lexer-gen.cc" +#line 3841 "src/prebuilt/ast-lexer-gen.cc" yy553: yych = *++lexer->cursor; if (yych == 'n') goto yy688; @@ -3857,9 +3855,9 @@ yy556: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 352 "src/ast-lexer.cc" +#line 350 "src/ast-lexer.cc" { OPCODE(F32Sub); RETURN(BINARY); } -#line 3863 "src/prebuilt/ast-lexer-gen.cc" +#line 3861 "src/prebuilt/ast-lexer-gen.cc" yy558: yych = *++lexer->cursor; if (yych == 'n') goto yy692; @@ -3869,17 +3867,17 @@ yy559: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 309 "src/ast-lexer.cc" +#line 307 "src/ast-lexer.cc" { OPCODE(F64Abs); RETURN(UNARY); } -#line 3875 "src/prebuilt/ast-lexer-gen.cc" +#line 3873 "src/prebuilt/ast-lexer-gen.cc" yy561: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 351 "src/ast-lexer.cc" +#line 349 "src/ast-lexer.cc" { OPCODE(F64Add); RETURN(BINARY); } -#line 3883 "src/prebuilt/ast-lexer-gen.cc" +#line 3881 "src/prebuilt/ast-lexer-gen.cc" yy563: yych = *++lexer->cursor; if (yych == 'l') goto yy693; @@ -3898,9 +3896,9 @@ yy566: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 357 "src/ast-lexer.cc" +#line 355 "src/ast-lexer.cc" { OPCODE(F64Div); RETURN(BINARY); } -#line 3904 "src/prebuilt/ast-lexer-gen.cc" +#line 3902 "src/prebuilt/ast-lexer-gen.cc" yy568: yych = *++lexer->cursor; if (yych == 'o') goto yy698; @@ -3914,25 +3912,25 @@ yy570: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 361 "src/ast-lexer.cc" +#line 359 "src/ast-lexer.cc" { OPCODE(F64Max); RETURN(BINARY); } -#line 3920 "src/prebuilt/ast-lexer-gen.cc" +#line 3918 "src/prebuilt/ast-lexer-gen.cc" yy572: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 359 "src/ast-lexer.cc" +#line 357 "src/ast-lexer.cc" { OPCODE(F64Min); RETURN(BINARY); } -#line 3928 "src/prebuilt/ast-lexer-gen.cc" +#line 3926 "src/prebuilt/ast-lexer-gen.cc" yy574: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 355 "src/ast-lexer.cc" +#line 353 "src/ast-lexer.cc" { OPCODE(F64Mul); RETURN(BINARY); } -#line 3936 "src/prebuilt/ast-lexer-gen.cc" +#line 3934 "src/prebuilt/ast-lexer-gen.cc" yy576: yych = *++lexer->cursor; if (yych == 'r') goto yy701; @@ -3942,9 +3940,9 @@ yy577: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 307 "src/ast-lexer.cc" +#line 305 "src/ast-lexer.cc" { OPCODE(F64Neg); RETURN(UNARY); } -#line 3948 "src/prebuilt/ast-lexer-gen.cc" +#line 3946 "src/prebuilt/ast-lexer-gen.cc" yy579: yych = *++lexer->cursor; if (yych == 'm') goto yy702; @@ -3966,9 +3964,9 @@ yy583: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 353 "src/ast-lexer.cc" +#line 351 "src/ast-lexer.cc" { OPCODE(F64Sub); RETURN(BINARY); } -#line 3972 "src/prebuilt/ast-lexer-gen.cc" +#line 3970 "src/prebuilt/ast-lexer-gen.cc" yy585: yych = *++lexer->cursor; if (yych == 'n') goto yy707; @@ -3990,25 +3988,25 @@ yy589: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 320 "src/ast-lexer.cc" +#line 318 "src/ast-lexer.cc" { OPCODE(I32Add); RETURN(BINARY); } -#line 3996 "src/prebuilt/ast-lexer-gen.cc" +#line 3994 "src/prebuilt/ast-lexer-gen.cc" yy591: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 334 "src/ast-lexer.cc" +#line 332 "src/ast-lexer.cc" { OPCODE(I32And); RETURN(BINARY); } -#line 4004 "src/prebuilt/ast-lexer-gen.cc" +#line 4002 "src/prebuilt/ast-lexer-gen.cc" yy593: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 300 "src/ast-lexer.cc" +#line 298 "src/ast-lexer.cc" { OPCODE(I32Clz); RETURN(UNARY); } -#line 4012 "src/prebuilt/ast-lexer-gen.cc" +#line 4010 "src/prebuilt/ast-lexer-gen.cc" yy595: yych = *++lexer->cursor; if (yych == 's') goto yy711; @@ -4018,9 +4016,9 @@ yy596: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 302 "src/ast-lexer.cc" +#line 300 "src/ast-lexer.cc" { OPCODE(I32Ctz); RETURN(UNARY); } -#line 4024 "src/prebuilt/ast-lexer-gen.cc" +#line 4022 "src/prebuilt/ast-lexer-gen.cc" yy598: yych = *++lexer->cursor; if (yych == '_') goto yy712; @@ -4030,9 +4028,9 @@ yy599: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 298 "src/ast-lexer.cc" +#line 296 "src/ast-lexer.cc" { OPCODE(I32Eqz); RETURN(CONVERT); } -#line 4036 "src/prebuilt/ast-lexer-gen.cc" +#line 4034 "src/prebuilt/ast-lexer-gen.cc" yy601: yych = *++lexer->cursor; if (yych == 's') goto yy713; @@ -4062,9 +4060,9 @@ yy606: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 324 "src/ast-lexer.cc" +#line 322 "src/ast-lexer.cc" { OPCODE(I32Mul); RETURN(BINARY); } -#line 4068 "src/prebuilt/ast-lexer-gen.cc" +#line 4066 "src/prebuilt/ast-lexer-gen.cc" yy608: yych = *++lexer->cursor; if (yych == 'c') goto yy731; @@ -4087,9 +4085,9 @@ yy612: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 340 "src/ast-lexer.cc" +#line 338 "src/ast-lexer.cc" { OPCODE(I32Shl); RETURN(BINARY); } -#line 4093 "src/prebuilt/ast-lexer-gen.cc" +#line 4091 "src/prebuilt/ast-lexer-gen.cc" yy614: yych = *++lexer->cursor; if (yych == '_') goto yy738; @@ -4103,9 +4101,9 @@ yy616: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 322 "src/ast-lexer.cc" +#line 320 "src/ast-lexer.cc" { OPCODE(I32Sub); RETURN(BINARY); } -#line 4109 "src/prebuilt/ast-lexer-gen.cc" +#line 4107 "src/prebuilt/ast-lexer-gen.cc" yy618: yych = *++lexer->cursor; if (yych == 'n') goto yy740; @@ -4119,33 +4117,33 @@ yy620: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 338 "src/ast-lexer.cc" +#line 336 "src/ast-lexer.cc" { OPCODE(I32Xor); RETURN(BINARY); } -#line 4125 "src/prebuilt/ast-lexer-gen.cc" +#line 4123 "src/prebuilt/ast-lexer-gen.cc" yy622: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 321 "src/ast-lexer.cc" +#line 319 "src/ast-lexer.cc" { OPCODE(I64Add); RETURN(BINARY); } -#line 4133 "src/prebuilt/ast-lexer-gen.cc" +#line 4131 "src/prebuilt/ast-lexer-gen.cc" yy624: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 335 "src/ast-lexer.cc" +#line 333 "src/ast-lexer.cc" { OPCODE(I64And); RETURN(BINARY); } -#line 4141 "src/prebuilt/ast-lexer-gen.cc" +#line 4139 "src/prebuilt/ast-lexer-gen.cc" yy626: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 301 "src/ast-lexer.cc" +#line 299 "src/ast-lexer.cc" { OPCODE(I64Clz); RETURN(UNARY); } -#line 4149 "src/prebuilt/ast-lexer-gen.cc" +#line 4147 "src/prebuilt/ast-lexer-gen.cc" yy628: yych = *++lexer->cursor; if (yych == 's') goto yy742; @@ -4155,9 +4153,9 @@ yy629: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 303 "src/ast-lexer.cc" +#line 301 "src/ast-lexer.cc" { OPCODE(I64Ctz); RETURN(UNARY); } -#line 4161 "src/prebuilt/ast-lexer-gen.cc" +#line 4159 "src/prebuilt/ast-lexer-gen.cc" yy631: yych = *++lexer->cursor; if (yych == '_') goto yy743; @@ -4167,9 +4165,9 @@ yy632: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 299 "src/ast-lexer.cc" +#line 297 "src/ast-lexer.cc" { OPCODE(I64Eqz); RETURN(CONVERT); } -#line 4173 "src/prebuilt/ast-lexer-gen.cc" +#line 4171 "src/prebuilt/ast-lexer-gen.cc" yy634: yych = *++lexer->cursor; if (yych == 'e') goto yy744; @@ -4203,9 +4201,9 @@ yy640: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 325 "src/ast-lexer.cc" +#line 323 "src/ast-lexer.cc" { OPCODE(I64Mul); RETURN(BINARY); } -#line 4209 "src/prebuilt/ast-lexer-gen.cc" +#line 4207 "src/prebuilt/ast-lexer-gen.cc" yy642: yych = *++lexer->cursor; if (yych == 'c') goto yy763; @@ -4228,9 +4226,9 @@ yy646: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 341 "src/ast-lexer.cc" +#line 339 "src/ast-lexer.cc" { OPCODE(I64Shl); RETURN(BINARY); } -#line 4234 "src/prebuilt/ast-lexer-gen.cc" +#line 4232 "src/prebuilt/ast-lexer-gen.cc" yy648: yych = *++lexer->cursor; if (yych == '_') goto yy770; @@ -4244,9 +4242,9 @@ yy650: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 323 "src/ast-lexer.cc" +#line 321 "src/ast-lexer.cc" { OPCODE(I64Sub); RETURN(BINARY); } -#line 4250 "src/prebuilt/ast-lexer-gen.cc" +#line 4248 "src/prebuilt/ast-lexer-gen.cc" yy652: yych = *++lexer->cursor; if (yych == 'n') goto yy772; @@ -4256,17 +4254,17 @@ yy653: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 339 "src/ast-lexer.cc" +#line 337 "src/ast-lexer.cc" { OPCODE(I64Xor); RETURN(BINARY); } -#line 4262 "src/prebuilt/ast-lexer-gen.cc" +#line 4260 "src/prebuilt/ast-lexer-gen.cc" yy655: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 251 "src/ast-lexer.cc" +#line 249 "src/ast-lexer.cc" { RETURN(IF); } -#line 4270 "src/prebuilt/ast-lexer-gen.cc" +#line 4268 "src/prebuilt/ast-lexer-gen.cc" yy657: yych = *++lexer->cursor; if (yych == 'y') goto yy773; @@ -4384,9 +4382,9 @@ yy673: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 257 "src/ast-lexer.cc" +#line 255 "src/ast-lexer.cc" { RETURN(BR_TABLE); } -#line 4390 "src/prebuilt/ast-lexer-gen.cc" +#line 4388 "src/prebuilt/ast-lexer-gen.cc" yy675: yych = *++lexer->cursor; if (yych == 'o') goto yy792; @@ -4404,9 +4402,9 @@ yy678: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 312 "src/ast-lexer.cc" +#line 310 "src/ast-lexer.cc" { OPCODE(F32Ceil); RETURN(UNARY); } -#line 4410 "src/prebuilt/ast-lexer-gen.cc" +#line 4408 "src/prebuilt/ast-lexer-gen.cc" yy680: yych = *++lexer->cursor; if (yych == 't') goto yy795; @@ -4432,9 +4430,9 @@ yy685: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 271 "src/ast-lexer.cc" +#line 269 "src/ast-lexer.cc" { OPCODE(F32Load); RETURN(LOAD); } -#line 4438 "src/prebuilt/ast-lexer-gen.cc" +#line 4436 "src/prebuilt/ast-lexer-gen.cc" yy687: yych = *++lexer->cursor; if (yych == 'e') goto yy802; @@ -4448,9 +4446,9 @@ yy689: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 310 "src/ast-lexer.cc" +#line 308 "src/ast-lexer.cc" { OPCODE(F32Sqrt); RETURN(UNARY); } -#line 4454 "src/prebuilt/ast-lexer-gen.cc" +#line 4452 "src/prebuilt/ast-lexer-gen.cc" yy691: yych = *++lexer->cursor; if (yych == 'e') goto yy804; @@ -4464,9 +4462,9 @@ yy693: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 313 "src/ast-lexer.cc" +#line 311 "src/ast-lexer.cc" { OPCODE(F64Ceil); RETURN(UNARY); } -#line 4470 "src/prebuilt/ast-lexer-gen.cc" +#line 4468 "src/prebuilt/ast-lexer-gen.cc" yy695: yych = *++lexer->cursor; if (yych == 't') goto yy808; @@ -4488,9 +4486,9 @@ yy699: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 272 "src/ast-lexer.cc" +#line 270 "src/ast-lexer.cc" { OPCODE(F64Load); RETURN(LOAD); } -#line 4494 "src/prebuilt/ast-lexer-gen.cc" +#line 4492 "src/prebuilt/ast-lexer-gen.cc" yy701: yych = *++lexer->cursor; if (yych == 'e') goto yy814; @@ -4508,9 +4506,9 @@ yy704: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 311 "src/ast-lexer.cc" +#line 309 "src/ast-lexer.cc" { OPCODE(F64Sqrt); RETURN(UNARY); } -#line 4514 "src/prebuilt/ast-lexer-gen.cc" +#line 4512 "src/prebuilt/ast-lexer-gen.cc" yy706: yych = *++lexer->cursor; if (yych == 'e') goto yy817; @@ -4545,49 +4543,49 @@ yy713: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 380 "src/ast-lexer.cc" +#line 378 "src/ast-lexer.cc" { OPCODE(I32GeS); RETURN(COMPARE); } -#line 4551 "src/prebuilt/ast-lexer-gen.cc" +#line 4549 "src/prebuilt/ast-lexer-gen.cc" yy715: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 382 "src/ast-lexer.cc" +#line 380 "src/ast-lexer.cc" { OPCODE(I32GeU); RETURN(COMPARE); } -#line 4559 "src/prebuilt/ast-lexer-gen.cc" +#line 4557 "src/prebuilt/ast-lexer-gen.cc" yy717: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 376 "src/ast-lexer.cc" +#line 374 "src/ast-lexer.cc" { OPCODE(I32GtS); RETURN(COMPARE); } -#line 4567 "src/prebuilt/ast-lexer-gen.cc" +#line 4565 "src/prebuilt/ast-lexer-gen.cc" yy719: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 378 "src/ast-lexer.cc" +#line 376 "src/ast-lexer.cc" { OPCODE(I32GtU); RETURN(COMPARE); } -#line 4575 "src/prebuilt/ast-lexer-gen.cc" +#line 4573 "src/prebuilt/ast-lexer-gen.cc" yy721: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 372 "src/ast-lexer.cc" +#line 370 "src/ast-lexer.cc" { OPCODE(I32LeS); RETURN(COMPARE); } -#line 4583 "src/prebuilt/ast-lexer-gen.cc" +#line 4581 "src/prebuilt/ast-lexer-gen.cc" yy723: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 374 "src/ast-lexer.cc" +#line 372 "src/ast-lexer.cc" { OPCODE(I32LeU); RETURN(COMPARE); } -#line 4591 "src/prebuilt/ast-lexer-gen.cc" +#line 4589 "src/prebuilt/ast-lexer-gen.cc" yy725: ++lexer->cursor; if ((yych = *lexer->cursor) <= '8') { @@ -4623,25 +4621,25 @@ yy725: } } yy726: -#line 269 "src/ast-lexer.cc" +#line 267 "src/ast-lexer.cc" { OPCODE(I32Load); RETURN(LOAD); } -#line 4629 "src/prebuilt/ast-lexer-gen.cc" +#line 4627 "src/prebuilt/ast-lexer-gen.cc" yy727: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 368 "src/ast-lexer.cc" +#line 366 "src/ast-lexer.cc" { OPCODE(I32LtS); RETURN(COMPARE); } -#line 4637 "src/prebuilt/ast-lexer-gen.cc" +#line 4635 "src/prebuilt/ast-lexer-gen.cc" yy729: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 370 "src/ast-lexer.cc" +#line 368 "src/ast-lexer.cc" { OPCODE(I32LtU); RETURN(COMPARE); } -#line 4645 "src/prebuilt/ast-lexer-gen.cc" +#line 4643 "src/prebuilt/ast-lexer-gen.cc" yy731: yych = *++lexer->cursor; if (yych == 'n') goto yy833; @@ -4660,17 +4658,17 @@ yy734: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 346 "src/ast-lexer.cc" +#line 344 "src/ast-lexer.cc" { OPCODE(I32Rotl); RETURN(BINARY); } -#line 4666 "src/prebuilt/ast-lexer-gen.cc" +#line 4664 "src/prebuilt/ast-lexer-gen.cc" yy736: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 348 "src/ast-lexer.cc" +#line 346 "src/ast-lexer.cc" { OPCODE(I32Rotr); RETURN(BINARY); } -#line 4674 "src/prebuilt/ast-lexer-gen.cc" +#line 4672 "src/prebuilt/ast-lexer-gen.cc" yy738: yych = *++lexer->cursor; if (yych == 's') goto yy839; @@ -4706,49 +4704,49 @@ yy745: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 381 "src/ast-lexer.cc" +#line 379 "src/ast-lexer.cc" { OPCODE(I64GeS); RETURN(COMPARE); } -#line 4712 "src/prebuilt/ast-lexer-gen.cc" +#line 4710 "src/prebuilt/ast-lexer-gen.cc" yy747: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 383 "src/ast-lexer.cc" +#line 381 "src/ast-lexer.cc" { OPCODE(I64GeU); RETURN(COMPARE); } -#line 4720 "src/prebuilt/ast-lexer-gen.cc" +#line 4718 "src/prebuilt/ast-lexer-gen.cc" yy749: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 377 "src/ast-lexer.cc" +#line 375 "src/ast-lexer.cc" { OPCODE(I64GtS); RETURN(COMPARE); } -#line 4728 "src/prebuilt/ast-lexer-gen.cc" +#line 4726 "src/prebuilt/ast-lexer-gen.cc" yy751: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 379 "src/ast-lexer.cc" +#line 377 "src/ast-lexer.cc" { OPCODE(I64GtU); RETURN(COMPARE); } -#line 4736 "src/prebuilt/ast-lexer-gen.cc" +#line 4734 "src/prebuilt/ast-lexer-gen.cc" yy753: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 373 "src/ast-lexer.cc" +#line 371 "src/ast-lexer.cc" { OPCODE(I64LeS); RETURN(COMPARE); } -#line 4744 "src/prebuilt/ast-lexer-gen.cc" +#line 4742 "src/prebuilt/ast-lexer-gen.cc" yy755: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 375 "src/ast-lexer.cc" +#line 373 "src/ast-lexer.cc" { OPCODE(I64LeU); RETURN(COMPARE); } -#line 4752 "src/prebuilt/ast-lexer-gen.cc" +#line 4750 "src/prebuilt/ast-lexer-gen.cc" yy757: ++lexer->cursor; if ((yych = *lexer->cursor) <= '7') { @@ -4788,25 +4786,25 @@ yy757: } } yy758: -#line 270 "src/ast-lexer.cc" +#line 268 "src/ast-lexer.cc" { OPCODE(I64Load); RETURN(LOAD); } -#line 4794 "src/prebuilt/ast-lexer-gen.cc" +#line 4792 "src/prebuilt/ast-lexer-gen.cc" yy759: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 369 "src/ast-lexer.cc" +#line 367 "src/ast-lexer.cc" { OPCODE(I64LtS); RETURN(COMPARE); } -#line 4802 "src/prebuilt/ast-lexer-gen.cc" +#line 4800 "src/prebuilt/ast-lexer-gen.cc" yy761: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 371 "src/ast-lexer.cc" +#line 369 "src/ast-lexer.cc" { OPCODE(I64LtU); RETURN(COMPARE); } -#line 4810 "src/prebuilt/ast-lexer-gen.cc" +#line 4808 "src/prebuilt/ast-lexer-gen.cc" yy763: yych = *++lexer->cursor; if (yych == 'n') goto yy857; @@ -4825,17 +4823,17 @@ yy766: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 347 "src/ast-lexer.cc" +#line 345 "src/ast-lexer.cc" { OPCODE(I64Rotl); RETURN(BINARY); } -#line 4831 "src/prebuilt/ast-lexer-gen.cc" +#line 4829 "src/prebuilt/ast-lexer-gen.cc" yy768: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 349 "src/ast-lexer.cc" +#line 347 "src/ast-lexer.cc" { OPCODE(I64Rotr); RETURN(BINARY); } -#line 4839 "src/prebuilt/ast-lexer-gen.cc" +#line 4837 "src/prebuilt/ast-lexer-gen.cc" yy770: yych = *++lexer->cursor; if (yych == 's') goto yy863; @@ -4891,9 +4889,9 @@ yy774: } } yy775: -#line 292 "src/ast-lexer.cc" +#line 290 "src/ast-lexer.cc" { TEXT_AT(7); RETURN(OFFSET_EQ_NAT); } -#line 4897 "src/prebuilt/ast-lexer-gen.cc" +#line 4895 "src/prebuilt/ast-lexer-gen.cc" yy776: ++lexer->cursor; if (lexer->limit <= lexer->cursor) FILL(1); @@ -4942,9 +4940,9 @@ yy778: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 444 "src/ast-lexer.cc" +#line 442 "src/ast-lexer.cc" { RETURN(REGISTER); } -#line 4948 "src/prebuilt/ast-lexer-gen.cc" +#line 4946 "src/prebuilt/ast-lexer-gen.cc" yy780: yych = *++lexer->cursor; if (yych == 'a') goto yy871; @@ -5048,9 +5046,9 @@ yy795: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 296 "src/ast-lexer.cc" +#line 294 "src/ast-lexer.cc" { TYPE(F32); RETURN(CONST); } -#line 5054 "src/prebuilt/ast-lexer-gen.cc" +#line 5052 "src/prebuilt/ast-lexer-gen.cc" yy797: yych = *++lexer->cursor; if (yych == 'r') goto yy886; @@ -5068,9 +5066,9 @@ yy800: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 314 "src/ast-lexer.cc" +#line 312 "src/ast-lexer.cc" { OPCODE(F32Floor); RETURN(UNARY); } -#line 5074 "src/prebuilt/ast-lexer-gen.cc" +#line 5072 "src/prebuilt/ast-lexer-gen.cc" yy802: yych = *++lexer->cursor; if (yych == 's') goto yy889; @@ -5084,25 +5082,25 @@ yy804: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 275 "src/ast-lexer.cc" +#line 273 "src/ast-lexer.cc" { OPCODE(F32Store); RETURN(STORE); } -#line 5090 "src/prebuilt/ast-lexer-gen.cc" +#line 5088 "src/prebuilt/ast-lexer-gen.cc" yy806: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 316 "src/ast-lexer.cc" +#line 314 "src/ast-lexer.cc" { OPCODE(F32Trunc); RETURN(UNARY); } -#line 5098 "src/prebuilt/ast-lexer-gen.cc" +#line 5096 "src/prebuilt/ast-lexer-gen.cc" yy808: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 297 "src/ast-lexer.cc" +#line 295 "src/ast-lexer.cc" { TYPE(F64); RETURN(CONST); } -#line 5106 "src/prebuilt/ast-lexer-gen.cc" +#line 5104 "src/prebuilt/ast-lexer-gen.cc" yy810: yych = *++lexer->cursor; if (yych == 'r') goto yy891; @@ -5116,9 +5114,9 @@ yy812: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 315 "src/ast-lexer.cc" +#line 313 "src/ast-lexer.cc" { OPCODE(F64Floor); RETURN(UNARY); } -#line 5122 "src/prebuilt/ast-lexer-gen.cc" +#line 5120 "src/prebuilt/ast-lexer-gen.cc" yy814: yych = *++lexer->cursor; if (yych == 's') goto yy893; @@ -5136,17 +5134,17 @@ yy817: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 276 "src/ast-lexer.cc" +#line 274 "src/ast-lexer.cc" { OPCODE(F64Store); RETURN(STORE); } -#line 5142 "src/prebuilt/ast-lexer-gen.cc" +#line 5140 "src/prebuilt/ast-lexer-gen.cc" yy819: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 317 "src/ast-lexer.cc" +#line 315 "src/ast-lexer.cc" { OPCODE(F64Trunc); RETURN(UNARY); } -#line 5150 "src/prebuilt/ast-lexer-gen.cc" +#line 5148 "src/prebuilt/ast-lexer-gen.cc" yy821: yych = *++lexer->cursor; if (yych == 'l') goto yy896; @@ -5156,9 +5154,9 @@ yy822: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 264 "src/ast-lexer.cc" +#line 262 "src/ast-lexer.cc" { RETURN(GET_LOCAL); } -#line 5162 "src/prebuilt/ast-lexer-gen.cc" +#line 5160 "src/prebuilt/ast-lexer-gen.cc" yy824: yych = *++lexer->cursor; if (yych == 'r') goto yy898; @@ -5168,25 +5166,25 @@ yy825: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 294 "src/ast-lexer.cc" +#line 292 "src/ast-lexer.cc" { TYPE(I32); RETURN(CONST); } -#line 5174 "src/prebuilt/ast-lexer-gen.cc" +#line 5172 "src/prebuilt/ast-lexer-gen.cc" yy827: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 326 "src/ast-lexer.cc" +#line 324 "src/ast-lexer.cc" { OPCODE(I32DivS); RETURN(BINARY); } -#line 5182 "src/prebuilt/ast-lexer-gen.cc" +#line 5180 "src/prebuilt/ast-lexer-gen.cc" yy829: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 328 "src/ast-lexer.cc" +#line 326 "src/ast-lexer.cc" { OPCODE(I32DivU); RETURN(BINARY); } -#line 5190 "src/prebuilt/ast-lexer-gen.cc" +#line 5188 "src/prebuilt/ast-lexer-gen.cc" yy831: yych = *++lexer->cursor; if (yych == '6') goto yy899; @@ -5208,33 +5206,33 @@ yy835: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 330 "src/ast-lexer.cc" +#line 328 "src/ast-lexer.cc" { OPCODE(I32RemS); RETURN(BINARY); } -#line 5214 "src/prebuilt/ast-lexer-gen.cc" +#line 5212 "src/prebuilt/ast-lexer-gen.cc" yy837: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 332 "src/ast-lexer.cc" +#line 330 "src/ast-lexer.cc" { OPCODE(I32RemU); RETURN(BINARY); } -#line 5222 "src/prebuilt/ast-lexer-gen.cc" +#line 5220 "src/prebuilt/ast-lexer-gen.cc" yy839: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 342 "src/ast-lexer.cc" +#line 340 "src/ast-lexer.cc" { OPCODE(I32ShrS); RETURN(BINARY); } -#line 5230 "src/prebuilt/ast-lexer-gen.cc" +#line 5228 "src/prebuilt/ast-lexer-gen.cc" yy841: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 344 "src/ast-lexer.cc" +#line 342 "src/ast-lexer.cc" { OPCODE(I32ShrU); RETURN(BINARY); } -#line 5238 "src/prebuilt/ast-lexer-gen.cc" +#line 5236 "src/prebuilt/ast-lexer-gen.cc" yy843: ++lexer->cursor; if ((yych = *lexer->cursor) <= '8') { @@ -5270,9 +5268,9 @@ yy843: } } yy844: -#line 273 "src/ast-lexer.cc" +#line 271 "src/ast-lexer.cc" { OPCODE(I32Store); RETURN(STORE); } -#line 5276 "src/prebuilt/ast-lexer-gen.cc" +#line 5274 "src/prebuilt/ast-lexer-gen.cc" yy845: yych = *++lexer->cursor; if (yych == '_') goto yy907; @@ -5286,25 +5284,25 @@ yy847: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 295 "src/ast-lexer.cc" +#line 293 "src/ast-lexer.cc" { TYPE(I64); RETURN(CONST); } -#line 5292 "src/prebuilt/ast-lexer-gen.cc" +#line 5290 "src/prebuilt/ast-lexer-gen.cc" yy849: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 327 "src/ast-lexer.cc" +#line 325 "src/ast-lexer.cc" { OPCODE(I64DivS); RETURN(BINARY); } -#line 5300 "src/prebuilt/ast-lexer-gen.cc" +#line 5298 "src/prebuilt/ast-lexer-gen.cc" yy851: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 329 "src/ast-lexer.cc" +#line 327 "src/ast-lexer.cc" { OPCODE(I64DivU); RETURN(BINARY); } -#line 5308 "src/prebuilt/ast-lexer-gen.cc" +#line 5306 "src/prebuilt/ast-lexer-gen.cc" yy853: yych = *++lexer->cursor; if (yych == 'd') goto yy909; @@ -5334,33 +5332,33 @@ yy859: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 331 "src/ast-lexer.cc" +#line 329 "src/ast-lexer.cc" { OPCODE(I64RemS); RETURN(BINARY); } -#line 5340 "src/prebuilt/ast-lexer-gen.cc" +#line 5338 "src/prebuilt/ast-lexer-gen.cc" yy861: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 333 "src/ast-lexer.cc" +#line 331 "src/ast-lexer.cc" { OPCODE(I64RemU); RETURN(BINARY); } -#line 5348 "src/prebuilt/ast-lexer-gen.cc" +#line 5346 "src/prebuilt/ast-lexer-gen.cc" yy863: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 343 "src/ast-lexer.cc" +#line 341 "src/ast-lexer.cc" { OPCODE(I64ShrS); RETURN(BINARY); } -#line 5356 "src/prebuilt/ast-lexer-gen.cc" +#line 5354 "src/prebuilt/ast-lexer-gen.cc" yy865: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 345 "src/ast-lexer.cc" +#line 343 "src/ast-lexer.cc" { OPCODE(I64ShrU); RETURN(BINARY); } -#line 5364 "src/prebuilt/ast-lexer-gen.cc" +#line 5362 "src/prebuilt/ast-lexer-gen.cc" yy867: ++lexer->cursor; if ((yych = *lexer->cursor) <= '7') { @@ -5400,9 +5398,9 @@ yy867: } } yy868: -#line 274 "src/ast-lexer.cc" +#line 272 "src/ast-lexer.cc" { OPCODE(I64Store); RETURN(STORE); } -#line 5406 "src/prebuilt/ast-lexer-gen.cc" +#line 5404 "src/prebuilt/ast-lexer-gen.cc" yy869: yych = *++lexer->cursor; if (yych == '_') goto yy920; @@ -5428,17 +5426,17 @@ yy872: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 265 "src/ast-lexer.cc" +#line 263 "src/ast-lexer.cc" { RETURN(SET_LOCAL); } -#line 5434 "src/prebuilt/ast-lexer-gen.cc" +#line 5432 "src/prebuilt/ast-lexer-gen.cc" yy874: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 266 "src/ast-lexer.cc" +#line 264 "src/ast-lexer.cc" { RETURN(TEE_LOCAL); } -#line 5442 "src/prebuilt/ast-lexer-gen.cc" +#line 5440 "src/prebuilt/ast-lexer-gen.cc" yy876: yych = *++lexer->cursor; if (yych == 'l') goto yy925; @@ -5524,9 +5522,9 @@ yy896: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 267 "src/ast-lexer.cc" +#line 265 "src/ast-lexer.cc" { RETURN(GET_GLOBAL); } -#line 5530 "src/prebuilt/ast-lexer-gen.cc" +#line 5528 "src/prebuilt/ast-lexer-gen.cc" yy898: yych = *++lexer->cursor; if (yych == 'y') goto yy949; @@ -5545,9 +5543,9 @@ yy901: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 304 "src/ast-lexer.cc" +#line 302 "src/ast-lexer.cc" { OPCODE(I32Popcnt); RETURN(UNARY); } -#line 5551 "src/prebuilt/ast-lexer-gen.cc" +#line 5549 "src/prebuilt/ast-lexer-gen.cc" yy903: yych = *++lexer->cursor; if (yych == 'r') goto yy956; @@ -5561,9 +5559,9 @@ yy905: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 287 "src/ast-lexer.cc" +#line 285 "src/ast-lexer.cc" { OPCODE(I32Store8); RETURN(STORE); } -#line 5567 "src/prebuilt/ast-lexer-gen.cc" +#line 5565 "src/prebuilt/ast-lexer-gen.cc" yy907: yych = *++lexer->cursor; if (yych == 's') goto yy959; @@ -5595,9 +5593,9 @@ yy913: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 305 "src/ast-lexer.cc" +#line 303 "src/ast-lexer.cc" { OPCODE(I64Popcnt); RETURN(UNARY); } -#line 5601 "src/prebuilt/ast-lexer-gen.cc" +#line 5599 "src/prebuilt/ast-lexer-gen.cc" yy915: yych = *++lexer->cursor; if (yych == 'r') goto yy969; @@ -5615,9 +5613,9 @@ yy918: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 288 "src/ast-lexer.cc" +#line 286 "src/ast-lexer.cc" { OPCODE(I64Store8); RETURN(STORE); } -#line 5621 "src/prebuilt/ast-lexer-gen.cc" +#line 5619 "src/prebuilt/ast-lexer-gen.cc" yy920: yych = *++lexer->cursor; if (yych == 's') goto yy974; @@ -5674,9 +5672,9 @@ yy923: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 268 "src/ast-lexer.cc" +#line 266 "src/ast-lexer.cc" { RETURN(SET_GLOBAL); } -#line 5680 "src/prebuilt/ast-lexer-gen.cc" +#line 5678 "src/prebuilt/ast-lexer-gen.cc" yy925: yych = *++lexer->cursor; if (yych == 'e') goto yy976; @@ -5702,9 +5700,9 @@ yy930: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 452 "src/ast-lexer.cc" +#line 450 "src/ast-lexer.cc" { RETURN(ASSERT_TRAP); } -#line 5708 "src/prebuilt/ast-lexer-gen.cc" +#line 5706 "src/prebuilt/ast-lexer-gen.cc" yy932: yych = *++lexer->cursor; if (yych == 'n') goto yy982; @@ -5714,9 +5712,9 @@ yy933: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 259 "src/ast-lexer.cc" +#line 257 "src/ast-lexer.cc" { RETURN(CALL_IMPORT); } -#line 5720 "src/prebuilt/ast-lexer-gen.cc" +#line 5718 "src/prebuilt/ast-lexer-gen.cc" yy935: yych = *++lexer->cursor; if (yych == 'c') goto yy983; @@ -5742,9 +5740,9 @@ yy940: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 318 "src/ast-lexer.cc" +#line 316 "src/ast-lexer.cc" { OPCODE(F32Nearest); RETURN(UNARY); } -#line 5748 "src/prebuilt/ast-lexer-gen.cc" +#line 5746 "src/prebuilt/ast-lexer-gen.cc" yy942: yych = *++lexer->cursor; if (yych == 'p') goto yy989; @@ -5762,9 +5760,9 @@ yy945: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 319 "src/ast-lexer.cc" +#line 317 "src/ast-lexer.cc" { OPCODE(F64Nearest); RETURN(UNARY); } -#line 5768 "src/prebuilt/ast-lexer-gen.cc" +#line 5766 "src/prebuilt/ast-lexer-gen.cc" yy947: yych = *++lexer->cursor; if (yych == '/') goto yy993; @@ -5778,9 +5776,9 @@ yy949: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 428 "src/ast-lexer.cc" +#line 426 "src/ast-lexer.cc" { RETURN(GROW_MEMORY); } -#line 5784 "src/prebuilt/ast-lexer-gen.cc" +#line 5782 "src/prebuilt/ast-lexer-gen.cc" yy951: yych = *++lexer->cursor; if (yych == 's') goto yy995; @@ -5791,17 +5789,17 @@ yy952: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 277 "src/ast-lexer.cc" +#line 275 "src/ast-lexer.cc" { OPCODE(I32Load8S); RETURN(LOAD); } -#line 5797 "src/prebuilt/ast-lexer-gen.cc" +#line 5795 "src/prebuilt/ast-lexer-gen.cc" yy954: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 279 "src/ast-lexer.cc" +#line 277 "src/ast-lexer.cc" { OPCODE(I32Load8U); RETURN(LOAD); } -#line 5805 "src/prebuilt/ast-lexer-gen.cc" +#line 5803 "src/prebuilt/ast-lexer-gen.cc" yy956: yych = *++lexer->cursor; if (yych == 'p') goto yy999; @@ -5811,9 +5809,9 @@ yy957: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 289 "src/ast-lexer.cc" +#line 287 "src/ast-lexer.cc" { OPCODE(I32Store16); RETURN(STORE); } -#line 5817 "src/prebuilt/ast-lexer-gen.cc" +#line 5815 "src/prebuilt/ast-lexer-gen.cc" yy959: yych = *++lexer->cursor; if (yych == '/') goto yy1000; @@ -5846,17 +5844,17 @@ yy965: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 278 "src/ast-lexer.cc" +#line 276 "src/ast-lexer.cc" { OPCODE(I64Load8S); RETURN(LOAD); } -#line 5852 "src/prebuilt/ast-lexer-gen.cc" +#line 5850 "src/prebuilt/ast-lexer-gen.cc" yy967: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 280 "src/ast-lexer.cc" +#line 278 "src/ast-lexer.cc" { OPCODE(I64Load8U); RETURN(LOAD); } -#line 5860 "src/prebuilt/ast-lexer-gen.cc" +#line 5858 "src/prebuilt/ast-lexer-gen.cc" yy969: yych = *++lexer->cursor; if (yych == 'p') goto yy1014; @@ -5866,17 +5864,17 @@ yy970: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 290 "src/ast-lexer.cc" +#line 288 "src/ast-lexer.cc" { OPCODE(I64Store16); RETURN(STORE); } -#line 5872 "src/prebuilt/ast-lexer-gen.cc" +#line 5870 "src/prebuilt/ast-lexer-gen.cc" yy972: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 291 "src/ast-lexer.cc" +#line 289 "src/ast-lexer.cc" { OPCODE(I64Store32); RETURN(STORE); } -#line 5880 "src/prebuilt/ast-lexer-gen.cc" +#line 5878 "src/prebuilt/ast-lexer-gen.cc" yy974: yych = *++lexer->cursor; if (yych == '/') goto yy1015; @@ -5890,9 +5888,9 @@ yy976: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 426 "src/ast-lexer.cc" +#line 424 "src/ast-lexer.cc" { RETURN(UNREACHABLE); } -#line 5896 "src/prebuilt/ast-lexer-gen.cc" +#line 5894 "src/prebuilt/ast-lexer-gen.cc" yy978: yych = *++lexer->cursor; if (yych == 's') goto yy1017; @@ -5931,9 +5929,9 @@ yy986: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 362 "src/ast-lexer.cc" +#line 360 "src/ast-lexer.cc" { OPCODE(F32Copysign); RETURN(BINARY); } -#line 5937 "src/prebuilt/ast-lexer-gen.cc" +#line 5935 "src/prebuilt/ast-lexer-gen.cc" yy988: yych = *++lexer->cursor; if (yych == '6') goto yy1028; @@ -5952,9 +5950,9 @@ yy991: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 363 "src/ast-lexer.cc" +#line 361 "src/ast-lexer.cc" { OPCODE(F64Copysign); RETURN(BINARY); } -#line 5958 "src/prebuilt/ast-lexer-gen.cc" +#line 5956 "src/prebuilt/ast-lexer-gen.cc" yy993: yych = *++lexer->cursor; if (yych == 'f') goto yy1032; @@ -5968,17 +5966,17 @@ yy995: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 281 "src/ast-lexer.cc" +#line 279 "src/ast-lexer.cc" { OPCODE(I32Load16S); RETURN(LOAD); } -#line 5974 "src/prebuilt/ast-lexer-gen.cc" +#line 5972 "src/prebuilt/ast-lexer-gen.cc" yy997: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 283 "src/ast-lexer.cc" +#line 281 "src/ast-lexer.cc" { OPCODE(I32Load16U); RETURN(LOAD); } -#line 5982 "src/prebuilt/ast-lexer-gen.cc" +#line 5980 "src/prebuilt/ast-lexer-gen.cc" yy999: yych = *++lexer->cursor; if (yych == 'r') goto yy1034; @@ -5996,9 +5994,9 @@ yy1002: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 398 "src/ast-lexer.cc" +#line 396 "src/ast-lexer.cc" { OPCODE(I32WrapI64); RETURN(CONVERT); } -#line 6002 "src/prebuilt/ast-lexer-gen.cc" +#line 6000 "src/prebuilt/ast-lexer-gen.cc" yy1004: yych = *++lexer->cursor; if (yych == '/') goto yy1037; @@ -6012,33 +6010,33 @@ yy1006: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 282 "src/ast-lexer.cc" +#line 280 "src/ast-lexer.cc" { OPCODE(I64Load16S); RETURN(LOAD); } -#line 6018 "src/prebuilt/ast-lexer-gen.cc" +#line 6016 "src/prebuilt/ast-lexer-gen.cc" yy1008: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 284 "src/ast-lexer.cc" +#line 282 "src/ast-lexer.cc" { OPCODE(I64Load16U); RETURN(LOAD); } -#line 6026 "src/prebuilt/ast-lexer-gen.cc" +#line 6024 "src/prebuilt/ast-lexer-gen.cc" yy1010: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 285 "src/ast-lexer.cc" +#line 283 "src/ast-lexer.cc" { OPCODE(I64Load32S); RETURN(LOAD); } -#line 6034 "src/prebuilt/ast-lexer-gen.cc" +#line 6032 "src/prebuilt/ast-lexer-gen.cc" yy1012: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 286 "src/ast-lexer.cc" +#line 284 "src/ast-lexer.cc" { OPCODE(I64Load32U); RETURN(LOAD); } -#line 6042 "src/prebuilt/ast-lexer-gen.cc" +#line 6040 "src/prebuilt/ast-lexer-gen.cc" yy1014: yych = *++lexer->cursor; if (yych == 'r') goto yy1039; @@ -6098,9 +6096,9 @@ yy1020: } } yy1021: -#line 450 "src/ast-lexer.cc" +#line 448 "src/ast-lexer.cc" { RETURN(ASSERT_RETURN); } -#line 6104 "src/prebuilt/ast-lexer-gen.cc" +#line 6102 "src/prebuilt/ast-lexer-gen.cc" yy1022: yych = *++lexer->cursor; if (yych == 'a') goto yy1047; @@ -6110,9 +6108,9 @@ yy1023: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 260 "src/ast-lexer.cc" +#line 258 "src/ast-lexer.cc" { RETURN(CALL_INDIRECT); } -#line 6116 "src/prebuilt/ast-lexer-gen.cc" +#line 6114 "src/prebuilt/ast-lexer-gen.cc" yy1025: yych = *++lexer->cursor; if (yych == 'y') goto yy1048; @@ -6194,9 +6192,9 @@ yy1043: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 448 "src/ast-lexer.cc" +#line 446 "src/ast-lexer.cc" { RETURN(ASSERT_INVALID); } -#line 6200 "src/prebuilt/ast-lexer-gen.cc" +#line 6198 "src/prebuilt/ast-lexer-gen.cc" yy1045: yych = *++lexer->cursor; if (yych == 'e') goto yy1072; @@ -6214,9 +6212,9 @@ yy1048: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 427 "src/ast-lexer.cc" +#line 425 "src/ast-lexer.cc" { RETURN(CURRENT_MEMORY); } -#line 6220 "src/prebuilt/ast-lexer-gen.cc" +#line 6218 "src/prebuilt/ast-lexer-gen.cc" yy1050: yych = *++lexer->cursor; if (yych == 'i') goto yy1075; @@ -6230,9 +6228,9 @@ yy1052: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 416 "src/ast-lexer.cc" +#line 414 "src/ast-lexer.cc" { OPCODE(F32DemoteF64); RETURN(CONVERT); } -#line 6236 "src/prebuilt/ast-lexer-gen.cc" +#line 6234 "src/prebuilt/ast-lexer-gen.cc" yy1054: yych = *++lexer->cursor; if (yych == 't') goto yy1077; @@ -6346,9 +6344,9 @@ yy1080: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 415 "src/ast-lexer.cc" +#line 413 "src/ast-lexer.cc" { OPCODE(F64PromoteF32); RETURN(CONVERT); } -#line 6352 "src/prebuilt/ast-lexer-gen.cc" +#line 6350 "src/prebuilt/ast-lexer-gen.cc" yy1082: yych = *++lexer->cursor; if (yych == '/') goto yy1117; @@ -6362,33 +6360,33 @@ yy1084: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 399 "src/ast-lexer.cc" +#line 397 "src/ast-lexer.cc" { OPCODE(I32TruncSF32); RETURN(CONVERT); } -#line 6368 "src/prebuilt/ast-lexer-gen.cc" +#line 6366 "src/prebuilt/ast-lexer-gen.cc" yy1086: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 401 "src/ast-lexer.cc" +#line 399 "src/ast-lexer.cc" { OPCODE(I32TruncSF64); RETURN(CONVERT); } -#line 6376 "src/prebuilt/ast-lexer-gen.cc" +#line 6374 "src/prebuilt/ast-lexer-gen.cc" yy1088: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 403 "src/ast-lexer.cc" +#line 401 "src/ast-lexer.cc" { OPCODE(I32TruncUF32); RETURN(CONVERT); } -#line 6384 "src/prebuilt/ast-lexer-gen.cc" +#line 6382 "src/prebuilt/ast-lexer-gen.cc" yy1090: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 405 "src/ast-lexer.cc" +#line 403 "src/ast-lexer.cc" { OPCODE(I32TruncUF64); RETURN(CONVERT); } -#line 6392 "src/prebuilt/ast-lexer-gen.cc" +#line 6390 "src/prebuilt/ast-lexer-gen.cc" yy1092: yych = *++lexer->cursor; if (yych == '2') goto yy1119; @@ -6406,33 +6404,33 @@ yy1095: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 400 "src/ast-lexer.cc" +#line 398 "src/ast-lexer.cc" { OPCODE(I64TruncSF32); RETURN(CONVERT); } -#line 6412 "src/prebuilt/ast-lexer-gen.cc" +#line 6410 "src/prebuilt/ast-lexer-gen.cc" yy1097: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 402 "src/ast-lexer.cc" +#line 400 "src/ast-lexer.cc" { OPCODE(I64TruncSF64); RETURN(CONVERT); } -#line 6420 "src/prebuilt/ast-lexer-gen.cc" +#line 6418 "src/prebuilt/ast-lexer-gen.cc" yy1099: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 404 "src/ast-lexer.cc" +#line 402 "src/ast-lexer.cc" { OPCODE(I64TruncUF32); RETURN(CONVERT); } -#line 6428 "src/prebuilt/ast-lexer-gen.cc" +#line 6426 "src/prebuilt/ast-lexer-gen.cc" yy1101: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 406 "src/ast-lexer.cc" +#line 404 "src/ast-lexer.cc" { OPCODE(I64TruncUF64); RETURN(CONVERT); } -#line 6436 "src/prebuilt/ast-lexer-gen.cc" +#line 6434 "src/prebuilt/ast-lexer-gen.cc" yy1103: yych = *++lexer->cursor; if (yych == 'n') goto yy1124; @@ -6442,9 +6440,9 @@ yy1104: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 447 "src/ast-lexer.cc" +#line 445 "src/ast-lexer.cc" { RETURN(ASSERT_MALFORMED); } -#line 6448 "src/prebuilt/ast-lexer-gen.cc" +#line 6446 "src/prebuilt/ast-lexer-gen.cc" yy1106: yych = *++lexer->cursor; if (yych == 'n') goto yy1126; @@ -6502,17 +6500,17 @@ yy1119: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 396 "src/ast-lexer.cc" +#line 394 "src/ast-lexer.cc" { OPCODE(I64ExtendSI32); RETURN(CONVERT); } -#line 6508 "src/prebuilt/ast-lexer-gen.cc" +#line 6506 "src/prebuilt/ast-lexer-gen.cc" yy1121: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 397 "src/ast-lexer.cc" +#line 395 "src/ast-lexer.cc" { OPCODE(I64ExtendUI32); RETURN(CONVERT); } -#line 6516 "src/prebuilt/ast-lexer-gen.cc" +#line 6514 "src/prebuilt/ast-lexer-gen.cc" yy1123: yych = *++lexer->cursor; if (yych == 'f') goto yy1149; @@ -6522,57 +6520,57 @@ yy1124: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 453 "src/ast-lexer.cc" +#line 451 "src/ast-lexer.cc" { RETURN(ASSERT_EXHAUSTION); } -#line 6528 "src/prebuilt/ast-lexer-gen.cc" +#line 6526 "src/prebuilt/ast-lexer-gen.cc" yy1126: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 451 "src/ast-lexer.cc" +#line 449 "src/ast-lexer.cc" { RETURN(ASSERT_RETURN_NAN); } -#line 6536 "src/prebuilt/ast-lexer-gen.cc" +#line 6534 "src/prebuilt/ast-lexer-gen.cc" yy1128: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 449 "src/ast-lexer.cc" +#line 447 "src/ast-lexer.cc" { RETURN(ASSERT_UNLINKABLE); } -#line 6544 "src/prebuilt/ast-lexer-gen.cc" +#line 6542 "src/prebuilt/ast-lexer-gen.cc" yy1130: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 407 "src/ast-lexer.cc" +#line 405 "src/ast-lexer.cc" { OPCODE(F32ConvertSI32); RETURN(CONVERT); } -#line 6552 "src/prebuilt/ast-lexer-gen.cc" +#line 6550 "src/prebuilt/ast-lexer-gen.cc" yy1132: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 409 "src/ast-lexer.cc" +#line 407 "src/ast-lexer.cc" { OPCODE(F32ConvertSI64); RETURN(CONVERT); } -#line 6560 "src/prebuilt/ast-lexer-gen.cc" +#line 6558 "src/prebuilt/ast-lexer-gen.cc" yy1134: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 411 "src/ast-lexer.cc" +#line 409 "src/ast-lexer.cc" { OPCODE(F32ConvertUI32); RETURN(CONVERT); } -#line 6568 "src/prebuilt/ast-lexer-gen.cc" +#line 6566 "src/prebuilt/ast-lexer-gen.cc" yy1136: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 413 "src/ast-lexer.cc" +#line 411 "src/ast-lexer.cc" { OPCODE(F32ConvertUI64); RETURN(CONVERT); } -#line 6576 "src/prebuilt/ast-lexer-gen.cc" +#line 6574 "src/prebuilt/ast-lexer-gen.cc" yy1138: yych = *++lexer->cursor; if (yych == '3') goto yy1150; @@ -6582,33 +6580,33 @@ yy1139: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 408 "src/ast-lexer.cc" +#line 406 "src/ast-lexer.cc" { OPCODE(F64ConvertSI32); RETURN(CONVERT); } -#line 6588 "src/prebuilt/ast-lexer-gen.cc" +#line 6586 "src/prebuilt/ast-lexer-gen.cc" yy1141: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 410 "src/ast-lexer.cc" +#line 408 "src/ast-lexer.cc" { OPCODE(F64ConvertSI64); RETURN(CONVERT); } -#line 6596 "src/prebuilt/ast-lexer-gen.cc" +#line 6594 "src/prebuilt/ast-lexer-gen.cc" yy1143: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 412 "src/ast-lexer.cc" +#line 410 "src/ast-lexer.cc" { OPCODE(F64ConvertUI32); RETURN(CONVERT); } -#line 6604 "src/prebuilt/ast-lexer-gen.cc" +#line 6602 "src/prebuilt/ast-lexer-gen.cc" yy1145: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 414 "src/ast-lexer.cc" +#line 412 "src/ast-lexer.cc" { OPCODE(F64ConvertUI64); RETURN(CONVERT); } -#line 6612 "src/prebuilt/ast-lexer-gen.cc" +#line 6610 "src/prebuilt/ast-lexer-gen.cc" yy1147: yych = *++lexer->cursor; if (yych == '6') goto yy1151; @@ -6642,47 +6640,47 @@ yy1154: if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 417 "src/ast-lexer.cc" +#line 415 "src/ast-lexer.cc" { OPCODE(F32ReinterpretI32); RETURN(CONVERT); } -#line 6649 "src/prebuilt/ast-lexer-gen.cc" +#line 6647 "src/prebuilt/ast-lexer-gen.cc" yy1156: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 421 "src/ast-lexer.cc" +#line 419 "src/ast-lexer.cc" { OPCODE(F64ReinterpretI64); RETURN(CONVERT); } -#line 6658 "src/prebuilt/ast-lexer-gen.cc" +#line 6656 "src/prebuilt/ast-lexer-gen.cc" yy1158: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 419 "src/ast-lexer.cc" +#line 417 "src/ast-lexer.cc" { OPCODE(I32ReinterpretF32); RETURN(CONVERT); } -#line 6667 "src/prebuilt/ast-lexer-gen.cc" +#line 6665 "src/prebuilt/ast-lexer-gen.cc" yy1160: ++lexer->cursor; if (yybm[0+(yych = *lexer->cursor)] & 16) { goto yy49; } -#line 423 "src/ast-lexer.cc" +#line 421 "src/ast-lexer.cc" { OPCODE(I64ReinterpretF64); RETURN(CONVERT); } -#line 6676 "src/prebuilt/ast-lexer-gen.cc" +#line 6674 "src/prebuilt/ast-lexer-gen.cc" } } -#line 476 "src/ast-lexer.cc" +#line 474 "src/ast-lexer.cc" } } static AstLexer* new_lexer(AstLexerSourceType type, const char* filename) { - AstLexer* lexer = static_cast<AstLexer*>(wabt_alloc_zero(sizeof(AstLexer))); + AstLexer* lexer = new AstLexer(); lexer->line = 1; lexer->filename = filename; lexer->source.type = type; @@ -6713,8 +6711,8 @@ AstLexer* new_ast_buffer_lexer(const char* filename, void destroy_ast_lexer(AstLexer* lexer) { if (lexer->source.type == AstLexerSourceType::File && lexer->source.file) fclose(lexer->source.file); - wabt_free(lexer->buffer); - wabt_free(lexer); + delete [] lexer->buffer; + delete lexer; } enum class LineOffsetPosition { diff --git a/src/prebuilt/ast-parser-gen.cc b/src/prebuilt/ast-parser-gen.cc index 657de813..c94fd543 100644 --- a/src/prebuilt/ast-parser-gen.cc +++ b/src/prebuilt/ast-parser-gen.cc @@ -85,18 +85,15 @@ #define INVALID_VAR_INDEX (-1) -#define RELOCATE_STACK(type, array, stack_base, old_byte_size, new_size) \ - do { \ - if ((stack_base) == (array)) { \ - (stack_base) = \ - static_cast<type*>(wabt_alloc((new_size) * sizeof(*(stack_base)))); \ - memcpy((stack_base), (array), old_byte_size); \ - } else { \ - (stack_base) = static_cast<type*>( \ - wabt_realloc((stack_base), (new_size) * sizeof(*(stack_base)))); \ - } \ - /* Cache the pointer in the parser struct to be free'd later. */ \ - parser->array = (stack_base); \ +#define RELOCATE_STACK(type, array, stack_base, old_byte_size, new_size) \ + do { \ + type* new_stack = new type[new_size](); \ + memcpy((new_stack), (stack_base), old_byte_size); \ + if ((stack_base) != (array)) { \ + delete[](stack_base); \ + } \ + /* Cache the pointer in the parser struct to be deleted later. */ \ + parser->array = (stack_base) = new_stack; \ } while (0) #define yyoverflow(message, ss, ss_size, vs, vs_size, ls, ls_size, new_size) \ @@ -192,8 +189,8 @@ } \ } while (0) -#define YYMALLOC(size) wabt_alloc(size) -#define YYFREE(p) wabt_free(p) +#define YYMALLOC(size) new char [size] +#define YYFREE(p) delete [] (p) #define USE_NATURAL_ALIGNMENT (~0) @@ -204,36 +201,19 @@ ExprList join_exprs2(Location* loc, ExprList* expr1, Expr* expr2); -FuncField* new_func_field(void) { - return static_cast<FuncField*>(wabt_alloc_zero(sizeof(FuncField))); -} - -Func* new_func(void) { - return static_cast<Func*>(wabt_alloc_zero(sizeof(Func))); -} - -Command* new_command(void) { - return static_cast<Command*>(wabt_alloc_zero(sizeof(Command))); -} - -Module* new_module(void) { - return static_cast<Module*>(wabt_alloc_zero(sizeof(Module))); -} - -Import* new_import(void) { - return static_cast<Import*>(wabt_alloc_zero(sizeof(Import))); -} - -TextListNode* new_text_list_node(void) { - return static_cast<TextListNode*>(wabt_alloc_zero(sizeof(TextListNode))); -} +FuncField* new_func_field(void) { return new FuncField(); } +Func* new_func(void) { return new Func(); } +Command* new_command(void) { return new Command(); } +Module* new_module(void) { return new Module(); } +Import* new_import(void) { return new Import(); } +TextListNode* new_text_list_node(void) { return new TextListNode(); } Result parse_const(Type type, LiteralType literal_type, const char* s, const char* end, Const* out); -void dup_text_list(TextList* text_list, void** out_data, size_t* out_size); +void dup_text_list(TextList* text_list, char** out_data, size_t* out_size); bool is_empty_signature(FuncSignature* sig); @@ -254,7 +234,7 @@ static void on_read_binary_error(uint32_t offset, const char* error, #define wabt_ast_parser_error ast_parser_error -#line 258 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:339 */ +#line 238 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -401,7 +381,7 @@ int wabt_ast_parser_parse (::wabt::AstLexer* lexer, ::wabt::AstParser* parser); /* Copy the second part of user declarations. */ -#line 405 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:358 */ +#line 385 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -707,24 +687,24 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 311, 311, 317, 327, 328, 332, 350, 351, 357, - 360, 365, 372, 375, 376, 380, 385, 392, 395, 398, - 403, 410, 416, 427, 431, 435, 442, 447, 454, 455, - 461, 462, 465, 469, 470, 474, 475, 485, 486, 497, - 498, 499, 502, 505, 508, 511, 514, 518, 522, 527, - 530, 534, 538, 542, 546, 550, 554, 558, 564, 570, - 582, 586, 590, 594, 598, 601, 606, 612, 618, 624, - 634, 642, 646, 649, 655, 661, 670, 676, 681, 687, - 692, 698, 706, 707, 715, 716, 724, 729, 730, 736, - 742, 752, 758, 764, 774, 827, 836, 843, 850, 860, - 863, 867, 873, 884, 890, 910, 917, 929, 936, 956, - 978, 985, 998, 1005, 1011, 1017, 1023, 1031, 1036, 1043, - 1049, 1055, 1061, 1070, 1078, 1083, 1088, 1093, 1100, 1107, - 1111, 1114, 1125, 1129, 1136, 1140, 1143, 1151, 1159, 1176, - 1192, 1202, 1209, 1216, 1222, 1258, 1268, 1290, 1300, 1326, - 1331, 1339, 1347, 1357, 1363, 1369, 1375, 1381, 1387, 1392, - 1398, 1407, 1412, 1413, 1419, 1428, 1429, 1437, 1449, 1450, - 1457, 1521 + 0, 291, 291, 297, 307, 308, 312, 330, 331, 337, + 340, 345, 352, 355, 356, 360, 365, 372, 375, 378, + 383, 390, 396, 407, 411, 415, 422, 427, 434, 435, + 441, 442, 445, 449, 450, 454, 455, 465, 466, 477, + 478, 479, 482, 485, 488, 491, 494, 498, 502, 507, + 510, 514, 518, 522, 526, 530, 534, 538, 544, 550, + 562, 566, 570, 574, 578, 581, 586, 592, 598, 604, + 614, 622, 626, 629, 635, 641, 650, 656, 661, 667, + 672, 678, 686, 687, 695, 696, 704, 709, 710, 716, + 722, 732, 738, 744, 754, 807, 816, 823, 830, 840, + 843, 847, 853, 864, 870, 890, 897, 909, 916, 936, + 958, 965, 978, 985, 991, 997, 1003, 1011, 1016, 1023, + 1029, 1035, 1041, 1050, 1058, 1063, 1068, 1073, 1080, 1087, + 1091, 1094, 1105, 1109, 1116, 1120, 1123, 1131, 1139, 1156, + 1172, 1182, 1189, 1196, 1202, 1238, 1248, 1270, 1280, 1306, + 1311, 1319, 1327, 1337, 1343, 1349, 1355, 1361, 1367, 1372, + 1378, 1387, 1392, 1393, 1399, 1408, 1409, 1417, 1429, 1430, + 1437, 1501 }; #endif @@ -1663,333 +1643,333 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio switch (yytype) { case 5: /* NAT */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1669 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1649 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 6: /* INT */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1675 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1655 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 7: /* FLOAT */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1681 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1661 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 8: /* TEXT */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1687 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1667 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 9: /* VAR */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1693 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1673 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 35: /* OFFSET_EQ_NAT */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1699 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1679 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 36: /* ALIGN_EQ_NAT */ -#line 272 "src/ast-parser.y" /* yacc.c:1257 */ +#line 252 "src/ast-parser.y" /* yacc.c:1257 */ {} -#line 1705 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1685 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 75: /* non_empty_text_list */ -#line 295 "src/ast-parser.y" /* yacc.c:1257 */ +#line 275 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_text_list(&((*yyvaluep).text_list)); } -#line 1711 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1691 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 76: /* text_list */ -#line 295 "src/ast-parser.y" /* yacc.c:1257 */ +#line 275 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_text_list(&((*yyvaluep).text_list)); } -#line 1717 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1697 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 77: /* quoted_text */ -#line 294 "src/ast-parser.y" /* yacc.c:1257 */ +#line 274 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_string_slice(&((*yyvaluep).text)); } -#line 1723 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1703 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 78: /* value_type_list */ -#line 296 "src/ast-parser.y" /* yacc.c:1257 */ +#line 276 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_type_vector(&((*yyvaluep).types)); } -#line 1729 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1709 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 81: /* func_type */ -#line 286 "src/ast-parser.y" /* yacc.c:1257 */ +#line 266 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_func_signature(&((*yyvaluep).func_sig)); } -#line 1735 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1715 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 82: /* func_sig */ -#line 286 "src/ast-parser.y" /* yacc.c:1257 */ +#line 266 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_func_signature(&((*yyvaluep).func_sig)); } -#line 1741 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1721 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 86: /* type_use */ -#line 298 "src/ast-parser.y" /* yacc.c:1257 */ +#line 278 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_var(&((*yyvaluep).var)); } -#line 1747 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1727 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 88: /* literal */ -#line 292 "src/ast-parser.y" /* yacc.c:1257 */ +#line 272 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_string_slice(&((*yyvaluep).literal).text); } -#line 1753 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1733 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 89: /* var */ -#line 298 "src/ast-parser.y" /* yacc.c:1257 */ +#line 278 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_var(&((*yyvaluep).var)); } -#line 1759 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1739 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 90: /* var_list */ -#line 297 "src/ast-parser.y" /* yacc.c:1257 */ +#line 277 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_var_vector_and_elements(&((*yyvaluep).vars)); } -#line 1765 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1745 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 91: /* bind_var_opt */ -#line 294 "src/ast-parser.y" /* yacc.c:1257 */ +#line 274 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_string_slice(&((*yyvaluep).text)); } -#line 1771 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1751 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 92: /* bind_var */ -#line 294 "src/ast-parser.y" /* yacc.c:1257 */ +#line 274 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_string_slice(&((*yyvaluep).text)); } -#line 1777 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1757 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 93: /* labeling_opt */ -#line 294 "src/ast-parser.y" /* yacc.c:1257 */ +#line 274 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_string_slice(&((*yyvaluep).text)); } -#line 1783 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1763 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 96: /* instr */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1789 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1769 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 97: /* plain_instr */ -#line 282 "src/ast-parser.y" /* yacc.c:1257 */ +#line 262 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr(((*yyvaluep).expr)); } -#line 1795 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1775 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 98: /* block_instr */ -#line 282 "src/ast-parser.y" /* yacc.c:1257 */ +#line 262 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr(((*yyvaluep).expr)); } -#line 1801 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1781 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 99: /* block */ -#line 273 "src/ast-parser.y" /* yacc.c:1257 */ +#line 253 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_block(&((*yyvaluep).block)); } -#line 1807 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1787 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 100: /* expr */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1813 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1793 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 101: /* expr1 */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1819 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1799 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 102: /* if_ */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1825 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1805 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 103: /* instr_list */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1831 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1811 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 104: /* expr_list */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1837 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1817 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 105: /* const_expr */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1843 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1823 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 106: /* func_fields */ -#line 284 "src/ast-parser.y" /* yacc.c:1257 */ +#line 264 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_func_fields(((*yyvaluep).func_fields)); } -#line 1849 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1829 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 107: /* func_body */ -#line 284 "src/ast-parser.y" /* yacc.c:1257 */ +#line 264 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_func_fields(((*yyvaluep).func_fields)); } -#line 1855 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1835 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 108: /* func_info */ -#line 285 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_func(((*yyvaluep).func)); wabt_free(((*yyvaluep).func)); } -#line 1861 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 265 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_func(((*yyvaluep).func)); delete ((*yyvaluep).func); } +#line 1841 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 109: /* func */ -#line 279 "src/ast-parser.y" /* yacc.c:1257 */ +#line 259 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_exported_func(&((*yyvaluep).exported_func)); } -#line 1867 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1847 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 110: /* offset */ -#line 283 "src/ast-parser.y" /* yacc.c:1257 */ +#line 263 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_expr_list(((*yyvaluep).expr_list).first); } -#line 1873 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1853 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 111: /* elem */ -#line 277 "src/ast-parser.y" /* yacc.c:1257 */ +#line 257 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_elem_segment(&((*yyvaluep).elem_segment)); } -#line 1879 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1859 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 112: /* table */ -#line 281 "src/ast-parser.y" /* yacc.c:1257 */ +#line 261 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_exported_table(&((*yyvaluep).exported_table)); } -#line 1885 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1865 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 113: /* data */ -#line 289 "src/ast-parser.y" /* yacc.c:1257 */ +#line 269 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_data_segment(&((*yyvaluep).data_segment)); } -#line 1891 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1871 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 114: /* memory */ -#line 280 "src/ast-parser.y" /* yacc.c:1257 */ +#line 260 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_exported_memory(&((*yyvaluep).exported_memory)); } -#line 1897 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1877 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 116: /* import_kind */ -#line 288 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_import(((*yyvaluep).import)); wabt_free(((*yyvaluep).import)); } -#line 1903 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 268 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_import(((*yyvaluep).import)); delete ((*yyvaluep).import); } +#line 1883 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 117: /* import */ -#line 288 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_import(((*yyvaluep).import)); wabt_free(((*yyvaluep).import)); } -#line 1909 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 268 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_import(((*yyvaluep).import)); delete ((*yyvaluep).import); } +#line 1889 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 118: /* inline_import */ -#line 288 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_import(((*yyvaluep).import)); wabt_free(((*yyvaluep).import)); } -#line 1915 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 268 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_import(((*yyvaluep).import)); delete ((*yyvaluep).import); } +#line 1895 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 119: /* export_kind */ -#line 278 "src/ast-parser.y" /* yacc.c:1257 */ +#line 258 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_export(&((*yyvaluep).export_)); } -#line 1921 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1901 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 120: /* export */ -#line 278 "src/ast-parser.y" /* yacc.c:1257 */ +#line 258 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_export(&((*yyvaluep).export_)); } -#line 1927 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1907 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 123: /* type_def */ -#line 287 "src/ast-parser.y" /* yacc.c:1257 */ +#line 267 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_func_type(&((*yyvaluep).func_type)); } -#line 1933 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1913 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 124: /* start */ -#line 298 "src/ast-parser.y" /* yacc.c:1257 */ +#line 278 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_var(&((*yyvaluep).var)); } -#line 1939 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1919 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 125: /* module_fields */ -#line 290 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_module(((*yyvaluep).module)); wabt_free(((*yyvaluep).module)); } -#line 1945 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 270 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_module(((*yyvaluep).module)); delete ((*yyvaluep).module); } +#line 1925 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 126: /* raw_module */ -#line 291 "src/ast-parser.y" /* yacc.c:1257 */ +#line 271 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_raw_module(&((*yyvaluep).raw_module)); } -#line 1951 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1931 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 127: /* module */ -#line 290 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_module(((*yyvaluep).module)); wabt_free(((*yyvaluep).module)); } -#line 1957 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 270 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_module(((*yyvaluep).module)); delete ((*yyvaluep).module); } +#line 1937 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 128: /* script_var_opt */ -#line 298 "src/ast-parser.y" /* yacc.c:1257 */ +#line 278 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_var(&((*yyvaluep).var)); } -#line 1963 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1943 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 130: /* assertion */ -#line 274 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_command(((*yyvaluep).command)); wabt_free(((*yyvaluep).command)); } -#line 1969 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 254 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_command(((*yyvaluep).command)); delete ((*yyvaluep).command); } +#line 1949 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 131: /* cmd */ -#line 274 "src/ast-parser.y" /* yacc.c:1257 */ - { destroy_command(((*yyvaluep).command)); wabt_free(((*yyvaluep).command)); } -#line 1975 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 254 "src/ast-parser.y" /* yacc.c:1257 */ + { destroy_command(((*yyvaluep).command)); delete ((*yyvaluep).command); } +#line 1955 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 132: /* cmd_list */ -#line 275 "src/ast-parser.y" /* yacc.c:1257 */ +#line 255 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_command_vector_and_elements(&((*yyvaluep).commands)); } -#line 1981 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1961 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 134: /* const_list */ -#line 276 "src/ast-parser.y" /* yacc.c:1257 */ +#line 256 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_const_vector(&((*yyvaluep).consts)); } -#line 1987 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1967 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; case 135: /* script */ -#line 293 "src/ast-parser.y" /* yacc.c:1257 */ +#line 273 "src/ast-parser.y" /* yacc.c:1257 */ { destroy_script(&((*yyvaluep).script)); } -#line 1993 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ +#line 1973 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */ break; @@ -2281,18 +2261,18 @@ yyreduce: switch (yyn) { case 2: -#line 311 "src/ast-parser.y" /* yacc.c:1646 */ +#line 291 "src/ast-parser.y" /* yacc.c:1646 */ { TextListNode* node = new_text_list_node(); DUPTEXT(node->text, (yyvsp[0].text)); node->next = nullptr; (yyval.text_list).first = (yyval.text_list).last = node; } -#line 2292 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2272 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 3: -#line 317 "src/ast-parser.y" /* yacc.c:1646 */ +#line 297 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.text_list) = (yyvsp[-1].text_list); TextListNode* node = new_text_list_node(); @@ -2301,17 +2281,17 @@ yyreduce: (yyval.text_list).last->next = node; (yyval.text_list).last = node; } -#line 2305 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2285 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 4: -#line 327 "src/ast-parser.y" /* yacc.c:1646 */ +#line 307 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.text_list).first = (yyval.text_list).last = nullptr; } -#line 2311 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2291 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 6: -#line 332 "src/ast-parser.y" /* yacc.c:1646 */ +#line 312 "src/ast-parser.y" /* yacc.c:1646 */ { TextListNode node; node.text = (yyvsp[0].text); @@ -2319,136 +2299,136 @@ yyreduce: TextList text_list; text_list.first = &node; text_list.last = &node; - void* data; + char* data; size_t size; dup_text_list(&text_list, &data, &size); - (yyval.text).start = static_cast<const char*>(data); + (yyval.text).start = data; (yyval.text).length = size; } -#line 2329 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2309 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 7: -#line 350 "src/ast-parser.y" /* yacc.c:1646 */ +#line 330 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.types)); } -#line 2335 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2315 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 8: -#line 351 "src/ast-parser.y" /* yacc.c:1646 */ +#line 331 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.types) = (yyvsp[-1].types); append_type_value(&(yyval.types), &(yyvsp[0].type)); } -#line 2344 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2324 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 9: -#line 357 "src/ast-parser.y" /* yacc.c:1646 */ +#line 337 "src/ast-parser.y" /* yacc.c:1646 */ {} -#line 2350 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2330 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 10: -#line 360 "src/ast-parser.y" /* yacc.c:1646 */ +#line 340 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.global)); (yyval.global).type = (yyvsp[0].type); (yyval.global).mutable_ = false; } -#line 2360 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2340 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 11: -#line 365 "src/ast-parser.y" /* yacc.c:1646 */ +#line 345 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.global)); (yyval.global).type = (yyvsp[-1].type); (yyval.global).mutable_ = true; } -#line 2370 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2350 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 12: -#line 372 "src/ast-parser.y" /* yacc.c:1646 */ +#line 352 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_sig) = (yyvsp[-1].func_sig); } -#line 2376 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2356 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 13: -#line 375 "src/ast-parser.y" /* yacc.c:1646 */ +#line 355 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.func_sig)); } -#line 2382 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2362 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 14: -#line 376 "src/ast-parser.y" /* yacc.c:1646 */ +#line 356 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).param_types = (yyvsp[-1].types); } -#line 2391 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2371 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 15: -#line 380 "src/ast-parser.y" /* yacc.c:1646 */ +#line 360 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).param_types = (yyvsp[-5].types); (yyval.func_sig).result_types = (yyvsp[-1].types); } -#line 2401 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2381 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 16: -#line 385 "src/ast-parser.y" /* yacc.c:1646 */ +#line 365 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).result_types = (yyvsp[-1].types); } -#line 2410 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2390 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 17: -#line 392 "src/ast-parser.y" /* yacc.c:1646 */ +#line 372 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.table).elem_limits = (yyvsp[-1].limits); } -#line 2416 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2396 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 18: -#line 395 "src/ast-parser.y" /* yacc.c:1646 */ +#line 375 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.memory).page_limits = (yyvsp[0].limits); } -#line 2422 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2402 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 19: -#line 398 "src/ast-parser.y" /* yacc.c:1646 */ +#line 378 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.limits).has_max = false; (yyval.limits).initial = (yyvsp[0].u64); (yyval.limits).max = 0; } -#line 2432 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2412 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 20: -#line 403 "src/ast-parser.y" /* yacc.c:1646 */ +#line 383 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.limits).has_max = true; (yyval.limits).initial = (yyvsp[-1].u64); (yyval.limits).max = (yyvsp[0].u64); } -#line 2442 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2422 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 21: -#line 410 "src/ast-parser.y" /* yacc.c:1646 */ +#line 390 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.var) = (yyvsp[-1].var); } -#line 2448 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2428 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 22: -#line 416 "src/ast-parser.y" /* yacc.c:1646 */ +#line 396 "src/ast-parser.y" /* yacc.c:1646 */ { if (WABT_FAILED(parse_uint64((yyvsp[0].literal).text.start, (yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &(yyval.u64)))) { @@ -2457,97 +2437,97 @@ yyreduce: WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text)); } } -#line 2461 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2441 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 23: -#line 427 "src/ast-parser.y" /* yacc.c:1646 */ +#line 407 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.literal).type = (yyvsp[0].literal).type; DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text); } -#line 2470 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2450 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 24: -#line 431 "src/ast-parser.y" /* yacc.c:1646 */ +#line 411 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.literal).type = (yyvsp[0].literal).type; DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text); } -#line 2479 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2459 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 25: -#line 435 "src/ast-parser.y" /* yacc.c:1646 */ +#line 415 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.literal).type = (yyvsp[0].literal).type; DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text); } -#line 2488 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2468 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 26: -#line 442 "src/ast-parser.y" /* yacc.c:1646 */ +#line 422 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.var).loc = (yylsp[0]); (yyval.var).type = VarType::Index; (yyval.var).index = (yyvsp[0].u64); } -#line 2498 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2478 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 27: -#line 447 "src/ast-parser.y" /* yacc.c:1646 */ +#line 427 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.var).loc = (yylsp[0]); (yyval.var).type = VarType::Name; DUPTEXT((yyval.var).name, (yyvsp[0].text)); } -#line 2508 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2488 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 28: -#line 454 "src/ast-parser.y" /* yacc.c:1646 */ +#line 434 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.vars)); } -#line 2514 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2494 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 29: -#line 455 "src/ast-parser.y" /* yacc.c:1646 */ +#line 435 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.vars) = (yyvsp[-1].vars); append_var_value(&(yyval.vars), &(yyvsp[0].var)); } -#line 2523 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2503 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 30: -#line 461 "src/ast-parser.y" /* yacc.c:1646 */ +#line 441 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.text)); } -#line 2529 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2509 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 32: -#line 465 "src/ast-parser.y" /* yacc.c:1646 */ +#line 445 "src/ast-parser.y" /* yacc.c:1646 */ { DUPTEXT((yyval.text), (yyvsp[0].text)); } -#line 2535 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2515 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 33: -#line 469 "src/ast-parser.y" /* yacc.c:1646 */ +#line 449 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.text)); } -#line 2541 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2521 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 35: -#line 474 "src/ast-parser.y" /* yacc.c:1646 */ +#line 454 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.u64) = 0; } -#line 2547 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2527 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 36: -#line 475 "src/ast-parser.y" /* yacc.c:1646 */ +#line 455 "src/ast-parser.y" /* yacc.c:1646 */ { if (WABT_FAILED(parse_int64((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u64), ParseIntType::SignedAndUnsigned))) { @@ -2556,17 +2536,17 @@ yyreduce: WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].text))); } } -#line 2560 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2540 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 37: -#line 485 "src/ast-parser.y" /* yacc.c:1646 */ +#line 465 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.u32) = USE_NATURAL_ALIGNMENT; } -#line 2566 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2546 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 38: -#line 486 "src/ast-parser.y" /* yacc.c:1646 */ +#line 466 "src/ast-parser.y" /* yacc.c:1646 */ { if (WABT_FAILED(parse_int32((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u32), ParseIntType::UnsignedOnly))) { @@ -2575,182 +2555,182 @@ yyreduce: WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].text))); } } -#line 2579 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2559 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 39: -#line 497 "src/ast-parser.y" /* yacc.c:1646 */ +#line 477 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = join_exprs1(&(yylsp[0]), (yyvsp[0].expr)); } -#line 2585 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2565 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 40: -#line 498 "src/ast-parser.y" /* yacc.c:1646 */ +#line 478 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = join_exprs1(&(yylsp[0]), (yyvsp[0].expr)); } -#line 2591 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2571 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 41: -#line 499 "src/ast-parser.y" /* yacc.c:1646 */ +#line 479 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[0].expr_list); } -#line 2597 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2577 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 42: -#line 502 "src/ast-parser.y" /* yacc.c:1646 */ +#line 482 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unreachable_expr(); } -#line 2605 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2585 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 43: -#line 505 "src/ast-parser.y" /* yacc.c:1646 */ +#line 485 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_nop_expr(); } -#line 2613 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2593 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 44: -#line 508 "src/ast-parser.y" /* yacc.c:1646 */ +#line 488 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_drop_expr(); } -#line 2621 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2601 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 45: -#line 511 "src/ast-parser.y" /* yacc.c:1646 */ +#line 491 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_select_expr(); } -#line 2629 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2609 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 46: -#line 514 "src/ast-parser.y" /* yacc.c:1646 */ +#line 494 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_br_expr(); (yyval.expr)->br.var = (yyvsp[0].var); } -#line 2638 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2618 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 47: -#line 518 "src/ast-parser.y" /* yacc.c:1646 */ +#line 498 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_br_if_expr(); (yyval.expr)->br_if.var = (yyvsp[0].var); } -#line 2647 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2627 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 48: -#line 522 "src/ast-parser.y" /* yacc.c:1646 */ +#line 502 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_br_table_expr(); (yyval.expr)->br_table.targets = (yyvsp[-1].vars); (yyval.expr)->br_table.default_target = (yyvsp[0].var); } -#line 2657 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2637 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 49: -#line 527 "src/ast-parser.y" /* yacc.c:1646 */ +#line 507 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_return_expr(); } -#line 2665 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2645 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 50: -#line 530 "src/ast-parser.y" /* yacc.c:1646 */ +#line 510 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_call_expr(); (yyval.expr)->call.var = (yyvsp[0].var); } -#line 2674 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2654 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 51: -#line 534 "src/ast-parser.y" /* yacc.c:1646 */ +#line 514 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_call_indirect_expr(); (yyval.expr)->call_indirect.var = (yyvsp[0].var); } -#line 2683 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2663 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 52: -#line 538 "src/ast-parser.y" /* yacc.c:1646 */ +#line 518 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_get_local_expr(); (yyval.expr)->get_local.var = (yyvsp[0].var); } -#line 2692 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2672 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 53: -#line 542 "src/ast-parser.y" /* yacc.c:1646 */ +#line 522 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_set_local_expr(); (yyval.expr)->set_local.var = (yyvsp[0].var); } -#line 2701 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2681 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 54: -#line 546 "src/ast-parser.y" /* yacc.c:1646 */ +#line 526 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_tee_local_expr(); (yyval.expr)->tee_local.var = (yyvsp[0].var); } -#line 2710 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2690 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 55: -#line 550 "src/ast-parser.y" /* yacc.c:1646 */ +#line 530 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_get_global_expr(); (yyval.expr)->get_global.var = (yyvsp[0].var); } -#line 2719 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2699 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 56: -#line 554 "src/ast-parser.y" /* yacc.c:1646 */ +#line 534 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_set_global_expr(); (yyval.expr)->set_global.var = (yyvsp[0].var); } -#line 2728 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2708 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 57: -#line 558 "src/ast-parser.y" /* yacc.c:1646 */ +#line 538 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_load_expr(); (yyval.expr)->load.opcode = (yyvsp[-2].opcode); (yyval.expr)->load.offset = (yyvsp[-1].u64); (yyval.expr)->load.align = (yyvsp[0].u32); } -#line 2739 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2719 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 58: -#line 564 "src/ast-parser.y" /* yacc.c:1646 */ +#line 544 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_store_expr(); (yyval.expr)->store.opcode = (yyvsp[-2].opcode); (yyval.expr)->store.offset = (yyvsp[-1].u64); (yyval.expr)->store.align = (yyvsp[0].u32); } -#line 2750 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2730 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 59: -#line 570 "src/ast-parser.y" /* yacc.c:1646 */ +#line 550 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_const_expr(); (yyval.expr)->const_.loc = (yylsp[-1]); @@ -2761,98 +2741,98 @@ yyreduce: "invalid literal \"" PRIstringslice "\"", WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text)); } - wabt_free(const_cast<char*>((yyvsp[0].literal).text.start)); + delete [] (yyvsp[0].literal).text.start; } -#line 2767 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2747 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 60: -#line 582 "src/ast-parser.y" /* yacc.c:1646 */ +#line 562 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expr(); (yyval.expr)->unary.opcode = (yyvsp[0].opcode); } -#line 2776 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2756 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 61: -#line 586 "src/ast-parser.y" /* yacc.c:1646 */ +#line 566 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expr(); (yyval.expr)->binary.opcode = (yyvsp[0].opcode); } -#line 2785 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2765 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 62: -#line 590 "src/ast-parser.y" /* yacc.c:1646 */ +#line 570 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_compare_expr(); (yyval.expr)->compare.opcode = (yyvsp[0].opcode); } -#line 2794 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2774 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 63: -#line 594 "src/ast-parser.y" /* yacc.c:1646 */ +#line 574 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_convert_expr(); (yyval.expr)->convert.opcode = (yyvsp[0].opcode); } -#line 2803 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2783 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 64: -#line 598 "src/ast-parser.y" /* yacc.c:1646 */ +#line 578 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_current_memory_expr(); } -#line 2811 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2791 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 65: -#line 601 "src/ast-parser.y" /* yacc.c:1646 */ +#line 581 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_grow_memory_expr(); } -#line 2819 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2799 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 66: -#line 606 "src/ast-parser.y" /* yacc.c:1646 */ +#line 586 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_block_expr(); (yyval.expr)->block = (yyvsp[-2].block); (yyval.expr)->block.label = (yyvsp[-3].text); CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text)); } -#line 2830 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2810 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 67: -#line 612 "src/ast-parser.y" /* yacc.c:1646 */ +#line 592 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_loop_expr(); (yyval.expr)->loop = (yyvsp[-2].block); (yyval.expr)->loop.label = (yyvsp[-3].text); CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text)); } -#line 2841 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2821 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 68: -#line 618 "src/ast-parser.y" /* yacc.c:1646 */ +#line 598 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_if_expr(); (yyval.expr)->if_.true_ = (yyvsp[-2].block); (yyval.expr)->if_.true_.label = (yyvsp[-3].text); CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text)); } -#line 2852 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2832 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 69: -#line 624 "src/ast-parser.y" /* yacc.c:1646 */ +#line 604 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_if_expr(); (yyval.expr)->if_.true_ = (yyvsp[-5].block); @@ -2861,57 +2841,57 @@ yyreduce: CHECK_END_LABEL((yylsp[-3]), (yyval.expr)->block.label, (yyvsp[-3].text)); CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text)); } -#line 2865 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2845 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 70: -#line 634 "src/ast-parser.y" /* yacc.c:1646 */ +#line 614 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.block)); (yyval.block).sig = (yyvsp[-1].types); (yyval.block).first = (yyvsp[0].expr_list).first; } -#line 2875 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2855 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 71: -#line 642 "src/ast-parser.y" /* yacc.c:1646 */ +#line 622 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[-1].expr_list); } -#line 2881 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2861 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 72: -#line 646 "src/ast-parser.y" /* yacc.c:1646 */ +#line 626 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = join_exprs2(&(yylsp[-1]), &(yyvsp[0].expr_list), (yyvsp[-1].expr)); } -#line 2889 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2869 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 73: -#line 649 "src/ast-parser.y" /* yacc.c:1646 */ +#line 629 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_block_expr(); expr->block = (yyvsp[0].block); expr->block.label = (yyvsp[-1].text); (yyval.expr_list) = join_exprs1(&(yylsp[-2]), expr); } -#line 2900 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2880 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 74: -#line 655 "src/ast-parser.y" /* yacc.c:1646 */ +#line 635 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_loop_expr(); expr->loop = (yyvsp[0].block); expr->loop.label = (yyvsp[-1].text); (yyval.expr_list) = join_exprs1(&(yylsp[-2]), expr); } -#line 2911 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2891 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 75: -#line 661 "src/ast-parser.y" /* yacc.c:1646 */ +#line 641 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[0].expr_list); Expr* if_ = (yyvsp[0].expr_list).last; @@ -2919,130 +2899,130 @@ yyreduce: if_->if_.true_.label = (yyvsp[-2].text); if_->if_.true_.sig = (yyvsp[-1].types); } -#line 2923 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2903 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 76: -#line 670 "src/ast-parser.y" /* yacc.c:1646 */ +#line 650 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_if_expr(); 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 2934 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2914 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 77: -#line 676 "src/ast-parser.y" /* yacc.c:1646 */ +#line 656 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_if_expr(); expr->if_.true_.first = (yyvsp[-1].expr_list).first; (yyval.expr_list) = join_exprs1(&(yylsp[-3]), expr); } -#line 2944 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2924 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 78: -#line 681 "src/ast-parser.y" /* yacc.c:1646 */ +#line 661 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_if_expr(); 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 2955 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2935 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 79: -#line 687 "src/ast-parser.y" /* yacc.c:1646 */ +#line 667 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_if_expr(); expr->if_.true_.first = (yyvsp[-1].expr_list).first; (yyval.expr_list) = join_exprs2(&(yylsp[-4]), &(yyvsp[-4].expr_list), expr); } -#line 2965 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2945 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 80: -#line 692 "src/ast-parser.y" /* yacc.c:1646 */ +#line 672 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_if_expr(); 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 2976 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2956 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 81: -#line 698 "src/ast-parser.y" /* yacc.c:1646 */ +#line 678 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_if_expr(); expr->if_.true_.first = (yyvsp[0].expr_list).first; (yyval.expr_list) = join_exprs2(&(yylsp[-1]), &(yyvsp[-1].expr_list), expr); } -#line 2986 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2966 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 82: -#line 706 "src/ast-parser.y" /* yacc.c:1646 */ +#line 686 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.expr_list)); } -#line 2992 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2972 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 83: -#line 707 "src/ast-parser.y" /* yacc.c:1646 */ +#line 687 "src/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 3003 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2983 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 84: -#line 715 "src/ast-parser.y" /* yacc.c:1646 */ +#line 695 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.expr_list)); } -#line 3009 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 2989 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 85: -#line 716 "src/ast-parser.y" /* yacc.c:1646 */ +#line 696 "src/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 3020 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3000 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 88: -#line 730 "src/ast-parser.y" /* yacc.c:1646 */ +#line 710 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(); (yyval.func_fields)->type = FuncFieldType::ResultTypes; (yyval.func_fields)->types = (yyvsp[-2].types); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3031 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3011 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 89: -#line 736 "src/ast-parser.y" /* yacc.c:1646 */ +#line 716 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(); (yyval.func_fields)->type = FuncFieldType::ParamTypes; (yyval.func_fields)->types = (yyvsp[-2].types); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3042 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3022 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 90: -#line 742 "src/ast-parser.y" /* yacc.c:1646 */ +#line 722 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(); (yyval.func_fields)->type = FuncFieldType::BoundParam; @@ -3051,33 +3031,33 @@ yyreduce: (yyval.func_fields)->bound_type.type = (yyvsp[-2].type); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3055 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3035 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 91: -#line 752 "src/ast-parser.y" /* yacc.c:1646 */ +#line 732 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(); (yyval.func_fields)->type = FuncFieldType::Exprs; (yyval.func_fields)->first_expr = (yyvsp[0].expr_list).first; (yyval.func_fields)->next = nullptr; } -#line 3066 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3046 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 92: -#line 758 "src/ast-parser.y" /* yacc.c:1646 */ +#line 738 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(); (yyval.func_fields)->type = FuncFieldType::LocalTypes; (yyval.func_fields)->types = (yyvsp[-2].types); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3077 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3057 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 93: -#line 764 "src/ast-parser.y" /* yacc.c:1646 */ +#line 744 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_fields) = new_func_field(); (yyval.func_fields)->type = FuncFieldType::BoundLocal; @@ -3086,11 +3066,11 @@ yyreduce: (yyval.func_fields)->bound_type.type = (yyvsp[-2].type); (yyval.func_fields)->next = (yyvsp[0].func_fields); } -#line 3090 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3070 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 94: -#line 774 "src/ast-parser.y" /* yacc.c:1646 */ +#line 754 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func) = new_func(); FuncField* field = (yyvsp[0].func_fields); @@ -3138,15 +3118,15 @@ yyreduce: } /* we steal memory from the func field, but not the linked list nodes */ - wabt_free(field); + delete (field); field = next; } } -#line 3146 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3126 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 95: -#line 827 "src/ast-parser.y" /* yacc.c:1646 */ +#line 807 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); @@ -3155,11 +3135,11 @@ yyreduce: (yyval.exported_func).func->name = (yyvsp[-4].text); (yyval.exported_func).export_ = (yyvsp[-3].optional_export); } -#line 3159 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3139 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 96: -#line 836 "src/ast-parser.y" /* yacc.c:1646 */ +#line 816 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); @@ -3167,51 +3147,51 @@ yyreduce: (yyval.exported_func).func->decl.type_var = (yyvsp[-2].var); (yyval.exported_func).func->name = (yyvsp[-3].text); } -#line 3171 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3151 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 97: -#line 843 "src/ast-parser.y" /* yacc.c:1646 */ +#line 823 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_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 3182 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3162 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 98: -#line 850 "src/ast-parser.y" /* yacc.c:1646 */ +#line 830 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.exported_func)); (yyval.exported_func).func = (yyvsp[-1].func); (yyval.exported_func).func->name = (yyvsp[-2].text); } -#line 3192 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3172 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 99: -#line 860 "src/ast-parser.y" /* yacc.c:1646 */ +#line 840 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.expr_list) = (yyvsp[-1].expr_list); } -#line 3200 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3180 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 101: -#line 867 "src/ast-parser.y" /* yacc.c:1646 */ +#line 847 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_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 3211 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3191 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 102: -#line 873 "src/ast-parser.y" /* yacc.c:1646 */ +#line 853 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.elem_segment)); (yyval.elem_segment).table_var.loc = (yylsp[-3]); @@ -3220,22 +3200,22 @@ yyreduce: (yyval.elem_segment).offset = (yyvsp[-2].expr_list).first; (yyval.elem_segment).vars = (yyvsp[-1].vars); } -#line 3224 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3204 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 103: -#line 884 "src/ast-parser.y" /* yacc.c:1646 */ +#line 864 "src/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 = false; (yyval.exported_table).export_ = (yyvsp[-2].optional_export); } -#line 3235 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3215 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 104: -#line 891 "src/ast-parser.y" /* yacc.c:1646 */ +#line 871 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_const_expr(); expr->loc = (yylsp[-8]); @@ -3252,11 +3232,11 @@ yyreduce: (yyval.exported_table).elem_segment.vars = (yyvsp[-2].vars); (yyval.exported_table).export_ = (yyvsp[-6].optional_export); } -#line 3256 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3236 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 105: -#line 910 "src/ast-parser.y" /* yacc.c:1646 */ +#line 890 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.data_segment)); (yyval.data_segment).memory_var = (yyvsp[-3].var); @@ -3264,11 +3244,11 @@ yyreduce: dup_text_list(&(yyvsp[-1].text_list), &(yyval.data_segment).data, &(yyval.data_segment).size); destroy_text_list(&(yyvsp[-1].text_list)); } -#line 3268 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3248 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 106: -#line 917 "src/ast-parser.y" /* yacc.c:1646 */ +#line 897 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.data_segment)); (yyval.data_segment).memory_var.loc = (yylsp[-3]); @@ -3278,11 +3258,11 @@ yyreduce: dup_text_list(&(yyvsp[-1].text_list), &(yyval.data_segment).data, &(yyval.data_segment).size); destroy_text_list(&(yyvsp[-1].text_list)); } -#line 3282 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3262 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 107: -#line 929 "src/ast-parser.y" /* yacc.c:1646 */ +#line 909 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.exported_memory)); (yyval.exported_memory).memory = (yyvsp[-1].memory); @@ -3290,11 +3270,11 @@ yyreduce: (yyval.exported_memory).has_data_segment = false; (yyval.exported_memory).export_ = (yyvsp[-2].optional_export); } -#line 3294 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3274 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 108: -#line 936 "src/ast-parser.y" /* yacc.c:1646 */ +#line 916 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_const_expr(); expr->loc = (yylsp[-7]); @@ -3314,11 +3294,11 @@ yyreduce: (yyval.exported_memory).memory.page_limits.has_max = true; (yyval.exported_memory).export_ = (yyvsp[-5].optional_export); } -#line 3318 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3298 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 109: -#line 956 "src/ast-parser.y" /* yacc.c:1646 */ +#line 936 "src/ast-parser.y" /* yacc.c:1646 */ { Expr* expr = new_const_expr(); expr->loc = (yylsp[-6]); @@ -3338,11 +3318,11 @@ yyreduce: (yyval.exported_memory).memory.page_limits.has_max = true; (yyval.exported_memory).export_.has_export = false; } -#line 3342 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3322 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 110: -#line 978 "src/ast-parser.y" /* yacc.c:1646 */ +#line 958 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.exported_global)); (yyval.exported_global).global = (yyvsp[-2].global); @@ -3350,11 +3330,11 @@ yyreduce: (yyval.exported_global).global.init_expr = (yyvsp[-1].expr_list).first; (yyval.exported_global).export_ = (yyvsp[-3].optional_export); } -#line 3354 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3334 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 111: -#line 985 "src/ast-parser.y" /* yacc.c:1646 */ +#line 965 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.exported_global)); (yyval.exported_global).global = (yyvsp[-2].global); @@ -3362,11 +3342,11 @@ yyreduce: (yyval.exported_global).global.init_expr = (yyvsp[-1].expr_list).first; (yyval.exported_global).export_.has_export = false; } -#line 3366 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3346 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 112: -#line 998 "src/ast-parser.y" /* yacc.c:1646 */ +#line 978 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(); (yyval.import)->kind = ExternalKind::Func; @@ -3374,65 +3354,65 @@ yyreduce: (yyval.import)->func.decl.flags = WABT_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE; (yyval.import)->func.decl.type_var = (yyvsp[-1].var); } -#line 3378 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3358 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 113: -#line 1005 "src/ast-parser.y" /* yacc.c:1646 */ +#line 985 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(); (yyval.import)->kind = ExternalKind::Func; (yyval.import)->func.name = (yyvsp[-2].text); (yyval.import)->func.decl.sig = (yyvsp[-1].func_sig); } -#line 3389 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3369 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 114: -#line 1011 "src/ast-parser.y" /* yacc.c:1646 */ +#line 991 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(); (yyval.import)->kind = ExternalKind::Table; (yyval.import)->table = (yyvsp[-1].table); (yyval.import)->table.name = (yyvsp[-2].text); } -#line 3400 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3380 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 115: -#line 1017 "src/ast-parser.y" /* yacc.c:1646 */ +#line 997 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(); (yyval.import)->kind = ExternalKind::Memory; (yyval.import)->memory = (yyvsp[-1].memory); (yyval.import)->memory.name = (yyvsp[-2].text); } -#line 3411 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3391 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 116: -#line 1023 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1003 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(); (yyval.import)->kind = ExternalKind::Global; (yyval.import)->global = (yyvsp[-1].global); (yyval.import)->global.name = (yyvsp[-2].text); } -#line 3422 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3402 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 117: -#line 1031 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1011 "src/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 3432 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3412 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 118: -#line 1036 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1016 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = ExternalKind::Func; @@ -3440,165 +3420,165 @@ yyreduce: (yyval.import)->func.decl.flags = WABT_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE; (yyval.import)->func.decl.type_var = (yyvsp[-1].var); } -#line 3444 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3424 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 119: -#line 1043 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1023 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = ExternalKind::Func; (yyval.import)->func.name = (yyvsp[-3].text); (yyval.import)->func.decl.sig = (yyvsp[-1].func_sig); } -#line 3455 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3435 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 120: -#line 1049 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1029 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = ExternalKind::Table; (yyval.import)->table = (yyvsp[-1].table); (yyval.import)->table.name = (yyvsp[-3].text); } -#line 3466 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3446 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 121: -#line 1055 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1035 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = ExternalKind::Memory; (yyval.import)->memory = (yyvsp[-1].memory); (yyval.import)->memory.name = (yyvsp[-3].text); } -#line 3477 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3457 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 122: -#line 1061 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1041 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = (yyvsp[-2].import); (yyval.import)->kind = ExternalKind::Global; (yyval.import)->global = (yyvsp[-1].global); (yyval.import)->global.name = (yyvsp[-3].text); } -#line 3488 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3468 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 123: -#line 1070 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1050 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.import) = new_import(); (yyval.import)->module_name = (yyvsp[-2].text); (yyval.import)->field_name = (yyvsp[-1].text); } -#line 3498 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3478 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 124: -#line 1078 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1058 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = ExternalKind::Func; (yyval.export_).var = (yyvsp[-1].var); } -#line 3508 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3488 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 125: -#line 1083 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1063 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = ExternalKind::Table; (yyval.export_).var = (yyvsp[-1].var); } -#line 3518 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3498 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 126: -#line 1088 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1068 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = ExternalKind::Memory; (yyval.export_).var = (yyvsp[-1].var); } -#line 3528 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3508 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 127: -#line 1093 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1073 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.export_)); (yyval.export_).kind = ExternalKind::Global; (yyval.export_).var = (yyvsp[-1].var); } -#line 3538 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3518 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 128: -#line 1100 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1080 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.export_) = (yyvsp[-1].export_); (yyval.export_).name = (yyvsp[-2].text); } -#line 3547 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3527 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 129: -#line 1107 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1087 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.optional_export)); (yyval.optional_export).has_export = false; } -#line 3556 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3536 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 131: -#line 1114 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1094 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.optional_export)); (yyval.optional_export).has_export = true; (yyval.optional_export).export_.name = (yyvsp[-1].text); } -#line 3566 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3546 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 132: -#line 1125 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1105 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.func_type)); (yyval.func_type).sig = (yyvsp[-1].func_sig); } -#line 3575 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3555 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 133: -#line 1129 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1109 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.func_type).name = (yyvsp[-2].text); (yyval.func_type).sig = (yyvsp[-1].func_sig); } -#line 3584 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3564 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 134: -#line 1136 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1116 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.var) = (yyvsp[-1].var); } -#line 3590 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3570 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 135: -#line 1140 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1120 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = new_module(); } -#line 3598 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3578 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 136: -#line 1143 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1123 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3607,11 +3587,11 @@ yyreduce: &field->func_type); INSERT_BINDING((yyval.module), func_type, func_types, (yylsp[0]), (yyvsp[0].func_type).name); } -#line 3611 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3591 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 137: -#line 1151 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1131 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3620,11 +3600,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 3624 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3604 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 138: -#line 1159 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1139 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3642,11 +3622,11 @@ yyreduce: } } -#line 3646 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3626 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 139: -#line 1176 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1156 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3663,11 +3643,11 @@ yyreduce: &data_segment_field->data_segment); } } -#line 3667 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3647 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 140: -#line 1192 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1172 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3676,13 +3656,13 @@ yyreduce: APPEND_ITEM_TO_VECTOR((yyval.module), Func, func, funcs, &field->func); INSERT_BINDING((yyval.module), func, funcs, (yylsp[0]), (yyvsp[0].exported_func).func->name); APPEND_INLINE_EXPORT((yyval.module), Func, (yylsp[0]), (yyvsp[0].exported_func), (yyval.module)->funcs.size - 1); - wabt_free((yyvsp[0].exported_func).func); + delete (yyvsp[0].exported_func).func; } -#line 3682 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3662 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 141: -#line 1202 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1182 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3690,11 +3670,11 @@ yyreduce: APPEND_ITEM_TO_VECTOR((yyval.module), ElemSegment, elem_segment, elem_segments, &field->elem_segment); } -#line 3694 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3674 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 142: -#line 1209 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1189 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3702,22 +3682,22 @@ yyreduce: APPEND_ITEM_TO_VECTOR((yyval.module), DataSegment, data_segment, data_segments, &field->data_segment); } -#line 3706 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3686 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 143: -#line 1216 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1196 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; APPEND_FIELD_TO_LIST((yyval.module), field, Start, start, (yylsp[0]), (yyvsp[0].var)); (yyval.module)->start = &field->start; } -#line 3717 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3697 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 144: -#line 1222 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1202 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field; @@ -3751,14 +3731,14 @@ yyreduce: (yyval.module)->num_global_imports++; break; } - wabt_free((yyvsp[0].import)); + delete (yyvsp[0].import); APPEND_ITEM_TO_VECTOR((yyval.module), Import, import, imports, &field->import); } -#line 3758 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3738 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 145: -#line 1258 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1238 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.module) = (yyvsp[-1].module); ModuleField* field = append_module_field((yyval.module)); @@ -3766,11 +3746,11 @@ 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 3770 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3750 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 146: -#line 1268 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1248 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.raw_module).type = RawModuleType::Text; (yyval.raw_module).text = (yyvsp[-1].module); @@ -3793,11 +3773,11 @@ yyreduce: } } } -#line 3797 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3777 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 147: -#line 1290 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1270 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.raw_module).type = RawModuleType::Binary; (yyval.raw_module).binary.name = (yyvsp[-2].text); @@ -3805,11 +3785,11 @@ yyreduce: dup_text_list(&(yyvsp[-1].text_list), &(yyval.raw_module).binary.data, &(yyval.raw_module).binary.size); destroy_text_list(&(yyvsp[-1].text_list)); } -#line 3809 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3789 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 148: -#line 1300 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1280 "src/ast-parser.y" /* yacc.c:1646 */ { if ((yyvsp[0].raw_module).type == RawModuleType::Text) { (yyval.module) = (yyvsp[0].raw_module).text; @@ -3826,36 +3806,36 @@ yyreduce: error_handler.user_data = &user_data; read_binary_ast((yyvsp[0].raw_module).binary.data, (yyvsp[0].raw_module).binary.size, &options, &error_handler, (yyval.module)); - wabt_free((yyvsp[0].raw_module).binary.data); + delete [] (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 3835 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3815 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 149: -#line 1326 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1306 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.var)); (yyval.var).type = VarType::Index; (yyval.var).index = INVALID_VAR_INDEX; } -#line 3845 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3825 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 150: -#line 1331 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1311 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.var)); (yyval.var).type = VarType::Name; DUPTEXT((yyval.var).name, (yyvsp[0].text)); } -#line 3855 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3835 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 151: -#line 1339 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1319 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.action)); (yyval.action).loc = (yylsp[-4]); @@ -3864,11 +3844,11 @@ yyreduce: (yyval.action).invoke.name = (yyvsp[-2].text); (yyval.action).invoke.args = (yyvsp[-1].consts); } -#line 3868 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3848 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 152: -#line 1347 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1327 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.action)); (yyval.action).loc = (yylsp[-3]); @@ -3876,119 +3856,119 @@ yyreduce: (yyval.action).type = ActionType::Get; (yyval.action).invoke.name = (yyvsp[-1].text); } -#line 3880 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3860 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 153: -#line 1357 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1337 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertMalformed; (yyval.command)->assert_malformed.module = (yyvsp[-2].raw_module); (yyval.command)->assert_malformed.text = (yyvsp[-1].text); } -#line 3891 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3871 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 154: -#line 1363 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1343 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertInvalid; (yyval.command)->assert_invalid.module = (yyvsp[-2].raw_module); (yyval.command)->assert_invalid.text = (yyvsp[-1].text); } -#line 3902 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3882 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 155: -#line 1369 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1349 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertUnlinkable; (yyval.command)->assert_unlinkable.module = (yyvsp[-2].raw_module); (yyval.command)->assert_unlinkable.text = (yyvsp[-1].text); } -#line 3913 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3893 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 156: -#line 1375 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1355 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertUninstantiable; (yyval.command)->assert_uninstantiable.module = (yyvsp[-2].raw_module); (yyval.command)->assert_uninstantiable.text = (yyvsp[-1].text); } -#line 3924 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3904 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 157: -#line 1381 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1361 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertReturn; (yyval.command)->assert_return.action = (yyvsp[-2].action); (yyval.command)->assert_return.expected = (yyvsp[-1].consts); } -#line 3935 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3915 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 158: -#line 1387 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1367 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertReturnNan; (yyval.command)->assert_return_nan.action = (yyvsp[-1].action); } -#line 3945 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3925 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 159: -#line 1392 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1372 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertTrap; (yyval.command)->assert_trap.action = (yyvsp[-2].action); (yyval.command)->assert_trap.text = (yyvsp[-1].text); } -#line 3956 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3936 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 160: -#line 1398 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1378 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::AssertExhaustion; (yyval.command)->assert_trap.action = (yyvsp[-2].action); (yyval.command)->assert_trap.text = (yyvsp[-1].text); } -#line 3967 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3947 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 161: -#line 1407 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1387 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::Action; (yyval.command)->action = (yyvsp[0].action); } -#line 3977 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3957 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 163: -#line 1413 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1393 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::Module; (yyval.command)->module = *(yyvsp[0].module); - wabt_free((yyvsp[0].module)); + delete (yyvsp[0].module); } -#line 3988 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3968 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 164: -#line 1419 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1399 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.command) = new_command(); (yyval.command)->type = CommandType::Register; @@ -3996,27 +3976,27 @@ yyreduce: (yyval.command)->register_.var = (yyvsp[-1].var); (yyval.command)->register_.var.loc = (yylsp[-1]); } -#line 4000 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3980 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 165: -#line 1428 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1408 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.commands)); } -#line 4006 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3986 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 166: -#line 1429 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1409 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.commands) = (yyvsp[-1].commands); append_command_value(&(yyval.commands), (yyvsp[0].command)); - wabt_free((yyvsp[0].command)); + delete (yyvsp[0].command); } -#line 4016 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 3996 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 167: -#line 1437 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1417 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.const_).loc = (yylsp[-2]); if (WABT_FAILED(parse_const((yyvsp[-2].type), (yyvsp[-1].literal).type, (yyvsp[-1].literal).text.start, @@ -4025,28 +4005,28 @@ yyreduce: "invalid literal \"" PRIstringslice "\"", WABT_PRINTF_STRING_SLICE_ARG((yyvsp[-1].literal).text)); } - wabt_free(const_cast<char*>((yyvsp[-1].literal).text.start)); + delete [] (yyvsp[-1].literal).text.start; } -#line 4031 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 4011 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 168: -#line 1449 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1429 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.consts)); } -#line 4037 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 4017 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 169: -#line 1450 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1430 "src/ast-parser.y" /* yacc.c:1646 */ { (yyval.consts) = (yyvsp[-1].consts); append_const_value(&(yyval.consts), &(yyvsp[0].const_)); } -#line 4046 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 4026 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; case 170: -#line 1457 "src/ast-parser.y" /* yacc.c:1646 */ +#line 1437 "src/ast-parser.y" /* yacc.c:1646 */ { WABT_ZERO_MEMORY((yyval.script)); (yyval.script).commands = (yyvsp[0].commands); @@ -4106,11 +4086,11 @@ yyreduce: } parser->script = (yyval.script); } -#line 4110 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 4090 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ break; -#line 4114 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ +#line 4094 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4345,7 +4325,7 @@ yyreturn: #endif return yyresult; } -#line 1524 "src/ast-parser.y" /* yacc.c:1906 */ +#line 1504 "src/ast-parser.y" /* yacc.c:1906 */ void append_expr_list(ExprList* expr_list, ExprList* expr) { @@ -4456,7 +4436,7 @@ size_t copy_string_contents(StringSlice* text, char* dest) { return dest - dest_start; } -void dup_text_list(TextList* text_list, void** out_data, size_t* out_size) { +void dup_text_list(TextList* text_list, char** out_data, size_t* out_size) { /* walk the linked list to see how much total space is needed */ size_t total_size = 0; TextListNode* node; @@ -4469,7 +4449,7 @@ void dup_text_list(TextList* text_list, void** out_data, size_t* out_size) { size_t size = (end > src) ? (end - src) : 0; total_size += size; } - char* result = (char*)wabt_alloc(total_size); + char* result = new char [total_size]; char* dest = result; for (node = text_list->first; node; node = node->next) { size_t actual_size = copy_string_contents(&node->text, dest); @@ -4508,9 +4488,9 @@ Result parse_ast(AstLexer * lexer, struct Script * out_script, WABT_ZERO_MEMORY(parser); parser.error_handler = error_handler; int result = wabt_ast_parser_parse(lexer, &parser); - wabt_free(parser.yyssa); - wabt_free(parser.yyvsa); - wabt_free(parser.yylsa); + delete [] parser.yyssa; + delete [] parser.yyvsa; + delete [] parser.yylsa; *out_script = parser.script; return result == 0 && parser.errors == 0 ? Result::Ok : Result::Error; } diff --git a/src/tools/wasm-interp.cc b/src/tools/wasm-interp.cc index b44017e1..2163dcb8 100644 --- a/src/tools/wasm-interp.cc +++ b/src/tools/wasm-interp.cc @@ -448,7 +448,7 @@ static Result read_module(const char* module_filename, BinaryErrorHandler* error_handler, InterpreterModule** out_module) { Result result; - void* data; + char* data; size_t size; *out_module = nullptr; @@ -462,7 +462,7 @@ static Result read_module(const char* module_filename, if (s_verbose) disassemble_module(env, s_stdout_stream, *out_module); } - wabt_free(data); + delete[] data; } return result; } @@ -544,7 +544,7 @@ static Result spectest_import_memory(InterpreterImport* import, memory->page_limits.initial = 1; memory->page_limits.max = 2; memory->byte_size = memory->page_limits.initial * WABT_MAX_PAGES; - memory->data = wabt_alloc_zero(memory->byte_size); + memory->data = new char[memory->byte_size](); return Result::Ok; } else { print_error(callback, "unknown host memory import " PRIimport, @@ -1002,7 +1002,7 @@ static char* create_module_path(Context* ctx, StringSlice filename) { const char* spec_json_filename = ctx->loc.filename; StringSlice dirname = get_dirname(spec_json_filename); size_t path_len = dirname.length + 1 + filename.length + 1; - char* path = static_cast<char*>(wabt_alloc(path_len)); + char* path = new char[path_len]; if (dirname.length == 0) { snprintf(path, path_len, PRIstringslice, @@ -1027,11 +1027,11 @@ static Result on_module_command(Context* ctx, if (WABT_FAILED(result)) { reset_interpreter_environment_to_mark(&ctx->env, mark); print_command_error(ctx, "error reading module: \"%s\"", path); - wabt_free(path); + delete[] path; return Result::Error; } - wabt_free(path); + delete[] path; InterpreterResult iresult = run_start_function(&ctx->thread, ctx->last_module); @@ -1118,19 +1118,17 @@ static Result on_action_command(Context* ctx, Action* action) { static BinaryErrorHandler* new_custom_error_handler(Context* ctx, const char* desc) { size_t header_size = ctx->source_filename.length + strlen(desc) + 100; - char* header = static_cast<char*>(wabt_alloc(header_size)); + char* header = new char[header_size]; snprintf(header, header_size, PRIstringslice ":%d: %s passed", WABT_PRINTF_STRING_SLICE_ARG(ctx->source_filename), ctx->command_line_number, desc); - DefaultErrorHandlerInfo* info = static_cast<DefaultErrorHandlerInfo*>( - wabt_alloc_zero(sizeof(DefaultErrorHandlerInfo))); + DefaultErrorHandlerInfo* info = new DefaultErrorHandlerInfo(); info->header = header; info->out_file = stdout; info->print_header = PrintErrorHeader::Once; - BinaryErrorHandler* error_handler = static_cast<BinaryErrorHandler*>( - wabt_alloc_zero(sizeof(BinaryErrorHandler))); + BinaryErrorHandler* error_handler = new BinaryErrorHandler(); error_handler->on_error = default_binary_error_callback; error_handler->user_data = info; return error_handler; @@ -1139,9 +1137,9 @@ static BinaryErrorHandler* new_custom_error_handler(Context* ctx, static void destroy_custom_error_handler(BinaryErrorHandler* error_handler) { DefaultErrorHandlerInfo* info = static_cast<DefaultErrorHandlerInfo*>(error_handler->user_data); - wabt_free(const_cast<void*>(static_cast<const void*>(info->header))); - wabt_free(info); - wabt_free(error_handler); + delete [] info->header; + delete info; + delete error_handler; } static Result on_assert_malformed_command(Context* ctx, @@ -1165,7 +1163,7 @@ static Result on_assert_malformed_command(Context* ctx, result = Result::Error; } - wabt_free(path); + delete[] path; destroy_interpreter_environment(&env); destroy_custom_error_handler(error_handler); return result; @@ -1227,7 +1225,7 @@ static Result on_assert_unlinkable_command(Context* ctx, result = Result::Error; } - wabt_free(path); + delete[] path; destroy_custom_error_handler(error_handler); return result; } @@ -1253,7 +1251,7 @@ static Result on_assert_invalid_command(Context* ctx, result = Result::Error; } - wabt_free(path); + delete[] path; destroy_interpreter_environment(&env); destroy_custom_error_handler(error_handler); return result; @@ -1284,7 +1282,7 @@ static Result on_assert_uninstantiable_command(Context* ctx, } reset_interpreter_environment_to_mark(&ctx->env, mark); - wabt_free(path); + delete[] path; return result; } @@ -1635,7 +1633,7 @@ static Result parse_commands(Context* ctx) { static void destroy_context(Context* ctx) { destroy_interpreter_thread(&ctx->thread); destroy_interpreter_environment(&ctx->env); - wabt_free(ctx->json_data); + delete[] ctx->json_data; } static Result read_and_run_spec_json(const char* spec_json_filename) { @@ -1647,13 +1645,13 @@ static Result read_and_run_spec_json(const char* spec_json_filename) { init_environment(&ctx.env); init_interpreter_thread(&ctx.env, &ctx.thread, &s_thread_options); - void* data; + char* data; size_t size; Result result = read_file(spec_json_filename, &data, &size); if (WABT_FAILED(result)) return Result::Error; - ctx.json_data = static_cast<char*>(data); + ctx.json_data = data; ctx.json_data_size = size; result = parse_commands(&ctx); diff --git a/src/tools/wasm-link.cc b/src/tools/wasm-link.cc index 11cb62c3..96d4064b 100644 --- a/src/tools/wasm-link.cc +++ b/src/tools/wasm-link.cc @@ -132,7 +132,7 @@ void destroy_binary(LinkerInputBinary* binary) { destroy_global_import_vector(&binary->global_imports); destroy_string_slice_vector(&binary->debug_names); destroy_export_vector(&binary->exports); - wabt_free(binary->data); + delete[] binary->data; } static uint32_t relocate_func_index(LinkerInputBinary* binary, @@ -816,13 +816,13 @@ int main(int argc, char** argv) { const char* input_filename = s_infiles.data[i]; if (s_verbose) writef(&s_log_stream, "reading file: %s\n", input_filename); - void* data; + char* data; size_t size; result = read_file(input_filename, &data, &size); if (WABT_FAILED(result)) return result != Result::Ok; LinkerInputBinary* b = append_binary(&context.inputs); - b->data = static_cast<uint8_t*>(data); + b->data = reinterpret_cast<uint8_t*>(data); b->size = size; b->filename = input_filename; result = read_binary_linker(b); diff --git a/src/tools/wasm2wast.cc b/src/tools/wasm2wast.cc index 82c45e60..32c103e8 100644 --- a/src/tools/wasm2wast.cc +++ b/src/tools/wasm2wast.cc @@ -141,7 +141,7 @@ int main(int argc, char** argv) { init_stdio(); parse_options(argc, argv); - void* data; + char* data; size_t size; result = read_file(s_infile, &data, &size); if (WABT_SUCCEEDED(result)) { @@ -175,7 +175,7 @@ int main(int argc, char** argv) { } destroy_module(&module); } - wabt_free(data); + delete[] data; } return result != Result::Ok; } diff --git a/src/tools/wasmdump.cc b/src/tools/wasmdump.cc index 99539dc6..1293c5a7 100644 --- a/src/tools/wasmdump.cc +++ b/src/tools/wasmdump.cc @@ -145,13 +145,13 @@ int main(int argc, char** argv) { return 1; } - void* void_data; + char* char_data; size_t size; - Result result = read_file(s_objdump_options.infile, &void_data, &size); + Result result = read_file(s_objdump_options.infile, &char_data, &size); if (WABT_FAILED(result)) return result != Result::Ok; - uint8_t* data = static_cast<uint8_t*>(void_data); + uint8_t* data = reinterpret_cast<uint8_t*>(char_data); // Perform serveral passed over the binary in order to print out different // types of information. @@ -201,6 +201,6 @@ int main(int argc, char** argv) { } done: - wabt_free(data); + delete[] data; return result != Result::Ok; } diff --git a/src/tools/wasmopcodecnt.cc b/src/tools/wasmopcodecnt.cc index 991b3302..4f09a958 100644 --- a/src/tools/wasmopcodecnt.cc +++ b/src/tools/wasmopcodecnt.cc @@ -334,13 +334,13 @@ int main(int argc, char** argv) { init_stdio(); parse_options(argc, argv); - void* data; + char* data; size_t size; Result result = read_file(s_infile, &data, &size); if (WABT_FAILED(result)) { const char* input_name = s_infile ? s_infile : "stdin"; ERROR("Unable to parse: %s", input_name); - wabt_free(data); + delete[] data; } FILE* out = stdout; if (s_outfile) { @@ -378,6 +378,6 @@ int main(int argc, char** argv) { } destroy_opcnt_data(&opcnt_data); } - wabt_free(data); + delete[] data; return result != Result::Ok; } diff --git a/src/vector.cc b/src/vector.cc index f27c4c28..4e119268 100644 --- a/src/vector.cc +++ b/src/vector.cc @@ -20,7 +20,7 @@ namespace wabt { -void ensure_capacity(void** data, +void ensure_capacity(char** data, size_t* capacity, size_t desired_size, size_t elt_byte_size) { @@ -29,12 +29,17 @@ void ensure_capacity(void** data, while (new_capacity < desired_size) new_capacity *= 2; size_t new_byte_size = new_capacity * elt_byte_size; - *data = wabt_realloc(*data, new_byte_size); + size_t old_byte_capacity = *capacity * elt_byte_size; + char* new_data = new char [new_byte_size]; + memcpy(new_data, *data, old_byte_capacity); + memset(new_data + old_byte_capacity, 0, new_byte_size - old_byte_capacity); + delete[] *data; + *data = new_data; *capacity = new_capacity; } } -void resize_vector(void** data, +void resize_vector(char** data, size_t* size, size_t* capacity, size_t desired_size, @@ -42,34 +47,30 @@ void resize_vector(void** data, size_t old_size = *size; ensure_capacity(data, capacity, desired_size, elt_byte_size); if (desired_size > old_size) { - memset(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(*data) + - old_size * elt_byte_size), - 0, (desired_size - old_size) * elt_byte_size); + memset(*data + old_size * elt_byte_size, 0, + (desired_size - old_size) * elt_byte_size); } *size = desired_size; } -void* append_element(void** data, +void* append_element(char** data, size_t* size, size_t* capacity, size_t elt_byte_size) { ensure_capacity(data, capacity, *size + 1, elt_byte_size); - void* p = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(*data) + - (*size)++ * elt_byte_size); + char* p = *data + (*size)++ * elt_byte_size; memset(p, 0, elt_byte_size); return p; } -void extend_elements(void** dst, +void extend_elements(char** dst, size_t* dst_size, size_t* dst_capacity, - void* const* src, + char* const* src, size_t src_size, size_t elt_byte_size) { ensure_capacity(dst, dst_capacity, *dst_size + src_size, elt_byte_size); - memcpy(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(*dst) + - (*dst_size * elt_byte_size)), - *src, src_size * elt_byte_size); + memcpy(*dst + (*dst_size * elt_byte_size), *src, src_size * elt_byte_size); *dst_size += src_size; } diff --git a/src/vector.h b/src/vector.h index d684d32e..326cb4c7 100644 --- a/src/vector.h +++ b/src/vector.h @@ -60,22 +60,22 @@ type##Vector* dst, const type##Vector* src) WABT_UNUSED; \ \ void destroy_##name##_vector(type##Vector* vec) { \ - wabt_free(vec->data); \ + delete[] vec->data; \ vec->data = nullptr; \ vec->size = 0; \ vec->capacity = 0; \ } \ void resize_##name##_vector(type##Vector* vec, size_t size) { \ - resize_vector(reinterpret_cast<void**>(&vec->data), &vec->size, \ + resize_vector(reinterpret_cast<char**>(&vec->data), &vec->size, \ &vec->capacity, size, sizeof(type)); \ } \ void reserve_##name##s(type##Vector* vec, size_t desired) { \ - ensure_capacity(reinterpret_cast<void**>(&vec->data), &vec->capacity, \ + ensure_capacity(reinterpret_cast<char**>(&vec->data), &vec->capacity, \ desired, sizeof(type)); \ } \ type* append_##name(type##Vector* vec) { \ return static_cast<type*>( \ - append_element(reinterpret_cast<void**>(&vec->data), &vec->size, \ + append_element(reinterpret_cast<char**>(&vec->data), &vec->size, \ &vec->capacity, sizeof(type))); \ } \ void append_##name##_value(type##Vector* vec, const type* value) { \ @@ -84,8 +84,8 @@ } \ void extend_##name##s(type##Vector* dst, const type##Vector* src) { \ extend_elements( \ - reinterpret_cast<void**>(&dst->data), &dst->size, &dst->capacity, \ - reinterpret_cast<void* const*>(&src->data), src->size, sizeof(type)); \ + reinterpret_cast<char**>(&dst->data), &dst->size, &dst->capacity, \ + reinterpret_cast<char* const*>(&src->data), src->size, sizeof(type)); \ } #define WABT_DESTROY_VECTOR_AND_ELEMENTS(v, name) \ @@ -98,26 +98,26 @@ namespace wabt { -void ensure_capacity(void** data, +void ensure_capacity(char** data, size_t* capacity, size_t desired_size, size_t elt_byte_size); -void resize_vector(void** data, +void resize_vector(char** data, size_t* size, size_t* capacity, size_t desired_size, size_t elt_byte_size); -void* append_element(void** data, +void* append_element(char** data, size_t* size, size_t* capacity, size_t elt_byte_size); -void extend_elements(void** dst, +void extend_elements(char** dst, size_t* dst_size, size_t* dst_capacity, - void* const* src, + char* const* src, size_t src_size, size_t elt_byte_size); diff --git a/src/writer.cc b/src/writer.cc index f9d34813..8e24abc0 100644 --- a/src/writer.cc +++ b/src/writer.cc @@ -89,7 +89,7 @@ void close_file_writer(FileWriter* writer) { void init_output_buffer(OutputBuffer* buf, size_t initial_capacity) { assert(initial_capacity != 0); - buf->start = wabt_alloc(initial_capacity); + buf->start = new char[initial_capacity](); buf->size = 0; buf->capacity = initial_capacity; } @@ -101,7 +101,11 @@ static void ensure_output_buffer_capacity(OutputBuffer* buf, size_t new_capacity = buf->capacity * 2; while (new_capacity < ensure_capacity) new_capacity *= 2; - buf->start = wabt_realloc(buf->start, new_capacity); + char* new_data = new char [new_capacity]; + memcpy(new_data, buf->start, buf->capacity); + memset(new_data + buf->capacity, 0, new_capacity - buf->capacity); + delete [] buf->start; + buf->start = new_data; buf->capacity = new_capacity; } } @@ -113,9 +117,7 @@ static Result write_data_to_output_buffer(size_t offset, MemoryWriter* writer = static_cast<MemoryWriter*>(user_data); size_t end = offset + size; ensure_output_buffer_capacity(&writer->buf, end); - memcpy(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(writer->buf.start) + - offset), - data, size); + memcpy(writer->buf.start + offset, data, size); if (end > writer->buf.size) writer->buf.size = end; return Result::Ok; @@ -190,7 +192,7 @@ Result write_output_buffer_to_file(OutputBuffer* buf, const char* filename) { } void destroy_output_buffer(OutputBuffer* buf) { - wabt_free(buf->start); + delete[] buf->start; } } // namespace wabt diff --git a/src/writer.h b/src/writer.h index 227631b1..19d70948 100644 --- a/src/writer.h +++ b/src/writer.h @@ -36,7 +36,7 @@ struct Writer { }; struct OutputBuffer { - void* start; + char* start; size_t size; size_t capacity; }; |