hotspot/test/runtime/7158988/TestPostFieldModification.java
author duke
Wed, 05 Jul 2017 20:01:44 +0200
changeset 26660 5e174bbfc03a
parent 12374 351cb50bd097
child 35594 cc13089c6327
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     1
/*
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     2
 * Copyright 2012 SAP AG.  All Rights Reserved.
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     4
 *
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     8
 *
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    13
 * accompanied this code).
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    14
 *
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    18
 *
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    21
 * questions.
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    22
 */
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    23
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    24
public class TestPostFieldModification {
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    25
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    26
  public String value;  // watch modification of value
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    27
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    28
  public static void main(String[] args){
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    29
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    30
    System.out.println("Start threads");
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    31
    // this thread modifies the field 'value'
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    32
    new Thread() {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    33
      TestPostFieldModification test = new TestPostFieldModification();
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    34
      public void run() {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    35
        test.value="test";
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    36
        for(int i = 0; i < 10; i++) {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    37
          test.value += new String("_test");
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    38
        }
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    39
      }
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    40
    }.start();
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    41
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    42
    // this thread is used to trigger a gc
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    43
    Thread d = new Thread() {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    44
      public void run() {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    45
        while(true) {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    46
          try {
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    47
            Thread.sleep(100);
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    48
          } catch (InterruptedException e) {
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    49
12374
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    50
          }
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    51
          System.gc();
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    52
        }
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    53
      }
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    54
    };
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    55
    d.setDaemon(true);
351cb50bd097 7160467: Fix test for 7158988
coleenp
parents: 12366
diff changeset
    56
    d.start();
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    57
  }
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    58
}