Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 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 "callee_save_frame.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 18 | #include "entrypoints/entrypoint_utils.h" |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 19 | #include "mirror/art_method-inl.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 20 | #include "mirror/class-inl.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 21 | #include "mirror/object_array-inl.h" |
Ian Rogers | 4f6ad8a | 2013-03-18 15:27:28 -0700 | [diff] [blame] | 22 | #include "mirror/object-inl.h" |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 23 | |
| 24 | namespace art { |
| 25 | |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame^] | 26 | #define GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, suffix2, instrumented_bool, allocator_type) \ |
| 27 | extern "C" mirror::Object* artAllocObjectFromCode ##suffix##suffix2( \ |
| 28 | uint32_t type_idx, mirror::ArtMethod* method, Thread* self, mirror::ArtMethod** sp) \ |
| 29 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ |
| 30 | FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \ |
| 31 | return AllocObjectFromCode<false, instrumented_bool>(type_idx, method, self, allocator_type); \ |
| 32 | } \ |
| 33 | extern "C" mirror::Object* artAllocObjectFromCodeWithAccessCheck##suffix##suffix2( \ |
| 34 | uint32_t type_idx, mirror::ArtMethod* method, Thread* self, mirror::ArtMethod** sp) \ |
| 35 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ |
| 36 | FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \ |
| 37 | return AllocObjectFromCode<true, instrumented_bool>(type_idx, method, self, allocator_type); \ |
| 38 | } \ |
| 39 | extern "C" mirror::Array* artAllocArrayFromCode##suffix##suffix2( \ |
| 40 | uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, \ |
| 41 | mirror::ArtMethod** sp) \ |
| 42 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ |
| 43 | FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \ |
| 44 | return AllocArrayFromCode<false, instrumented_bool>(type_idx, method, component_count, self, \ |
| 45 | allocator_type); \ |
| 46 | } \ |
| 47 | extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \ |
| 48 | uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, \ |
| 49 | mirror::ArtMethod** sp) \ |
| 50 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ |
| 51 | FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \ |
| 52 | return AllocArrayFromCode<true, instrumented_bool>(type_idx, method, component_count, self, \ |
| 53 | allocator_type); \ |
| 54 | } \ |
| 55 | extern "C" mirror::Array* artCheckAndAllocArrayFromCode##suffix##suffix2( \ |
| 56 | uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, \ |
| 57 | mirror::ArtMethod** sp) \ |
| 58 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ |
| 59 | FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \ |
| 60 | return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false, allocator_type); \ |
| 61 | } \ |
| 62 | extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \ |
| 63 | uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, \ |
| 64 | mirror::ArtMethod** sp) \ |
| 65 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ |
| 66 | FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \ |
| 67 | return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true, allocator_type); \ |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 68 | } |
| 69 | |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame^] | 70 | #define GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(suffix, allocator_type) \ |
| 71 | GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, Instrumented, true, allocator_type) \ |
| 72 | GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, , false, allocator_type) |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 73 | |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame^] | 74 | GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(, gc::kAllocatorTypeFreeList) |
| 75 | GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(BumpPointer, gc::kAllocatorTypeBumpPointer) |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 76 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 77 | } // namespace art |