blob: b71b880939e7369df960cb1ac6cf097dccfb0294 [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
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080026#define GENERATE_ENTRYPOINTS_FOR_ALLOCATOR_INST(suffix, suffix2, instrumented_bool, allocator_type) \
27extern "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} \
33extern "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} \
39extern "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} \
47extern "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} \
55extern "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} \
62extern "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 Rogers57b86d42012-03-27 16:05:41 -070068}
69
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080070#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 Rogers57b86d42012-03-27 16:05:41 -070073
Mathieu Chartiercbb2d202013-11-14 17:45:16 -080074GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(, gc::kAllocatorTypeFreeList)
75GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(BumpPointer, gc::kAllocatorTypeBumpPointer)
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070076
Ian Rogers57b86d42012-03-27 16:05:41 -070077} // namespace art