Commit 9b4a0b9b authored by Matthias Liedtke's avatar Matthias Liedtke Committed by V8 LUCI CQ

[wasm-gc] Remove rtt type encoding and leftovers

The RTT type can not be used directly in WebAssembly any more and is treated
as a compiler-internal type for the GC MVP.

Bug: v8:7748
Change-Id: I97cb241e6c46446149cc6ae2b1d535b93402fa76
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3787877
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: 's avatarManos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82000}
parent 7586dc79
......@@ -371,49 +371,6 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
? kWasmBottom
: ValueType::RefMaybeNull(heap_type, nullability);
}
// TODO(7748): This is here only for backwards compatibility, and the parsed
// depth is ignored.
case kRttWithDepthCode:
case kRttCode: {
if (!VALIDATE(enabled.has_gc())) {
DecodeError<validate>(
decoder, pc,
"invalid value type 'rtt', enable with --experimental-wasm-gc");
return kWasmBottom;
}
if (code == kRttWithDepthCode) {
uint32_t depth = decoder->read_u32v<validate>(pc + 1, length, "depth");
*length += 1;
if (!VALIDATE(depth <= kV8MaxRttSubtypingDepth)) {
DecodeError<validate>(
decoder, pc,
"subtyping depth %u is greater than the maximum depth "
"%u supported by V8",
depth, kV8MaxRttSubtypingDepth);
return kWasmBottom;
}
}
uint32_t type_index_length;
uint32_t type_index =
decoder->read_u32v<validate>(pc + *length, &type_index_length);
*length += type_index_length;
if (!VALIDATE(type_index < kV8MaxWasmTypes)) {
DecodeError<validate>(
decoder, pc,
"Type index %u is greater than the maximum number %zu "
"of type definitions supported by V8",
type_index, kV8MaxWasmTypes);
return kWasmBottom;
}
// We use capacity over size so this works mid-DecodeTypeSection.
if (!VALIDATE(module == nullptr ||
type_index < module->types.capacity())) {
DecodeError<validate>(decoder, pc, "Type index %u is out of bounds",
type_index);
return kWasmBottom;
}
return ValueType::Rtt(type_index);
}
case kS128Code: {
if (!VALIDATE(enabled.has_simd())) {
DecodeError<validate>(
......
......@@ -548,15 +548,15 @@ class ValueType {
default:
return kRefCode;
}
case kVoid:
return kVoidCode;
case kRtt:
return kRttCode;
#define NUMERIC_TYPE_CASE(kind, ...) \
case k##kind: \
return k##kind##Code;
FOREACH_NUMERIC_VALUE_TYPE(NUMERIC_TYPE_CASE)
#undef NUMERIC_TYPE_CASE
// The RTT value type can not be used in WebAssembly and is a
// compiler-internal type only.
case kRtt:
case kVoid:
case kBottom:
// Unreachable code
return kVoidCode;
......
......@@ -45,9 +45,6 @@ enum ValueTypeCode : uint8_t {
kRefNullCode = 0x6c,
kRefCode = 0x6b,
kI31RefCode = 0x6a,
// TODO(7748): Only here for backwards compatibility, remove when able.
kRttWithDepthCode = 0x69,
kRttCode = 0x68,
kDataRefCode = 0x67,
kArrayRefCode = 0x66,
kNoneCode = 0x65,
......
......@@ -2075,8 +2075,7 @@ TEST_F(WasmModuleVerifyTest, IllegalTableTypes) {
static Vec table_types[] = {{kRefNullCode, 0},
{kRefNullCode, 1},
{kRefNullCode, kI31RefCode},
{kI31RefCode},
{kRttCode, 0}};
{kI31RefCode}};
for (Vec type : table_types) {
Vec data = {
......
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