Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_INTERPRETER_INTERPRETER_H_ |
| 18 | #define ART_RUNTIME_INTERPRETER_INTERPRETER_H_ |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 19 | |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 20 | #include "base/mutex.h" |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 21 | #include "dex_file.h" |
Mathieu Chartier | ef41db7 | 2016-10-25 15:08:01 -0700 | [diff] [blame] | 22 | #include "obj_ptr.h" |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 23 | |
| 24 | namespace art { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 25 | namespace mirror { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 26 | class Object; |
| 27 | } // namespace mirror |
| 28 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 29 | class ArtMethod; |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 30 | union JValue; |
Ian Rogers | 306057f | 2012-11-26 12:45:53 -0800 | [diff] [blame] | 31 | class ShadowFrame; |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 32 | class Thread; |
| 33 | |
| 34 | namespace interpreter { |
| 35 | |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 36 | // Called by ArtMethod::Invoke, shadow frames arguments are taken from the args array. |
Aart Bik | 0122320 | 2016-05-05 15:10:42 -0700 | [diff] [blame] | 37 | // The optional stay_in_interpreter parameter (false by default) can be used by clients to |
| 38 | // explicitly force interpretation in the remaining path that implements method invocation. |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 39 | extern void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, |
Mathieu Chartier | ef41db7 | 2016-10-25 15:08:01 -0700 | [diff] [blame] | 40 | ObjPtr<mirror::Object> receiver, |
| 41 | uint32_t* args, |
| 42 | JValue* result, |
Aart Bik | 0122320 | 2016-05-05 15:10:42 -0700 | [diff] [blame] | 43 | bool stay_in_interpreter = false) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 44 | REQUIRES_SHARED(Locks::mutator_lock_); |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 45 | |
Nicolas Geoffray | 73be1e8 | 2015-09-17 15:22:56 +0100 | [diff] [blame] | 46 | // 'from_code' denotes whether the deoptimization was explicitly triggered by compiled code. |
| 47 | extern void EnterInterpreterFromDeoptimize(Thread* self, ShadowFrame* shadow_frame, bool from_code, |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 48 | JValue* ret_val) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 49 | REQUIRES_SHARED(Locks::mutator_lock_); |
Jeff Hao | 11ffc2d | 2013-02-01 11:52:17 -0800 | [diff] [blame] | 50 | |
Ian Rogers | e94652f | 2014-12-02 11:13:19 -0800 | [diff] [blame] | 51 | extern JValue EnterInterpreterFromEntryPoint(Thread* self, const DexFile::CodeItem* code_item, |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 52 | ShadowFrame* shadow_frame) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 53 | REQUIRES_SHARED(Locks::mutator_lock_); |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 54 | |
Andreas Gampe | 3cfa4d0 | 2015-10-06 17:04:01 -0700 | [diff] [blame] | 55 | void ArtInterpreterToInterpreterBridge(Thread* self, const DexFile::CodeItem* code_item, |
| 56 | ShadowFrame* shadow_frame, JValue* result) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 57 | REQUIRES_SHARED(Locks::mutator_lock_); |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 58 | |
buzbee | 1452bee | 2015-03-06 14:43:04 -0800 | [diff] [blame] | 59 | // One-time sanity check. |
| 60 | void CheckInterpreterAsmConstants(); |
| 61 | |
| 62 | void InitInterpreterTls(Thread* self); |
| 63 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 64 | } // namespace interpreter |
| 65 | |
Ian Rogers | 2fa6b2e | 2012-10-17 00:10:17 -0700 | [diff] [blame] | 66 | } // namespace art |
| 67 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 68 | #endif // ART_RUNTIME_INTERPRETER_INTERPRETER_H_ |