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 /* common includes */
18 #include "Dalvik.h"
19
20 extern "C" {
21
22 /*
23 * Look up an interface on a class using the cache.
24 *
25 * This function used to be defined in mterp/c/header.c, but it is now used by
26 * the JIT compiler as well so it is separated into its own header file to
27 * avoid potential out-of-sync changes in the future.
28 */
dvmFindInterfaceMethodInCache(ClassObject * thisClass,u4 methodIdx,const Method * method,DvmDex * methodClassDex)29 INLINE Method* dvmFindInterfaceMethodInCache(ClassObject* thisClass,
30 u4 methodIdx, const Method* method, DvmDex* methodClassDex)
31 {
32 #define ATOMIC_CACHE_CALC \
33 dvmInterpFindInterfaceMethod(thisClass, methodIdx, method, methodClassDex)
34 #define ATOMIC_CACHE_NULL_ALLOWED false
35
36 return (Method*) ATOMIC_CACHE_LOOKUP(methodClassDex->pInterfaceCache,
37 DEX_INTERFACE_CACHE_SIZE, thisClass, methodIdx);
38
39 #undef ATOMIC_CACHE_CALC
40 }
41
42 }
43