1 /* 2 * Copyright (C) 2008 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 * Dalvik interpreter definitions. These are internal to the interpreter. 18 * 19 * This includes defines, types, function declarations, and inline functions 20 * that are common to all interpreter implementations. 21 * 22 * Functions and globals declared here are defined in Interp.c. 23 */ 24 #ifndef DALVIK_INTERP_DEFS_H_ 25 #define DALVIK_INTERP_DEFS_H_ 26 27 #if defined(WITH_JIT) 28 /* 29 * Size of save area for callee-save FP regs, which are not automatically 30 * saved by interpreter main because it doesn't use them (but Jit'd code 31 * may). Save/restore routine is defined by target, and size should 32 * be >= max needed by any target. 33 */ 34 #define JIT_CALLEE_SAVE_DOUBLE_COUNT 8 35 36 #endif 37 38 /* 39 * Portable interpreter. 40 */ 41 extern void dvmInterpretPortable(Thread* self); 42 43 /* 44 * "mterp" interpreter. 45 */ 46 extern void dvmMterpStd(Thread* self); 47 48 /* 49 * Get the "this" pointer from the current frame. 50 */ 51 Object* dvmGetThisPtr(const Method* method, const u4* fp); 52 53 /* 54 * Verify that our tracked local references are valid. 55 */ 56 void dvmInterpCheckTrackedRefs(Thread* self, const Method* method, 57 int debugTrackedRefStart); 58 59 /* 60 * Process switch statement. 61 */ 62 extern "C" s4 dvmInterpHandlePackedSwitch(const u2* switchData, s4 testVal); 63 extern "C" s4 dvmInterpHandleSparseSwitch(const u2* switchData, s4 testVal); 64 65 /* 66 * Process fill-array-data. 67 */ 68 extern "C" bool dvmInterpHandleFillArrayData(ArrayObject* arrayObject, 69 const u2* arrayData); 70 71 /* 72 * Find an interface method. 73 */ 74 Method* dvmInterpFindInterfaceMethod(ClassObject* thisClass, u4 methodIdx, 75 const Method* method, DvmDex* methodClassDex); 76 77 /* 78 * Determine if the debugger or profiler is currently active. 79 */ 80 static inline bool dvmDebuggerOrProfilerActive() 81 { 82 return gDvm.debuggerActive || gDvm.activeProfilers != 0; 83 } 84 85 #if defined(WITH_JIT) 86 /* 87 * Determine if the jit, debugger or profiler is currently active. Used when 88 * selecting which interpreter to switch to. 89 */ 90 static inline bool dvmJitDebuggerOrProfilerActive() 91 { 92 return (gDvmJit.pProfTable != NULL) || dvmDebuggerOrProfilerActive(); 93 } 94 95 /* 96 * Hide the translations and stick with the interpreter as long as one of the 97 * following conditions is true. 98 */ 99 static inline bool dvmJitHideTranslation() 100 { 101 return (gDvm.sumThreadSuspendCount != 0) || 102 (gDvmJit.codeCacheFull == true) || 103 (gDvmJit.pProfTable == NULL); 104 } 105 106 #endif 107 108 #endif // DALVIK_INTERP_DEFS_H_ 109