quick_entrypoints.h revision 984305917bf57b3f8d92965e4715a0370cc5bcfb
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#ifndef ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
18#define ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
19
20#include <jni.h>
21
22#include "base/macros.h"
23#include "offsets.h"
24
25#define QUICK_ENTRYPOINT_OFFSET(ptr_size, x) \
26    Thread::QuickEntryPointOffset<ptr_size>(OFFSETOF_MEMBER(QuickEntryPoints, x))
27
28namespace art {
29
30namespace mirror {
31class ArtMethod;
32class Class;
33class Object;
34}  // namespace mirror
35
36class Thread;
37
38// Pointers to functions that are called by quick compiler generated code via thread-local storage.
39struct PACKED(4) QuickEntryPoints {
40#define ENTRYPOINT_ENUM(name, rettype, ...) rettype ( * p ## name )( __VA_ARGS__ );
41#include "quick_entrypoints_list.h"
42  QUICK_ENTRYPOINT_LIST(ENTRYPOINT_ENUM)
43#undef QUICK_ENTRYPOINT_LIST
44#undef ENTRYPOINT_ENUM
45};
46
47
48// JNI entrypoints.
49// TODO: NO_THREAD_SAFETY_ANALYSIS due to different control paths depending on fast JNI.
50extern uint32_t JniMethodStart(Thread* self) NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
51extern uint32_t JniMethodStartSynchronized(jobject to_lock, Thread* self)
52    NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
53extern void JniMethodEnd(uint32_t saved_local_ref_cookie, Thread* self)
54    NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
55extern void JniMethodEndSynchronized(uint32_t saved_local_ref_cookie, jobject locked,
56                                     Thread* self)
57    NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
58extern mirror::Object* JniMethodEndWithReference(jobject result, uint32_t saved_local_ref_cookie,
59                                                 Thread* self)
60    NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
61
62extern mirror::Object* JniMethodEndWithReferenceSynchronized(jobject result,
63                                                             uint32_t saved_local_ref_cookie,
64                                                             jobject locked, Thread* self)
65    NO_THREAD_SAFETY_ANALYSIS HOT_ATTR;
66
67}  // namespace art
68
69#endif  // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
70