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" |
Hiroshi Yamauchi | e15ea08 | 2015-02-09 17:11:42 -0800 | [diff] [blame] | 22 | #include "lock_word.h" |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 23 | #include "mirror/class.h" |
| 24 | #include "mirror/string.h" |
| 25 | #include "runtime.h" |
| 26 | #include "thread.h" |
| 27 | #endif |
| 28 | |
Hiroshi Yamauchi | 800ac2d | 2014-04-02 17:32:54 -0700 | [diff] [blame] | 29 | #include "read_barrier_c.h" |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 30 | |
Zheng Xu | 69a5030 | 2015-04-14 20:04:41 +0800 | [diff] [blame] | 31 | #if defined(__arm__) || defined(__mips__) |
| 32 | // 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] | 33 | // checks in the event of loop back edges. The SUSPEND_CHECK_INTERVAL constant is loaded into a |
| 34 | // register at the point of an up-call or after handling a suspend check. It reduces the number of |
| 35 | // loads of the TLS suspend check value by the given amount (turning it into a decrement and compare |
| 36 | // of a register). This increases the time for a thread to respond to requests from GC and the |
| 37 | // debugger, damaging GC performance and creating other unwanted artifacts. For example, this count |
| 38 | // has the effect of making loops and Java code look cold in profilers, where the count is reset |
| 39 | // impacts where samples will occur. Reducing the count as much as possible improves profiler |
| 40 | // accuracy in tools like traceview. |
| 41 | // 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] | 42 | #define SUSPEND_CHECK_INTERVAL 96 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 43 | #endif |
| 44 | |
| 45 | #if defined(__cplusplus) |
| 46 | |
| 47 | #ifndef ADD_TEST_EQ // Allow #include-r to replace with their own. |
| 48 | #define ADD_TEST_EQ(x, y) CHECK_EQ(x, y); |
| 49 | #endif |
| 50 | |
| 51 | static inline void CheckAsmSupportOffsetsAndSizes() { |
| 52 | #else |
| 53 | #define ADD_TEST_EQ(x, y) |
| 54 | #endif |
| 55 | |
| 56 | // Size of references to the heap on the stack. |
| 57 | #define STACK_REFERENCE_SIZE 4 |
| 58 | ADD_TEST_EQ(static_cast<size_t>(STACK_REFERENCE_SIZE), sizeof(art::StackReference<art::mirror::Object>)) |
| 59 | |
Mathieu Chartier | bb87e0f | 2015-04-03 11:21:55 -0700 | [diff] [blame] | 60 | // Size of heap references |
| 61 | #define COMPRESSED_REFERENCE_SIZE 4 |
| 62 | ADD_TEST_EQ(static_cast<size_t>(COMPRESSED_REFERENCE_SIZE), |
| 63 | sizeof(art::mirror::CompressedReference<art::mirror::Object>)) |
| 64 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 65 | // Note: these callee save methods loads require read barriers. |
| 66 | // Offset of field Runtime::callee_save_methods_[kSaveAll] |
| 67 | #define RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET 0 |
| 68 | ADD_TEST_EQ(static_cast<size_t>(RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET), |
| 69 | art::Runtime::GetCalleeSaveMethodOffset(art::Runtime::kSaveAll)) |
| 70 | |
| 71 | // Offset of field Runtime::callee_save_methods_[kRefsOnly] |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 72 | #define RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET 8 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 73 | ADD_TEST_EQ(static_cast<size_t>(RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET), |
| 74 | art::Runtime::GetCalleeSaveMethodOffset(art::Runtime::kRefsOnly)) |
| 75 | |
| 76 | // Offset of field Runtime::callee_save_methods_[kRefsAndArgs] |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 77 | #define RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET (2 * 8) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 78 | ADD_TEST_EQ(static_cast<size_t>(RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET), |
| 79 | art::Runtime::GetCalleeSaveMethodOffset(art::Runtime::kRefsAndArgs)) |
| 80 | |
| 81 | // Offset of field Thread::tls32_.state_and_flags. |
| 82 | #define THREAD_FLAGS_OFFSET 0 |
| 83 | ADD_TEST_EQ(THREAD_FLAGS_OFFSET, |
| 84 | art::Thread::ThreadFlagsOffset<__SIZEOF_POINTER__>().Int32Value()) |
| 85 | |
| 86 | // Offset of field Thread::tls32_.thin_lock_thread_id. |
| 87 | #define THREAD_ID_OFFSET 12 |
| 88 | ADD_TEST_EQ(THREAD_ID_OFFSET, |
| 89 | art::Thread::ThinLockIdOffset<__SIZEOF_POINTER__>().Int32Value()) |
| 90 | |
| 91 | // Offset of field Thread::tlsPtr_.card_table. |
Sebastien Hertz | 0747466 | 2015-08-25 15:12:33 +0000 | [diff] [blame] | 92 | #define THREAD_CARD_TABLE_OFFSET 128 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 93 | ADD_TEST_EQ(THREAD_CARD_TABLE_OFFSET, |
| 94 | art::Thread::CardTableOffset<__SIZEOF_POINTER__>().Int32Value()) |
| 95 | |
| 96 | // Offset of field Thread::tlsPtr_.exception. |
| 97 | #define THREAD_EXCEPTION_OFFSET (THREAD_CARD_TABLE_OFFSET + __SIZEOF_POINTER__) |
| 98 | ADD_TEST_EQ(THREAD_EXCEPTION_OFFSET, |
| 99 | art::Thread::ExceptionOffset<__SIZEOF_POINTER__>().Int32Value()) |
| 100 | |
| 101 | // Offset of field Thread::tlsPtr_.managed_stack.top_quick_frame_. |
| 102 | #define THREAD_TOP_QUICK_FRAME_OFFSET (THREAD_CARD_TABLE_OFFSET + (3 * __SIZEOF_POINTER__)) |
| 103 | ADD_TEST_EQ(THREAD_TOP_QUICK_FRAME_OFFSET, |
| 104 | art::Thread::TopOfManagedStackOffset<__SIZEOF_POINTER__>().Int32Value()) |
| 105 | |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 106 | // Offset of field Thread::tlsPtr_.self. |
Andreas Gampe | 449357d | 2015-06-01 22:29:51 -0700 | [diff] [blame] | 107 | #define THREAD_SELF_OFFSET (THREAD_CARD_TABLE_OFFSET + (9 * __SIZEOF_POINTER__)) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 108 | ADD_TEST_EQ(THREAD_SELF_OFFSET, |
| 109 | art::Thread::SelfOffset<__SIZEOF_POINTER__>().Int32Value()) |
Ian Rogers | 4a510d8 | 2011-10-09 14:30:24 -0700 | [diff] [blame] | 110 | |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 111 | // Offset of field Thread::tlsPtr_.thread_local_pos. |
Mingyao Yang | 99170c6 | 2015-07-06 11:10:37 -0700 | [diff] [blame] | 112 | #define THREAD_LOCAL_POS_OFFSET (THREAD_CARD_TABLE_OFFSET + 152 * __SIZEOF_POINTER__) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 113 | ADD_TEST_EQ(THREAD_LOCAL_POS_OFFSET, |
| 114 | art::Thread::ThreadLocalPosOffset<__SIZEOF_POINTER__>().Int32Value()) |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 115 | // Offset of field Thread::tlsPtr_.thread_local_end. |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 116 | #define THREAD_LOCAL_END_OFFSET (THREAD_LOCAL_POS_OFFSET + __SIZEOF_POINTER__) |
| 117 | ADD_TEST_EQ(THREAD_LOCAL_END_OFFSET, |
| 118 | art::Thread::ThreadLocalEndOffset<__SIZEOF_POINTER__>().Int32Value()) |
Roland Levillain | ca80ecc | 2015-07-22 17:19:28 +0100 | [diff] [blame] | 119 | // Offset of field Thread::tlsPtr_.thread_local_objects. |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 120 | #define THREAD_LOCAL_OBJECTS_OFFSET (THREAD_LOCAL_POS_OFFSET + 2 * __SIZEOF_POINTER__) |
| 121 | ADD_TEST_EQ(THREAD_LOCAL_OBJECTS_OFFSET, |
| 122 | art::Thread::ThreadLocalObjectsOffset<__SIZEOF_POINTER__>().Int32Value()) |
| 123 | |
Ian Rogers | d9c4fc9 | 2013-10-01 19:45:43 -0700 | [diff] [blame] | 124 | // Offsets within java.lang.Object. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 125 | #define MIRROR_OBJECT_CLASS_OFFSET 0 |
| 126 | ADD_TEST_EQ(MIRROR_OBJECT_CLASS_OFFSET, art::mirror::Object::ClassOffset().Int32Value()) |
| 127 | #define MIRROR_OBJECT_LOCK_WORD_OFFSET 4 |
| 128 | ADD_TEST_EQ(MIRROR_OBJECT_LOCK_WORD_OFFSET, art::mirror::Object::MonitorOffset().Int32Value()) |
Ian Rogers | d9c4fc9 | 2013-10-01 19:45:43 -0700 | [diff] [blame] | 129 | |
Hiroshi Yamauchi | 60f63f5 | 2015-04-23 16:12:40 -0700 | [diff] [blame] | 130 | #if defined(USE_BROOKS_READ_BARRIER) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 131 | #define MIRROR_OBJECT_HEADER_SIZE 16 |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 132 | #else |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 133 | #define MIRROR_OBJECT_HEADER_SIZE 8 |
| 134 | #endif |
| 135 | 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] | 136 | |
| 137 | // Offsets within java.lang.Class. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 138 | #define MIRROR_CLASS_COMPONENT_TYPE_OFFSET (4 + MIRROR_OBJECT_HEADER_SIZE) |
| 139 | ADD_TEST_EQ(MIRROR_CLASS_COMPONENT_TYPE_OFFSET, |
| 140 | art::mirror::Class::ComponentTypeOffset().Int32Value()) |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 141 | #define MIRROR_CLASS_ACCESS_FLAGS_OFFSET (72 + MIRROR_OBJECT_HEADER_SIZE) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 142 | ADD_TEST_EQ(MIRROR_CLASS_ACCESS_FLAGS_OFFSET, |
| 143 | art::mirror::Class::AccessFlagsOffset().Int32Value()) |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 144 | #define MIRROR_CLASS_OBJECT_SIZE_OFFSET (104 + MIRROR_OBJECT_HEADER_SIZE) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 145 | ADD_TEST_EQ(MIRROR_CLASS_OBJECT_SIZE_OFFSET, |
| 146 | art::mirror::Class::ObjectSizeOffset().Int32Value()) |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 147 | #define MIRROR_CLASS_STATUS_OFFSET (116 + MIRROR_OBJECT_HEADER_SIZE) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 148 | ADD_TEST_EQ(MIRROR_CLASS_STATUS_OFFSET, |
| 149 | art::mirror::Class::StatusOffset().Int32Value()) |
| 150 | |
| 151 | #define MIRROR_CLASS_STATUS_INITIALIZED 10 |
| 152 | ADD_TEST_EQ(static_cast<uint32_t>(MIRROR_CLASS_STATUS_INITIALIZED), |
| 153 | static_cast<uint32_t>(art::mirror::Class::kStatusInitialized)) |
| 154 | #define ACCESS_FLAGS_CLASS_IS_FINALIZABLE 0x80000000 |
| 155 | ADD_TEST_EQ(static_cast<uint32_t>(ACCESS_FLAGS_CLASS_IS_FINALIZABLE), |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 156 | static_cast<uint32_t>(art::kAccClassIsFinalizable)) |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 157 | |
| 158 | // Array offsets. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 159 | #define MIRROR_ARRAY_LENGTH_OFFSET MIRROR_OBJECT_HEADER_SIZE |
| 160 | ADD_TEST_EQ(MIRROR_ARRAY_LENGTH_OFFSET, art::mirror::Array::LengthOffset().Int32Value()) |
| 161 | |
| 162 | #define MIRROR_CHAR_ARRAY_DATA_OFFSET (4 + MIRROR_OBJECT_HEADER_SIZE) |
| 163 | ADD_TEST_EQ(MIRROR_CHAR_ARRAY_DATA_OFFSET, |
| 164 | art::mirror::Array::DataOffset(sizeof(uint16_t)).Int32Value()) |
| 165 | |
| 166 | #define MIRROR_OBJECT_ARRAY_DATA_OFFSET (4 + MIRROR_OBJECT_HEADER_SIZE) |
| 167 | ADD_TEST_EQ(MIRROR_OBJECT_ARRAY_DATA_OFFSET, |
| 168 | art::mirror::Array::DataOffset( |
| 169 | sizeof(art::mirror::HeapReference<art::mirror::Object>)).Int32Value()) |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 170 | |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 171 | #define MIRROR_OBJECT_ARRAY_COMPONENT_SIZE 4 |
| 172 | ADD_TEST_EQ(static_cast<size_t>(MIRROR_OBJECT_ARRAY_COMPONENT_SIZE), |
| 173 | sizeof(art::mirror::HeapReference<art::mirror::Object>)) |
| 174 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 175 | #define MIRROR_LONG_ARRAY_DATA_OFFSET (8 + MIRROR_OBJECT_HEADER_SIZE) |
| 176 | ADD_TEST_EQ(MIRROR_LONG_ARRAY_DATA_OFFSET, |
| 177 | art::mirror::Array::DataOffset(sizeof(uint64_t)).Int32Value()) |
| 178 | |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 179 | // Offsets within java.lang.String. |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 180 | #define MIRROR_STRING_COUNT_OFFSET MIRROR_OBJECT_HEADER_SIZE |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 181 | ADD_TEST_EQ(MIRROR_STRING_COUNT_OFFSET, art::mirror::String::CountOffset().Int32Value()) |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 182 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 183 | #define MIRROR_STRING_VALUE_OFFSET (8 + MIRROR_OBJECT_HEADER_SIZE) |
| 184 | ADD_TEST_EQ(MIRROR_STRING_VALUE_OFFSET, art::mirror::String::ValueOffset().Int32Value()) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 185 | |
| 186 | // Offsets within java.lang.reflect.ArtMethod. |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 187 | #define ART_METHOD_DEX_CACHE_METHODS_OFFSET_32 20 |
| 188 | ADD_TEST_EQ(ART_METHOD_DEX_CACHE_METHODS_OFFSET_32, |
| 189 | art::ArtMethod::DexCacheResolvedMethodsOffset(4).Int32Value()) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 190 | |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 191 | #define ART_METHOD_DEX_CACHE_METHODS_OFFSET_64 24 |
| 192 | ADD_TEST_EQ(ART_METHOD_DEX_CACHE_METHODS_OFFSET_64, |
| 193 | art::ArtMethod::DexCacheResolvedMethodsOffset(8).Int32Value()) |
| 194 | |
| 195 | #define ART_METHOD_DEX_CACHE_TYPES_OFFSET_32 24 |
| 196 | ADD_TEST_EQ(ART_METHOD_DEX_CACHE_TYPES_OFFSET_32, |
| 197 | art::ArtMethod::DexCacheResolvedTypesOffset(4).Int32Value()) |
| 198 | |
| 199 | #define ART_METHOD_DEX_CACHE_TYPES_OFFSET_64 32 |
| 200 | ADD_TEST_EQ(ART_METHOD_DEX_CACHE_TYPES_OFFSET_64, |
| 201 | art::ArtMethod::DexCacheResolvedTypesOffset(8).Int32Value()) |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 202 | |
Nicolas Geoffray | 7bf2b4f | 2015-07-08 10:11:59 +0000 | [diff] [blame] | 203 | #define ART_METHOD_QUICK_CODE_OFFSET_32 32 |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 204 | ADD_TEST_EQ(ART_METHOD_QUICK_CODE_OFFSET_32, |
| 205 | art::ArtMethod::EntryPointFromQuickCompiledCodeOffset(4).Int32Value()) |
Mathieu Chartier | 2d72101 | 2014-11-10 11:08:06 -0800 | [diff] [blame] | 206 | |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 207 | #define ART_METHOD_QUICK_CODE_OFFSET_64 48 |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 208 | ADD_TEST_EQ(ART_METHOD_QUICK_CODE_OFFSET_64, |
| 209 | art::ArtMethod::EntryPointFromQuickCompiledCodeOffset(8).Int32Value()) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 210 | |
Hiroshi Yamauchi | e15ea08 | 2015-02-09 17:11:42 -0800 | [diff] [blame] | 211 | #define LOCK_WORD_STATE_SHIFT 30 |
| 212 | ADD_TEST_EQ(LOCK_WORD_STATE_SHIFT, static_cast<int32_t>(art::LockWord::kStateShift)) |
| 213 | |
| 214 | #define LOCK_WORD_STATE_MASK 0xC0000000 |
| 215 | ADD_TEST_EQ(LOCK_WORD_STATE_MASK, static_cast<uint32_t>(art::LockWord::kStateMaskShifted)) |
| 216 | |
| 217 | #define LOCK_WORD_READ_BARRIER_STATE_SHIFT 28 |
| 218 | ADD_TEST_EQ(LOCK_WORD_READ_BARRIER_STATE_SHIFT, |
| 219 | static_cast<int32_t>(art::LockWord::kReadBarrierStateShift)) |
| 220 | |
| 221 | #define LOCK_WORD_READ_BARRIER_STATE_MASK 0x30000000 |
| 222 | ADD_TEST_EQ(LOCK_WORD_READ_BARRIER_STATE_MASK, |
| 223 | static_cast<int32_t>(art::LockWord::kReadBarrierStateMaskShifted)) |
| 224 | |
| 225 | #define LOCK_WORD_READ_BARRIER_STATE_MASK_TOGGLED 0xCFFFFFFF |
| 226 | ADD_TEST_EQ(LOCK_WORD_READ_BARRIER_STATE_MASK_TOGGLED, |
| 227 | static_cast<uint32_t>(art::LockWord::kReadBarrierStateMaskShiftedToggled)) |
| 228 | |
| 229 | #define LOCK_WORD_THIN_LOCK_COUNT_ONE 65536 |
| 230 | ADD_TEST_EQ(LOCK_WORD_THIN_LOCK_COUNT_ONE, static_cast<int32_t>(art::LockWord::kThinLockCountOne)) |
| 231 | |
Hiroshi Yamauchi | e01a520 | 2015-03-19 12:35:04 -0700 | [diff] [blame] | 232 | #define OBJECT_ALIGNMENT_MASK 7 |
| 233 | ADD_TEST_EQ(static_cast<size_t>(OBJECT_ALIGNMENT_MASK), art::kObjectAlignment - 1) |
| 234 | |
| 235 | #define OBJECT_ALIGNMENT_MASK_TOGGLED 0xFFFFFFF8 |
| 236 | ADD_TEST_EQ(static_cast<uint32_t>(OBJECT_ALIGNMENT_MASK_TOGGLED), |
| 237 | ~static_cast<uint32_t>(art::kObjectAlignment - 1)) |
| 238 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 239 | #if defined(__cplusplus) |
| 240 | } // End of CheckAsmSupportOffsets. |
Hiroshi Yamauchi | 9d04a20 | 2014-01-31 13:35:49 -0800 | [diff] [blame] | 241 | #endif |
| 242 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 243 | #endif // ART_RUNTIME_ASM_SUPPORT_H_ |