hotspot/test/compiler/c2/Test6968348.java
changeset 41092 c388d897472d
parent 40059 c2304140ed64
child 41705 332239c052cc
equal deleted inserted replaced
41091:de3789bb384e 41092:c388d897472d
     1 /*
     1 /*
     2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 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.
    36 import jdk.internal.misc.Unsafe;
    36 import jdk.internal.misc.Unsafe;
    37 
    37 
    38 import java.lang.reflect.Field;
    38 import java.lang.reflect.Field;
    39 
    39 
    40 public class Test6968348 {
    40 public class Test6968348 {
    41     static Unsafe unsafe;
    41     static Unsafe unsafe = Unsafe.getUnsafe();
    42     static final long[] buffer = new long[4096];
    42     static final long[] buffer = new long[4096];
    43     static int array_long_base_offset;
    43     static int array_long_base_offset;
    44 
    44 
    45     public static void main(String[] args) throws Exception {
    45     public static void main(String[] args) throws Exception {
    46         Class c = Test6968348.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe");
       
    47         Field f = c.getDeclaredField("theUnsafe");
       
    48         f.setAccessible(true);
       
    49         unsafe = (Unsafe)f.get(c);
       
    50         array_long_base_offset = unsafe.arrayBaseOffset(long[].class);
    46         array_long_base_offset = unsafe.arrayBaseOffset(long[].class);
    51 
    47 
    52         for (int n = 0; n < 100000; n++) {
    48         for (int n = 0; n < 100000; n++) {
    53             test();
    49             test();
    54         }
    50         }