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"
18#include "entrypoints/entrypoint_utils.h"
19#include "mirror/art_method-inl.h"
20#include "mirror/class-inl.h"
21#include "mirror/object_array-inl.h"
22#include "mirror/object-inl.h"
23
24namespace art {
25
26extern "C" mirror::Object* artAllocObjectFromCode(uint32_t type_idx, mirror::ArtMethod* method,
27                                                  Thread* self, mirror::ArtMethod** sp)
28    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
29  FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
30  return AllocObjectFromCode(type_idx, method, self, false);
31}
32
33extern "C" mirror::Object* artAllocObjectFromCodeWithAccessCheck(uint32_t type_idx,
34                                                                 mirror::ArtMethod* method,
35                                                                 Thread* self,
36                                                                 mirror::ArtMethod** sp)
37    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
38  FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
39  return AllocObjectFromCode(type_idx, method, self, true);
40}
41
42extern "C" mirror::Array* artAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* method,
43                                                int32_t component_count, Thread* self,
44                                                mirror::ArtMethod** sp)
45    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
46  FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
47  return AllocArrayFromCode(type_idx, method, component_count, self, false);
48}
49
50extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheck(uint32_t type_idx,
51                                                               mirror::ArtMethod* method,
52                                                               int32_t component_count,
53                                                               Thread* self,
54                                                               mirror::ArtMethod** sp)
55    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
56  FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
57  return AllocArrayFromCode(type_idx, method, component_count, self, true);
58}
59
60extern "C" mirror::Array* artCheckAndAllocArrayFromCode(uint32_t type_idx,
61                                                        mirror::ArtMethod* method,
62                                                        int32_t component_count, Thread* self,
63                                                        mirror::ArtMethod** sp)
64    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
65  FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
66  return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false);
67}
68
69extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck(uint32_t type_idx,
70                                                                       mirror::ArtMethod* method,
71                                                                       int32_t component_count,
72                                                                       Thread* self,
73                                                                       mirror::ArtMethod** sp)
74    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
75  FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
76  return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true);
77}
78
79}  // namespace art
80