author | iignatyev |
Fri, 07 Jun 2019 21:35:26 -0700 | |
changeset 55301 | a9188ba494a3 |
parent 50642 | fff48b02d4a6 |
permissions | -rw-r--r-- |
36508 | 1 |
/* |
55301
a9188ba494a3
8149040: Cleanup compiler/jsr292/NonInlinedCall tests after JDK-8148994
iignatyev
parents:
50642
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
36508 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
package java.lang.invoke; |
|
25 |
||
26 |
import java.lang.invoke.MethodHandles.Lookup; |
|
27 |
import jdk.internal.vm.annotation.DontInline; |
|
28 |
import jdk.internal.vm.annotation.ForceInline; |
|
55301
a9188ba494a3
8149040: Cleanup compiler/jsr292/NonInlinedCall tests after JDK-8148994
iignatyev
parents:
50642
diff
changeset
|
29 |
|
36508 | 30 |
/** |
31 |
* Helper class to inject into java.lang.invoke that provides access to |
|
32 |
* package-private methods in this package. |
|
33 |
*/ |
|
34 |
public class MethodHandleHelper { |
|
35 |
||
36 |
private MethodHandleHelper() { } |
|
37 |
||
38 |
public static final Lookup IMPL_LOOKUP = Lookup.IMPL_LOOKUP; |
|
39 |
public static final Class<?> MHN_CALL_SITE_CONTEXT_CLASS |
|
40 |
= MethodHandleNatives.CallSiteContext.class; |
|
41 |
||
42 |
public static void customize(MethodHandle mh) { |
|
43 |
mh.customize(); |
|
44 |
} |
|
45 |
||
46 |
@ForceInline |
|
43943
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
47 |
public static Object internalMemberName(MethodHandle mh) throws Throwable { |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
48 |
return mh.internalMemberName(); |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
49 |
} |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
50 |
|
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
51 |
@ForceInline |
50642
fff48b02d4a6
8198719: MethodHandleHelper.linkToStatic should drop MH arg
dchuyko
parents:
47216
diff
changeset
|
52 |
public static void linkToStatic(float arg, Object name) throws Throwable { |
fff48b02d4a6
8198719: MethodHandleHelper.linkToStatic should drop MH arg
dchuyko
parents:
47216
diff
changeset
|
53 |
MethodHandle.linkToStatic(arg, name); |
43943
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
54 |
} |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
55 |
|
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
56 |
@ForceInline |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
57 |
public static void invokeBasicV(MethodHandle mh, float arg) throws Throwable { |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
58 |
mh.invokeBasic(arg); |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
59 |
} |
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
60 |
|
e2fdae30bbc1
8166110: Inlining through MH invokers/linkers in unreachable code is unsafe
vlivanov
parents:
36508
diff
changeset
|
61 |
@ForceInline |
36508 | 62 |
public static Object invokeBasicL(MethodHandle mh) throws Throwable { |
63 |
return mh.invokeBasic(); |
|
64 |
} |
|
65 |
||
66 |
@ForceInline |
|
67 |
public static int invokeBasicI(MethodHandle mh) throws Throwable { |
|
68 |
return (int) mh.invokeBasic(); |
|
69 |
} |
|
70 |
||
71 |
public static MethodHandle varargsArray(int nargs) { |
|
72 |
return MethodHandleImpl.varargsArray(nargs); |
|
73 |
} |
|
74 |
||
75 |
public static MethodHandle varargsArray(Class<?> arrayType, int nargs) { |
|
76 |
return MethodHandleImpl.varargsArray(arrayType, nargs); |
|
77 |
} |
|
78 |
||
79 |
public static LambdaForm getLambdaForm(MethodHandle mh) { |
|
80 |
return mh.form; |
|
81 |
} |
|
82 |
} |