1 #!/bin/sh 2 3 # 4 # Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 # 7 # This code is free software; you can redistribute it and/or modify it 8 # under the terms of the GNU General Public License version 2 only, as 9 # published by the Free Software Foundation. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 # @test 27 # @bug 4628760 28 # @summary RedefineClasses gets assertion: "Should be a method entry in cpcache!" 29 # @author jjh 30 # 31 # @run shell/timeout=180 RedefineClasses.sh 32 33 # On windows, with b90, this gets this: 34 # assert(u2_at_bcp >= 0 && u2_at_bcp < old_cache->length(), "Bad cpcache index!") 35 # 36 # Error happened during: VM_RedefineClasses 37 # 38 # Error ID: D:/jdk1.4/hotspot\src\share\vm\prims\jvmdi_hotswap.cpp, 331 39 40 # On solaris, and on windows with 4559100 fixed, this test fails with: 41 # 42 # HotSpot Virtual Machine Error, assertion failure 43 # Please report this error at 44 # http://java.sun.com/cgi-bin/bugreport.cgi 45 # 46 # Java VM: Java HotSpot(TM) Client VM (1.4-internal-debug mixed mode) 47 # 48 # assert(old_cache->entry_at(u2_at_bcp)->is_method_entry(), "Should be a method entry in cpcache!") 49 # 50 # Error happened during: VM_RedefineClasses 51 # 52 # Error ID: M:\ws\m\b2\service_hs_baseline\src\share\vm\prims\jvmdi_hotswap.cpp, 335 53 54 55 # With -Xcomp on solaris this passes, but takes 2 minutes, thus the /timeout above. 56 57 # These are variables that can be set to control execution 58 59 java=java 60 61 createJavaFile() 62 { 63 cat <<EOF > $1.java.1 64 65 66 import java.lang.Thread; 67 import java.util.HashMap; 68 import javax.swing.*; 69 import java.util.*; 70 71 72 public class $1 { 73 int xxx = 20; 74 //ThreadGroup k = new ThreadGroup("group"); 75 int i; 76 77 public $1() { 78 } 79 80 public void a1() { 81 a2(); 82 } 83 84 public void a2() { 85 a3(); 86 } 87 88 public void a3() { 89 System.out.println("out from a3"); // @1 breakpoint 90 //System.out.println("hello world"); // @ 1 delete this isn't even necesary 91 } 92 public void a4() { 93 System.out.println("in a4"); 94 int i = 2; 95 int j = 3333; 96 System.out.println("i + j = " + (i + j)); 97 System.out.println("out from a4"); 98 System.out.println("def"); 99 a1(); 100 } 101 102 public void aa() { 103 a4(); 104 System.out.println("out from aa"); 105 } 106 107 108 public static void main(String[] args) { 109 byte xyz[] = new byte[] { 'a', 'b', 'c' }; 110 111 int x1 = 100; 112 x1 = 101; 113 x1 = 102; 114 x1 = 103; 115 String m1 = "def"; 116 String m2 = "abc"; 117 String m3 = "def"; 118 119 int[] m = new int[] { 100, 200, 300 }; 120 121 $1 untitled31 = new $1(); 122 untitled31.aa(); 123 } 124 } 125 126 EOF 127 } 128 129 # This is called to feed cmds to jdb. 130 dojdbCmds() 131 { 132 setBkpts @1 133 runToBkpt 134 cmd redefine $classname $tmpFileDir/$classname.class 135 cmd redefine $classname $tmpFileDir/$classname.class 136 cmd redefine $classname $tmpFileDir/$classname.class 137 } 138 139 140 mysetup() 141 { 142 if [ -z "$TESTSRC" ] ; then 143 TESTSRC=. 144 fi 145 146 for ii in . $TESTSRC $TESTSRC/.. ; do 147 if [ -r "$ii/ShellScaffold.sh" ] ; then 148 . $ii/ShellScaffold.sh 149 break 150 fi 151 done 152 } 153 154 # You could replace this next line with the contents 155 # of ShellScaffold.sh and this script will run just the same. 156 mysetup 157 158 runit 159 pass