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