ART: Convert pointer size to enum
Move away from size_t to dedicated enum (class).
Bug: 30373134
Bug: 30419309
Test: m test-art-host
Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
diff --git a/runtime/utils/dex_cache_arrays_layout.h b/runtime/utils/dex_cache_arrays_layout.h
index cd84460..f2437fa 100644
--- a/runtime/utils/dex_cache_arrays_layout.h
+++ b/runtime/utils/dex_cache_arrays_layout.h
@@ -31,7 +31,7 @@
// Construct an invalid layout.
DexCacheArraysLayout()
: /* types_offset_ is always 0u */
- pointer_size_(0u),
+ pointer_size_(kRuntimePointerSize),
methods_offset_(0u),
strings_offset_(0u),
fields_offset_(0u),
@@ -39,10 +39,10 @@
}
// Construct a layout for a particular dex file header.
- DexCacheArraysLayout(size_t pointer_size, const DexFile::Header& header);
+ DexCacheArraysLayout(PointerSize pointer_size, const DexFile::Header& header);
// Construct a layout for a particular dex file.
- DexCacheArraysLayout(size_t pointer_size, const DexFile* dex_file);
+ DexCacheArraysLayout(PointerSize pointer_size, const DexFile* dex_file);
bool Valid() const {
return Size() != 0u;
@@ -96,17 +96,17 @@
private:
static constexpr size_t types_offset_ = 0u;
- const size_t pointer_size_; // Must be first for construction initialization order.
+ const PointerSize pointer_size_; // Must be first for construction initialization order.
const size_t methods_offset_;
const size_t strings_offset_;
const size_t fields_offset_;
const size_t size_;
- static size_t Alignment(size_t pointer_size);
+ static size_t Alignment(PointerSize pointer_size);
- static size_t ElementOffset(size_t element_size, uint32_t idx);
+ static size_t ElementOffset(PointerSize element_size, uint32_t idx);
- static size_t ArraySize(size_t element_size, uint32_t num_elements);
+ static size_t ArraySize(PointerSize element_size, uint32_t num_elements);
};
} // namespace art