blob: 2d06508069847929c5622b9081a539cb39a0aee5 [file] [log] [blame]
Ian Rogers57b86d42012-03-27 16:05:41 -07001/*
2 * Copyright (C) 2012 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
Mathieu Chartierd8891782014-03-02 13:28:37 -080017#include "entrypoints/quick/quick_alloc_entrypoints.h"
18
Mathieu Chartiere401d142015-04-22 13:56:20 -070019#include "art_method-inl.h"
Andreas Gampe542451c2016-07-26 09:02:02 -070020#include "base/enums.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070021#include "callee_save_frame.h"
Andreas Gampea5b09a62016-11-17 15:21:22 -080022#include "dex_file_types.h"
Mingyao Yang98d1cc82014-05-15 17:02:16 -070023#include "entrypoints/entrypoint_utils-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080024#include "mirror/class-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080025#include "mirror/object_array-inl.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070026#include "mirror/object-inl.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070027
28namespace art {
29
Hiroshi Yamauchieb1e9292014-08-06 12:41:15 -070030static constexpr bool kUseTlabFastPath = true;
31
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000032template <bool kInitialized,
33 bool kFinalize,
34 bool kInstrumented,
35 gc::AllocatorType allocator_type>
36static ALWAYS_INLINE inline mirror::Object* artAllocObjectFromCode(
37 mirror::Class* klass,
38 Thread* self) REQUIRES_SHARED(Locks::mutator_lock_) {
39 ScopedQuickEntrypointChecks sqec(self);
40 DCHECK(klass != nullptr);
41 if (kUseTlabFastPath && !kInstrumented && allocator_type == gc::kAllocatorTypeTLAB) {
42 if (kInitialized || klass->IsInitialized()) {
43 if (!kFinalize || !klass->IsFinalizable()) {
44 size_t byte_count = klass->GetObjectSize();
45 byte_count = RoundUp(byte_count, gc::space::BumpPointerSpace::kAlignment);
46 mirror::Object* obj;
47 if (LIKELY(byte_count < self->TlabSize())) {
48 obj = self->AllocTlab(byte_count);
49 DCHECK(obj != nullptr) << "AllocTlab can't fail";
50 obj->SetClass(klass);
51 if (kUseBakerReadBarrier) {
52 obj->AssertReadBarrierState();
53 }
54 QuasiAtomic::ThreadFenceForConstructor();
55 return obj;
56 }
57 }
58 }
59 }
60 if (kInitialized) {
61 return AllocObjectFromCodeInitialized<kInstrumented>(klass, self, allocator_type);
62 } else if (!kFinalize) {
63 return AllocObjectFromCodeResolved<kInstrumented>(klass, self, allocator_type);
64 } else {
65 return AllocObjectFromCode<kInstrumented>(klass, self, allocator_type);
66 }
67}
68
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080069#define GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, suffix2, instrumented_bool, allocator_type) \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000070extern "C" mirror::Object* artAllocObjectFromCodeWithChecks##suffix##suffix2( \
71 mirror::Class* klass, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070072 REQUIRES_SHARED(Locks::mutator_lock_) { \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000073 return artAllocObjectFromCode<false, true, instrumented_bool, allocator_type>(klass, self); \
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080074} \
Hiroshi Yamauchibe1ca552014-01-15 11:46:48 -080075extern "C" mirror::Object* artAllocObjectFromCodeResolved##suffix##suffix2( \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000076 mirror::Class* klass, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070077 REQUIRES_SHARED(Locks::mutator_lock_) { \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000078 return artAllocObjectFromCode<false, false, instrumented_bool, allocator_type>(klass, self); \
Hiroshi Yamauchibe1ca552014-01-15 11:46:48 -080079} \
80extern "C" mirror::Object* artAllocObjectFromCodeInitialized##suffix##suffix2( \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000081 mirror::Class* klass, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070082 REQUIRES_SHARED(Locks::mutator_lock_) { \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +000083 return artAllocObjectFromCode<true, false, instrumented_bool, allocator_type>(klass, self); \
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080084} \
85extern "C" mirror::Array* artAllocArrayFromCode##suffix##suffix2( \
Mathieu Chartiere401d142015-04-22 13:56:20 -070086 uint32_t type_idx, int32_t component_count, ArtMethod* method, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070087 REQUIRES_SHARED(Locks::mutator_lock_) { \
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070088 ScopedQuickEntrypointChecks sqec(self); \
Andreas Gampea5b09a62016-11-17 15:21:22 -080089 return AllocArrayFromCode<false, instrumented_bool>(dex::TypeIndex(type_idx), \
90 component_count, \
91 method, \
92 self, \
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080093 allocator_type); \
94} \
Hiroshi Yamauchibb8f0ab2014-01-27 16:50:29 -080095extern "C" mirror::Array* artAllocArrayFromCodeResolved##suffix##suffix2( \
Mathieu Chartiere401d142015-04-22 13:56:20 -070096 mirror::Class* klass, int32_t component_count, ArtMethod* method, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070097 REQUIRES_SHARED(Locks::mutator_lock_) { \
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070098 ScopedQuickEntrypointChecks sqec(self); \
Andreas Gampe1cc7dba2014-12-17 18:43:01 -080099 return AllocArrayFromCodeResolved<false, instrumented_bool>(klass, component_count, method, self, \
Hiroshi Yamauchibb8f0ab2014-01-27 16:50:29 -0800100 allocator_type); \
101} \
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800102extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700103 uint32_t type_idx, int32_t component_count, ArtMethod* method, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700104 REQUIRES_SHARED(Locks::mutator_lock_) { \
Ian Rogers1d8cdbc2014-09-22 22:51:09 -0700105 ScopedQuickEntrypointChecks sqec(self); \
Andreas Gampea5b09a62016-11-17 15:21:22 -0800106 return AllocArrayFromCode<true, instrumented_bool>(dex::TypeIndex(type_idx), \
107 component_count, \
108 method, \
109 self, \
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800110 allocator_type); \
111} \
112extern "C" mirror::Array* artCheckAndAllocArrayFromCode##suffix##suffix2( \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700113 uint32_t type_idx, int32_t component_count, ArtMethod* method, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700114 REQUIRES_SHARED(Locks::mutator_lock_) { \
Ian Rogers1d8cdbc2014-09-22 22:51:09 -0700115 ScopedQuickEntrypointChecks sqec(self); \
Chih-Hung Hsiehfba39972016-05-11 11:26:48 -0700116 if (!(instrumented_bool)) { \
Andreas Gampea5b09a62016-11-17 15:21:22 -0800117 return CheckAndAllocArrayFromCode(dex::TypeIndex(type_idx), \
118 component_count, \
119 method, \
120 self, \
121 false, \
122 allocator_type); \
Hiroshi Yamauchicbbb0802013-11-21 12:42:36 -0800123 } else { \
Andreas Gampea5b09a62016-11-17 15:21:22 -0800124 return CheckAndAllocArrayFromCodeInstrumented(dex::TypeIndex(type_idx), \
125 component_count, \
126 method, \
127 self, \
128 false, \
129 allocator_type); \
Hiroshi Yamauchicbbb0802013-11-21 12:42:36 -0800130 } \
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800131} \
132extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700133 uint32_t type_idx, int32_t component_count, ArtMethod* method, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700134 REQUIRES_SHARED(Locks::mutator_lock_) { \
Ian Rogers1d8cdbc2014-09-22 22:51:09 -0700135 ScopedQuickEntrypointChecks sqec(self); \
Chih-Hung Hsiehfba39972016-05-11 11:26:48 -0700136 if (!(instrumented_bool)) { \
Andreas Gampea5b09a62016-11-17 15:21:22 -0800137 return CheckAndAllocArrayFromCode(dex::TypeIndex(type_idx), \
138 component_count, \
139 method, \
140 self, \
141 true, \
142 allocator_type); \
Hiroshi Yamauchicbbb0802013-11-21 12:42:36 -0800143 } else { \
Andreas Gampea5b09a62016-11-17 15:21:22 -0800144 return CheckAndAllocArrayFromCodeInstrumented(dex::TypeIndex(type_idx), \
145 component_count, \
146 method, \
147 self, \
148 true, \
149 allocator_type); \
Hiroshi Yamauchicbbb0802013-11-21 12:42:36 -0800150 } \
Jeff Hao848f70a2014-01-15 13:49:50 -0800151} \
152extern "C" mirror::String* artAllocStringFromBytesFromCode##suffix##suffix2( \
153 mirror::ByteArray* byte_array, int32_t high, int32_t offset, int32_t byte_count, \
154 Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700155 REQUIRES_SHARED(Locks::mutator_lock_) { \
Jeff Hao848f70a2014-01-15 13:49:50 -0800156 ScopedQuickEntrypointChecks sqec(self); \
157 StackHandleScope<1> hs(self); \
158 Handle<mirror::ByteArray> handle_array(hs.NewHandle(byte_array)); \
159 return mirror::String::AllocFromByteArray<instrumented_bool>(self, byte_count, handle_array, \
160 offset, high, allocator_type); \
161} \
162extern "C" mirror::String* artAllocStringFromCharsFromCode##suffix##suffix2( \
163 int32_t offset, int32_t char_count, mirror::CharArray* char_array, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700164 REQUIRES_SHARED(Locks::mutator_lock_) { \
Jeff Hao848f70a2014-01-15 13:49:50 -0800165 StackHandleScope<1> hs(self); \
166 Handle<mirror::CharArray> handle_array(hs.NewHandle(char_array)); \
167 return mirror::String::AllocFromCharArray<instrumented_bool>(self, char_count, handle_array, \
168 offset, allocator_type); \
169} \
Chih-Hung Hsiehfba39972016-05-11 11:26:48 -0700170extern "C" mirror::String* artAllocStringFromStringFromCode##suffix##suffix2( /* NOLINT */ \
Jeff Hao848f70a2014-01-15 13:49:50 -0800171 mirror::String* string, Thread* self) \
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700172 REQUIRES_SHARED(Locks::mutator_lock_) { \
Jeff Hao848f70a2014-01-15 13:49:50 -0800173 StackHandleScope<1> hs(self); \
174 Handle<mirror::String> handle_string(hs.NewHandle(string)); \
175 return mirror::String::AllocFromString<instrumented_bool>(self, handle_string->GetLength(), \
176 handle_string, 0, allocator_type); \
Ian Rogers57b86d42012-03-27 16:05:41 -0700177}
178
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800179#define GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(suffix, allocator_type) \
180 GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, Instrumented, true, allocator_type) \
181 GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, , false, allocator_type)
Ian Rogers57b86d42012-03-27 16:05:41 -0700182
Mathieu Chartiere6da9af2013-12-16 11:54:42 -0800183GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(DlMalloc, gc::kAllocatorTypeDlMalloc)
184GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(RosAlloc, gc::kAllocatorTypeRosAlloc)
Mathieu Chartiercbb2d202013-11-14 17:45:16 -0800185GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(BumpPointer, gc::kAllocatorTypeBumpPointer)
Mathieu Chartier692fafd2013-11-29 17:24:40 -0800186GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(TLAB, gc::kAllocatorTypeTLAB)
Hiroshi Yamauchi2cd334a2015-01-09 14:03:35 -0800187GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(Region, gc::kAllocatorTypeRegion)
188GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(RegionTLAB, gc::kAllocatorTypeRegionTLAB)
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -0700189
Mathieu Chartierd8891782014-03-02 13:28:37 -0800190#define GENERATE_ENTRYPOINTS(suffix) \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700191extern "C" void* art_quick_alloc_array##suffix(uint32_t, int32_t, ArtMethod* ref); \
192extern "C" void* art_quick_alloc_array_resolved##suffix(mirror::Class* klass, int32_t, ArtMethod* ref); \
193extern "C" void* art_quick_alloc_array_with_access_check##suffix(uint32_t, int32_t, ArtMethod* ref); \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +0000194extern "C" void* art_quick_alloc_object_resolved##suffix(mirror::Class* klass); \
195extern "C" void* art_quick_alloc_object_initialized##suffix(mirror::Class* klass); \
196extern "C" void* art_quick_alloc_object_with_checks##suffix(mirror::Class* klass); \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700197extern "C" void* art_quick_check_and_alloc_array##suffix(uint32_t, int32_t, ArtMethod* ref); \
198extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix(uint32_t, int32_t, ArtMethod* ref); \
Jeff Hao848f70a2014-01-15 13:49:50 -0800199extern "C" void* art_quick_alloc_string_from_bytes##suffix(void*, int32_t, int32_t, int32_t); \
200extern "C" void* art_quick_alloc_string_from_chars##suffix(int32_t, int32_t, void*); \
201extern "C" void* art_quick_alloc_string_from_string##suffix(void*); \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700202extern "C" void* art_quick_alloc_array##suffix##_instrumented(uint32_t, int32_t, ArtMethod* ref); \
203extern "C" void* art_quick_alloc_array_resolved##suffix##_instrumented(mirror::Class* klass, int32_t, ArtMethod* ref); \
204extern "C" void* art_quick_alloc_array_with_access_check##suffix##_instrumented(uint32_t, int32_t, ArtMethod* ref); \
205extern "C" void* art_quick_alloc_object##suffix##_instrumented(uint32_t type_idx, ArtMethod* ref); \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +0000206extern "C" void* art_quick_alloc_object_resolved##suffix##_instrumented(mirror::Class* klass); \
207extern "C" void* art_quick_alloc_object_initialized##suffix##_instrumented(mirror::Class* klass); \
208extern "C" void* art_quick_alloc_object_with_checks##suffix##_instrumented(mirror::Class* klass); \
Mathieu Chartiere401d142015-04-22 13:56:20 -0700209extern "C" void* art_quick_check_and_alloc_array##suffix##_instrumented(uint32_t, int32_t, ArtMethod* ref); \
210extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix##_instrumented(uint32_t, int32_t, ArtMethod* ref); \
Jeff Hao848f70a2014-01-15 13:49:50 -0800211extern "C" void* art_quick_alloc_string_from_bytes##suffix##_instrumented(void*, int32_t, int32_t, int32_t); \
212extern "C" void* art_quick_alloc_string_from_chars##suffix##_instrumented(int32_t, int32_t, void*); \
213extern "C" void* art_quick_alloc_string_from_string##suffix##_instrumented(void*); \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800214void SetQuickAllocEntryPoints##suffix(QuickEntryPoints* qpoints, bool instrumented) { \
215 if (instrumented) { \
216 qpoints->pAllocArray = art_quick_alloc_array##suffix##_instrumented; \
217 qpoints->pAllocArrayResolved = art_quick_alloc_array_resolved##suffix##_instrumented; \
218 qpoints->pAllocArrayWithAccessCheck = art_quick_alloc_array_with_access_check##suffix##_instrumented; \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800219 qpoints->pAllocObjectResolved = art_quick_alloc_object_resolved##suffix##_instrumented; \
220 qpoints->pAllocObjectInitialized = art_quick_alloc_object_initialized##suffix##_instrumented; \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +0000221 qpoints->pAllocObjectWithChecks = art_quick_alloc_object_with_checks##suffix##_instrumented; \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800222 qpoints->pCheckAndAllocArray = art_quick_check_and_alloc_array##suffix##_instrumented; \
223 qpoints->pCheckAndAllocArrayWithAccessCheck = art_quick_check_and_alloc_array_with_access_check##suffix##_instrumented; \
Jeff Hao848f70a2014-01-15 13:49:50 -0800224 qpoints->pAllocStringFromBytes = art_quick_alloc_string_from_bytes##suffix##_instrumented; \
225 qpoints->pAllocStringFromChars = art_quick_alloc_string_from_chars##suffix##_instrumented; \
226 qpoints->pAllocStringFromString = art_quick_alloc_string_from_string##suffix##_instrumented; \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800227 } else { \
228 qpoints->pAllocArray = art_quick_alloc_array##suffix; \
229 qpoints->pAllocArrayResolved = art_quick_alloc_array_resolved##suffix; \
230 qpoints->pAllocArrayWithAccessCheck = art_quick_alloc_array_with_access_check##suffix; \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800231 qpoints->pAllocObjectResolved = art_quick_alloc_object_resolved##suffix; \
232 qpoints->pAllocObjectInitialized = art_quick_alloc_object_initialized##suffix; \
Nicolas Geoffray0d3998b2017-01-12 15:35:12 +0000233 qpoints->pAllocObjectWithChecks = art_quick_alloc_object_with_checks##suffix; \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800234 qpoints->pCheckAndAllocArray = art_quick_check_and_alloc_array##suffix; \
235 qpoints->pCheckAndAllocArrayWithAccessCheck = art_quick_check_and_alloc_array_with_access_check##suffix; \
Jeff Hao848f70a2014-01-15 13:49:50 -0800236 qpoints->pAllocStringFromBytes = art_quick_alloc_string_from_bytes##suffix; \
237 qpoints->pAllocStringFromChars = art_quick_alloc_string_from_chars##suffix; \
238 qpoints->pAllocStringFromString = art_quick_alloc_string_from_string##suffix; \
Mathieu Chartierd8891782014-03-02 13:28:37 -0800239 } \
240}
241
242// Generate the entrypoint functions.
Ian Rogersc3ccc102014-06-25 11:52:14 -0700243#if !defined(__APPLE__) || !defined(__LP64__)
Andreas Gampec8ccf682014-09-29 20:07:43 -0700244GENERATE_ENTRYPOINTS(_dlmalloc)
245GENERATE_ENTRYPOINTS(_rosalloc)
246GENERATE_ENTRYPOINTS(_bump_pointer)
247GENERATE_ENTRYPOINTS(_tlab)
Hiroshi Yamauchi2cd334a2015-01-09 14:03:35 -0800248GENERATE_ENTRYPOINTS(_region)
249GENERATE_ENTRYPOINTS(_region_tlab)
Ian Rogersc3ccc102014-06-25 11:52:14 -0700250#endif
Mathieu Chartierd8891782014-03-02 13:28:37 -0800251
252static bool entry_points_instrumented = false;
253static gc::AllocatorType entry_points_allocator = gc::kAllocatorTypeDlMalloc;
254
255void SetQuickAllocEntryPointsAllocator(gc::AllocatorType allocator) {
256 entry_points_allocator = allocator;
257}
258
259void SetQuickAllocEntryPointsInstrumented(bool instrumented) {
260 entry_points_instrumented = instrumented;
261}
262
Mathieu Chartier5ace2012016-11-30 10:15:41 -0800263void ResetQuickAllocEntryPoints(QuickEntryPoints* qpoints, bool is_marking) {
Andreas Gampe48cc32c2015-04-07 02:53:04 +0000264#if !defined(__APPLE__) || !defined(__LP64__)
Ian Rogersde2db522014-11-04 14:43:18 -0800265 switch (entry_points_allocator) {
Mathieu Chartierd8891782014-03-02 13:28:37 -0800266 case gc::kAllocatorTypeDlMalloc: {
267 SetQuickAllocEntryPoints_dlmalloc(qpoints, entry_points_instrumented);
Ian Rogers7dc9c812014-11-04 15:10:55 -0800268 return;
Mathieu Chartierd8891782014-03-02 13:28:37 -0800269 }
270 case gc::kAllocatorTypeRosAlloc: {
271 SetQuickAllocEntryPoints_rosalloc(qpoints, entry_points_instrumented);
Ian Rogers7dc9c812014-11-04 15:10:55 -0800272 return;
Mathieu Chartierd8891782014-03-02 13:28:37 -0800273 }
274 case gc::kAllocatorTypeBumpPointer: {
275 CHECK(kMovingCollector);
276 SetQuickAllocEntryPoints_bump_pointer(qpoints, entry_points_instrumented);
Ian Rogers7dc9c812014-11-04 15:10:55 -0800277 return;
Mathieu Chartierd8891782014-03-02 13:28:37 -0800278 }
279 case gc::kAllocatorTypeTLAB: {
280 CHECK(kMovingCollector);
281 SetQuickAllocEntryPoints_tlab(qpoints, entry_points_instrumented);
Ian Rogers7dc9c812014-11-04 15:10:55 -0800282 return;
Mathieu Chartierd8891782014-03-02 13:28:37 -0800283 }
Hiroshi Yamauchi2cd334a2015-01-09 14:03:35 -0800284 case gc::kAllocatorTypeRegion: {
285 CHECK(kMovingCollector);
286 SetQuickAllocEntryPoints_region(qpoints, entry_points_instrumented);
287 return;
288 }
289 case gc::kAllocatorTypeRegionTLAB: {
290 CHECK(kMovingCollector);
Mathieu Chartier5ace2012016-11-30 10:15:41 -0800291 if (is_marking) {
292 SetQuickAllocEntryPoints_region_tlab(qpoints, entry_points_instrumented);
293 } else {
294 // Not marking means we need no read barriers and can just use the normal TLAB case.
295 SetQuickAllocEntryPoints_tlab(qpoints, entry_points_instrumented);
296 }
Hiroshi Yamauchi2cd334a2015-01-09 14:03:35 -0800297 return;
298 }
Andreas Gampe48cc32c2015-04-07 02:53:04 +0000299 default:
300 break;
Mathieu Chartierd8891782014-03-02 13:28:37 -0800301 }
Andreas Gampe48cc32c2015-04-07 02:53:04 +0000302#else
303 UNUSED(qpoints);
Mathieu Chartier5ace2012016-11-30 10:15:41 -0800304 UNUSED(is_marking);
Andreas Gampe48cc32c2015-04-07 02:53:04 +0000305#endif
306 UNIMPLEMENTED(FATAL);
Ian Rogersde2db522014-11-04 14:43:18 -0800307 UNREACHABLE();
Mathieu Chartierd8891782014-03-02 13:28:37 -0800308}
309
Ian Rogers57b86d42012-03-27 16:05:41 -0700310} // namespace art