diff options
Diffstat (limited to 'runtime/instruction_set.h')
-rw-r--r-- | runtime/instruction_set.h | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/runtime/instruction_set.h b/runtime/instruction_set.h index 67e7100873..96eeb8dd37 100644 --- a/runtime/instruction_set.h +++ b/runtime/instruction_set.h @@ -22,6 +22,7 @@ #include "base/logging.h" // Logging is required for FATAL in the helper functions. #include "base/macros.h" +#include "globals.h" // For KB. namespace art { @@ -36,6 +37,20 @@ enum InstructionSet { }; std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs); +#if defined(__arm__) +static constexpr InstructionSet kRuntimeISA = kArm; +#elif defined(__aarch64__) +static constexpr InstructionSet kRuntimeISA = kArm64; +#elif defined(__mips__) +static constexpr InstructionSet kRuntimeISA = kMips; +#elif defined(__i386__) +static constexpr InstructionSet kRuntimeISA = kX86; +#elif defined(__x86_64__) +static constexpr InstructionSet kRuntimeISA = kX86_64; +#else +static constexpr InstructionSet kRuntimeISA = kNone; +#endif + // Architecture-specific pointer sizes static constexpr size_t kArmPointerSize = 4; static constexpr size_t kArm64PointerSize = 8; @@ -153,19 +168,33 @@ static inline size_t GetBytesPerFprSpillLocation(InstructionSet isa) { } } -#if defined(__arm__) -static constexpr InstructionSet kRuntimeISA = kArm; -#elif defined(__aarch64__) -static constexpr InstructionSet kRuntimeISA = kArm64; -#elif defined(__mips__) -static constexpr InstructionSet kRuntimeISA = kMips; -#elif defined(__i386__) -static constexpr InstructionSet kRuntimeISA = kX86; -#elif defined(__x86_64__) -static constexpr InstructionSet kRuntimeISA = kX86_64; -#else -static constexpr InstructionSet kRuntimeISA = kNone; -#endif +static constexpr size_t kDefaultStackOverflowReservedBytes = 16 * KB; +static constexpr size_t kArmStackOverflowReservedBytes = kDefaultStackOverflowReservedBytes; +static constexpr size_t kMipsStackOverflowReservedBytes = kDefaultStackOverflowReservedBytes; + +// TODO: shrink reserved space, in particular for 64bit. + +// Worst-case, we would need about 2.6x the amount of x86_64 for many more registers. +// But this one works rather well. +static constexpr size_t kArm64StackOverflowReservedBytes = 32 * KB; +// TODO: Bumped to workaround regression (http://b/14982147) Specifically to fix: +// test-art-host-run-test-interpreter-018-stack-overflow +// test-art-host-run-test-interpreter-107-int-math2 +static constexpr size_t kX86StackOverflowReservedBytes = 24 * KB; +static constexpr size_t kX86_64StackOverflowReservedBytes = 32 * KB; + +static constexpr size_t GetStackOverflowReservedBytes(InstructionSet isa) { + return (isa == kArm || isa == kThumb2) ? kArmStackOverflowReservedBytes : + isa == kArm64 ? kArm64StackOverflowReservedBytes : + isa == kMips ? kMipsStackOverflowReservedBytes : + isa == kX86 ? kX86StackOverflowReservedBytes : + isa == kX86_64 ? kX86_64StackOverflowReservedBytes : + isa == kNone ? (LOG(FATAL) << "kNone has no stack overflow size", 0) : + (LOG(FATAL) << "Unknown instruction set" << isa, 0); +} + +static constexpr size_t kRuntimeStackOverflowReservedBytes = + GetStackOverflowReservedBytes(kRuntimeISA); enum InstructionFeatures { kHwDiv = 0x1, // Supports hardware divide. |