portable_alloc_entrypoints.cc revision ea46f950e7a51585db293cd7f047de190a482414
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.h"
18#include "mirror/art_method-inl.h"
19#include "mirror/object-inl.h"
20
21namespace art {
22
23extern "C" mirror::Object* art_portable_alloc_object_from_code(uint32_t type_idx,
24                                                               mirror::ArtMethod* referrer,
25                                                               Thread* thread)
26    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
27  return AllocObjectFromCode(type_idx, referrer, thread, false);
28}
29
30extern "C" mirror::Object* art_portable_alloc_object_from_code_with_access_check(uint32_t type_idx,
31                                                                                 mirror::ArtMethod* referrer,
32                                                                                 Thread* thread)
33    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
34  return AllocObjectFromCode(type_idx, referrer, thread, true);
35}
36
37extern "C" mirror::Object* art_portable_alloc_array_from_code(uint32_t type_idx,
38                                                              mirror::ArtMethod* referrer,
39                                                              uint32_t length,
40                                                              Thread* self)
41    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
42  return AllocArrayFromCode(type_idx, referrer, length, self, false);
43}
44
45extern "C" mirror::Object* art_portable_alloc_array_from_code_with_access_check(uint32_t type_idx,
46                                                                                mirror::ArtMethod* referrer,
47                                                                                uint32_t length,
48                                                                                Thread* self)
49    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
50  return AllocArrayFromCode(type_idx, referrer, length, self, true);
51}
52
53extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code(uint32_t type_idx,
54                                                                        mirror::ArtMethod* referrer,
55                                                                        uint32_t length,
56                                                                        Thread* thread)
57    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
58  return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, false);
59}
60
61extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx,
62                                                                                          mirror::ArtMethod* referrer,
63                                                                                          uint32_t length,
64                                                                                          Thread* thread)
65    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
66  return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, true);
67}
68
69}  // namespace art
70