1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2012 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker #ifndef ART_RUNTIME_INTERPRETER_INTERPRETER_H_ 18*795d594fSAndroid Build Coastguard Worker #define ART_RUNTIME_INTERPRETER_INTERPRETER_H_ 19*795d594fSAndroid Build Coastguard Worker 20*795d594fSAndroid Build Coastguard Worker #include "base/locks.h" 21*795d594fSAndroid Build Coastguard Worker #include "base/macros.h" 22*795d594fSAndroid Build Coastguard Worker #include "dex/dex_file.h" 23*795d594fSAndroid Build Coastguard Worker #include "obj_ptr.h" 24*795d594fSAndroid Build Coastguard Worker 25*795d594fSAndroid Build Coastguard Worker namespace art HIDDEN { 26*795d594fSAndroid Build Coastguard Worker namespace mirror { 27*795d594fSAndroid Build Coastguard Worker class Object; 28*795d594fSAndroid Build Coastguard Worker } // namespace mirror 29*795d594fSAndroid Build Coastguard Worker 30*795d594fSAndroid Build Coastguard Worker class ArtMethod; 31*795d594fSAndroid Build Coastguard Worker class CodeItemDataAccessor; 32*795d594fSAndroid Build Coastguard Worker union JValue; 33*795d594fSAndroid Build Coastguard Worker class ShadowFrame; 34*795d594fSAndroid Build Coastguard Worker class Thread; 35*795d594fSAndroid Build Coastguard Worker enum class DeoptimizationMethodType; 36*795d594fSAndroid Build Coastguard Worker 37*795d594fSAndroid Build Coastguard Worker namespace interpreter { 38*795d594fSAndroid Build Coastguard Worker 39*795d594fSAndroid Build Coastguard Worker // Called by ArtMethod::Invoke, shadow frames arguments are taken from the args array. 40*795d594fSAndroid Build Coastguard Worker // The optional stay_in_interpreter parameter (false by default) can be used by clients to 41*795d594fSAndroid Build Coastguard Worker // explicitly force interpretation in the remaining path that implements method invocation. 42*795d594fSAndroid Build Coastguard Worker extern void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, 43*795d594fSAndroid Build Coastguard Worker ObjPtr<mirror::Object> receiver, 44*795d594fSAndroid Build Coastguard Worker uint32_t* args, 45*795d594fSAndroid Build Coastguard Worker JValue* result, 46*795d594fSAndroid Build Coastguard Worker bool stay_in_interpreter = false) 47*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 48*795d594fSAndroid Build Coastguard Worker 49*795d594fSAndroid Build Coastguard Worker // 'from_code' denotes whether the deoptimization was explicitly triggered by compiled code. 50*795d594fSAndroid Build Coastguard Worker extern void EnterInterpreterFromDeoptimize(Thread* self, 51*795d594fSAndroid Build Coastguard Worker ShadowFrame* shadow_frame, 52*795d594fSAndroid Build Coastguard Worker JValue* ret_val, 53*795d594fSAndroid Build Coastguard Worker bool from_code, 54*795d594fSAndroid Build Coastguard Worker DeoptimizationMethodType method_type) 55*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 56*795d594fSAndroid Build Coastguard Worker 57*795d594fSAndroid Build Coastguard Worker extern JValue EnterInterpreterFromEntryPoint(Thread* self, 58*795d594fSAndroid Build Coastguard Worker const CodeItemDataAccessor& accessor, 59*795d594fSAndroid Build Coastguard Worker ShadowFrame* shadow_frame) 60*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 61*795d594fSAndroid Build Coastguard Worker 62*795d594fSAndroid Build Coastguard Worker void ArtInterpreterToInterpreterBridge(Thread* self, 63*795d594fSAndroid Build Coastguard Worker const CodeItemDataAccessor& accessor, 64*795d594fSAndroid Build Coastguard Worker ShadowFrame* shadow_frame, 65*795d594fSAndroid Build Coastguard Worker JValue* result) 66*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 67*795d594fSAndroid Build Coastguard Worker 68*795d594fSAndroid Build Coastguard Worker // One-time check of assembler constants. 69*795d594fSAndroid Build Coastguard Worker void CheckInterpreterAsmConstants(); 70*795d594fSAndroid Build Coastguard Worker 71*795d594fSAndroid Build Coastguard Worker // Returns true if the previous frame has the ForceRetryInstruction bit set. This is required for 72*795d594fSAndroid Build Coastguard Worker // ForPopFrame to work correctly since that will cause the java function return with null/0 which 73*795d594fSAndroid Build Coastguard Worker // might not be expected by the code being run. 74*795d594fSAndroid Build Coastguard Worker bool PrevFrameWillRetry(Thread* self, const ShadowFrame& frame) 75*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 76*795d594fSAndroid Build Coastguard Worker 77*795d594fSAndroid Build Coastguard Worker } // namespace interpreter 78*795d594fSAndroid Build Coastguard Worker 79*795d594fSAndroid Build Coastguard Worker } // namespace art 80*795d594fSAndroid Build Coastguard Worker 81*795d594fSAndroid Build Coastguard Worker #endif // ART_RUNTIME_INTERPRETER_INTERPRETER_H_ 82