summaryrefslogtreecommitdiffstats
path: root/runtime/arch/arch_test.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-04-30 18:28:55 -0700
committerAndreas Gampe <agampe@google.com>2014-04-30 18:28:55 -0700
commitb132ec5bba1a14d77fa11574df8dc593ae12a643 (patch)
treedec34c98da677d6e628604f0bc3502645839a6f1 /runtime/arch/arch_test.cc
parentbe4706907e226959623c0fb4937cf3979f440a97 (diff)
downloadart-b132ec5bba1a14d77fa11574df8dc593ae12a643.zip
art-b132ec5bba1a14d77fa11574df8dc593ae12a643.tar.gz
art-b132ec5bba1a14d77fa11574df8dc593ae12a643.tar.bz2
Add heap reference size to the checks in arch_test
As we will potentially make heap references larger than 32b on 64b systems at some point, add a constant to the .h files that describes what the current assembly implementation assumes about the size of heap references, and check whether that agrees with sizeof. Change-Id: I75ffd7e2b59891ec36977fd831a8d5faac69c76d
Diffstat (limited to 'runtime/arch/arch_test.cc')
-rw-r--r--runtime/arch/arch_test.cc119
1 files changed, 28 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
}