Commit fdd12a48 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][cleanup] Rename kWasmVar to kWasmBottom

In the context of the reference types proposal, the imaginary sub type
of all types was called "bot". With this CL we use this name now also
in V8.

R=clemensh@chromium.org

Bug: v8:9396
Change-Id: I65a2a177ae2af97e66549e7a5b1457595b04a1d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1675950
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62361}
parent b3f99025
......@@ -223,7 +223,7 @@ class LiftoffCompiler {
return kAnyRef;
case kWasmExceptRef:
return kExceptionHandling;
case kWasmVar:
case kWasmBottom:
return kMultiValue;
default:
return kOtherReason;
......
......@@ -240,7 +240,7 @@ inline bool decode_local_type(uint8_t val, ValueType* result) {
*result = kWasmExceptRef;
return true;
default:
*result = kWasmVar;
*result = kWasmBottom;
return false;
}
}
......@@ -297,20 +297,20 @@ struct BlockTypeImmediate {
}
uint32_t in_arity() const {
if (type != kWasmVar) return 0;
if (type != kWasmBottom) return 0;
return static_cast<uint32_t>(sig->parameter_count());
}
uint32_t out_arity() const {
if (type == kWasmStmt) return 0;
if (type != kWasmVar) return 1;
if (type != kWasmBottom) return 1;
return static_cast<uint32_t>(sig->return_count());
}
ValueType in_type(uint32_t index) {
DCHECK_EQ(kWasmVar, type);
DCHECK_EQ(kWasmBottom, type);
return sig->GetParam(index);
}
ValueType out_type(uint32_t index) {
if (type == kWasmVar) return sig->GetReturn(index);
if (type == kWasmBottom) return sig->GetReturn(index);
DCHECK_NE(kWasmStmt, type);
DCHECK_EQ(0, index);
return type;
......@@ -1122,7 +1122,7 @@ class WasmDecoder : public Decoder {
}
inline bool Complete(BlockTypeImmediate<validate>& imm) {
if (imm.type != kWasmVar) return true;
if (imm.type != kWasmBottom) return true;
if (!VALIDATE(module_ && imm.sig_index < module_->signatures.size())) {
return false;
}
......@@ -1658,7 +1658,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
ZoneVector<Control> control_; // stack of blocks, loops, and ifs.
static Value UnreachableValue(const uint8_t* pc) {
return Value{pc, kWasmVar};
return Value{pc, kWasmBottom};
}
bool CheckHasMemory() {
......@@ -1926,7 +1926,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
auto cond = Pop(2, kWasmI32);
auto fval = Pop();
auto tval = Pop(0, fval.type);
ValueType type = tval.type == kWasmVar ? fval.type : tval.type;
ValueType type = tval.type == kWasmBottom ? fval.type : tval.type;
if (ValueTypes::IsSubType(type, kWasmAnyRef)) {
this->error(
"select without type is only valid for value type inputs");
......@@ -2929,7 +2929,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
V8_INLINE Value Pop(int index, ValueType expected) {
auto val = Pop();
if (!VALIDATE(ValueTypes::IsSubType(val.type, expected) ||
val.type == kWasmVar || expected == kWasmVar)) {
val.type == kWasmBottom || expected == kWasmBottom)) {
this->errorf(val.pc, "%s[%d] expected type %s, found %s of type %s",
SafeOpcodeNameAt(this->pc_), index,
ValueTypes::TypeName(expected), SafeOpcodeNameAt(val.pc),
......
......@@ -717,7 +717,7 @@ class WasmGraphBuildingInterface {
Value& val = stack_values[i];
Value& old = (*merge)[i];
DCHECK_NOT_NULL(val.node);
DCHECK(val.type == kWasmVar ||
DCHECK(val.type == kWasmBottom ||
ValueTypes::MachineRepresentationFor(val.type) ==
ValueTypes::MachineRepresentationFor(old.type));
old.node = first ? val.node
......
......@@ -25,7 +25,7 @@ namespace wasm {
// \ /
// I32 I64 F32 F64 NullRef
// \ \ \ \ /
// ------------ Var (Bot)
// ------------ Bottom
enum ValueType : uint8_t {
kWasmStmt,
kWasmI32,
......@@ -37,7 +37,7 @@ enum ValueType : uint8_t {
kWasmAnyFunc,
kWasmNullRef,
kWasmExceptRef,
kWasmVar,
kWasmBottom,
};
using FunctionSig = Signature<ValueType>;
......@@ -208,7 +208,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
static inline ValueType CommonSubType(ValueType a, ValueType b) {
if (a == b) return a;
// The only sub type of any value type is {bot}.
if (!IsReferenceType(a) || !IsReferenceType(b)) return kWasmVar;
if (!IsReferenceType(a) || !IsReferenceType(b)) return kWasmBottom;
if (IsSubType(a, b)) return a;
if (IsSubType(b, a)) return b;
// {a} and {b} are not each other's subtype. The biggest sub-type of all
......@@ -367,7 +367,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
return 's';
case kWasmStmt:
return 'v';
case kWasmVar:
case kWasmBottom:
return '*';
default:
return '?';
......@@ -396,8 +396,8 @@ class V8_EXPORT_PRIVATE ValueTypes {
return "s128";
case kWasmStmt:
return "<stmt>";
case kWasmVar:
return "<var>";
case kWasmBottom:
return "<bot>";
default:
return "<unknown>";
}
......
......@@ -821,7 +821,7 @@ class SideTable : public ZoneObject {
bool is_loop = opcode == kExprLoop;
BlockTypeImmediate<Decoder::kNoValidate> imm(kAllWasmFeatures, &i,
i.pc());
if (imm.type == kWasmVar) {
if (imm.type == kWasmBottom) {
imm.sig = module->signatures[imm.sig_index];
}
TRACE("control @%u: %s, arity %d->%d\n", i.pc_offset(),
......@@ -837,7 +837,7 @@ class SideTable : public ZoneObject {
case kExprIf: {
BlockTypeImmediate<Decoder::kNoValidate> imm(kAllWasmFeatures, &i,
i.pc());
if (imm.type == kWasmVar) {
if (imm.type == kWasmBottom) {
imm.sig = module->signatures[imm.sig_index];
}
TRACE("control @%u: If, arity %d->%d\n", i.pc_offset(),
......@@ -870,7 +870,7 @@ class SideTable : public ZoneObject {
case kExprTry: {
BlockTypeImmediate<Decoder::kNoValidate> imm(kAllWasmFeatures, &i,
i.pc());
if (imm.type == kWasmVar) {
if (imm.type == kWasmBottom) {
imm.sig = module->signatures[imm.sig_index];
}
TRACE("control @%u: Try, arity %d->%d\n", i.pc_offset(),
......
......@@ -105,7 +105,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes,
BlockTypeImmediate<Decoder::kNoValidate> imm(kAllWasmFeatures, &i,
i.pc());
os << WasmOpcodes::OpcodeName(opcode);
if (imm.type == kWasmVar) {
if (imm.type == kWasmBottom) {
os << " (type " << imm.sig_index << ")";
} else if (imm.out_arity() > 0) {
os << " " << ValueTypes::TypeName(imm.out_type(0));
......
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