blob: 6f7b1ab19bfd33d5608c981758c3d2859f2be39c [file] [log] [blame]
Ian Rogers57b86d42012-03-27 16:05:41 -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
17#include "callee_save_frame.h"
Ian Rogers7655f292013-07-29 11:07:13 -070018#include "entrypoints/entrypoint_utils.h"
Brian Carlstromea46f952013-07-30 01:26:50 -070019#include "mirror/art_method-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080020#include "mirror/class-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080021#include "mirror/object_array-inl.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070022#include "mirror/object-inl.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070023
24namespace art {
25
Brian Carlstromea46f952013-07-30 01:26:50 -070026extern "C" mirror::Object* artAllocObjectFromCode(uint32_t type_idx, mirror::ArtMethod* method,
27 Thread* self, mirror::ArtMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070028 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070029 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
30 return AllocObjectFromCode(type_idx, method, self, false);
31}
32
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080033extern "C" mirror::Object* artAllocObjectFromCodeWithAccessCheck(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070034 mirror::ArtMethod* method,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080035 Thread* self,
Brian Carlstromea46f952013-07-30 01:26:50 -070036 mirror::ArtMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070037 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070038 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
39 return AllocObjectFromCode(type_idx, method, self, true);
40}
41
Brian Carlstromea46f952013-07-30 01:26:50 -070042extern "C" mirror::Array* artAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* method,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080043 int32_t component_count, Thread* self,
Brian Carlstromea46f952013-07-30 01:26:50 -070044 mirror::ArtMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070045 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070046 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
Ian Rogers50b35e22012-10-04 10:09:15 -070047 return AllocArrayFromCode(type_idx, method, component_count, self, false);
Ian Rogers57b86d42012-03-27 16:05:41 -070048}
49
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080050extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheck(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070051 mirror::ArtMethod* method,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080052 int32_t component_count,
53 Thread* self,
Brian Carlstromea46f952013-07-30 01:26:50 -070054 mirror::ArtMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070055 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070056 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
Ian Rogers50b35e22012-10-04 10:09:15 -070057 return AllocArrayFromCode(type_idx, method, component_count, self, true);
Ian Rogers57b86d42012-03-27 16:05:41 -070058}
59
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080060extern "C" mirror::Array* artCheckAndAllocArrayFromCode(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070061 mirror::ArtMethod* method,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080062 int32_t component_count, Thread* self,
Brian Carlstromea46f952013-07-30 01:26:50 -070063 mirror::ArtMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070064 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070065 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
66 return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false);
67}
68
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080069extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck(uint32_t type_idx,
Brian Carlstromea46f952013-07-30 01:26:50 -070070 mirror::ArtMethod* method,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080071 int32_t component_count,
72 Thread* self,
Brian Carlstromea46f952013-07-30 01:26:50 -070073 mirror::ArtMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070074 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070075 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
76 return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true);
77}
78
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070079extern "C" mirror::Object* artAllocObjectFromCodeInstrumented(uint32_t type_idx, mirror::ArtMethod* method,
80 Thread* self, mirror::ArtMethod** sp)
81 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
82 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
83 return AllocObjectFromCodeInstrumented(type_idx, method, self, false);
84}
85
86extern "C" mirror::Object* artAllocObjectFromCodeWithAccessCheckInstrumented(uint32_t type_idx,
87 mirror::ArtMethod* method,
88 Thread* self,
89 mirror::ArtMethod** sp)
90 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
91 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
92 return AllocObjectFromCodeInstrumented(type_idx, method, self, true);
93}
94
95extern "C" mirror::Array* artAllocArrayFromCodeInstrumented(uint32_t type_idx, mirror::ArtMethod* method,
96 int32_t component_count, Thread* self,
97 mirror::ArtMethod** sp)
98 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
99 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
100 return AllocArrayFromCodeInstrumented(type_idx, method, component_count, self, false);
101}
102
103extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheckInstrumented(uint32_t type_idx,
104 mirror::ArtMethod* method,
105 int32_t component_count,
106 Thread* self,
107 mirror::ArtMethod** sp)
108 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
109 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
110 return AllocArrayFromCodeInstrumented(type_idx, method, component_count, self, true);
111}
112
113extern "C" mirror::Array* artCheckAndAllocArrayFromCodeInstrumented(uint32_t type_idx,
114 mirror::ArtMethod* method,
115 int32_t component_count, Thread* self,
116 mirror::ArtMethod** sp)
117 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
118 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
119 return CheckAndAllocArrayFromCodeInstrumented(type_idx, method, component_count, self, false);
120}
121
122extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented(uint32_t type_idx,
123 mirror::ArtMethod* method,
124 int32_t component_count,
125 Thread* self,
126 mirror::ArtMethod** sp)
127 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
128 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
129 return CheckAndAllocArrayFromCodeInstrumented(type_idx, method, component_count, self, true);
130}
131
Ian Rogers57b86d42012-03-27 16:05:41 -0700132} // namespace art