1 /* 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 17 #include "entrypoints/entrypoint_utils-inl.h" 18 #include "mirror/art_method-inl.h" 19 #include "mirror/object-inl.h" 20 21 namespace art { 22 23 static constexpr gc::AllocatorType kPortableAllocatorType = 24 gc::kUseRosAlloc ? gc::kAllocatorTypeRosAlloc : gc::kAllocatorTypeDlMalloc; 25 26 extern "C" mirror::Object* art_portable_alloc_object_from_code(uint32_t type_idx, 27 mirror::ArtMethod* referrer, 28 Thread* thread) 29 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 30 return AllocObjectFromCode<false, true>(type_idx, referrer, thread, kPortableAllocatorType); 31 } 32 33 extern "C" mirror::Object* art_portable_alloc_object_from_code_with_access_check(uint32_t type_idx, 34 mirror::ArtMethod* referrer, 35 Thread* thread) 36 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 37 return AllocObjectFromCode<true, true>(type_idx, referrer, thread, kPortableAllocatorType); 38 } 39 40 extern "C" mirror::Object* art_portable_alloc_array_from_code(uint32_t type_idx, 41 mirror::ArtMethod* referrer, 42 uint32_t length, 43 Thread* self) 44 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 45 return AllocArrayFromCode<false, true>(type_idx, referrer, length, self, 46 kPortableAllocatorType); 47 } 48 49 extern "C" mirror::Object* art_portable_alloc_array_from_code_with_access_check(uint32_t type_idx, 50 mirror::ArtMethod* referrer, 51 uint32_t length, 52 Thread* self) 53 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 54 return AllocArrayFromCode<true, true>(type_idx, referrer, length, self, 55 kPortableAllocatorType); 56 } 57 58 extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code(uint32_t type_idx, 59 mirror::ArtMethod* referrer, 60 uint32_t length, 61 Thread* thread) 62 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 63 return CheckAndAllocArrayFromCodeInstrumented(type_idx, referrer, length, thread, false, 64 kPortableAllocatorType); 65 } 66 67 extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx, 68 mirror::ArtMethod* referrer, 69 uint32_t length, 70 Thread* thread) 71 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 72 return CheckAndAllocArrayFromCodeInstrumented(type_idx, referrer, length, thread, true, 73 kPortableAllocatorType); 74 } 75 76 } // namespace art 77