blob: 877df8f7b009202308d75a5d59b903dee76593d2 [file] [log] [blame]
Ian Rogers7655f292013-07-29 11:07:13 -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
Vladimir Marko3a21e382016-09-02 12:38:38 +010017#include <math.h>
18
Mingyao Yang98d1cc82014-05-15 17:02:16 -070019#include "entrypoints/jni/jni_entrypoints.h"
Mathieu Chartierd8891782014-03-02 13:28:37 -080020#include "entrypoints/quick/quick_alloc_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080021#include "entrypoints/quick/quick_default_externs.h"
Andreas Gampec7ed09b2016-04-25 20:08:55 -070022#include "entrypoints/quick/quick_default_init_entrypoints.h"
Ian Rogers7655f292013-07-29 11:07:13 -070023#include "entrypoints/quick/quick_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070024#include "entrypoints/runtime_asm_entrypoints.h"
25#include "interpreter/interpreter.h"
Ian Rogers7655f292013-07-29 11:07:13 -070026
27namespace art {
28
Ian Rogers848871b2013-08-05 10:56:33 -070029// Cast entrypoints.
Mathieu Chartierb99f4d62016-11-07 16:17:26 -080030extern "C" size_t art_quick_is_assignable(mirror::Class* klass, mirror::Class* ref_class);
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070031
Man Cao1aee9002015-07-14 22:31:42 -070032// Read barrier entrypoints.
Roland Levillain02b75802016-07-13 11:54:35 +010033// art_quick_read_barrier_mark_regX uses an non-standard calling
34// convention: it expects its input in register X and returns its
Roland Levillain4359e612016-07-20 11:32:19 +010035// result in that same register, and saves and restores all
36// caller-save registers.
Roland Levillain02b75802016-07-13 11:54:35 +010037extern "C" mirror::Object* art_quick_read_barrier_mark_reg00(mirror::Object*);
38extern "C" mirror::Object* art_quick_read_barrier_mark_reg01(mirror::Object*);
39extern "C" mirror::Object* art_quick_read_barrier_mark_reg02(mirror::Object*);
40extern "C" mirror::Object* art_quick_read_barrier_mark_reg03(mirror::Object*);
41extern "C" mirror::Object* art_quick_read_barrier_mark_reg05(mirror::Object*);
42extern "C" mirror::Object* art_quick_read_barrier_mark_reg06(mirror::Object*);
43extern "C" mirror::Object* art_quick_read_barrier_mark_reg07(mirror::Object*);
Man Cao1aee9002015-07-14 22:31:42 -070044extern "C" mirror::Object* art_quick_read_barrier_slow(mirror::Object*, mirror::Object*, uint32_t);
Roland Levillain0d5a2812015-11-13 10:07:31 +000045extern "C" mirror::Object* art_quick_read_barrier_for_root_slow(GcRoot<mirror::Object>*);
Man Cao1aee9002015-07-14 22:31:42 -070046
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070047void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampec7ed09b2016-04-25 20:08:55 -070048 DefaultInitEntryPoints(jpoints, qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070049
50 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070051 qpoints->pInstanceofNonTrivial = art_quick_is_assignable;
Mathieu Chartierb99f4d62016-11-07 16:17:26 -080052 qpoints->pCheckInstanceOf = art_quick_check_instance_of;
Ian Rogers7655f292013-07-29 11:07:13 -070053
Mark Mendella4f12202015-08-06 15:23:34 -040054 // More math.
55 qpoints->pCos = cos;
56 qpoints->pSin = sin;
57 qpoints->pAcos = acos;
58 qpoints->pAsin = asin;
59 qpoints->pAtan = atan;
60 qpoints->pAtan2 = atan2;
61 qpoints->pCbrt = cbrt;
62 qpoints->pCosh = cosh;
63 qpoints->pExp = exp;
64 qpoints->pExpm1 = expm1;
65 qpoints->pHypot = hypot;
66 qpoints->pLog = log;
67 qpoints->pLog10 = log10;
68 qpoints->pNextAfter = nextafter;
69 qpoints->pSinh = sinh;
70 qpoints->pTan = tan;
71 qpoints->pTanh = tanh;
72
Ian Rogers7655f292013-07-29 11:07:13 -070073 // Math
Ian Rogers848871b2013-08-05 10:56:33 -070074 qpoints->pD2l = art_quick_d2l;
75 qpoints->pF2l = art_quick_f2l;
76 qpoints->pLdiv = art_quick_ldiv;
Ian Rogersa9a82542013-10-04 11:17:26 -070077 qpoints->pLmod = art_quick_lmod;
Ian Rogers848871b2013-08-05 10:56:33 -070078 qpoints->pLmul = art_quick_lmul;
79 qpoints->pShlLong = art_quick_lshl;
80 qpoints->pShrLong = art_quick_lshr;
81 qpoints->pUshrLong = art_quick_lushr;
Ian Rogers7655f292013-07-29 11:07:13 -070082
83 // Intrinsics
Mark Mendell4028a6c2014-02-19 20:06:20 -080084 // qpoints->pIndexOf = nullptr; // Not needed on x86
Ian Rogers7655f292013-07-29 11:07:13 -070085 qpoints->pStringCompareTo = art_quick_string_compareto;
86 qpoints->pMemcpy = art_quick_memcpy;
87
Roland Levillain0d5a2812015-11-13 10:07:31 +000088 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -070089 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillain02b75802016-07-13 11:54:35 +010090 qpoints->pReadBarrierMarkReg00 = art_quick_read_barrier_mark_reg00;
91 qpoints->pReadBarrierMarkReg01 = art_quick_read_barrier_mark_reg01;
92 qpoints->pReadBarrierMarkReg02 = art_quick_read_barrier_mark_reg02;
93 qpoints->pReadBarrierMarkReg03 = art_quick_read_barrier_mark_reg03;
94 qpoints->pReadBarrierMarkReg04 = nullptr; // Cannot use register 4 (ESP) to pass arguments.
95 qpoints->pReadBarrierMarkReg05 = art_quick_read_barrier_mark_reg05;
96 qpoints->pReadBarrierMarkReg06 = art_quick_read_barrier_mark_reg06;
97 qpoints->pReadBarrierMarkReg07 = art_quick_read_barrier_mark_reg07;
98 // x86 has only 8 core registers.
99 qpoints->pReadBarrierMarkReg08 = nullptr;
100 qpoints->pReadBarrierMarkReg09 = nullptr;
101 qpoints->pReadBarrierMarkReg10 = nullptr;
102 qpoints->pReadBarrierMarkReg11 = nullptr;
103 qpoints->pReadBarrierMarkReg12 = nullptr;
104 qpoints->pReadBarrierMarkReg13 = nullptr;
105 qpoints->pReadBarrierMarkReg14 = nullptr;
106 qpoints->pReadBarrierMarkReg15 = nullptr;
107 qpoints->pReadBarrierMarkReg16 = nullptr;
108 qpoints->pReadBarrierMarkReg17 = nullptr;
109 qpoints->pReadBarrierMarkReg18 = nullptr;
110 qpoints->pReadBarrierMarkReg19 = nullptr;
111 qpoints->pReadBarrierMarkReg20 = nullptr;
112 qpoints->pReadBarrierMarkReg21 = nullptr;
113 qpoints->pReadBarrierMarkReg22 = nullptr;
114 qpoints->pReadBarrierMarkReg23 = nullptr;
115 qpoints->pReadBarrierMarkReg24 = nullptr;
116 qpoints->pReadBarrierMarkReg25 = nullptr;
117 qpoints->pReadBarrierMarkReg26 = nullptr;
118 qpoints->pReadBarrierMarkReg27 = nullptr;
119 qpoints->pReadBarrierMarkReg28 = nullptr;
120 qpoints->pReadBarrierMarkReg29 = nullptr;
Man Cao1aee9002015-07-14 22:31:42 -0700121 qpoints->pReadBarrierSlow = art_quick_read_barrier_slow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000122 qpoints->pReadBarrierForRootSlow = art_quick_read_barrier_for_root_slow;
Ian Rogers7655f292013-07-29 11:07:13 -0700123};
124
125} // namespace art