blob: 2b2cb8e265d533dda02965852c5192309a0f47f2 [file] [log] [blame]
Ben Chengba4fc8b2009-06-01 13:00:29 -07001/*
2 * Copyright (C) 2009 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 * Jit control
18 */
19#ifndef _DALVIK_INTERP_JIT
20#define _DALVIK_INTERP_JIT
21
22#include "InterpDefs.h"
23
24#define JIT_PROF_SIZE 512
25/*
26 * JitTable hash function.
27 */
28static inline u4 dvmJitHash( const u2* p ) {
29 /*
30 * TODO - Might make sense to keep "maxTableEntries - 1" as its own
31 * variable for speed reasons.
32 */
33 return ((((u4)p>>12)^(u4)p)>>1) & (gDvmJit.maxTableEntries-1);
34}
35
36/*
37 * Entries in the JIT's address lookup hash table.
38 * with assembly hash function in mterp.
39 * TODO: rework this structure now that the profile counts have
40 * moved into their own table.
41 */
42typedef struct JitEntry {
43 u2 unused; /* was execution count */
44 u2 chain; /* Index of next in chain */
45 const u2* dPC; /* Dalvik code address */
46 void* codeAddress; /* Code address of native translation */
47} JitEntry;
48
49int dvmJitStartup(void);
50void dvmJitShutdown(void);
51int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState);
52void* dvmJitGetCodeAddr(const u2* dPC);
53void dvmJitSetCodeAddr(const u2* dPC, void *nPC);
54bool dvmJitCheckTraceRequest(Thread* self, InterpState* interpState);
55void* dvmJitChain(void* tgtAddr, u4* branchAddr);
56void dvmJitStopTranslationRequests();
57void dvmJitStats();
58
59#endif /*_DALVIK_INTERP_JIT*/