Skip to content

Commit 344f2c6

Browse files
ubaidskcertik
authored andcommitted
Refactor: WASM_X86: Improve comment and code formatting
1 parent 6cad3e9 commit 344f2c6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/libasr/codegen/wasm_to_x86.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class X86Generator : public WASMDecoder<X86Generator> {
3535
m_a.asm_push_r32(X86Reg::ebp);
3636
m_a.asm_mov_r32_r32(X86Reg::ebp, X86Reg::esp);
3737

38-
// Initialze space for local variables to zero
38+
// Initialze local variables to zero and thus allocate space
3939
m_a.asm_mov_r32_imm32(X86Reg::eax, 0U);
4040
for (uint32_t j = 0; j < codes.p[i].locals.size(); j++) {
4141
for (uint32_t k = 0; k < codes.p[i].locals.p[j].count;
@@ -106,7 +106,9 @@ Result<int> wasm_to_x86(Vec<uint8_t> &wasm_bytes, Allocator &al,
106106
auto t1 = std::chrono::high_resolution_clock::now();
107107
m_a.verify();
108108
auto t2 = std::chrono::high_resolution_clock::now();
109-
time_verify = std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count();
109+
time_verify =
110+
std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1)
111+
.count();
110112
}
111113

112114
{
@@ -124,9 +126,11 @@ Result<int> wasm_to_x86(Vec<uint8_t> &wasm_bytes, Allocator &al,
124126
<< std::endl;
125127
std::cout << "Generate asm: " << std::setw(5) << time_gen_x86_bytes
126128
<< std::endl;
127-
std::cout << "Verify: " << std::setw(5) << time_verify << std::endl;
129+
std::cout << "Verify: " << std::setw(5) << time_verify
130+
<< std::endl;
128131
std::cout << "Save: " << std::setw(5) << time_save << std::endl;
129-
int total = time_decode_wasm + time_gen_x86_bytes + time_verify + time_save;
132+
int total =
133+
time_decode_wasm + time_gen_x86_bytes + time_verify + time_save;
130134
std::cout << "Total: " << std::setw(5) << total << std::endl;
131135
}
132136
return 0;

src/libasr/codegen/wasm_to_x86.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class X86Visitor : public BaseWASMVisitor<X86Visitor> {
4343
if (func_index == 0) {
4444
m_a.asm_call_label("print_i32");
4545
} else if (func_index == 5) {
46-
// currently ignoring print_buf
46+
// currently ignoring flush_buf
4747
} else if (func_index == 6) {
4848
m_a.asm_call_label("exit");
4949
} else {

0 commit comments

Comments
 (0)