Skip to content

Commit

Permalink
type.h: Introduce ExnRef (WebAssembly#2489)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoniEx2 authored Oct 17, 2024
1 parent 2b4e2c7 commit 3bcb05b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/wabt/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; }
Expand All @@ -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";
Expand All @@ -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 "<invalid>";
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/interp/interp-util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ std::string TypedValueToString(const TypedValue& tv) {
case Type::ExternRef:
return StringPrintf("externref:%" PRIzd, tv.value.Get<Ref>().index);

case Type::ExnRef:
return StringPrintf("exnref:%" PRIzd, tv.value.Get<Ref>().index);

case Type::Reference:
case Type::Func:
case Type::Struct:
Expand Down

0 comments on commit 3bcb05b

Please sign in to comment.