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 /*
25 * @test
26 * @bug 8072008
27 * @library /testlibrary /test/lib ../patches
28 * @modules java.base/jdk.internal.misc
29 * @modules java.base/jdk.internal.vm.annotation
30 * @build java.base/java.lang.invoke.MethodHandleHelper
31 * @build sun.hotspot.WhiteBox
32 * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions
33 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
34 * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1
35 * -XX:+FoldStableValues
36 * compiler.jsr292.NonInlinedCall.GCTest
37 */
38
39 package compiler.jsr292.NonInlinedCall;
40
41 import java.lang.invoke.MethodHandleHelper;
42 import java.lang.invoke.MethodHandleHelper.NonInlinedReinvoker;
43 import java.lang.invoke.MethodHandles;
44 import java.lang.invoke.MethodHandle;
45
46 import java.lang.invoke.MethodType;
47 import java.lang.ref.PhantomReference;
48 import java.lang.ref.Reference;
49 import java.lang.ref.ReferenceQueue;
50
51 import jdk.internal.vm.annotation.DontInline;
52 import jdk.internal.vm.annotation.Stable;
53
54 import sun.hotspot.WhiteBox;
55
56 import static jdk.test.lib.Asserts.*;
57
58 public class GCTest {
59 static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
60
61 static class T {
62 static int f1() { return 0; }
63 static int f2() { return 1; }
64 }
65
66 static @Stable MethodHandle mh;
67 static PhantomReference<Object> lform;
68
69 static final ReferenceQueue<Object> rq = new ReferenceQueue<>();
70 static final WhiteBox WB = WhiteBox.getWhiteBox();
71
72 @DontInline
73 static int invokeBasic() {
74 try {
75 return MethodHandleHelper.invokeBasicI(mh);
76 } catch (Throwable e) {
77 throw new Error(e);
|
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 /*
25 * @test
26 * @bug 8072008
27 * @library /testlibrary /test/lib ../patches
28 * @modules java.base/jdk.internal.misc
29 * java.base/jdk.internal.vm.annotation
30 *
31 * @build java.base/java.lang.invoke.MethodHandleHelper
32 * @build sun.hotspot.WhiteBox
33 * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions
34 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
35 * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1
36 * -XX:+FoldStableValues
37 * compiler.jsr292.NonInlinedCall.GCTest
38 */
39
40 package compiler.jsr292.NonInlinedCall;
41
42 import jdk.internal.vm.annotation.DontInline;
43 import jdk.internal.vm.annotation.Stable;
44 import sun.hotspot.WhiteBox;
45
46 import java.lang.invoke.MethodHandle;
47 import java.lang.invoke.MethodHandleHelper;
48 import java.lang.invoke.MethodHandleHelper.NonInlinedReinvoker;
49 import java.lang.invoke.MethodHandles;
50 import java.lang.invoke.MethodType;
51 import java.lang.ref.PhantomReference;
52 import java.lang.ref.Reference;
53 import java.lang.ref.ReferenceQueue;
54
55 import static jdk.test.lib.Asserts.assertEquals;
56
57 public class GCTest {
58 static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
59
60 static class T {
61 static int f1() { return 0; }
62 static int f2() { return 1; }
63 }
64
65 static @Stable MethodHandle mh;
66 static PhantomReference<Object> lform;
67
68 static final ReferenceQueue<Object> rq = new ReferenceQueue<>();
69 static final WhiteBox WB = WhiteBox.getWhiteBox();
70
71 @DontInline
72 static int invokeBasic() {
73 try {
74 return MethodHandleHelper.invokeBasicI(mh);
75 } catch (Throwable e) {
76 throw new Error(e);
|