4327N/A/*
4327N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4327N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4327N/A *
4327N/A * This code is free software; you can redistribute it and/or modify it
4327N/A * under the terms of the GNU General Public License version 2 only, as
4327N/A * published by the Free Software Foundation.
4327N/A *
4327N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4327N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4327N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4327N/A * version 2 for more details (a copy is included in the LICENSE file that
4327N/A * accompanied this code).
4327N/A *
4327N/A * You should have received a copy of the GNU General Public License version
4327N/A * 2 along with this work; if not, write to the Free Software Foundation,
4327N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4327N/A *
4327N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4327N/A * or visit www.oracle.com if you need additional information or have any
4327N/A * questions.
4327N/A */
4327N/A
4327N/A/*
4327N/A * @test
4327N/A * @bug 8007722
4327N/A * @summary GetAndSetP's MachNode should capture bottom type
4327N/A * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8007722
4327N/A *
4327N/A */
4327N/A
4327N/Aimport java.util.concurrent.atomic.*;
4327N/A
4327N/Apublic class Test8007722 {
4327N/A
4327N/A int i;
4327N/A static AtomicReference<Test8007722> ref;
4327N/A
4327N/A static int test(Test8007722 new_obj) {
4327N/A Test8007722 o = ref.getAndSet(new_obj);
4327N/A int ret = o.i;
4327N/A o.i = 5;
4327N/A return ret;
4327N/A }
4327N/A
4327N/A static public void main(String[] args) {
4327N/A Test8007722 obj = new Test8007722();
4327N/A ref = new AtomicReference<Test8007722>(obj);
4327N/A
4327N/A for (int i = 0; i < 20000; i++) {
4327N/A test(obj);
4327N/A }
4327N/A
4327N/A System.out.println("PASSED");
4327N/A }
4327N/A}