Skip to content

Commit ad3de46

Browse files
alimpfardawesomekling
authored andcommitted
LibWasm: Replace memory read macros with templated functions
1 parent 563b402 commit ad3de46

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,6 @@ void BytecodeInterpreter::unary_operation(Configuration& configuration)
220220
configuration.stack().peek() = Value(result);
221221
}
222222

223-
#define LOAD_AND_PUSH(read_type, push_type) \
224-
do { \
225-
return load_and_push<read_type, push_type>(configuration, instruction); \
226-
} while (false)
227-
228223
#define POP_AND_STORE(pop_type, store_type) \
229224
do { \
230225
TRAP_IF_NOT(!configuration.stack().is_empty()); \
@@ -523,33 +518,33 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
523518
return;
524519
}
525520
case Instructions::i32_load.value():
526-
LOAD_AND_PUSH(i32, i32);
521+
return load_and_push<i32, i32>(configuration, instruction);
527522
case Instructions::i64_load.value():
528-
LOAD_AND_PUSH(i64, i64);
523+
return load_and_push<i64, i64>(configuration, instruction);
529524
case Instructions::f32_load.value():
530-
LOAD_AND_PUSH(float, float);
525+
return load_and_push<float, float>(configuration, instruction);
531526
case Instructions::f64_load.value():
532-
LOAD_AND_PUSH(double, double);
527+
return load_and_push<double, double>(configuration, instruction);
533528
case Instructions::i32_load8_s.value():
534-
LOAD_AND_PUSH(i8, i32);
529+
return load_and_push<i8, i32>(configuration, instruction);
535530
case Instructions::i32_load8_u.value():
536-
LOAD_AND_PUSH(u8, i32);
531+
return load_and_push<u8, i32>(configuration, instruction);
537532
case Instructions::i32_load16_s.value():
538-
LOAD_AND_PUSH(i16, i32);
533+
return load_and_push<i16, i32>(configuration, instruction);
539534
case Instructions::i32_load16_u.value():
540-
LOAD_AND_PUSH(u16, i32);
535+
return load_and_push<u16, i32>(configuration, instruction);
541536
case Instructions::i64_load8_s.value():
542-
LOAD_AND_PUSH(i8, i64);
537+
return load_and_push<i8, i64>(configuration, instruction);
543538
case Instructions::i64_load8_u.value():
544-
LOAD_AND_PUSH(u8, i64);
539+
return load_and_push<u8, i64>(configuration, instruction);
545540
case Instructions::i64_load16_s.value():
546-
LOAD_AND_PUSH(i16, i64);
541+
return load_and_push<i16, i64>(configuration, instruction);
547542
case Instructions::i64_load16_u.value():
548-
LOAD_AND_PUSH(u16, i64);
543+
return load_and_push<u16, i64>(configuration, instruction);
549544
case Instructions::i64_load32_s.value():
550-
LOAD_AND_PUSH(i32, i64);
545+
return load_and_push<i32, i64>(configuration, instruction);
551546
case Instructions::i64_load32_u.value():
552-
LOAD_AND_PUSH(u32, i64);
547+
return load_and_push<u32, i64>(configuration, instruction);
553548
case Instructions::i32_store.value():
554549
POP_AND_STORE(i32, i32);
555550
case Instructions::i64_store.value():

0 commit comments

Comments
 (0)