OpcodeInfo.java revision 8def5c9e3d9b0f73beacbd4b44b966736dc04f23
1/*
2 * Copyright (C) 2010 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
17package dalvik.bytecode;
18
19/**
20 * Information about Dalvik opcodes.
21 */
22public final class OpcodeInfo {
23    /**
24     * The maximum possible value of a Dalvik opcode.
25     *
26     * <p><b>Note:</b>: This is constant in any given VM incarnation,
27     * but it is subject to change over time, so it is not appropriate
28     * to represent as a compile-time constant value.</p>
29     */
30    public static final int MAXIMUM_VALUE;
31
32    static {
33        /*
34         * See note on the definition of MAXIMUM_VALUE, above, for
35         * why it's not assigned directly on the declaration line.
36         *
37         * IMPORTANT NOTE: This assignment is generated automatically
38         * by the opcode-gen tool. Any edits will get wiped out the
39         * next time the tool is run.
40         */
41        // BEGIN(libcore-maximum-value); GENERATED AUTOMATICALLY BY opcode-gen
42        MAXIMUM_VALUE = 255;
43        // END(libcore-maximum-value)
44    }
45
46    /**
47     * This class is not instantiable.
48     */
49    private OpcodeInfo() {
50        // This space intentionally left blank.
51    }
52
53    /**
54     * Returns whether the given opcode represents a method invocation
55     * operation. This includes most things that look like method
56     * invocation at the source level, but it notably excludes methods
57     * that are implemented directly in the VM.
58     *
59     * @hide Unclear if this is useful enough to publish as supported API.
60     *
61     * @param opcode one of the values defined in {@link Opcodes}
62     */
63    public static native boolean isInvoke(int opcode);
64}
65