test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/RedefineTest.java
changeset 55301 a9188ba494a3
parent 52015 821bfc24d750
equal deleted inserted replaced
55300:1e0b948cc122 55301:a9188ba494a3
   112     }
   112     }
   113 
   113 
   114     static final WhiteBox WB = WhiteBox.getWhiteBox();
   114     static final WhiteBox WB = WhiteBox.getWhiteBox();
   115 
   115 
   116     @DontInline
   116     @DontInline
   117     static int invokeBasic() {
   117     static int invokeExact() {
   118         try {
   118         try {
   119             return (int)mh.invokeExact();
   119             return (int)mh.invokeExact();
   120         } catch (Throwable e) {
   120         } catch (Throwable e) {
   121             throw new Error(e);
   121             throw new Error(e);
   122         }
   122         }
   128     }
   128     }
   129 
   129 
   130 
   130 
   131     public static void main(String[] args) throws Exception {
   131     public static void main(String[] args) throws Exception {
   132         for (int i = 0; i < 20_000; i++) {
   132         for (int i = 0; i < 20_000; i++) {
   133             int r = invokeBasic();
   133             int r = invokeExact();
   134             if (r != 0) {
   134             if (r != 0) {
   135                 throw new Error(r + " != 0");
   135                 throw new Error(r + " != 0");
   136             }
   136             }
   137         }
   137         }
   138         // WB.ensureCompiled();
   138         // WB.ensureCompiled();
   140         redefine();
   140         redefine();
   141 
   141 
   142         int exp = (instr != null) ? 1 : 0;
   142         int exp = (instr != null) ? 1 : 0;
   143 
   143 
   144         for (int i = 0; i < 20_000; i++) {
   144         for (int i = 0; i < 20_000; i++) {
   145             if (invokeBasic() != exp) {
   145             if (invokeExact() != exp) {
   146                 throw new Error();
   146                 throw new Error();
   147             }
   147             }
   148         }
   148         }
   149 
   149 
   150         WB.clearInlineCaches();
   150         WB.clearInlineCaches();
   151 
   151 
   152         for (int i = 0; i < 20_000; i++) {
   152         for (int i = 0; i < 20_000; i++) {
   153             if (invokeBasic() != exp) {
   153             if (invokeExact() != exp) {
   154                 throw new Error();
   154                 throw new Error();
   155             }
   155             }
   156         }
   156         }
   157 
   157 
   158         // WB.ensureCompiled();
   158         // WB.ensureCompiled();