ART: Introduce compiler data type.
Replace most uses of the runtime's Primitive in compiler
with a new class DataType. This prepares for introducing
new types, such as Uint8, that the runtime does not need
to know about.
Test: m test-art-host-gtest
Test: testrunner.py --host
Bug: 23964345
Change-Id: Iec2ad82454eec678fffcd8279a9746b90feb9b0c
diff --git a/compiler/optimizing/register_allocation_resolver.cc b/compiler/optimizing/register_allocation_resolver.cc
index ce3a496..f0057c3 100644
--- a/compiler/optimizing/register_allocation_resolver.cc
+++ b/compiler/optimizing/register_allocation_resolver.cc
@@ -100,24 +100,24 @@
// [art method ].
size_t slot = current->GetSpillSlot();
switch (current->GetType()) {
- case Primitive::kPrimDouble:
+ case DataType::Type::kFloat64:
slot += long_spill_slots;
FALLTHROUGH_INTENDED;
- case Primitive::kPrimLong:
+ case DataType::Type::kInt64:
slot += float_spill_slots;
FALLTHROUGH_INTENDED;
- case Primitive::kPrimFloat:
+ case DataType::Type::kFloat32:
slot += int_spill_slots;
FALLTHROUGH_INTENDED;
- case Primitive::kPrimNot:
- case Primitive::kPrimInt:
- case Primitive::kPrimChar:
- case Primitive::kPrimByte:
- case Primitive::kPrimBoolean:
- case Primitive::kPrimShort:
+ case DataType::Type::kReference:
+ case DataType::Type::kInt32:
+ case DataType::Type::kUint16:
+ case DataType::Type::kInt8:
+ case DataType::Type::kBool:
+ case DataType::Type::kInt16:
slot += reserved_out_slots;
break;
- case Primitive::kPrimVoid:
+ case DataType::Type::kVoid:
LOG(FATAL) << "Unexpected type for interval " << current->GetType();
}
current->SetSpillSlot(slot * kVRegSize);
@@ -205,12 +205,12 @@
size_t temp_index = liveness_.GetTempIndex(temp);
LocationSummary* locations = at->GetLocations();
switch (temp->GetType()) {
- case Primitive::kPrimInt:
+ case DataType::Type::kInt32:
locations->SetTempAt(temp_index, Location::RegisterLocation(temp->GetRegister()));
break;
- case Primitive::kPrimDouble:
- if (codegen_->NeedsTwoRegisters(Primitive::kPrimDouble)) {
+ case DataType::Type::kFloat64:
+ if (codegen_->NeedsTwoRegisters(DataType::Type::kFloat64)) {
Location location = Location::FpuRegisterPairLocation(
temp->GetRegister(), temp->GetHighInterval()->GetRegister());
locations->SetTempAt(temp_index, location);
@@ -383,7 +383,7 @@
safepoint_position = safepoint_position->GetNext()) {
DCHECK(current->CoversSlow(safepoint_position->GetPosition()));
- if (current->GetType() == Primitive::kPrimNot) {
+ if (current->GetType() == DataType::Type::kReference) {
DCHECK(interval->GetDefinedBy()->IsActualObject())
<< interval->GetDefinedBy()->DebugName()
<< '(' << interval->GetDefinedBy()->GetId() << ')'
@@ -507,13 +507,13 @@
Location source,
Location destination,
HInstruction* instruction,
- Primitive::Type type) const {
- if (type == Primitive::kPrimLong
+ DataType::Type type) const {
+ if (type == DataType::Type::kInt64
&& codegen_->ShouldSplitLongMoves()
// The parallel move resolver knows how to deal with long constants.
&& !source.IsConstant()) {
- move->AddMove(source.ToLow(), destination.ToLow(), Primitive::kPrimInt, instruction);
- move->AddMove(source.ToHigh(), destination.ToHigh(), Primitive::kPrimInt, nullptr);
+ move->AddMove(source.ToLow(), destination.ToLow(), DataType::Type::kInt32, instruction);
+ move->AddMove(source.ToHigh(), destination.ToHigh(), DataType::Type::kInt32, nullptr);
} else {
move->AddMove(source, destination, type, instruction);
}