blob: 954450fe7a7299fa89fc621bc02fc8742bc5dbf4 [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
Ian Rogers166db042013-07-26 12:05:57 -070017#ifndef ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
18#define ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
Ian Rogers57b86d42012-03-27 16:05:41 -070019
Ian Rogers848871b2013-08-05 10:56:33 -070020#include <jni.h>
21
Andreas Gampe7fbc4a52018-11-28 08:26:47 -080022#include "base/locks.h"
Ian Rogers848871b2013-08-05 10:56:33 -070023#include "base/macros.h"
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +010024#include "deoptimization_kind.h"
Ian Rogers848871b2013-08-05 10:56:33 -070025#include "offsets.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070026
Ian Rogersdd7624d2014-03-14 17:43:00 -070027#define QUICK_ENTRYPOINT_OFFSET(ptr_size, x) \
28 Thread::QuickEntryPointOffset<ptr_size>(OFFSETOF_MEMBER(QuickEntryPoints, x))
Ian Rogers57b86d42012-03-27 16:05:41 -070029
30namespace art {
Ian Rogers848871b2013-08-05 10:56:33 -070031
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080032namespace mirror {
Andreas Gampe1cc7dba2014-12-17 18:43:01 -080033class Array;
Brian Carlstromea46f952013-07-30 01:26:50 -070034class Class;
Roland Levillain0d5a2812015-11-13 10:07:31 +000035template<class MirrorType> class CompressedReference;
Brian Carlstromea46f952013-07-30 01:26:50 -070036class Object;
Vladimir Marko552a1342017-10-31 10:56:47 +000037class String;
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080038} // namespace mirror
Ian Rogers848871b2013-08-05 10:56:33 -070039
Mathieu Chartiere401d142015-04-22 13:56:20 -070040class ArtMethod;
Roland Levillain0d5a2812015-11-13 10:07:31 +000041template<class MirrorType> class GcRoot;
Roland Levillainad0777d2018-02-12 20:00:18 +000042template<class MirrorType> class StackReference;
Ian Rogers57b86d42012-03-27 16:05:41 -070043class Thread;
44
Ian Rogers166db042013-07-26 12:05:57 -070045// Pointers to functions that are called by quick compiler generated code via thread-local storage.
46struct PACKED(4) QuickEntryPoints {
Andreas Gampe98430592014-07-27 19:44:50 -070047#define ENTRYPOINT_ENUM(name, rettype, ...) rettype ( * p ## name )( __VA_ARGS__ );
48#include "quick_entrypoints_list.h"
49 QUICK_ENTRYPOINT_LIST(ENTRYPOINT_ENUM)
50#undef QUICK_ENTRYPOINT_LIST
51#undef ENTRYPOINT_ENUM
Ian Rogers57b86d42012-03-27 16:05:41 -070052};
53
Anwar Ghuloum63937db2013-05-24 09:08:32 -070054
Ian Rogers693ff612013-02-01 10:56:12 -080055// JNI entrypoints.
Ian Rogers1eb512d2013-10-18 15:42:20 -070056// TODO: NO_THREAD_SAFETY_ANALYSIS due to different control paths depending on fast JNI.
57extern uint32_t JniMethodStart(Thread* self) NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Igor Murashkin9d4b6da2016-07-29 09:51:58 -070058extern uint32_t JniMethodFastStart(Thread* self) NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Ian Rogers693ff612013-02-01 10:56:12 -080059extern uint32_t JniMethodStartSynchronized(jobject to_lock, Thread* self)
Ian Rogers1eb512d2013-10-18 15:42:20 -070060 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Ian Rogers693ff612013-02-01 10:56:12 -080061extern void JniMethodEnd(uint32_t saved_local_ref_cookie, Thread* self)
Ian Rogers1eb512d2013-10-18 15:42:20 -070062 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Igor Murashkin9d4b6da2016-07-29 09:51:58 -070063extern void JniMethodFastEnd(uint32_t saved_local_ref_cookie, Thread* self)
64 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Ian Rogers693ff612013-02-01 10:56:12 -080065extern void JniMethodEndSynchronized(uint32_t saved_local_ref_cookie, jobject locked,
66 Thread* self)
Ian Rogers1eb512d2013-10-18 15:42:20 -070067 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Ian Rogers693ff612013-02-01 10:56:12 -080068extern mirror::Object* JniMethodEndWithReference(jobject result, uint32_t saved_local_ref_cookie,
69 Thread* self)
Ian Rogers1eb512d2013-10-18 15:42:20 -070070 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Igor Murashkinaf1e2992016-10-12 17:44:50 -070071extern mirror::Object* JniMethodFastEndWithReference(jobject result,
72 uint32_t saved_local_ref_cookie,
73 Thread* self)
74 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
75
Ian Rogers693ff612013-02-01 10:56:12 -080076
77extern mirror::Object* JniMethodEndWithReferenceSynchronized(jobject result,
78 uint32_t saved_local_ref_cookie,
79 jobject locked, Thread* self)
Ian Rogers1eb512d2013-10-18 15:42:20 -070080 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
Ian Rogers693ff612013-02-01 10:56:12 -080081
Vladimir Marko552a1342017-10-31 10:56:47 +000082extern "C" mirror::String* artStringBuilderAppend(uint32_t format,
83 const uint32_t* args,
84 Thread* self)
85 REQUIRES_SHARED(Locks::mutator_lock_) HOT_ATTR;
86
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -070087extern void ReadBarrierJni(mirror::CompressedReference<mirror::Object>* handle_on_stack,
88 Thread* self)
89 NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
90
Roland Levillain0d5a2812015-11-13 10:07:31 +000091
Man Cao1aee9002015-07-14 22:31:42 -070092// Read barrier entrypoints.
Roland Levillain0d5a2812015-11-13 10:07:31 +000093//
94// Compilers for ARM, ARM64, MIPS, MIPS64 can insert a call to these
95// functions directly. For x86 and x86-64, compilers need a wrapper
96// assembly function, to handle mismatch in ABI.
97
Roland Levillain7c1559a2015-12-15 10:55:36 +000098// Mark the heap reference `obj`. This entry point is used by read
99// barrier fast path implementations generated by the compiler to mark
100// an object that is referenced by a field of a gray object.
101extern "C" mirror::Object* artReadBarrierMark(mirror::Object* obj)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700102 REQUIRES_SHARED(Locks::mutator_lock_) HOT_ATTR;
Roland Levillain7c1559a2015-12-15 10:55:36 +0000103
Roland Levillain0d5a2812015-11-13 10:07:31 +0000104// Read barrier entrypoint for heap references.
Roland Levillain7c1559a2015-12-15 10:55:36 +0000105// This is the read barrier slow path for instance and static fields
106// and reference type arrays.
107extern "C" mirror::Object* artReadBarrierSlow(mirror::Object* ref,
108 mirror::Object* obj,
Man Cao1aee9002015-07-14 22:31:42 -0700109 uint32_t offset)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700110 REQUIRES_SHARED(Locks::mutator_lock_) HOT_ATTR;
Man Cao1aee9002015-07-14 22:31:42 -0700111
Roland Levillain0d5a2812015-11-13 10:07:31 +0000112// Read barrier entrypoint for GC roots.
113extern "C" mirror::Object* artReadBarrierForRootSlow(GcRoot<mirror::Object>* root)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700114 REQUIRES_SHARED(Locks::mutator_lock_) HOT_ATTR;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000115
Ian Rogers57b86d42012-03-27 16:05:41 -0700116} // namespace art
117
Ian Rogers166db042013-07-26 12:05:57 -0700118#endif // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_