diff options
-rw-r--r-- | runtime/arch/arch_test.cc | 119 | ||||
-rw-r--r-- | runtime/arch/arm/asm_support_arm.h | 3 | ||||
-rw-r--r-- | runtime/arch/arm64/asm_support_arm64.h | 3 | ||||
-rw-r--r-- | runtime/arch/mips/asm_support_mips.h | 3 | ||||
-rw-r--r-- | runtime/arch/x86/asm_support_x86.h | 3 | ||||
-rw-r--r-- | runtime/arch/x86_64/asm_support_x86_64.h | 3 |
6 files changed, 43 insertions, 91 deletions
diff --git a/runtime/arch/arch_test.cc b/runtime/arch/arch_test.cc index 47c6d28..c285088 100644 --- a/runtime/arch/arch_test.cc +++ b/runtime/arch/arch_test.cc @@ -92,6 +92,9 @@ TEST_F(ArchTest, ARM) { #ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #endif +#ifdef HEAP_REFERENCE_SIZE +#undef HEAP_REFERENCE_SIZE +#endif } @@ -147,6 +150,9 @@ TEST_F(ArchTest, ARM64) { #ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #endif +#ifdef HEAP_REFERENCE_SIZE +#undef HEAP_REFERENCE_SIZE +#endif } @@ -202,6 +208,9 @@ TEST_F(ArchTest, MIPS) { #ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #endif +#ifdef HEAP_REFERENCE_SIZE +#undef HEAP_REFERENCE_SIZE +#endif } @@ -257,6 +266,9 @@ TEST_F(ArchTest, X86) { #ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #endif +#ifdef HEAP_REFERENCE_SIZE +#undef HEAP_REFERENCE_SIZE +#endif } @@ -312,10 +324,16 @@ TEST_F(ArchTest, X86_64) { #ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE #endif +#ifdef HEAP_REFERENCE_SIZE +#undef HEAP_REFERENCE_SIZE +#endif } -TEST_F(ArchTest, ThreadOffsets) { +// The following tests are all for the running architecture. So we get away +// with just including it and not undefining it every time. + + #if defined(__arm__) #include "arch/arm/asm_support_arm.h" #undef ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_ @@ -342,6 +360,8 @@ TEST_F(ArchTest, ThreadOffsets) { #endif #endif + +TEST_F(ArchTest, ThreadOffsets) { // Ugly hack, change when possible. #ifdef __LP64__ #define POINTER_SIZE 8 @@ -376,70 +396,10 @@ TEST_F(ArchTest, ThreadOffsets) { #else LOG(INFO) << "No Thread ID Offset found."; #endif - - - // Undefine everything for the next test -#ifdef RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET -#undef RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET -#endif -#ifdef RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET -#undef RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET -#endif -#ifdef RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET -#undef RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET -#endif -#ifdef THREAD_SELF_OFFSET -#undef THREAD_SELF_OFFSET -#endif -#ifdef THREAD_CARD_TABLE_OFFSET -#undef THREAD_CARD_TABLE_OFFSET -#endif -#ifdef THREAD_EXCEPTION_OFFSET -#undef THREAD_EXCEPTION_OFFSET -#endif -#ifdef THREAD_ID_OFFSET -#undef THREAD_ID_OFFSET -#endif -#ifdef FRAME_SIZE_SAVE_ALL_CALLEE_SAVE -#undef FRAME_SIZE_SAVE_ALL_CALLEE_SAVE -#endif -#ifdef FRAME_SIZE_REFS_ONLY_CALLEE_SAVE -#undef FRAME_SIZE_REFS_ONLY_CALLEE_SAVE -#endif -#ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE -#undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE -#endif } TEST_F(ArchTest, CalleeSaveMethodOffsets) { -#if defined(__arm__) -#include "arch/arm/asm_support_arm.h" -#undef ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_ -#elif defined(__aarch64__) -#include "arch/arm64/asm_support_arm64.h" -#undef ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_H_ -#elif defined(__mips__) -#include "arch/mips/asm_support_mips.h" -#undef ART_RUNTIME_ARCH_MIPS_ASM_SUPPORT_MIPS_H_ -#elif defined(__i386__) -#include "arch/x86/asm_support_x86.h" -#undef ART_RUNTIME_ARCH_X86_ASM_SUPPORT_X86_H_ -#elif defined(__x86_64__) -#include "arch/x86_64/asm_support_x86_64.h" -#undef ART_RUNTIME_ARCH_X86_64_ASM_SUPPORT_X86_64_H_ -#else - // This happens for the host test. -#ifdef __LP64__ -#include "arch/x86_64/asm_support_x86_64.h" -#undef ART_RUNTIME_ARCH_X86_64_ASM_SUPPORT_X86_64_H_ -#else -#include "arch/x86/asm_support_x86.h" -#undef ART_RUNTIME_ARCH_X86_ASM_SUPPORT_X86_H_ -#endif -#endif - - #if defined(RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET) EXPECT_EQ(Runtime::GetCalleeSaveMethodOffset(Runtime::kSaveAll), static_cast<size_t>(RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET)); @@ -460,38 +420,15 @@ TEST_F(ArchTest, CalleeSaveMethodOffsets) { #else LOG(INFO) << "No Runtime Refs-and-Args Offset found."; #endif +} - // Undefine everything for the next test -#ifdef RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET -#undef RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET -#endif -#ifdef RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET -#undef RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET -#endif -#ifdef RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET -#undef RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET -#endif -#ifdef THREAD_SELF_OFFSET -#undef THREAD_SELF_OFFSET -#endif -#ifdef THREAD_CARD_TABLE_OFFSET -#undef THREAD_CARD_TABLE_OFFSET -#endif -#ifdef THREAD_EXCEPTION_OFFSET -#undef THREAD_EXCEPTION_OFFSET -#endif -#ifdef THREAD_ID_OFFSET -#undef THREAD_ID_OFFSET -#endif -#ifdef FRAME_SIZE_SAVE_ALL_CALLEE_SAVE -#undef FRAME_SIZE_SAVE_ALL_CALLEE_SAVE -#endif -#ifdef FRAME_SIZE_REFS_ONLY_CALLEE_SAVE -#undef FRAME_SIZE_REFS_ONLY_CALLEE_SAVE -#endif -#ifdef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE -#undef FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE +TEST_F(ArchTest, HeapReferenceSize) { +#if defined(HEAP_REFERENCE_SIZE) + EXPECT_EQ(sizeof(mirror::HeapReference<mirror::Object>), + static_cast<size_t>(HEAP_REFERENCE_SIZE)); +#else + LOG(INFO) << "No expected HeapReference Size found."; #endif } diff --git a/runtime/arch/arm/asm_support_arm.h b/runtime/arch/arm/asm_support_arm.h index a73d522..9e1db96 100644 --- a/runtime/arch/arm/asm_support_arm.h +++ b/runtime/arch/arm/asm_support_arm.h @@ -32,4 +32,7 @@ #define FRAME_SIZE_REFS_ONLY_CALLEE_SAVE 32 #define FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE 48 +// Expected size of a heap reference +#define HEAP_REFERENCE_SIZE 4 + #endif // ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_ diff --git a/runtime/arch/arm64/asm_support_arm64.h b/runtime/arch/arm64/asm_support_arm64.h index b18e415..e55885f 100644 --- a/runtime/arch/arm64/asm_support_arm64.h +++ b/runtime/arch/arm64/asm_support_arm64.h @@ -41,4 +41,7 @@ #define FRAME_SIZE_REFS_ONLY_CALLEE_SAVE 176 #define FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE 304 +// Expected size of a heap reference +#define HEAP_REFERENCE_SIZE 4 + #endif // ART_RUNTIME_ARCH_ARM64_ASM_SUPPORT_ARM64_H_ diff --git a/runtime/arch/mips/asm_support_mips.h b/runtime/arch/mips/asm_support_mips.h index 2b4a745..4db5ea6 100644 --- a/runtime/arch/mips/asm_support_mips.h +++ b/runtime/arch/mips/asm_support_mips.h @@ -30,4 +30,7 @@ #define FRAME_SIZE_REFS_ONLY_CALLEE_SAVE 64 #define FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE 64 +// Expected size of a heap reference +#define HEAP_REFERENCE_SIZE 4 + #endif // ART_RUNTIME_ARCH_MIPS_ASM_SUPPORT_MIPS_H_ diff --git a/runtime/arch/x86/asm_support_x86.h b/runtime/arch/x86/asm_support_x86.h index fd5ed5a..531ed77 100644 --- a/runtime/arch/x86/asm_support_x86.h +++ b/runtime/arch/x86/asm_support_x86.h @@ -32,4 +32,7 @@ #define FRAME_SIZE_REFS_ONLY_CALLEE_SAVE 32 #define FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE 32 +// Expected size of a heap reference +#define HEAP_REFERENCE_SIZE 4 + #endif // ART_RUNTIME_ARCH_X86_ASM_SUPPORT_X86_H_ diff --git a/runtime/arch/x86_64/asm_support_x86_64.h b/runtime/arch/x86_64/asm_support_x86_64.h index 109533b..29633fb 100644 --- a/runtime/arch/x86_64/asm_support_x86_64.h +++ b/runtime/arch/x86_64/asm_support_x86_64.h @@ -39,4 +39,7 @@ #define FRAME_SIZE_REFS_ONLY_CALLEE_SAVE 64 #define FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE 176 +// Expected size of a heap reference +#define HEAP_REFERENCE_SIZE 4 + #endif // ART_RUNTIME_ARCH_X86_64_ASM_SUPPORT_X86_64_H_ |