| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 28 | static 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 | */ |
| 42 | typedef 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 | |
| 49 | int dvmJitStartup(void); |
| 50 | void dvmJitShutdown(void); |
| 51 | int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState); |
| 52 | void* dvmJitGetCodeAddr(const u2* dPC); |
| 53 | void dvmJitSetCodeAddr(const u2* dPC, void *nPC); |
| 54 | bool dvmJitCheckTraceRequest(Thread* self, InterpState* interpState); |
| 55 | void* dvmJitChain(void* tgtAddr, u4* branchAddr); |
| 56 | void dvmJitStopTranslationRequests(); |
| 57 | void dvmJitStats(); |
| 58 | |
| 59 | #endif /*_DALVIK_INTERP_JIT*/ |