Merge "Ensure that BitTableAccessor refers to non-null table."
diff --git a/libartbase/base/bit_table.h b/libartbase/base/bit_table.h
index c1619b5..418d7c4 100644
--- a/libartbase/base/bit_table.h
+++ b/libartbase/base/bit_table.h
@@ -134,14 +134,14 @@
static constexpr uint32_t kNumColumns = NumColumns;
static constexpr uint32_t kNoValue = BitTableBase<kNumColumns>::kNoValue;
- BitTableAccessor() {}
BitTableAccessor(const BitTableBase<kNumColumns>* table, uint32_t row)
: table_(table), row_(row) {
+ DCHECK(table_ != nullptr);
}
ALWAYS_INLINE uint32_t Row() const { return row_; }
- ALWAYS_INLINE bool IsValid() const { return table_ != nullptr && row_ < table_->NumRows(); }
+ ALWAYS_INLINE bool IsValid() const { return row_ < table_->NumRows(); }
ALWAYS_INLINE bool Equals(const BitTableAccessor& other) {
return this->table_ == other.table_ && this->row_ == other.row_;
@@ -223,6 +223,10 @@
ALWAYS_INLINE Accessor GetRow(uint32_t row) const {
return Accessor(this, row);
}
+
+ ALWAYS_INLINE Accessor GetInvalidRow() const {
+ return Accessor(this, static_cast<uint32_t>(-1));
+ }
};
template<typename Accessor>
diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc
index f9e2d27..7f7f6fc 100644
--- a/runtime/stack_map.cc
+++ b/runtime/stack_map.cc
@@ -61,7 +61,7 @@
return *it;
}
}
- return StackMap();
+ return stack_maps_.GetInvalidRow();
}
// Scan backward to determine dex register locations at given stack map.
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index e94f71a..83f0c05 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -388,7 +388,7 @@
return stack_map;
}
}
- return StackMap();
+ return stack_maps_.GetInvalidRow();
}
// Searches the stack map list backwards because catch stack maps are stored at the end.
@@ -399,7 +399,7 @@
return stack_map;
}
}
- return StackMap();
+ return stack_maps_.GetInvalidRow();
}
StackMap GetOsrStackMapForDexPc(uint32_t dex_pc) const {
@@ -409,7 +409,7 @@
return stack_map;
}
}
- return StackMap();
+ return stack_maps_.GetInvalidRow();
}
StackMap GetStackMapForNativePcOffset(uint32_t pc, InstructionSet isa = kRuntimeISA) const;
@@ -421,7 +421,7 @@
return item;
}
}
- return InvokeInfo();
+ return invoke_infos_.GetInvalidRow();
}
// Dump this CodeInfo object on `vios`.