blob: f9d7774d5b259260a4b0780a23eba3cc13ee6372 [file] [log] [blame]
Ian Rogers2fa6b2e2012-10-17 00:10:17 -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
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_INTERPRETER_INTERPRETER_H_
18#define ART_RUNTIME_INTERPRETER_INTERPRETER_H_
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070019
Ian Rogers719d1a32014-03-06 12:13:39 -080020#include "base/mutex.h"
Ian Rogers7db619b2013-01-16 18:35:48 -080021#include "dex_file.h"
Mathieu Chartieref41db72016-10-25 15:08:01 -070022#include "obj_ptr.h"
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070023
24namespace art {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080025namespace mirror {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080026class Object;
27} // namespace mirror
28
Mathieu Chartiere401d142015-04-22 13:56:20 -070029class ArtMethod;
Mathieu Chartier808c7a52017-12-15 11:19:33 -080030class CodeItemDataAccessor;
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070031union JValue;
Ian Rogers306057f2012-11-26 12:45:53 -080032class ShadowFrame;
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070033class Thread;
Mingyao Yang2ee17902017-08-30 11:37:08 -070034enum class DeoptimizationMethodType;
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070035
36namespace interpreter {
37
Brian Carlstromea46f952013-07-30 01:26:50 -070038// Called by ArtMethod::Invoke, shadow frames arguments are taken from the args array.
Aart Bik01223202016-05-05 15:10:42 -070039// The optional stay_in_interpreter parameter (false by default) can be used by clients to
40// explicitly force interpretation in the remaining path that implements method invocation.
Mathieu Chartiere401d142015-04-22 13:56:20 -070041extern void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method,
Mathieu Chartieref41db72016-10-25 15:08:01 -070042 ObjPtr<mirror::Object> receiver,
43 uint32_t* args,
44 JValue* result,
Aart Bik01223202016-05-05 15:10:42 -070045 bool stay_in_interpreter = false)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070046 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070047
Nicolas Geoffray73be1e82015-09-17 15:22:56 +010048// 'from_code' denotes whether the deoptimization was explicitly triggered by compiled code.
Mingyao Yang2ee17902017-08-30 11:37:08 -070049extern void EnterInterpreterFromDeoptimize(Thread* self,
50 ShadowFrame* shadow_frame,
51 JValue* ret_val,
52 bool from_code,
53 DeoptimizationMethodType method_type)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070054 REQUIRES_SHARED(Locks::mutator_lock_);
Jeff Hao11ffc2d2013-02-01 11:52:17 -080055
Mathieu Chartier808c7a52017-12-15 11:19:33 -080056extern JValue EnterInterpreterFromEntryPoint(Thread* self,
57 const CodeItemDataAccessor& accessor,
Ian Rogers6f3dbba2014-10-14 17:41:57 -070058 ShadowFrame* shadow_frame)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070059 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers7db619b2013-01-16 18:35:48 -080060
Mathieu Chartier808c7a52017-12-15 11:19:33 -080061void ArtInterpreterToInterpreterBridge(Thread* self,
62 const CodeItemDataAccessor& accessor,
63 ShadowFrame* shadow_frame,
64 JValue* result)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070065 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers6f3dbba2014-10-14 17:41:57 -070066
buzbee1452bee2015-03-06 14:43:04 -080067// One-time sanity check.
68void CheckInterpreterAsmConstants();
69
70void InitInterpreterTls(Thread* self);
71
Ian Rogers6f3dbba2014-10-14 17:41:57 -070072} // namespace interpreter
73
Ian Rogers2fa6b2e2012-10-17 00:10:17 -070074} // namespace art
75
Brian Carlstromfc0e3212013-07-17 14:40:12 -070076#endif // ART_RUNTIME_INTERPRETER_INTERPRETER_H_