From 3bcb05b9b7100688ab166591b02bad1415ba7baf Mon Sep 17 00:00:00 2001 From: "Soni L." Date: Thu, 17 Oct 2024 14:46:34 -0300 Subject: [PATCH] type.h: Introduce ExnRef (#2489) --- include/wabt/type.h | 6 +++++- src/interp/interp-util.cc | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/wabt/type.h b/include/wabt/type.h index 96fcf94588..c270624c81 100644 --- a/include/wabt/type.h +++ b/include/wabt/type.h @@ -42,6 +42,7 @@ class Type { V128 = -0x05, // 0x7b I8 = -0x06, // 0x7a : packed-type only, used in gc and as v128 lane I16 = -0x07, // 0x79 : packed-type only, used in gc and as v128 lane + ExnRef = -0x0c, // 0x74 FuncRef = -0x10, // 0x70 ExternRef = -0x11, // 0x6f Reference = -0x15, // 0x6b @@ -68,7 +69,7 @@ class Type { bool IsRef() const { return enum_ == Type::ExternRef || enum_ == Type::FuncRef || - enum_ == Type::Reference; + enum_ == Type::Reference || enum_ == Type::ExnRef; } bool IsReferenceWithIndex() const { return enum_ == Type::Reference; } @@ -87,6 +88,7 @@ class Type { case Type::V128: return "v128"; case Type::I8: return "i8"; case Type::I16: return "i16"; + case Type::ExnRef: return "exnref"; case Type::FuncRef: return "funcref"; case Type::Func: return "func"; case Type::Void: return "void"; @@ -103,6 +105,7 @@ class Type { switch (enum_) { case Type::FuncRef: return "func"; case Type::ExternRef: return "extern"; + case Type::ExnRef: return "exn"; case Type::Struct: return "struct"; case Type::Array: return "array"; default: return ""; @@ -145,6 +148,7 @@ class Type { case Type::F64: case Type::V128: case Type::FuncRef: + case Type::ExnRef: case Type::ExternRef: case Type::Reference: return TypeVector(this, this + 1); diff --git a/src/interp/interp-util.cc b/src/interp/interp-util.cc index 5267f4ae2a..fcba2c7f1a 100644 --- a/src/interp/interp-util.cc +++ b/src/interp/interp-util.cc @@ -55,6 +55,9 @@ std::string TypedValueToString(const TypedValue& tv) { case Type::ExternRef: return StringPrintf("externref:%" PRIzd, tv.value.Get().index); + case Type::ExnRef: + return StringPrintf("exnref:%" PRIzd, tv.value.Get().index); + case Type::Reference: case Type::Func: case Type::Struct: