hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
changeset 41092 c388d897472d
parent 40059 c2304140ed64
child 41705 332239c052cc
equal deleted inserted replaced
41091:de3789bb384e 41092:c388d897472d
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    48   private static final int OFFSET = 3;
    48   private static final int OFFSET = 3;
    49   private static final int SCALE = 2;
    49   private static final int SCALE = 2;
    50   private static final int ALIGN_OFF = 8;
    50   private static final int ALIGN_OFF = 8;
    51   private static final int UNALIGN_OFF = 5;
    51   private static final int UNALIGN_OFF = 5;
    52 
    52 
    53   private static final Unsafe unsafe;
    53   private static final Unsafe unsafe = Unsafe.getUnsafe();
    54   private static final int BASE;
    54   private static final int BASE;
    55   static {
    55   static {
    56     try {
    56     try {
    57       Class c = TestIntUnsafeVolatile.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe");
       
    58       Field f = c.getDeclaredField("theUnsafe");
       
    59       f.setAccessible(true);
       
    60       unsafe = (Unsafe)f.get(c);
       
    61       BASE = unsafe.arrayBaseOffset(int[].class);
    57       BASE = unsafe.arrayBaseOffset(int[].class);
    62     } catch (Exception e) {
    58     } catch (Exception e) {
    63       InternalError err = new InternalError();
    59       InternalError err = new InternalError();
    64       err.initCause(e);
    60       err.initCause(e);
    65       throw err;
    61       throw err;