JDK-8046026.js revision 956:25a50ee3bb8a
1139778Simp/* 212115Sdyson * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 312115Sdyson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 412115Sdyson * 512115Sdyson * This code is free software; you can redistribute it and/or modify it 612115Sdyson * under the terms of the GNU General Public License version 2 only, as 7139778Simp * published by the Free Software Foundation. 812115Sdyson * 912115Sdyson * This code is distributed in the hope that it will be useful, but WITHOUT 1012115Sdyson * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1112115Sdyson * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1212115Sdyson * version 2 for more details (a copy is included in the LICENSE file that 1312115Sdyson * accompanied this code). 1412115Sdyson * 1512115Sdyson * You should have received a copy of the GNU General Public License version 1612115Sdyson * 2 along with this work; if not, write to the Free Software Foundation, 1712115Sdyson * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1812115Sdyson * 1912115Sdyson * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2012115Sdyson * or visit www.oracle.com if you need additional information or have any 2112115Sdyson * questions. 2212115Sdyson */ 2312115Sdyson 2412115Sdyson/** 2512115Sdyson * JDK-8046026: CompiledFunction.relinkComposableInvoker assert is being hit 2612115Sdyson * JDK-8044770: crash with jdk9-dev/nashorn during global object initialization from MT test 2712115Sdyson * JDK-8047770: NPE in deoptimizing recompilation in multithreaded 2812115Sdyson * 2912115Sdyson * @test 3012115Sdyson * @run 3112115Sdyson */ 3212115Sdyson 3312115Sdyson(function() { 3412115Sdysonvar n = 1 << 25; 3512115Sdysonvar ThreadLocalRandom = java.util.concurrent.ThreadLocalRandom; 3612115Sdysonvar m = java.util.stream.IntStream.range(0, n) 3712115Sdyson .parallel() // this is the essence of this test. We must trigger parallel execution 3812115Sdyson .filter(function() { 3912115Sdyson var tlr = ThreadLocalRandom.current(); 4012115Sdyson 4193016Sbde var x = tlr.nextDouble(-1.0, 1.0); 4212115Sdyson var y = tlr.nextDouble(-1.0, 1.0); 4312115Sdyson 4412115Sdyson return x * x + y * y <= 1.0; 4512159Sbde }) 4612115Sdyson .count(); 4760041Sphkvar pi = (4.0 * m) / n; 4812115Sdysonprint(pi.toFixed(2)); 49193377Sstas})() 5012115Sdyson