1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 22:25:06 +00:00

LibWasm: Parse the "extend" set of instructions

This commit is contained in:
Ali Mohammad Pur 2021-06-01 21:55:14 +04:30 committed by Ali Mohammad Pur
parent 6b5d1eedcb
commit 02b3238c41
4 changed files with 20 additions and 0 deletions

View file

@ -900,6 +900,11 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
case Instructions::table_grow.value(): case Instructions::table_grow.value():
case Instructions::table_size.value(): case Instructions::table_size.value():
case Instructions::table_fill.value(): case Instructions::table_fill.value():
case Instructions::i32_extend8_s.value():
case Instructions::i32_extend16_s.value():
case Instructions::i64_extend8_s.value():
case Instructions::i64_extend16_s.value():
case Instructions::i64_extend32_s.value():
default: default:
unimplemented:; unimplemented:;
dbgln("Instruction '{}' not implemented", instruction_name(instruction.opcode())); dbgln("Instruction '{}' not implemented", instruction_name(instruction.opcode()));

View file

@ -187,6 +187,11 @@ static constexpr OpCode unreachable = 0x00,
i64_reinterpret_f64 = 0xbd, i64_reinterpret_f64 = 0xbd,
f32_reinterpret_i32 = 0xbe, f32_reinterpret_i32 = 0xbe,
f64_reinterpret_i64 = 0xbf, f64_reinterpret_i64 = 0xbf,
i32_extend8_s = 0xc0,
i32_extend16_s = 0xc1,
i64_extend8_s = 0xc2,
i64_extend16_s = 0xc3,
i64_extend32_s = 0xc4,
ref_null = 0xd0, ref_null = 0xd0,
ref_is_null = 0xd1, ref_is_null = 0xd1,
ref_func = 0xd2; ref_func = 0xd2;

View file

@ -631,6 +631,11 @@ ParseResult<Vector<Instruction>> Instruction::parse(InputStream& stream, Instruc
case Instructions::i64_reinterpret_f64.value(): case Instructions::i64_reinterpret_f64.value():
case Instructions::f32_reinterpret_i32.value(): case Instructions::f32_reinterpret_i32.value():
case Instructions::f64_reinterpret_i64.value(): case Instructions::f64_reinterpret_i64.value():
case Instructions::i32_extend8_s.value():
case Instructions::i32_extend16_s.value():
case Instructions::i64_extend8_s.value():
case Instructions::i64_extend16_s.value():
case Instructions::i64_extend32_s.value():
return Vector { Instruction { opcode } }; return Vector { Instruction { opcode } };
case 0xfc: { case 0xfc: {
// These are multibyte instructions. // These are multibyte instructions.

View file

@ -798,6 +798,11 @@ HashMap<Wasm::OpCode, String> Wasm::Names::instruction_names {
{ Instructions::i64_reinterpret_f64, "i64.reinterpret.f64" }, { Instructions::i64_reinterpret_f64, "i64.reinterpret.f64" },
{ Instructions::f32_reinterpret_i32, "f32.reinterpret.i32" }, { Instructions::f32_reinterpret_i32, "f32.reinterpret.i32" },
{ Instructions::f64_reinterpret_i64, "f64.reinterpret.i64" }, { Instructions::f64_reinterpret_i64, "f64.reinterpret.i64" },
{ Instructions::i32_extend8_s, "i32.extend8_s" },
{ Instructions::i32_extend16_s, "i32.extend16_s" },
{ Instructions::i64_extend8_s, "i64.extend8_s" },
{ Instructions::i64_extend16_s, "i64.extend16_s" },
{ Instructions::i64_extend32_s, "i64.extend32_s" },
{ Instructions::ref_null, "ref.null" }, { Instructions::ref_null, "ref.null" },
{ Instructions::ref_is_null, "ref.is.null" }, { Instructions::ref_is_null, "ref.is.null" },
{ Instructions::ref_func, "ref.func" }, { Instructions::ref_func, "ref.func" },