diff options
author | 2016-07-26 09:02:02 -0700 | |
---|---|---|
committer | 2016-08-01 18:54:48 -0700 | |
commit | 542451cc546779f5c67840e105c51205a1b0a8fd (patch) | |
tree | 11e09bb5abaee12dddffefbe7e425291076dfa7a /runtime/arch/instruction_set.h | |
parent | 85c4a4b8c9eabfe16e4e49f9b4aa78c1bf4be023 (diff) |
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
Diffstat (limited to 'runtime/arch/instruction_set.h')
-rw-r--r-- | runtime/arch/instruction_set.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/runtime/arch/instruction_set.h b/runtime/arch/instruction_set.h index ff9c0b320d..917acc9eec 100644 --- a/runtime/arch/instruction_set.h +++ b/runtime/arch/instruction_set.h @@ -20,6 +20,7 @@ #include <iosfwd> #include <string> +#include "base/enums.h" #include "base/logging.h" // Logging is required for FATAL in the helper functions. namespace art { @@ -53,12 +54,12 @@ static constexpr InstructionSet kRuntimeISA = kNone; #endif // Architecture-specific pointer sizes -static constexpr size_t kArmPointerSize = 4; -static constexpr size_t kArm64PointerSize = 8; -static constexpr size_t kMipsPointerSize = 4; -static constexpr size_t kMips64PointerSize = 8; -static constexpr size_t kX86PointerSize = 4; -static constexpr size_t kX86_64PointerSize = 8; +static constexpr PointerSize kArmPointerSize = PointerSize::k32; +static constexpr PointerSize kArm64PointerSize = PointerSize::k64; +static constexpr PointerSize kMipsPointerSize = PointerSize::k32; +static constexpr PointerSize kMips64PointerSize = PointerSize::k64; +static constexpr PointerSize kX86PointerSize = PointerSize::k32; +static constexpr PointerSize kX86_64PointerSize = PointerSize::k64; // ARM instruction alignment. ARM processors require code to be 4-byte aligned, // but ARM ELF requires 8.. @@ -82,7 +83,7 @@ InstructionSet GetInstructionSetFromString(const char* instruction_set); InstructionSet GetInstructionSetFromELF(uint16_t e_machine, uint32_t e_flags); -static inline size_t GetInstructionSetPointerSize(InstructionSet isa) { +static inline PointerSize GetInstructionSetPointerSize(InstructionSet isa) { switch (isa) { case kArm: // Fall-through. @@ -147,8 +148,8 @@ static inline bool Is64BitInstructionSet(InstructionSet isa) { } } -static inline size_t InstructionSetPointerSize(InstructionSet isa) { - return Is64BitInstructionSet(isa) ? 8U : 4U; +static inline PointerSize InstructionSetPointerSize(InstructionSet isa) { + return Is64BitInstructionSet(isa) ? PointerSize::k64 : PointerSize::k32; } static inline size_t GetBytesPerGprSpillLocation(InstructionSet isa) { |