Commit d5cecd11 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by Commit Bot

[wasm-gc] Fix i31ref decoding and some error messages

Bug: v8:7748
Change-Id: I4d6aef3ab503ffc9b9624b6d65d74f36141d550d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2403258
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69880}
parent d2ef8722
......@@ -211,7 +211,8 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
case kLocalExternRef:
case kLocalI31Ref: {
HeapType heap_type = HeapType::from_code(code);
ValueType result = ValueType::Ref(heap_type, kNullable);
ValueType result = ValueType::Ref(
heap_type, code == kLocalI31Ref ? kNonNullable : kNullable);
if (!VALIDATE(enabled.contains(feature_for_heap_type(heap_type)))) {
decoder->errorf(
pc, "invalid value type '%s', enable with --experimental-wasm-%s",
......@@ -234,7 +235,7 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
Nullability nullability = code == kLocalOptRef ? kNullable : kNonNullable;
if (!VALIDATE(enabled.has_typed_funcref())) {
decoder->errorf(pc,
"Invalid type 'ref%s', enable with "
"Invalid type '(ref%s <heaptype>)', enable with "
"--experimental-wasm-typed-funcref",
nullability == kNullable ? " null" : "");
return kWasmBottom;
......
......@@ -561,7 +561,9 @@ class ModuleDecoderImpl : public Decoder {
}
case kWasmStructTypeCode: {
if (!enabled_features_.has_gc()) {
errorf(pc(), "struct types are part of the GC proposal");
errorf(pc(),
"invalid struct type definition, enable with "
"--experimental-wasm-gc");
break;
}
const StructType* s = consume_struct(module_->signature_zone.get());
......@@ -572,7 +574,9 @@ class ModuleDecoderImpl : public Decoder {
}
case kWasmArrayTypeCode: {
if (!enabled_features_.has_gc()) {
errorf(pc(), "array types are part of the GC proposal");
errorf(pc(),
"invalid array type definition, enable with "
"--experimental-wasm-gc");
break;
}
const ArrayType* type = consume_array(module_->signature_zone.get());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment