This makes it comparable in DCHECK_EQ and similar methods.
Change-Id: I6b5b237be89325850ae6860d011fd6741189ab01
// kInStackLargeOffset and kConstantLargeValue are hidden by GetKind().
// kInRegisterHigh and kInFpuRegisterHigh should be handled by
// the special cases above and they should not occur alone.
- LOG(ERROR) << "Unexpected register location kind: "
- << DexRegisterLocation::PrettyDescriptor(kind);
+ LOG(ERROR) << "Unexpected register location kind: " << kind;
break;
}
if (is64bitValue) {
void StackMapStream::AddDexRegisterEntry(DexRegisterLocation::Kind kind, int32_t value) {
if (kind != DexRegisterLocation::Kind::kNone) {
// Ensure we only use non-compressed location kind at this stage.
- DCHECK(DexRegisterLocation::IsShortLocationKind(kind))
- << DexRegisterLocation::PrettyDescriptor(kind);
+ DCHECK(DexRegisterLocation::IsShortLocationKind(kind)) << kind;
DexRegisterLocation location(kind, value);
// Look for Dex register `location` in the location catalog (using the
CHECK_EQ(location.GetValue(), 0);
break;
default:
- LOG(FATAL) << "Unexpected location kind"
- << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind());
+ LOG(FATAL) << "Unexpected location kind " << location.GetInternalKind();
}
}
}
continue;
}
- DCHECK(location == DexRegisterLocation::Kind::kInStack)
- << DexRegisterLocation::PrettyDescriptor(location);
+ DCHECK_EQ(location, DexRegisterLocation::Kind::kInStack);
int32_t vreg_value = shadow_frame->GetVReg(vreg);
int32_t slot_offset = vreg_map.GetStackOffsetInBytes(vreg,
return VRegKind::kDoubleHiVReg;
default:
- LOG(FATAL) << "Unexpected vreg location "
- << DexRegisterLocation::PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected vreg location " << kind;
UNREACHABLE();
}
}
}
default: {
LOG(FATAL)
- << "Unexpected location kind"
- << DexRegisterLocation::PrettyDescriptor(
- vreg_map.GetLocationInternalKind(vreg,
- number_of_vregs,
- code_info,
- encoding));
+ << "Unexpected location kind "
+ << vreg_map.GetLocationInternalKind(vreg,
+ number_of_vregs,
+ code_info,
+ encoding);
UNREACHABLE();
}
}
return false;
default:
LOG(FATAL)
- << "Unexpected location kind"
- << DexRegisterLocation::PrettyDescriptor(
- dex_register_map.GetLocationInternalKind(vreg,
- number_of_dex_registers,
- code_info,
- encoding));
+ << "Unexpected location kind "
+ << dex_register_map.GetLocationInternalKind(vreg,
+ number_of_dex_registers,
+ code_info,
+ encoding);
UNREACHABLE();
}
}
constexpr uint32_t StackMap::kNoDexRegisterMap;
constexpr uint32_t StackMap::kNoInlineInfo;
+std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation::Kind& kind) {
+ using Kind = DexRegisterLocation::Kind;
+ switch (kind) {
+ case Kind::kNone:
+ return stream << "none";
+ case Kind::kInStack:
+ return stream << "in stack";
+ case Kind::kInRegister:
+ return stream << "in register";
+ case Kind::kInRegisterHigh:
+ return stream << "in register high";
+ case Kind::kInFpuRegister:
+ return stream << "in fpu register";
+ case Kind::kInFpuRegisterHigh:
+ return stream << "in fpu register high";
+ case Kind::kConstant:
+ return stream << "as constant";
+ case Kind::kInStackLargeOffset:
+ return stream << "in stack (large offset)";
+ case Kind::kConstantLargeValue:
+ return stream << "as constant (large value)";
+ }
+ return stream << "Kind<" << static_cast<uint32_t>(kind) << ">";
+}
+
DexRegisterLocation::Kind DexRegisterMap::GetLocationInternalKind(
uint16_t dex_register_number,
uint16_t number_of_dex_registers,
const std::string& prefix = "v",
const std::string& suffix = "") {
os << prefix << dex_register_num << ": "
- << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind())
+ << location.GetInternalKind()
<< " (" << location.GetValue() << ")" << suffix << '\n';
}
sizeof(Kind) == 1u,
"art::DexRegisterLocation::Kind has a size different from one byte.");
- static const char* PrettyDescriptor(Kind kind) {
- switch (kind) {
- case Kind::kNone:
- return "none";
- case Kind::kInStack:
- return "in stack";
- case Kind::kInRegister:
- return "in register";
- case Kind::kInRegisterHigh:
- return "in register high";
- case Kind::kInFpuRegister:
- return "in fpu register";
- case Kind::kInFpuRegisterHigh:
- return "in fpu register high";
- case Kind::kConstant:
- return "as constant";
- case Kind::kInStackLargeOffset:
- return "in stack (large offset)";
- case Kind::kConstantLargeValue:
- return "as constant (large value)";
- }
- UNREACHABLE();
- }
-
static bool IsShortLocationKind(Kind kind) {
switch (kind) {
case Kind::kInStack:
return false;
case Kind::kNone:
- LOG(FATAL) << "Unexpected location kind " << PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected location kind";
}
UNREACHABLE();
}
friend class DexRegisterLocationHashFn;
};
+std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation::Kind& kind);
+
/**
* Store information on unique Dex register locations used in a method.
* The information is of the form:
case DexRegisterLocation::Kind::kConstantLargeValue:
case DexRegisterLocation::Kind::kInStackLargeOffset:
case DexRegisterLocation::Kind::kNone:
- LOG(FATAL) << "Unexpected location kind " << DexRegisterLocation::PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected location kind " << kind;
}
UNREACHABLE();
}
case DexRegisterLocation::Kind::kConstantLargeValue:
case DexRegisterLocation::Kind::kInStackLargeOffset:
case DexRegisterLocation::Kind::kNone:
- LOG(FATAL) << "Unexpected location kind " << DexRegisterLocation::PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected location kind " << kind;
}
UNREACHABLE();
}
const StackMapEncoding& enc) const {
DexRegisterLocation location =
GetDexRegisterLocation(dex_register_number, number_of_dex_registers, code_info, enc);
- DCHECK(location.GetKind() == DexRegisterLocation::Kind::kConstant)
- << DexRegisterLocation::PrettyDescriptor(location.GetKind());
+ DCHECK_EQ(location.GetKind(), DexRegisterLocation::Kind::kConstant);
return location.GetValue();
}
location.GetInternalKind() == DexRegisterLocation::Kind::kInRegisterHigh ||
location.GetInternalKind() == DexRegisterLocation::Kind::kInFpuRegister ||
location.GetInternalKind() == DexRegisterLocation::Kind::kInFpuRegisterHigh)
- << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind());
+ << location.GetInternalKind();
return location.GetValue();
}