test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff test/compiler/intrinsics/unsafe

test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java

Print this page
rev 9264 : 8143059: TestUnsafeUnalignedMismatchedAccesses doens't build after 8139891
Summary: Use new Unsafe import path
Reviewed-by:


  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 /**
  26  * @test
  27  * @bug 8136473
  28  * @summary Mismatched stores on same slice possible with Unsafe.Put*Unaligned methods
  29  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestUnsafeUnalignedMismatchedAccesses
  30  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses TestUnsafeUnalignedMismatchedAccesses
  31  *
  32  */
  33 
  34 import java.lang.reflect.*;
  35 import sun.misc.Unsafe;
  36 
  37 public class TestUnsafeUnalignedMismatchedAccesses {
  38 
  39     private static final Unsafe UNSAFE;
  40 
  41     static {
  42         try {
  43             Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
  44             unsafeField.setAccessible(true);
  45             UNSAFE = (Unsafe) unsafeField.get(null);
  46         }
  47         catch (Exception e) {
  48             throw new AssertionError(e);
  49         }
  50     }
  51 
  52     static void test1(byte[] array) {
  53         array[0] = 0;
  54         UNSAFE.putIntUnaligned(array, UNSAFE.ARRAY_BYTE_BASE_OFFSET, 0);
  55         array[0] = 0;




  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 /**
  26  * @test
  27  * @bug 8136473
  28  * @summary Mismatched stores on same slice possible with Unsafe.Put*Unaligned methods
  29  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestUnsafeUnalignedMismatchedAccesses
  30  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses TestUnsafeUnalignedMismatchedAccesses
  31  *
  32  */
  33 
  34 import java.lang.reflect.*;
  35 import jdk.internal.misc.Unsafe;
  36 
  37 public class TestUnsafeUnalignedMismatchedAccesses {
  38 
  39     private static final Unsafe UNSAFE;
  40 
  41     static {
  42         try {
  43             Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
  44             unsafeField.setAccessible(true);
  45             UNSAFE = (Unsafe) unsafeField.get(null);
  46         }
  47         catch (Exception e) {
  48             throw new AssertionError(e);
  49         }
  50     }
  51 
  52     static void test1(byte[] array) {
  53         array[0] = 0;
  54         UNSAFE.putIntUnaligned(array, UNSAFE.ARRAY_BYTE_BASE_OFFSET, 0);
  55         array[0] = 0;


test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File