From 53ebe607f886fa2e1261684250567cac358778ad Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 28 Jan 2023 15:37:59 +0000 Subject: [PATCH] LibWasm: Implement data.drop instruction --- .../LibWasm/AbstractMachine/BytecodeInterpreter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp index a46b241f49..dba2c43e24 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp +++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp @@ -696,6 +696,13 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi } return; } + // https://webassembly.github.io/spec/core/bikeshed/#exec-data-drop + case Instructions::data_drop.value(): { + auto data_index = instruction.arguments().get(); + auto data_address = configuration.frame().module().datas()[data_index.value()]; + *configuration.store().get(data_address) = DataInstance({}); + return; + } case Instructions::table_get.value(): case Instructions::table_set.value(): goto unimplemented; @@ -1006,7 +1013,6 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi return unary_operation>(configuration); case Instructions::i64_trunc_sat_f64_u.value(): return unary_operation>(configuration); - case Instructions::data_drop.value(): case Instructions::table_init.value(): case Instructions::elem_drop.value(): case Instructions::table_copy.value():