summaryrefslogtreecommitdiff
path: root/src/interp/binary-reader-interp.cc
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-11-08 17:37:22 -0800
committerGitHub <noreply@github.com>2019-11-08 17:37:22 -0800
commit3cc34754555c224c1693d7c42925c3c32145e3e0 (patch)
tree9a60d2109b5ea919f510c0bd807c683282caa25e /src/interp/binary-reader-interp.cc
parent660ce2ce9b4812248088ac45e5f8ef98a6bf6e51 (diff)
downloadwabt-3cc34754555c224c1693d7c42925c3c32145e3e0.tar.gz
wabt-3cc34754555c224c1693d7c42925c3c32145e3e0.tar.bz2
wabt-3cc34754555c224c1693d7c42925c3c32145e3e0.zip
Allow anyref globals to store ref subtypes (#1214)
This requires the type of a global to be distinct from its current TypedValue contents.
Diffstat (limited to 'src/interp/binary-reader-interp.cc')
-rw-r--r--src/interp/binary-reader-interp.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/interp/binary-reader-interp.cc b/src/interp/binary-reader-interp.cc
index 11a3f44b..9750f98c 100644
--- a/src/interp/binary-reader-interp.cc
+++ b/src/interp/binary-reader-interp.cc
@@ -946,17 +946,16 @@ wabt::Result BinaryReaderInterp::BeginGlobal(Index index,
Type type,
bool mutable_) {
assert(TranslateGlobalIndexToEnv(index) == env_->GetGlobalCount());
- env_->EmplaceBackGlobal(TypedValue(type), mutable_);
+ env_->EmplaceBackGlobal(type, mutable_);
init_expr_value_.type = Type::Void;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterp::EndGlobalInitExpr(Index index) {
Global* global = GetGlobalByModuleIndex(index);
- if (Failed(typechecker_.CheckType(init_expr_value_.type, global->typed_value.type))) {
+ if (Failed(typechecker_.CheckType(init_expr_value_.type, global->type))) {
PrintError("type mismatch in global, expected %s but got %s.",
- GetTypeName(global->typed_value.type),
- GetTypeName(init_expr_value_.type));
+ GetTypeName(global->type), GetTypeName(init_expr_value_.type));
return wabt::Result::Error;
}
global->typed_value = init_expr_value_;
@@ -1656,7 +1655,7 @@ wabt::Result BinaryReaderInterp::OnGlobalSetExpr(Index global_index) {
global_index);
return wabt::Result::Error;
}
- CHECK_RESULT(typechecker_.OnGlobalSet(global->typed_value.type));
+ CHECK_RESULT(typechecker_.OnGlobalSet(global->type));
CHECK_RESULT(EmitOpcode(Opcode::GlobalSet));
CHECK_RESULT(EmitI32(TranslateGlobalIndexToEnv(global_index)));
return wabt::Result::Ok;