diff options
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/InstrumentLocals.cpp | 18 | ||||
-rw-r--r-- | src/passes/Print.cpp | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp index 761aac2a9..311d4a27b 100644 --- a/src/passes/InstrumentLocals.cpp +++ b/src/passes/InstrumentLocals.cpp @@ -57,7 +57,7 @@ Name get_f32("get_f32"); Name get_f64("get_f64"); Name get_v128("get_v128"); Name get_funcref("get_funcref"); -Name get_anyref("get_anyref"); +Name get_externref("get_externref"); Name set_i32("set_i32"); Name set_i64("set_i64"); @@ -65,7 +65,7 @@ Name set_f32("set_f32"); Name set_f64("set_f64"); Name set_v128("set_v128"); Name set_funcref("set_funcref"); -Name set_anyref("set_anyref"); +Name set_externref("set_externref"); struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { void visitLocalGet(LocalGet* curr) { @@ -75,8 +75,8 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { auto heapType = curr->type.getHeapType(); if (heapType == HeapType::func && curr->type.isNullable()) { import = get_funcref; - } else if (heapType == HeapType::any && curr->type.isNullable()) { - import = get_anyref; + } else if (heapType == HeapType::ext && curr->type.isNullable()) { + import = get_externref; } else { WASM_UNREACHABLE("TODO: general reference types"); } @@ -128,8 +128,8 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { auto heapType = type.getHeapType(); if (heapType == HeapType::func && type.isNullable()) { import = set_funcref; - } else if (heapType == HeapType::any && type.isNullable()) { - import = set_anyref; + } else if (heapType == HeapType::ext && type.isNullable()) { + import = set_externref; } else { WASM_UNREACHABLE("TODO: general reference types"); } @@ -175,12 +175,12 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { if (curr->features.hasReferenceTypes()) { Type func = Type(HeapType::func, Nullable); - Type any = Type(HeapType::any, Nullable); + Type ext = Type(HeapType::ext, Nullable); addImport(curr, get_funcref, {Type::i32, Type::i32, func}, func); addImport(curr, set_funcref, {Type::i32, Type::i32, func}, func); - addImport(curr, get_anyref, {Type::i32, Type::i32, any}, any); - addImport(curr, set_anyref, {Type::i32, Type::i32, any}, any); + addImport(curr, get_externref, {Type::i32, Type::i32, ext}, ext); + addImport(curr, set_externref, {Type::i32, Type::i32, ext}, ext); } if (curr->features.hasSIMD()) { addImport(curr, get_v128, {Type::i32, Type::i32, Type::v128}, Type::v128); diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 87c33ed93..81ae1bfc6 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -88,6 +88,9 @@ static bool maybePrintRefShorthand(std::ostream& o, Type type) { if (heapType.isBasic()) { if (type.isNullable()) { switch (heapType.getBasic()) { + case HeapType::ext: + o << "externref"; + return true; case HeapType::func: o << "funcref"; return true; @@ -115,6 +118,7 @@ static bool maybePrintRefShorthand(std::ostream& o, Type type) { } } else { switch (heapType.getBasic()) { + case HeapType::ext: case HeapType::func: case HeapType::any: case HeapType::eq: |