summaryrefslogtreecommitdiff
path: root/vm/interp/InterpDefs.h
blob: acec648da5142c6f567f8e4f064c798e1c0aedc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * Dalvik interpreter definitions.  These are internal to the interpreter.
 *
 * This includes defines, types, function declarations, and inline functions
 * that are common to all interpreter implementations.
 *
 * Functions and globals declared here are defined in Interp.c.
 */
#ifndef DALVIK_INTERP_DEFS_H_
#define DALVIK_INTERP_DEFS_H_

#if defined(WITH_JIT)
/*
 * Size of save area for callee-save FP regs, which are not automatically
 * saved by interpreter main because it doesn't use them (but Jit'd code
 * may). Save/restore routine is defined by target, and size should
 * be >= max needed by any target.
 */
#define JIT_CALLEE_SAVE_DOUBLE_COUNT 8

#endif

/*
 * Portable interpreter.
 */
extern void dvmInterpretPortable(Thread* self);

/*
 * "mterp" interpreter.
 */
extern void dvmMterpStd(Thread* self);

/*
 * Get the "this" pointer from the current frame.
 */
Object* dvmGetThisPtr(const Method* method, const u4* fp);

/*
 * Verify that our tracked local references are valid.
 */
void dvmInterpCheckTrackedRefs(Thread* self, const Method* method,
    int debugTrackedRefStart);

/*
 * Process switch statement.
 */
extern "C" s4 dvmInterpHandlePackedSwitch(const u2* switchData, s4 testVal);
extern "C" s4 dvmInterpHandleSparseSwitch(const u2* switchData, s4 testVal);

/*
 * Process fill-array-data.
 */
extern "C" bool dvmInterpHandleFillArrayData(ArrayObject* arrayObject,
                                  const u2* arrayData);

/*
 * Find an interface method.
 */
Method* dvmInterpFindInterfaceMethod(ClassObject* thisClass, u4 methodIdx,
    const Method* method, DvmDex* methodClassDex);

/*
 * Determine if the debugger or profiler is currently active.
 */
static inline bool dvmDebuggerOrProfilerActive()
{
    return gDvm.debuggerActive || gDvm.activeProfilers != 0;
}

#if defined(WITH_JIT)
/*
 * Determine if the jit, debugger or profiler is currently active.  Used when
 * selecting which interpreter to switch to.
 */
static inline bool dvmJitDebuggerOrProfilerActive()
{
    return (gDvmJit.pProfTable != NULL) || dvmDebuggerOrProfilerActive();
}

/*
 * Hide the translations and stick with the interpreter as long as one of the
 * following conditions is true.
 */
static inline bool dvmJitHideTranslation()
{
    return (gDvm.sumThreadSuspendCount != 0) ||
           (gDvmJit.codeCacheFull == true) ||
           (gDvmJit.pProfTable == NULL);
}

#endif

#endif  // DALVIK_INTERP_DEFS_H_