blob: 5c68a8f1a27484397e6ac57a9f905c93d5ee2342 [file] [log] [blame]
Narayan Kamath9823e782016-08-03 12:46:58 +01001/*
2 * Copyright (C) 2016 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#ifndef ART_RUNTIME_METHOD_HANDLES_H_
18#define ART_RUNTIME_METHOD_HANDLES_H_
19
20#include <ostream>
21
22namespace art {
23
24// Defines the behaviour of a given method handle. The behaviour
25// of a handle of a given kind is identical to the dex bytecode behaviour
26// of the equivalent instruction.
27//
28// NOTE: These must be kept in sync with the constants defined in
29// java.lang.invoke.MethodHandle.
30enum MethodHandleKind {
31 kInvokeVirtual = 0,
32 kInvokeSuper,
33 kInvokeDirect,
34 kInvokeStatic,
35 kInvokeInterface,
36 kInstanceGet,
37 kInstancePut,
38 kStaticGet,
39 kStaticPut,
40 kLastValidKind = kStaticPut,
41 kLastInvokeKind = kInvokeInterface
42};
43
44// Whether the given method handle kind is some variant of an invoke.
45inline bool IsInvoke(const MethodHandleKind handle_kind) {
46 return handle_kind <= kLastInvokeKind;
47}
48
49} // namespace art
50
51#endif // ART_RUNTIME_METHOD_HANDLES_H_