18 * |
18 * |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @requires vm.jvmci |
|
27 * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot |
|
28 * jdk.internal.vm.ci/jdk.vm.ci.meta |
|
29 * @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src |
|
30 * @run testng/othervm |
|
31 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler |
|
32 * jdk.vm.ci.hotspot.test.TestHotSpotSpeculationLog |
|
33 */ |
|
34 |
23 package jdk.vm.ci.hotspot.test; |
35 package jdk.vm.ci.hotspot.test; |
24 |
36 |
25 import java.util.function.Supplier; |
37 import java.util.function.Supplier; |
26 |
38 |
27 import org.junit.Assert; |
39 import org.testng.Assert; |
28 import org.junit.Assume; |
40 import org.testng.SkipException; |
29 import org.junit.Test; |
41 import org.testng.annotations.Test; |
30 |
42 |
31 import jdk.vm.ci.hotspot.HotSpotSpeculationLog; |
43 import jdk.vm.ci.hotspot.HotSpotSpeculationLog; |
32 import jdk.vm.ci.meta.SpeculationLog; |
44 import jdk.vm.ci.meta.SpeculationLog; |
33 import jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding; |
45 import jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding; |
34 |
46 |
85 |
97 |
86 SpeculationLog.Speculation s1 = log.speculate(reason1); |
98 SpeculationLog.Speculation s1 = log.speculate(reason1); |
87 SpeculationLog.Speculation s2 = log.speculate(reason2); |
99 SpeculationLog.Speculation s2 = log.speculate(reason2); |
88 |
100 |
89 boolean added = log.addFailedSpeculation(s1); |
101 boolean added = log.addFailedSpeculation(s1); |
90 Assume.assumeTrue(added); |
102 if (!added) { |
|
103 throw new SkipException("log.addFailedSpeculation(s1) is false"); |
|
104 } |
|
105 |
91 log.collectFailedSpeculations(); |
106 log.collectFailedSpeculations(); |
92 Assert.assertFalse(log.maySpeculate(reason1)); |
107 Assert.assertFalse(log.maySpeculate(reason1)); |
93 Assert.assertTrue(log.maySpeculate(reason2)); |
108 Assert.assertTrue(log.maySpeculate(reason2)); |
94 |
109 |
95 added = log.addFailedSpeculation(s2); |
110 added = log.addFailedSpeculation(s2); |
96 Assume.assumeTrue(added); |
111 if (!added) { |
|
112 throw new SkipException("log.addFailedSpeculation(s2) is false"); |
|
113 } |
97 log.collectFailedSpeculations(); |
114 log.collectFailedSpeculations(); |
98 Assume.assumeTrue(added); |
|
99 Assert.assertFalse(log.maySpeculate(reason1)); |
115 Assert.assertFalse(log.maySpeculate(reason1)); |
100 Assert.assertFalse(log.toString(), log.maySpeculate(reason2)); |
116 Assert.assertFalse(log.maySpeculate(reason2), log.toString()); |
101 } |
117 } |
102 } |
118 } |