hotspot/test/compiler/6775880/Test.java
author sundar
Fri, 22 Aug 2014 22:50:38 +0530
changeset 26238 829648e12198
parent 25476 b97716c4b5c9
permissions -rw-r--r--
8055830: JDK-8015969.js is silently failing Reviewed-by: lagergren, jlaskey, hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1613
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     1
/*
25476
b97716c4b5c9 8048620: Remove unneeded/obsolete -source/-target options in hotspot tests
darcy
parents: 5547
diff changeset
     2
 * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
1613
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     4
 *
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     8
 *
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    13
 * accompanied this code).
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    14
 *
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    21
 * questions.
1613
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    22
 *
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    23
 */
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    24
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    25
/*
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    26
 * @test
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    27
 * @bug 6775880
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    28
 * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
2028
04fa713b25f9 6788376: allow to ignore unrecognized VM options
kvn
parents: 1613
diff changeset
    29
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test
1613
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    30
 */
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    31
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    32
public class Test {
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    33
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    34
  int cnt;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    35
  int b[];
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    36
  String s;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    37
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    38
  String test() {
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    39
    String res="";
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    40
    for (int i=0; i < cnt; i++) {
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    41
      if (i != 0) {
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    42
        res = res +".";
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    43
      }
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    44
      res = res + b[i];
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    45
    }
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    46
    return res;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    47
  }
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    48
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    49
  public static void main(String[] args) {
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    50
    Test t = new Test();
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    51
    t.cnt = 3;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    52
    t.b = new int[3];
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    53
    t.b[0] = 0;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    54
    t.b[1] = 1;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    55
    t.b[2] = 2;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    56
    int j=0;
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    57
    t.s = "";
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    58
    for (int i=0; i<10001; i++) {
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    59
      t.s = "c";
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    60
      t.s = t.test();
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    61
    }
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    62
    System.out.println("After s=" + t.s);
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    63
  }
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    64
}
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    65
be097ec639a2 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
diff changeset
    66