blob: de95f7dfbcfce60f92664020e0aa7e45f4ff7288 [file] [log] [blame]
Ian Rogers7655f292013-07-29 11:07:13 -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
Mingyao Yang98d1cc82014-05-15 17:02:16 -070017#include "entrypoints/entrypoint_utils-inl.h"
Brian Carlstromea46f952013-07-30 01:26:50 -070018#include "mirror/art_method-inl.h"
Ian Rogers7655f292013-07-29 11:07:13 -070019#include "mirror/object-inl.h"
20
21namespace art {
22
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080023static constexpr gc::AllocatorType kPortableAllocatorType =
24 gc::kUseRosAlloc ? gc::kAllocatorTypeRosAlloc : gc::kAllocatorTypeDlMalloc;
25
Ian Rogers7655f292013-07-29 11:07:13 -070026extern "C" mirror::Object* art_portable_alloc_object_from_code(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070027 mirror::ArtMethod* referrer,
Ian Rogers7655f292013-07-29 11:07:13 -070028 Thread* thread)
29 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080030 return AllocObjectFromCode<false, true>(type_idx, referrer, thread, kPortableAllocatorType);
Ian Rogers7655f292013-07-29 11:07:13 -070031}
32
33extern "C" mirror::Object* art_portable_alloc_object_from_code_with_access_check(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070034 mirror::ArtMethod* referrer,
Ian Rogers7655f292013-07-29 11:07:13 -070035 Thread* thread)
36 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080037 return AllocObjectFromCode<true, true>(type_idx, referrer, thread, kPortableAllocatorType);
Ian Rogers7655f292013-07-29 11:07:13 -070038}
39
40extern "C" mirror::Object* art_portable_alloc_array_from_code(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070041 mirror::ArtMethod* referrer,
Ian Rogers7655f292013-07-29 11:07:13 -070042 uint32_t length,
43 Thread* self)
44 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080045 return AllocArrayFromCode<false, true>(type_idx, referrer, length, self,
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080046 kPortableAllocatorType);
Ian Rogers7655f292013-07-29 11:07:13 -070047}
48
49extern "C" mirror::Object* art_portable_alloc_array_from_code_with_access_check(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070050 mirror::ArtMethod* referrer,
Ian Rogers7655f292013-07-29 11:07:13 -070051 uint32_t length,
52 Thread* self)
53 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080054 return AllocArrayFromCode<true, true>(type_idx, referrer, length, self,
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080055 kPortableAllocatorType);
Ian Rogers7655f292013-07-29 11:07:13 -070056}
57
58extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070059 mirror::ArtMethod* referrer,
Ian Rogers7655f292013-07-29 11:07:13 -070060 uint32_t length,
61 Thread* thread)
62 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Hiroshi Yamauchicbbb0802013-11-21 12:42:36 -080063 return CheckAndAllocArrayFromCodeInstrumented(type_idx, referrer, length, thread, false,
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080064 kPortableAllocatorType);
Ian Rogers7655f292013-07-29 11:07:13 -070065}
66
67extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070068 mirror::ArtMethod* referrer,
Ian Rogers7655f292013-07-29 11:07:13 -070069 uint32_t length,
70 Thread* thread)
71 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Hiroshi Yamauchicbbb0802013-11-21 12:42:36 -080072 return CheckAndAllocArrayFromCodeInstrumented(type_idx, referrer, length, thread, true,
Mathieu Chartiere6da9af2013-12-16 11:54:42 -080073 kPortableAllocatorType);
Ian Rogers7655f292013-07-29 11:07:13 -070074}
75
76} // namespace art