Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Ian Rogers | 9651f42 | 2011-09-19 20:26:07 -0700 | [diff] [blame] | 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_ASM_SUPPORT_H_ |
| 18 | #define ART_RUNTIME_ASM_SUPPORT_H_ |
Ian Rogers | 9651f42 | 2011-09-19 20:26:07 -0700 | [diff] [blame] | 19 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 20 | #if defined(__cplusplus) |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 21 | #include "art_method.h" |
Christina Wadsworth | 97a8a9a | 2016-08-19 11:23:48 -0700 | [diff] [blame] | 22 | #include "base/bit_utils.h" |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 23 | #include "gc/allocator/rosalloc.h" |
Mathieu Chartier | 8261d02 | 2016-08-08 09:41:04 -0700 | [diff] [blame] | 24 | #include "gc/heap.h" |
Nicolas Geoffray | 274fe4a | 2016-04-12 16:33:24 +0100 | [diff] [blame] | 25 | #include "jit/jit.h" |
Hiroshi Yamauchi | e15ea08 | 2015-02-09 17:11:42 -0800 | [diff] [blame] | 26 | #include "lock_word.h" |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 27 | #include "mirror/class.h" |
Christina Wadsworth | 97a8a9a | 2016-08-19 11:23:48 -0700 | [diff] [blame] | 28 | #include "mirror/dex_cache.h" |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 29 | #include "mirror/string.h" |
Christina Wadsworth | 97a8a9a | 2016-08-19 11:23:48 -0700 | [diff] [blame] | 30 | #include "utils/dex_cache_arrays_layout.h" |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 31 | #include "runtime.h" |
| 32 | #include "thread.h" |
| 33 | #endif |
| 34 | |
Hiroshi Yamauchi | 800ac2d | 2014-04-02 17:32:54 -0700 | [diff] [blame] | 35 | #include "read_barrier_c.h" |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 36 | |
Zheng Xu | 69a5030 | 2015-04-14 20:04:41 +0800 | [diff] [blame] | 37 | #if defined(__arm__) || defined(__mips__) |
| 38 | // In quick code for ARM and MIPS we make poor use of registers and perform frequent suspend |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 39 | // checks in the event of loop back edges. The SUSPEND_CHECK_INTERVAL constant is loaded into a |
| 40 | // register at the point of an up-call or after handling a suspend check. It reduces the number of |
| 41 | // loads of the TLS suspend check value by the given amount (turning it into a decrement and compare |
| 42 | // of a register). This increases the time for a thread to respond to requests from GC and the |
| 43 | // debugger, damaging GC performance and creating other unwanted artifacts. For example, this count |
| 44 | // has the effect of making loops and Java code look cold in profilers, where the count is reset |
| 45 | // impacts where samples will occur. Reducing the count as much as possible improves profiler |
| 46 | // accuracy in tools like traceview. |
| 47 | // TODO: get a compiler that can do a proper job of loop optimization and remove this. |
buzbee | 72be1cd | 2014-11-11 22:48:59 -0800 | [diff] [blame] | 48 | #define SUSPEND_CHECK_INTERVAL 96 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 49 | #endif |
| 50 | |
| 51 | #if defined(__cplusplus) |
| 52 | |
| 53 | #ifndef ADD_TEST_EQ // Allow #include-r to replace with their own. |
| 54 | #define ADD_TEST_EQ(x, y) CHECK_EQ(x, y); |
| 55 | #endif |
| 56 | |
| 57 | static inline void CheckAsmSupportOffsetsAndSizes() { |
| 58 | #else |
| 59 | #define ADD_TEST_EQ(x, y) |
| 60 | #endif |
| 61 | |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 62 | #if defined(__LP64__) |
| 63 | #define POINTER_SIZE_SHIFT 3 |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 64 | #define POINTER_SIZE art::PointerSize::k64 |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 65 | #else |
| 66 | #define POINTER_SIZE_SHIFT 2 |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 67 | #define POINTER_SIZE art::PointerSize::k32 |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 68 | #endif |
| 69 | ADD_TEST_EQ(static_cast<size_t>(1U << POINTER_SIZE_SHIFT), |
| 70 | static_cast<size_t>(__SIZEOF_POINTER__)) |
| 71 | |
Igor Murashkin | 311fdf5 | 2016-07-22 15:59:16 -0700 | [diff] [blame] | 72 | // Import platform-independent constant defines from our autogenerated list. |
| 73 | // Export new defines (for assembly use) by editing cpp-define-generator def files. |
| 74 | #define DEFINE_CHECK_EQ ADD_TEST_EQ |
| 75 | #include "generated/asm_support_gen.h" |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 76 | |
| 77 | // Offset of field Thread::tlsPtr_.exception. |
| 78 | #define THREAD_EXCEPTION_OFFSET (THREAD_CARD_TABLE_OFFSET + __SIZEOF_POINTER__) |
| 79 | ADD_TEST_EQ(THREAD_EXCEPTION_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 80 | art::Thread::ExceptionOffset<POINTER_SIZE>().Int32Value()) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 81 | |
| 82 | // Offset of field Thread::tlsPtr_.managed_stack.top_quick_frame_. |
| 83 | #define THREAD_TOP_QUICK_FRAME_OFFSET (THREAD_CARD_TABLE_OFFSET + (3 * __SIZEOF_POINTER__)) |
| 84 | ADD_TEST_EQ(THREAD_TOP_QUICK_FRAME_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 85 | art::Thread::TopOfManagedStackOffset<POINTER_SIZE>().Int32Value()) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 86 | |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 87 | // Offset of field Thread::tlsPtr_.self. |
Andreas Gampe | 449357d | 2015-06-01 22:29:51 -0700 | [diff] [blame] | 88 | #define THREAD_SELF_OFFSET (THREAD_CARD_TABLE_OFFSET + (9 * __SIZEOF_POINTER__)) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 89 | ADD_TEST_EQ(THREAD_SELF_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 90 | art::Thread::SelfOffset<POINTER_SIZE>().Int32Value()) |
Ian Rogers | 4a510d8 | 2011-10-09 14:30:24 -0700 | [diff] [blame] | 91 | |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame] | 92 | // Offset of field Thread::tlsPtr_.thread_local_objects. |
Igor Murashkin | 9d4b6da | 2016-07-29 09:51:58 -0700 | [diff] [blame] | 93 | #define THREAD_LOCAL_OBJECTS_OFFSET (THREAD_CARD_TABLE_OFFSET + 199 * __SIZEOF_POINTER__) |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame] | 94 | ADD_TEST_EQ(THREAD_LOCAL_OBJECTS_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 95 | art::Thread::ThreadLocalObjectsOffset<POINTER_SIZE>().Int32Value()) |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 96 | // Offset of field Thread::tlsPtr_.thread_local_pos. |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame] | 97 | #define THREAD_LOCAL_POS_OFFSET (THREAD_LOCAL_OBJECTS_OFFSET + __SIZEOF_SIZE_T__) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 98 | ADD_TEST_EQ(THREAD_LOCAL_POS_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 99 | art::Thread::ThreadLocalPosOffset<POINTER_SIZE>().Int32Value()) |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 100 | // Offset of field Thread::tlsPtr_.thread_local_end. |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 101 | #define THREAD_LOCAL_END_OFFSET (THREAD_LOCAL_POS_OFFSET + __SIZEOF_POINTER__) |
| 102 | ADD_TEST_EQ(THREAD_LOCAL_END_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 103 | art::Thread::ThreadLocalEndOffset<POINTER_SIZE>().Int32Value()) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 104 | // Offset of field Thread::tlsPtr_.mterp_current_ibase. |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame] | 105 | #define THREAD_CURRENT_IBASE_OFFSET (THREAD_LOCAL_END_OFFSET + __SIZEOF_POINTER__) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 106 | ADD_TEST_EQ(THREAD_CURRENT_IBASE_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 107 | art::Thread::MterpCurrentIBaseOffset<POINTER_SIZE>().Int32Value()) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 108 | // Offset of field Thread::tlsPtr_.mterp_default_ibase. |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 109 | #define THREAD_DEFAULT_IBASE_OFFSET (THREAD_CURRENT_IBASE_OFFSET + __SIZEOF_POINTER__) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 110 | ADD_TEST_EQ(THREAD_DEFAULT_IBASE_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 111 | art::Thread::MterpDefaultIBaseOffset<POINTER_SIZE>().Int32Value()) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 112 | // Offset of field Thread::tlsPtr_.mterp_alt_ibase. |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 113 | #define THREAD_ALT_IBASE_OFFSET (THREAD_DEFAULT_IBASE_OFFSET + __SIZEOF_POINTER__) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 114 | ADD_TEST_EQ(THREAD_ALT_IBASE_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 115 | art::Thread::MterpAltIBaseOffset<POINTER_SIZE>().Int32Value()) |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 116 | // Offset of field Thread::tlsPtr_.rosalloc_runs. |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 117 | #define THREAD_ROSALLOC_RUNS_OFFSET (THREAD_ALT_IBASE_OFFSET + __SIZEOF_POINTER__) |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 118 | ADD_TEST_EQ(THREAD_ROSALLOC_RUNS_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 119 | art::Thread::RosAllocRunsOffset<POINTER_SIZE>().Int32Value()) |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 120 | // Offset of field Thread::tlsPtr_.thread_local_alloc_stack_top. |
Hiroshi Yamauchi | 7ed9c56 | 2016-02-02 15:22:09 -0800 | [diff] [blame] | 121 | #define THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET (THREAD_ROSALLOC_RUNS_OFFSET + 16 * __SIZEOF_POINTER__) |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 122 | ADD_TEST_EQ(THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 123 | art::Thread::ThreadLocalAllocStackTopOffset<POINTER_SIZE>().Int32Value()) |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 124 | // Offset of field Thread::tlsPtr_.thread_local_alloc_stack_end. |
Hiroshi Yamauchi | 7ed9c56 | 2016-02-02 15:22:09 -0800 | [diff] [blame] | 125 | #define THREAD_LOCAL_ALLOC_STACK_END_OFFSET (THREAD_ROSALLOC_RUNS_OFFSET + 17 * __SIZEOF_POINTER__) |
Hiroshi Yamauchi | dc412b6 | 2015-10-15 12:26:57 -0700 | [diff] [blame] | 126 | ADD_TEST_EQ(THREAD_LOCAL_ALLOC_STACK_END_OFFSET, |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 127 | art::Thread::ThreadLocalAllocStackEndOffset<POINTER_SIZE>().Int32Value()) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 128 | |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 129 | // Offsets within ShadowFrame. |
| 130 | #define SHADOWFRAME_LINK_OFFSET 0 |
| 131 | ADD_TEST_EQ(SHADOWFRAME_LINK_OFFSET, |
| 132 | static_cast<int32_t>(art::ShadowFrame::LinkOffset())) |
| 133 | #define SHADOWFRAME_METHOD_OFFSET (SHADOWFRAME_LINK_OFFSET + 1 * __SIZEOF_POINTER__) |
| 134 | ADD_TEST_EQ(SHADOWFRAME_METHOD_OFFSET, |
| 135 | static_cast<int32_t>(art::ShadowFrame::MethodOffset())) |
| 136 | #define SHADOWFRAME_RESULT_REGISTER_OFFSET (SHADOWFRAME_LINK_OFFSET + 2 * __SIZEOF_POINTER__) |
| 137 | ADD_TEST_EQ(SHADOWFRAME_RESULT_REGISTER_OFFSET, |
| 138 | static_cast<int32_t>(art::ShadowFrame::ResultRegisterOffset())) |
| 139 | #define SHADOWFRAME_DEX_PC_PTR_OFFSET (SHADOWFRAME_LINK_OFFSET + 3 * __SIZEOF_POINTER__) |
| 140 | ADD_TEST_EQ(SHADOWFRAME_DEX_PC_PTR_OFFSET, |
| 141 | static_cast<int32_t>(art::ShadowFrame::DexPCPtrOffset())) |
| 142 | #define SHADOWFRAME_CODE_ITEM_OFFSET (SHADOWFRAME_LINK_OFFSET + 4 * __SIZEOF_POINTER__) |
| 143 | ADD_TEST_EQ(SHADOWFRAME_CODE_ITEM_OFFSET, |
| 144 | static_cast<int32_t>(art::ShadowFrame::CodeItemOffset())) |
| 145 | #define SHADOWFRAME_LOCK_COUNT_DATA_OFFSET (SHADOWFRAME_LINK_OFFSET + 5 * __SIZEOF_POINTER__) |
| 146 | ADD_TEST_EQ(SHADOWFRAME_LOCK_COUNT_DATA_OFFSET, |
| 147 | static_cast<int32_t>(art::ShadowFrame::LockCountDataOffset())) |
| 148 | #define SHADOWFRAME_NUMBER_OF_VREGS_OFFSET (SHADOWFRAME_LINK_OFFSET + 6 * __SIZEOF_POINTER__) |
| 149 | ADD_TEST_EQ(SHADOWFRAME_NUMBER_OF_VREGS_OFFSET, |
| 150 | static_cast<int32_t>(art::ShadowFrame::NumberOfVRegsOffset())) |
| 151 | #define SHADOWFRAME_DEX_PC_OFFSET (SHADOWFRAME_NUMBER_OF_VREGS_OFFSET + 4) |
| 152 | ADD_TEST_EQ(SHADOWFRAME_DEX_PC_OFFSET, |
| 153 | static_cast<int32_t>(art::ShadowFrame::DexPCOffset())) |
Bill Buzbee | 1d011d9 | 2016-04-04 16:59:29 +0000 | [diff] [blame] | 154 | #define SHADOWFRAME_CACHED_HOTNESS_COUNTDOWN_OFFSET (SHADOWFRAME_NUMBER_OF_VREGS_OFFSET + 8) |
| 155 | ADD_TEST_EQ(SHADOWFRAME_CACHED_HOTNESS_COUNTDOWN_OFFSET, |
| 156 | static_cast<int32_t>(art::ShadowFrame::CachedHotnessCountdownOffset())) |
| 157 | #define SHADOWFRAME_HOTNESS_COUNTDOWN_OFFSET (SHADOWFRAME_NUMBER_OF_VREGS_OFFSET + 10) |
| 158 | ADD_TEST_EQ(SHADOWFRAME_HOTNESS_COUNTDOWN_OFFSET, |
| 159 | static_cast<int32_t>(art::ShadowFrame::HotnessCountdownOffset())) |
| 160 | #define SHADOWFRAME_VREGS_OFFSET (SHADOWFRAME_NUMBER_OF_VREGS_OFFSET + 12) |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 161 | ADD_TEST_EQ(SHADOWFRAME_VREGS_OFFSET, |
| 162 | static_cast<int32_t>(art::ShadowFrame::VRegsOffset())) |
| 163 | |
Hiroshi Yamauchi | 60f63f5 | 2015-04-23 16:12:40 -0700 | [diff] [blame] | 164 | #if defined(USE_BROOKS_READ_BARRIER) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 165 | #define MIRROR_OBJECT_HEADER_SIZE 16 |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 166 | #else |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 167 | #define MIRROR_OBJECT_HEADER_SIZE 8 |
| 168 | #endif |
| 169 | ADD_TEST_EQ(size_t(MIRROR_OBJECT_HEADER_SIZE), sizeof(art::mirror::Object)) |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 170 | |
| 171 | // Offsets within java.lang.Class. |
Neil Fuller | 3d0aa88 | 2016-08-16 19:53:07 +0100 | [diff] [blame] | 172 | #define MIRROR_CLASS_COMPONENT_TYPE_OFFSET (4 + MIRROR_OBJECT_HEADER_SIZE) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 173 | ADD_TEST_EQ(MIRROR_CLASS_COMPONENT_TYPE_OFFSET, |
| 174 | art::mirror::Class::ComponentTypeOffset().Int32Value()) |
Neil Fuller | 3d0aa88 | 2016-08-16 19:53:07 +0100 | [diff] [blame] | 175 | #define MIRROR_CLASS_ACCESS_FLAGS_OFFSET (64 + MIRROR_OBJECT_HEADER_SIZE) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 176 | ADD_TEST_EQ(MIRROR_CLASS_ACCESS_FLAGS_OFFSET, |
| 177 | art::mirror::Class::AccessFlagsOffset().Int32Value()) |
Neil Fuller | 3d0aa88 | 2016-08-16 19:53:07 +0100 | [diff] [blame] | 178 | #define MIRROR_CLASS_OBJECT_SIZE_OFFSET (96 + MIRROR_OBJECT_HEADER_SIZE) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 179 | ADD_TEST_EQ(MIRROR_CLASS_OBJECT_SIZE_OFFSET, |
| 180 | art::mirror::Class::ObjectSizeOffset().Int32Value()) |
Mathieu Chartier | 93bbee0 | 2016-08-31 09:38:40 -0700 | [diff] [blame] | 181 | #define MIRROR_CLASS_OBJECT_SIZE_ALLOC_FAST_PATH_OFFSET (100 + MIRROR_OBJECT_HEADER_SIZE) |
| 182 | ADD_TEST_EQ(MIRROR_CLASS_OBJECT_SIZE_ALLOC_FAST_PATH_OFFSET, |
| 183 | art::mirror::Class::ObjectSizeAllocFastPathOffset().Int32Value()) |
| 184 | #define MIRROR_CLASS_OBJECT_PRIMITIVE_TYPE_OFFSET (104 + MIRROR_OBJECT_HEADER_SIZE) |
Mathieu Chartier | 8261d02 | 2016-08-08 09:41:04 -0700 | [diff] [blame] | 185 | ADD_TEST_EQ(MIRROR_CLASS_OBJECT_PRIMITIVE_TYPE_OFFSET, |
| 186 | art::mirror::Class::PrimitiveTypeOffset().Int32Value()) |
Mathieu Chartier | 93bbee0 | 2016-08-31 09:38:40 -0700 | [diff] [blame] | 187 | #define MIRROR_CLASS_STATUS_OFFSET (112 + MIRROR_OBJECT_HEADER_SIZE) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 188 | ADD_TEST_EQ(MIRROR_CLASS_STATUS_OFFSET, |
| 189 | art::mirror::Class::StatusOffset().Int32Value()) |
| 190 | |
Mathieu Chartier | 8261d02 | 2016-08-08 09:41:04 -0700 | [diff] [blame] | 191 | #define PRIMITIVE_TYPE_SIZE_SHIFT_SHIFT 16 |
| 192 | ADD_TEST_EQ(PRIMITIVE_TYPE_SIZE_SHIFT_SHIFT, |
| 193 | static_cast<int>(art::mirror::Class::kPrimitiveTypeSizeShiftShift)) |
| 194 | |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 195 | // Array offsets. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 196 | #define MIRROR_ARRAY_LENGTH_OFFSET MIRROR_OBJECT_HEADER_SIZE |
| 197 | ADD_TEST_EQ(MIRROR_ARRAY_LENGTH_OFFSET, art::mirror::Array::LengthOffset().Int32Value()) |
| 198 | |
| 199 | #define MIRROR_CHAR_ARRAY_DATA_OFFSET (4 + MIRROR_OBJECT_HEADER_SIZE) |
| 200 | ADD_TEST_EQ(MIRROR_CHAR_ARRAY_DATA_OFFSET, |
| 201 | art::mirror::Array::DataOffset(sizeof(uint16_t)).Int32Value()) |
| 202 | |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 203 | #define MIRROR_BOOLEAN_ARRAY_DATA_OFFSET MIRROR_CHAR_ARRAY_DATA_OFFSET |
| 204 | ADD_TEST_EQ(MIRROR_BOOLEAN_ARRAY_DATA_OFFSET, |
| 205 | art::mirror::Array::DataOffset(sizeof(uint8_t)).Int32Value()) |
| 206 | |
| 207 | #define MIRROR_BYTE_ARRAY_DATA_OFFSET MIRROR_CHAR_ARRAY_DATA_OFFSET |
| 208 | ADD_TEST_EQ(MIRROR_BYTE_ARRAY_DATA_OFFSET, |
| 209 | art::mirror::Array::DataOffset(sizeof(int8_t)).Int32Value()) |
| 210 | |
| 211 | #define MIRROR_SHORT_ARRAY_DATA_OFFSET MIRROR_CHAR_ARRAY_DATA_OFFSET |
| 212 | ADD_TEST_EQ(MIRROR_SHORT_ARRAY_DATA_OFFSET, |
| 213 | art::mirror::Array::DataOffset(sizeof(int16_t)).Int32Value()) |
| 214 | |
| 215 | #define MIRROR_INT_ARRAY_DATA_OFFSET MIRROR_CHAR_ARRAY_DATA_OFFSET |
| 216 | ADD_TEST_EQ(MIRROR_INT_ARRAY_DATA_OFFSET, |
| 217 | art::mirror::Array::DataOffset(sizeof(int32_t)).Int32Value()) |
| 218 | |
| 219 | #define MIRROR_WIDE_ARRAY_DATA_OFFSET (8 + MIRROR_OBJECT_HEADER_SIZE) |
| 220 | ADD_TEST_EQ(MIRROR_WIDE_ARRAY_DATA_OFFSET, |
| 221 | art::mirror::Array::DataOffset(sizeof(uint64_t)).Int32Value()) |
| 222 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 223 | #define MIRROR_OBJECT_ARRAY_DATA_OFFSET (4 + MIRROR_OBJECT_HEADER_SIZE) |
| 224 | ADD_TEST_EQ(MIRROR_OBJECT_ARRAY_DATA_OFFSET, |
| 225 | art::mirror::Array::DataOffset( |
| 226 | sizeof(art::mirror::HeapReference<art::mirror::Object>)).Int32Value()) |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 227 | |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 228 | #define MIRROR_OBJECT_ARRAY_COMPONENT_SIZE 4 |
| 229 | ADD_TEST_EQ(static_cast<size_t>(MIRROR_OBJECT_ARRAY_COMPONENT_SIZE), |
| 230 | sizeof(art::mirror::HeapReference<art::mirror::Object>)) |
| 231 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 232 | #define MIRROR_LONG_ARRAY_DATA_OFFSET (8 + MIRROR_OBJECT_HEADER_SIZE) |
| 233 | ADD_TEST_EQ(MIRROR_LONG_ARRAY_DATA_OFFSET, |
| 234 | art::mirror::Array::DataOffset(sizeof(uint64_t)).Int32Value()) |
| 235 | |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 236 | // Offsets within java.lang.String. |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 237 | #define MIRROR_STRING_COUNT_OFFSET MIRROR_OBJECT_HEADER_SIZE |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 238 | ADD_TEST_EQ(MIRROR_STRING_COUNT_OFFSET, art::mirror::String::CountOffset().Int32Value()) |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 239 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 240 | #define MIRROR_STRING_VALUE_OFFSET (8 + MIRROR_OBJECT_HEADER_SIZE) |
| 241 | ADD_TEST_EQ(MIRROR_STRING_VALUE_OFFSET, art::mirror::String::ValueOffset().Int32Value()) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 242 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 243 | |
Bill Buzbee | 1d011d9 | 2016-04-04 16:59:29 +0000 | [diff] [blame] | 244 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 245 | #if defined(__cplusplus) |
| 246 | } // End of CheckAsmSupportOffsets. |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 247 | #endif |
| 248 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 249 | #endif // ART_RUNTIME_ASM_SUPPORT_H_ |