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 * Target-specific optimization and run-time hints
18 */
19
20
21 #include "Dalvik.h"
22 #include "libdex/DexClass.h"
23
24 #include <stdlib.h>
25 #include <stddef.h>
26 #include <sys/stat.h>
27
28
29 /*
30 * The class loader will associate with each method a 32-bit info word
31 * (jniArgInfo) to support JNI calls. The high order 4 bits of this word
32 * are the same for all targets, while the lower 28 are used for hints to
33 * allow accelerated JNI bridge transfers.
34 *
35 * jniArgInfo (32-bit int) layout:
36 *
37 * SRRRHHHH HHHHHHHH HHHHHHHH HHHHHHHH
38 *
39 * S - if set, ignore the hints and do things the hard way (scan signature)
40 * R - return-type enumeration
41 * H - target-specific hints
42 *
43 * This function is a placeholder/template and should be duplicated in the
44 * appropriate arch/<target>/ directory for new target ports. The hints
45 * field should be defined and constructed in conjunction with
46 * dvmPlatformInvoke.
47
48 * If valid hints can't be constructed, this function should return a negative
49 * value. In that case, the caller will set the S bit in the jniArgInfo word
50 * and convert the arguments the slow way.
51 */
dvmPlatformInvokeHints(const DexProto * proto)52 u4 dvmPlatformInvokeHints( const DexProto* proto)
53 {
54 /* No hints for generic target - force argument walk at run-time */
55 return DALVIK_JNI_NO_ARG_INFO;
56 }
57