@@ -36,7 +36,7 @@ class X86Visitor : public WASMDecoder<X86Visitor>,
36
36
std::vector<std::string> loop_unique_id;
37
37
uint32_t cur_nesting_length;
38
38
int32_t last_vis_i32_const, last_last_vis_i32_const;
39
- std::unordered_map< int32_t , std::string> loc_to_str ;
39
+ std::map<std::string , std::string> label_to_str ;
40
40
41
41
X86Visitor (X86Assembler &m_a, Allocator &al,
42
42
diag::Diagnostics &diagonostics, Vec<uint8_t > &code)
@@ -79,15 +79,14 @@ class X86Visitor : public WASMDecoder<X86Visitor>,
79
79
std::string label =
80
80
" string" + std::to_string (last_last_vis_i32_const);
81
81
emit_print (m_a, label,
82
- loc_to_str[last_last_vis_i32_const ].size ());
82
+ label_to_str[label ].size ());
83
83
break ;
84
84
}
85
85
case 5 : { // flush_buf
86
- std::string label = " string-1 " ;
86
+ std::string label = " string_newline " ;
87
87
std::string msg = " \n " ;
88
- int32_t loc = -1 ; // tmp negative index used
89
88
emit_print (m_a, label, msg.size ());
90
- loc_to_str[loc ] = msg;
89
+ label_to_str[ " string_newline " ] = msg;
91
90
break ;
92
91
}
93
92
case 6 : { // set_exit_code
@@ -312,7 +311,8 @@ class X86Visitor : public WASMDecoder<X86Visitor>,
312
311
for (uint32_t i = 0 ; i < data_segments.size (); i++) {
313
312
offset = data_segments[i].insts_start_index ;
314
313
decode_instructions ();
315
- loc_to_str[last_vis_i32_const] = data_segments[i].text ;
314
+ std::string label = " string" + std::to_string (last_vis_i32_const);
315
+ label_to_str[label] = data_segments[i].text ;
316
316
}
317
317
318
318
for (uint32_t i = 0 ; i < type_indices.size (); i++) {
@@ -347,9 +347,8 @@ class X86Visitor : public WASMDecoder<X86Visitor>,
347
347
}
348
348
}
349
349
350
- for (auto &s : loc_to_str) {
351
- std::string label = " string" + std::to_string (s.first );
352
- emit_data_string (m_a, label, s.second );
350
+ for (auto &s : label_to_str) {
351
+ emit_data_string (m_a, s.first , s.second );
353
352
}
354
353
355
354
emit_elf32_footer (m_a);
0 commit comments