Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 | */ |
| 16 | |
| 17 | #include <memory> |
Dave Allison | 8ce6b90 | 2014-08-26 11:07:58 -0700 | [diff] [blame] | 18 | #include <setjmp.h> |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 19 | |
| 20 | #include "base/macros.h" |
| 21 | #include "common_runtime_test.h" |
| 22 | #include "thread.h" |
| 23 | |
| 24 | // This test checks the offsets of values in the thread TLS and entrypoint structures. A failure |
| 25 | // of this test means that offsets have changed from the last update of the test. This indicates |
| 26 | // that an oat version bump may be in order, and some defines should be carefully checked (or their |
| 27 | // corresponding tests run). |
| 28 | |
| 29 | namespace art { |
| 30 | |
| 31 | // OFFSETOF_MEMBER uses reinterpret_cast. This means it is not a constexpr. So we cannot use |
| 32 | // compile-time assertions. Once we find another way, adjust the define accordingly. |
| 33 | #define CHECKED(expr, name) \ |
| 34 | EXPECT_TRUE(expr) << #name |
| 35 | |
| 36 | // Macro to check whether two fields have an expected difference in offsets. The error is named |
| 37 | // name. |
| 38 | #define EXPECT_OFFSET_DIFF(first_type, first_field, second_type, second_field, diff, name) \ |
| 39 | CHECKED(OFFSETOF_MEMBER(second_type, second_field) \ |
| 40 | - OFFSETOF_MEMBER(first_type, first_field) == diff, name) |
| 41 | |
| 42 | // Helper macro for when the fields are from the same type. |
| 43 | #define EXPECT_OFFSET_DIFFNP(type, first_field, second_field, diff) \ |
| 44 | EXPECT_OFFSET_DIFF(type, first_field, type, second_field, diff, \ |
| 45 | type ## _ ## first_field ## _ ## second_field) |
| 46 | |
| 47 | // Helper macro for when the fields are from the same type and in the same member of said type. |
| 48 | #define EXPECT_OFFSET_DIFFP(type, prefix, first_field, second_field, diff) \ |
| 49 | EXPECT_OFFSET_DIFF(type, prefix . first_field, type, prefix . second_field, diff, \ |
| 50 | type ## _ ## prefix ## _ ## first_field ## _ ## second_field) |
| 51 | |
| 52 | // Macro to check whether two fields have at least an expected difference in offsets. The error is |
| 53 | // named name. |
| 54 | #define EXPECT_OFFSET_DIFF_GT(first_type, first_field, second_type, second_field, diff, name) \ |
| 55 | CHECKED(OFFSETOF_MEMBER(second_type, second_field) \ |
| 56 | - OFFSETOF_MEMBER(first_type, first_field) >= diff, name) |
| 57 | |
| 58 | // Helper macro for when the fields are from the same type. |
| 59 | #define EXPECT_OFFSET_DIFF_GT3(type, first_field, second_field, diff, name) \ |
| 60 | EXPECT_OFFSET_DIFF_GT(type, first_field, type, second_field, diff, name) |
| 61 | |
| 62 | class EntrypointsOrderTest : public CommonRuntimeTest { |
| 63 | protected: |
| 64 | void CheckThreadOffsets() { |
| 65 | CHECKED(OFFSETOF_MEMBER(Thread, tls32_.state_and_flags) == 0, thread_flags_at_zero); |
| 66 | EXPECT_OFFSET_DIFFP(Thread, tls32_, state_and_flags, suspend_count, 4); |
| 67 | EXPECT_OFFSET_DIFFP(Thread, tls32_, suspend_count, debug_suspend_count, 4); |
| 68 | EXPECT_OFFSET_DIFFP(Thread, tls32_, debug_suspend_count, thin_lock_thread_id, 4); |
| 69 | EXPECT_OFFSET_DIFFP(Thread, tls32_, thin_lock_thread_id, tid, 4); |
| 70 | EXPECT_OFFSET_DIFFP(Thread, tls32_, tid, daemon, 4); |
| 71 | EXPECT_OFFSET_DIFFP(Thread, tls32_, daemon, throwing_OutOfMemoryError, 4); |
| 72 | EXPECT_OFFSET_DIFFP(Thread, tls32_, throwing_OutOfMemoryError, no_thread_suspension, 4); |
| 73 | EXPECT_OFFSET_DIFFP(Thread, tls32_, no_thread_suspension, thread_exit_check_count, 4); |
Dave Allison | 648d711 | 2014-07-25 16:15:27 -0700 | [diff] [blame] | 74 | EXPECT_OFFSET_DIFFP(Thread, tls32_, thread_exit_check_count, |
| 75 | is_exception_reported_to_instrumentation_, 4); |
| 76 | EXPECT_OFFSET_DIFFP(Thread, tls32_, is_exception_reported_to_instrumentation_, |
| 77 | handling_signal_, 4); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 78 | |
| 79 | // TODO: Better connection. Take alignment into account. |
| 80 | EXPECT_OFFSET_DIFF_GT3(Thread, tls32_.thread_exit_check_count, tls64_.trace_clock_base, 4, |
| 81 | thread_tls32_to_tls64); |
| 82 | |
| 83 | EXPECT_OFFSET_DIFFP(Thread, tls64_, trace_clock_base, deoptimization_return_value, 8); |
| 84 | EXPECT_OFFSET_DIFFP(Thread, tls64_, deoptimization_return_value, stats, 8); |
| 85 | |
| 86 | // TODO: Better connection. Take alignment into account. |
| 87 | EXPECT_OFFSET_DIFF_GT3(Thread, tls64_.stats, tlsPtr_.card_table, 8, thread_tls64_to_tlsptr); |
| 88 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 89 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, card_table, exception, sizeof(void*)); |
| 90 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, exception, stack_end, sizeof(void*)); |
| 91 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, stack_end, managed_stack, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 92 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, managed_stack, suspend_trigger, sizeof(ManagedStack)); |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 93 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, suspend_trigger, jni_env, sizeof(void*)); |
| 94 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, jni_env, self, sizeof(void*)); |
| 95 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, self, opeer, sizeof(void*)); |
| 96 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, opeer, jpeer, sizeof(void*)); |
| 97 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, jpeer, stack_begin, sizeof(void*)); |
| 98 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, stack_begin, stack_size, sizeof(void*)); |
| 99 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, stack_size, throw_location, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 100 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, throw_location, stack_trace_sample, sizeof(ThrowLocation)); |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 101 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, stack_trace_sample, wait_next, sizeof(void*)); |
| 102 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, wait_next, monitor_enter_object, sizeof(void*)); |
| 103 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, monitor_enter_object, top_handle_scope, sizeof(void*)); |
| 104 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, top_handle_scope, class_loader_override, sizeof(void*)); |
| 105 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, class_loader_override, long_jump_context, sizeof(void*)); |
| 106 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, long_jump_context, instrumentation_stack, sizeof(void*)); |
| 107 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, instrumentation_stack, debug_invoke_req, sizeof(void*)); |
| 108 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, debug_invoke_req, single_step_control, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 109 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, single_step_control, deoptimization_shadow_frame, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 110 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 111 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, deoptimization_shadow_frame, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 112 | shadow_frame_under_construction, sizeof(void*)); |
| 113 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, shadow_frame_under_construction, name, sizeof(void*)); |
| 114 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, name, pthread_self, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 115 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, pthread_self, last_no_thread_suspension_cause, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 116 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 117 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, last_no_thread_suspension_cause, checkpoint_functions, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 118 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 119 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, checkpoint_functions, interpreter_entrypoints, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 120 | sizeof(void*) * 3); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 121 | |
| 122 | // Skip across the entrypoints structures. |
| 123 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 124 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_start, thread_local_pos, sizeof(void*)); |
| 125 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_pos, thread_local_end, sizeof(void*)); |
| 126 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_end, thread_local_objects, sizeof(void*)); |
| 127 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_objects, rosalloc_runs, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 128 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, rosalloc_runs, thread_local_alloc_stack_top, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 129 | sizeof(void*) * kNumRosAllocThreadLocalSizeBrackets); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 130 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_alloc_stack_top, thread_local_alloc_stack_end, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 131 | sizeof(void*)); |
| 132 | EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_alloc_stack_end, held_mutexes, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 133 | EXPECT_OFFSET_DIFF(Thread, tlsPtr_.held_mutexes, Thread, wait_mutex_, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 134 | sizeof(void*) * kLockLevelCount + sizeof(void*), thread_tlsptr_end); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | void CheckInterpreterEntryPoints() { |
| 138 | CHECKED(OFFSETOF_MEMBER(InterpreterEntryPoints, pInterpreterToInterpreterBridge) == 0, |
| 139 | InterpreterEntryPoints_start_with_i2i); |
| 140 | EXPECT_OFFSET_DIFFNP(InterpreterEntryPoints, pInterpreterToInterpreterBridge, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 141 | pInterpreterToCompiledCodeBridge, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 142 | CHECKED(OFFSETOF_MEMBER(InterpreterEntryPoints, pInterpreterToCompiledCodeBridge) |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 143 | + sizeof(void*) == sizeof(InterpreterEntryPoints), InterpreterEntryPoints_all); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | void CheckJniEntryPoints() { |
| 147 | CHECKED(OFFSETOF_MEMBER(JniEntryPoints, pDlsymLookup) == 0, |
| 148 | JniEntryPoints_start_with_dlsymlookup); |
| 149 | CHECKED(OFFSETOF_MEMBER(JniEntryPoints, pDlsymLookup) |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 150 | + sizeof(void*) == sizeof(JniEntryPoints), JniEntryPoints_all); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | void CheckPortableEntryPoints() { |
| 154 | CHECKED(OFFSETOF_MEMBER(PortableEntryPoints, pPortableImtConflictTrampoline) == 0, |
| 155 | PortableEntryPoints_start_with_imt); |
| 156 | EXPECT_OFFSET_DIFFNP(PortableEntryPoints, pPortableImtConflictTrampoline, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 157 | pPortableResolutionTrampoline, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 158 | EXPECT_OFFSET_DIFFNP(PortableEntryPoints, pPortableResolutionTrampoline, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 159 | pPortableToInterpreterBridge, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 160 | CHECKED(OFFSETOF_MEMBER(PortableEntryPoints, pPortableToInterpreterBridge) |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 161 | + sizeof(void*) == sizeof(PortableEntryPoints), PortableEntryPoints_all); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | void CheckQuickEntryPoints() { |
| 165 | CHECKED(OFFSETOF_MEMBER(QuickEntryPoints, pAllocArray) == 0, |
| 166 | QuickEntryPoints_start_with_allocarray); |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 167 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocArray, pAllocArrayResolved, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 168 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocArrayResolved, pAllocArrayWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 169 | sizeof(void*)); |
| 170 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocArrayWithAccessCheck, pAllocObject, sizeof(void*)); |
| 171 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocObject, pAllocObjectResolved, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 172 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocObjectResolved, pAllocObjectInitialized, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 173 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 174 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocObjectInitialized, pAllocObjectWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 175 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 176 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAllocObjectWithAccessCheck, pCheckAndAllocArray, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 177 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 178 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCheckAndAllocArray, pCheckAndAllocArrayWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 179 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 180 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCheckAndAllocArrayWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 181 | pInstanceofNonTrivial, sizeof(void*)); |
| 182 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInstanceofNonTrivial, pCheckCast, sizeof(void*)); |
| 183 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCheckCast, pInitializeStaticStorage, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 184 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInitializeStaticStorage, pInitializeTypeAndVerifyAccess, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 185 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 186 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInitializeTypeAndVerifyAccess, pInitializeType, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 187 | sizeof(void*)); |
| 188 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInitializeType, pResolveString, sizeof(void*)); |
| 189 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pResolveString, pSet8Instance, sizeof(void*)); |
| 190 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet8Instance, pSet8Static, sizeof(void*)); |
| 191 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet8Static, pSet16Instance, sizeof(void*)); |
| 192 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet16Instance, pSet16Static, sizeof(void*)); |
| 193 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet16Static, pSet32Instance, sizeof(void*)); |
| 194 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet32Instance, pSet32Static, sizeof(void*)); |
| 195 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet32Static, pSet64Instance, sizeof(void*)); |
| 196 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet64Instance, pSet64Static, sizeof(void*)); |
| 197 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSet64Static, pSetObjInstance, sizeof(void*)); |
| 198 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSetObjInstance, pSetObjStatic, sizeof(void*)); |
| 199 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pSetObjStatic, pGetByteInstance, sizeof(void*)); |
| 200 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetByteInstance, pGetBooleanInstance, sizeof(void*)); |
| 201 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetBooleanInstance, pGetByteStatic, sizeof(void*)); |
| 202 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetByteStatic, pGetBooleanStatic, sizeof(void*)); |
| 203 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetBooleanStatic, pGetShortInstance, sizeof(void*)); |
| 204 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetShortInstance, pGetCharInstance, sizeof(void*)); |
| 205 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetCharInstance, pGetShortStatic, sizeof(void*)); |
| 206 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetShortStatic, pGetCharStatic, sizeof(void*)); |
| 207 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetCharStatic, pGet32Instance, sizeof(void*)); |
| 208 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGet32Instance, pGet32Static, sizeof(void*)); |
| 209 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGet32Static, pGet64Instance, sizeof(void*)); |
| 210 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGet64Instance, pGet64Static, sizeof(void*)); |
| 211 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGet64Static, pGetObjInstance, sizeof(void*)); |
| 212 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetObjInstance, pGetObjStatic, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 213 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pGetObjStatic, pAputObjectWithNullAndBoundCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 214 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 215 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAputObjectWithNullAndBoundCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 216 | pAputObjectWithBoundCheck, sizeof(void*)); |
| 217 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAputObjectWithBoundCheck, pAputObject, sizeof(void*)); |
| 218 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pAputObject, pHandleFillArrayData, sizeof(void*)); |
| 219 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pHandleFillArrayData, pJniMethodStart, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 220 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pJniMethodStart, pJniMethodStartSynchronized, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 221 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 222 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pJniMethodStartSynchronized, pJniMethodEnd, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 223 | sizeof(void*)); |
| 224 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pJniMethodEnd, pJniMethodEndSynchronized, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 225 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pJniMethodEndSynchronized, pJniMethodEndWithReference, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 226 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 227 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pJniMethodEndWithReference, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 228 | pJniMethodEndWithReferenceSynchronized, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 229 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pJniMethodEndWithReferenceSynchronized, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 230 | pQuickGenericJniTrampoline, sizeof(void*)); |
| 231 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pQuickGenericJniTrampoline, pLockObject, sizeof(void*)); |
| 232 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pLockObject, pUnlockObject, sizeof(void*)); |
| 233 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pUnlockObject, pCmpgDouble, sizeof(void*)); |
| 234 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCmpgDouble, pCmpgFloat, sizeof(void*)); |
| 235 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCmpgFloat, pCmplDouble, sizeof(void*)); |
| 236 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCmplDouble, pCmplFloat, sizeof(void*)); |
| 237 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pCmplFloat, pFmod, sizeof(void*)); |
| 238 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pFmod, pL2d, sizeof(void*)); |
| 239 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pL2d, pFmodf, sizeof(void*)); |
| 240 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pFmodf, pL2f, sizeof(void*)); |
| 241 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pL2f, pD2iz, sizeof(void*)); |
| 242 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pD2iz, pF2iz, sizeof(void*)); |
| 243 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pF2iz, pIdivmod, sizeof(void*)); |
| 244 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pIdivmod, pD2l, sizeof(void*)); |
| 245 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pD2l, pF2l, sizeof(void*)); |
| 246 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pF2l, pLdiv, sizeof(void*)); |
| 247 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pLdiv, pLmod, sizeof(void*)); |
| 248 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pLmod, pLmul, sizeof(void*)); |
| 249 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pLmul, pShlLong, sizeof(void*)); |
| 250 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pShlLong, pShrLong, sizeof(void*)); |
| 251 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pShrLong, pUshrLong, sizeof(void*)); |
| 252 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pUshrLong, pIndexOf, sizeof(void*)); |
| 253 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pIndexOf, pStringCompareTo, sizeof(void*)); |
| 254 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pStringCompareTo, pMemcpy, sizeof(void*)); |
| 255 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pMemcpy, pQuickImtConflictTrampoline, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 256 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pQuickImtConflictTrampoline, pQuickResolutionTrampoline, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 257 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 258 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pQuickResolutionTrampoline, pQuickToInterpreterBridge, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 259 | sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 260 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pQuickToInterpreterBridge, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 261 | pInvokeDirectTrampolineWithAccessCheck, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 262 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInvokeDirectTrampolineWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 263 | pInvokeInterfaceTrampolineWithAccessCheck, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 264 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInvokeInterfaceTrampolineWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 265 | pInvokeStaticTrampolineWithAccessCheck, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 266 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInvokeStaticTrampolineWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 267 | pInvokeSuperTrampolineWithAccessCheck, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 268 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInvokeSuperTrampolineWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 269 | pInvokeVirtualTrampolineWithAccessCheck, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 270 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pInvokeVirtualTrampolineWithAccessCheck, |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 271 | pTestSuspend, sizeof(void*)); |
| 272 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pTestSuspend, pDeliverException, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 273 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 274 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pDeliverException, pThrowArrayBounds, sizeof(void*)); |
| 275 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowArrayBounds, pThrowDivZero, sizeof(void*)); |
| 276 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowDivZero, pThrowNoSuchMethod, sizeof(void*)); |
| 277 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowNoSuchMethod, pThrowNullPointer, sizeof(void*)); |
| 278 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowNullPointer, pThrowStackOverflow, sizeof(void*)); |
| 279 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowStackOverflow, pA64Load, sizeof(void*)); |
| 280 | EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pA64Load, pA64Store, sizeof(void*)); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 281 | |
Douglas Leung | d9cb8ae | 2014-07-09 14:28:35 -0700 | [diff] [blame] | 282 | CHECKED(OFFSETOF_MEMBER(QuickEntryPoints, pA64Store) |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 283 | + sizeof(void*) == sizeof(QuickEntryPoints), QuickEntryPoints_all); |
Andreas Gampe | 4352b45 | 2014-06-04 18:59:01 -0700 | [diff] [blame] | 284 | } |
| 285 | }; |
| 286 | |
| 287 | TEST_F(EntrypointsOrderTest, ThreadOffsets) { |
| 288 | CheckThreadOffsets(); |
| 289 | } |
| 290 | |
| 291 | TEST_F(EntrypointsOrderTest, InterpreterEntryPoints) { |
| 292 | CheckInterpreterEntryPoints(); |
| 293 | } |
| 294 | |
| 295 | TEST_F(EntrypointsOrderTest, JniEntryPoints) { |
| 296 | CheckJniEntryPoints(); |
| 297 | } |
| 298 | |
| 299 | TEST_F(EntrypointsOrderTest, PortableEntryPoints) { |
| 300 | CheckPortableEntryPoints(); |
| 301 | } |
| 302 | |
| 303 | TEST_F(EntrypointsOrderTest, QuickEntryPoints) { |
| 304 | CheckQuickEntryPoints(); |
| 305 | } |
| 306 | |
| 307 | } // namespace art |