Wed, 22 Jan 2014 12:37:28 -0800
Added tag jdk8u5-b05 for changeset b90de55aca30
iveresov@6069 | 1 | /* |
iveresov@6069 | 2 | * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
iveresov@6069 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
iveresov@6069 | 4 | * |
iveresov@6069 | 5 | * This code is free software; you can redistribute it and/or modify it |
iveresov@6069 | 6 | * under the terms of the GNU General Public License version 2 only, as |
iveresov@6069 | 7 | * published by the Free Software Foundation. |
iveresov@6069 | 8 | * |
iveresov@6069 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
iveresov@6069 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
iveresov@6069 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
iveresov@6069 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
iveresov@6069 | 13 | * accompanied this code). |
iveresov@6069 | 14 | * |
iveresov@6069 | 15 | * You should have received a copy of the GNU General Public License version |
iveresov@6069 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
iveresov@6069 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
iveresov@6069 | 18 | * |
iveresov@6069 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
iveresov@6069 | 20 | * or visit www.oracle.com if you need additional information or have any |
iveresov@6069 | 21 | * questions. |
iveresov@6069 | 22 | */ |
iveresov@6069 | 23 | |
iveresov@6069 | 24 | /* |
iveresov@6069 | 25 | * @test |
iveresov@6069 | 26 | * @bug 8027751 |
iveresov@6069 | 27 | * @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill |
iveresov@6069 | 28 | * @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp |
iveresov@6069 | 29 | * |
iveresov@6069 | 30 | * G1 barriers use logical operators (xor) on T_OBJECT mixed with T_LONG or T_INT. |
iveresov@6069 | 31 | * The current implementation of logical operations on x86 in C1 doesn't allow for long operands to be on stack. |
iveresov@6069 | 32 | * There is a special code in the register allocator that forces long arguments in registers on x86. However T_OBJECT |
iveresov@6069 | 33 | * can be spilled just fine, and in that case the xor emission will fail. |
iveresov@6069 | 34 | */ |
iveresov@6069 | 35 | |
iveresov@6069 | 36 | import java.util.concurrent.atomic.*; |
iignatyev@6174 | 37 | |
iignatyev@6174 | 38 | public class C1ObjectSpillInLogicOp { |
iignatyev@6174 | 39 | public static void main(String[] args) { |
iveresov@6069 | 40 | AtomicReferenceArray<Integer> x = new AtomicReferenceArray(128); |
iveresov@6069 | 41 | Integer y = new Integer(0); |
iveresov@6069 | 42 | for (int i = 0; i < 50000; i++) { |
iveresov@6069 | 43 | x.getAndSet(i % x.length(), y); |
iveresov@6069 | 44 | } |
iveresov@6069 | 45 | } |
iveresov@6069 | 46 | } |