1 /*
   2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test TestNewAcmp
  26  * @summary Verifies correctness of the new acmp bytecode.
  27  * @library /testlibrary /test/lib /compiler/whitebox /
  28  * @compile -XDallowWithFieldOperator TestNewAcmp.java
  29  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  30  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
  31  *                   -XX:+EnableValhalla -XX:TypeProfileLevel=222
  32  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  33  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  34  *                   compiler.valhalla.valuetypes.TestNewAcmp 0
  35  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  36  *                   -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
  37  *                   -XX:+AlwaysIncrementalInline
  38  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  39  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  40  *                   compiler.valhalla.valuetypes.TestNewAcmp 0
  41  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
  42  *                   -XX:+EnableValhalla -XX:TypeProfileLevel=222
  43  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  44  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  45  *                   compiler.valhalla.valuetypes.TestNewAcmp 1
  46  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  47  *                   -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
  48  *                   -XX:+AlwaysIncrementalInline
  49  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  50  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  51  *                   compiler.valhalla.valuetypes.TestNewAcmp 1
  52  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
  53  *                   -XX:+EnableValhalla -XX:TypeProfileLevel=222
  54  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  55  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  56  *                   compiler.valhalla.valuetypes.TestNewAcmp 2
  57  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  58  *                   -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
  59  *                   -XX:+AlwaysIncrementalInline
  60  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  61  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  62  *                   compiler.valhalla.valuetypes.TestNewAcmp 2
  63  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
  64  *                   -XX:+EnableValhalla -XX:TypeProfileLevel=222
  65  *                   -XX:+UnlockExperimentalVMOptions -XX:ACmpOnValues=3
  66  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  67  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  68  *                   compiler.valhalla.valuetypes.TestNewAcmp 0
  69  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  70  *                   -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
  71  *                   -XX:+UnlockExperimentalVMOptions -XX:ACmpOnValues=3
  72  *                   -XX:+AlwaysIncrementalInline
  73  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  74  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  75  *                   compiler.valhalla.valuetypes.TestNewAcmp 0
  76  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
  77  *                   -XX:+EnableValhalla -XX:TypeProfileLevel=222
  78  *                   -XX:+UnlockExperimentalVMOptions -XX:ACmpOnValues=3
  79  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  80  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  81  *                   compiler.valhalla.valuetypes.TestNewAcmp 1
  82  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  83  *                   -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
  84  *                   -XX:+UnlockExperimentalVMOptions -XX:ACmpOnValues=3
  85  *                   -XX:+AlwaysIncrementalInline
  86  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  87  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  88  *                   compiler.valhalla.valuetypes.TestNewAcmp 1
  89  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
  90  *                   -XX:+EnableValhalla -XX:TypeProfileLevel=222
  91  *                   -XX:+UnlockExperimentalVMOptions -XX:ACmpOnValues=3
  92  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
  93  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
  94  *                   compiler.valhalla.valuetypes.TestNewAcmp 2
  95  * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  96  *                   -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
  97  *                   -XX:+UnlockExperimentalVMOptions -XX:ACmpOnValues=3
  98  *                   -XX:+AlwaysIncrementalInline
  99  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
 100  *                   -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmp*
 101  *                   compiler.valhalla.valuetypes.TestNewAcmp 2
 102  */
 103 
 104 package compiler.valhalla.valuetypes;
 105 
 106 import jdk.test.lib.Asserts;
 107 import java.lang.annotation.Retention;
 108 import java.lang.annotation.RetentionPolicy;
 109 import java.lang.invoke.*;
 110 import java.lang.reflect.Method;
 111 import java.util.regex.Pattern;
 112 import java.util.regex.Matcher;
 113 import java.util.Arrays;
 114 import sun.hotspot.WhiteBox;
 115 
 116 interface MyInterface {
 117 
 118 }
 119 
 120 value class MyValue1 implements MyInterface {
 121     final int x = 0;
 122 
 123     static MyValue1 createDefault() {
 124         return MyValue1.default;
 125     }
 126 
 127     static MyValue1 setX(MyValue1 v, int x) {
 128         return __WithField(v.x, x);
 129     }
 130 }
 131 
 132 value class MyValue2 implements MyInterface {
 133     final int x = 0;
 134 
 135     static MyValue2 createDefault() {
 136         return MyValue2.default;
 137     }
 138 
 139     static MyValue2 setX(MyValue2 v, int x) {
 140         return __WithField(v.x, x);
 141     }
 142 }
 143 
 144 class MyObject implements MyInterface {
 145     int x;
 146 }
 147 
 148 // Mark test methods that return always false
 149 @Retention(RetentionPolicy.RUNTIME)
 150 @interface AlwaysFalse {
 151     int[] valid_for() default {1, 2};
 152 }
 153 
 154 // Mark test methods that return always true
 155 @Retention(RetentionPolicy.RUNTIME)
 156 @interface AlwaysTrue {
 157     int[] valid_for() default {1, 2};
 158 }
 159 
 160 // Mark test methods that return false if the argument is null
 161 @Retention(RetentionPolicy.RUNTIME)
 162 @interface FalseIfNull { }
 163 
 164 // Mark test methods that return true if the argument is null
 165 @Retention(RetentionPolicy.RUNTIME)
 166 @interface TrueIfNull { }
 167 
 168 public class TestNewAcmp {
 169 
 170     public boolean testEq01_1(Object u1, Object u2) {
 171         return get(u1) == u2; // new acmp
 172     }
 173 
 174     public boolean testEq01_2(Object u1, Object u2) {
 175         return u1 == get(u2); // new acmp
 176     }
 177 
 178     public boolean testEq01_3(Object u1, Object u2) {
 179         return get(u1) == get(u2); // new acmp
 180     }
 181 
 182     @FalseIfNull
 183     public boolean testEq01_4(Object u1, Object u2) {
 184         return getNotNull(u1) == u2; // new acmp without null check
 185     }
 186 
 187     @FalseIfNull
 188     public boolean testEq01_5(Object u1, Object u2) {
 189         return u1 == getNotNull(u2); // new acmp without null check
 190     }
 191 
 192     @FalseIfNull
 193     public boolean testEq01_6(Object u1, Object u2) {
 194         return getNotNull(u1) == getNotNull(u2); // new acmp without null check
 195     }
 196 
 197     public boolean testEq02_1(MyValue1 v1, MyValue1 v2) {
 198         return get(v1) == (Object)v2; // only true if both null
 199     }
 200 
 201     public boolean testEq02_2(MyValue1 v1, MyValue1 v2) {
 202         return (Object)v1 == get(v2); // only true if both null
 203     }
 204 
 205     public boolean testEq02_3(MyValue1 v1, MyValue1 v2) {
 206         return get(v1) == get(v2); // only true if both null
 207     }
 208 
 209     public boolean testEq03_1(MyValue1 v, Object u) {
 210         return get(v) == u; // only true if both null
 211     }
 212 
 213     public boolean testEq03_2(MyValue1 v, Object u) {
 214         return (Object)v == get(u); // only true if both null
 215     }
 216 
 217     public boolean testEq03_3(MyValue1 v, Object u) {
 218         return get(v) == get(u); // only true if both null
 219     }
 220 
 221     public boolean testEq04_1(Object u, MyValue1 v) {
 222         return get(u) == (Object)v; // only true if both null
 223     }
 224 
 225     public boolean testEq04_2(Object u, MyValue1 v) {
 226         return u == get(v); // only true if both null
 227     }
 228 
 229     public boolean testEq04_3(Object u, MyValue1 v) {
 230         return get(u) == get(v); // only true if both null
 231     }
 232 
 233     public boolean testEq05_1(MyObject o, MyValue1 v) {
 234         return get(o) == (Object)v; // only true if both null
 235     }
 236 
 237     public boolean testEq05_2(MyObject o, MyValue1 v) {
 238         return o == get(v); // only true if both null
 239     }
 240 
 241     public boolean testEq05_3(MyObject o, MyValue1 v) {
 242         return get(o) == get(v); // only true if both null
 243     }
 244 
 245     public boolean testEq06_1(MyValue1 v, MyObject o) {
 246         return get(v) == o; // only true if both null
 247     }
 248 
 249     public boolean testEq06_2(MyValue1 v, MyObject o) {
 250         return (Object)v == get(o); // only true if both null
 251     }
 252 
 253     public boolean testEq06_3(MyValue1 v, MyObject o) {
 254         return get(v) == get(o); // only true if both null
 255     }
 256 
 257     @AlwaysFalse
 258     public boolean testEq07_1(MyValue1 v1, MyValue1 v2) {
 259         return getNotNull(v1) == (Object)v2; // false
 260     }
 261 
 262     @AlwaysFalse
 263     public boolean testEq07_2(MyValue1 v1, MyValue1 v2) {
 264         return (Object)v1 == getNotNull(v2); // false
 265     }
 266 
 267     @AlwaysFalse
 268     public boolean testEq07_3(MyValue1 v1, MyValue1 v2) {
 269         return getNotNull(v1) == getNotNull(v2); // false
 270     }
 271 
 272     @AlwaysFalse
 273     public boolean testEq08_1(MyValue1 v, Object u) {
 274         return getNotNull(v) == u; // false
 275     }
 276 
 277     @AlwaysFalse
 278     public boolean testEq08_2(MyValue1 v, Object u) {
 279         return (Object)v == getNotNull(u); // false
 280     }
 281 
 282     @AlwaysFalse
 283     public boolean testEq08_3(MyValue1 v, Object u) {
 284         return getNotNull(v) == getNotNull(u); // false
 285     }
 286 
 287     @AlwaysFalse
 288     public boolean testEq09_1(Object u, MyValue1 v) {
 289         return getNotNull(u) == (Object)v; // false
 290     }
 291 
 292     @AlwaysFalse
 293     public boolean testEq09_2(Object u, MyValue1 v) {
 294         return u == getNotNull(v); // false
 295     }
 296 
 297     @AlwaysFalse
 298     public boolean testEq09_3(Object u, MyValue1 v) {
 299         return getNotNull(u) == getNotNull(v); // false
 300     }
 301 
 302     @AlwaysFalse
 303     public boolean testEq10_1(MyObject o, MyValue1 v) {
 304         return getNotNull(o) == (Object)v; // false
 305     }
 306 
 307     @AlwaysFalse
 308     public boolean testEq10_2(MyObject o, MyValue1 v) {
 309         return o == getNotNull(v); // false
 310     }
 311 
 312     @AlwaysFalse
 313     public boolean testEq10_3(MyObject o, MyValue1 v) {
 314         return getNotNull(o) == getNotNull(v); // false
 315     }
 316 
 317     @AlwaysFalse
 318     public boolean testEq11_1(MyValue1 v, MyObject o) {
 319         return getNotNull(v) == o; // false
 320     }
 321 
 322     @AlwaysFalse
 323     public boolean testEq11_2(MyValue1 v, MyObject o) {
 324         return (Object)v == getNotNull(o); // false
 325     }
 326 
 327     @AlwaysFalse
 328     public boolean testEq11_3(MyValue1 v, MyObject o) {
 329         return getNotNull(v) == getNotNull(o); // false
 330     }
 331 
 332     public boolean testEq12_1(MyObject o1, MyObject o2) {
 333         return get(o1) == o2; // old acmp
 334     }
 335 
 336     public boolean testEq12_2(MyObject o1, MyObject o2) {
 337         return o1 == get(o2); // old acmp
 338     }
 339 
 340     public boolean testEq12_3(MyObject o1, MyObject o2) {
 341         return get(o1) == get(o2); // old acmp
 342     }
 343 
 344     public boolean testEq13_1(Object u, MyObject o) {
 345         return get(u) == o; // old acmp
 346     }
 347 
 348     public boolean testEq13_2(Object u, MyObject o) {
 349         return u == get(o); // old acmp
 350     }
 351 
 352     public boolean testEq13_3(Object u, MyObject o) {
 353         return get(u) == get(o); // old acmp
 354     }
 355 
 356     public boolean testEq14_1(MyObject o, Object u) {
 357         return get(o) == u; // old acmp
 358     }
 359 
 360     public boolean testEq14_2(MyObject o, Object u) {
 361         return o == get(u); // old acmp
 362     }
 363 
 364     public boolean testEq14_3(MyObject o, Object u) {
 365         return get(o) == get(u); // old acmp
 366     }
 367 
 368     public boolean testEq15_1(Object[] a, Object u) {
 369         return get(a) == u; // old acmp
 370     }
 371 
 372     public boolean testEq15_2(Object[] a, Object u) {
 373         return a == get(u); // old acmp
 374     }
 375 
 376     public boolean testEq15_3(Object[] a, Object u) {
 377         return get(a) == get(u); // old acmp
 378     }
 379 
 380     public boolean testEq16_1(Object u, Object[] a) {
 381         return get(u) == a; // old acmp
 382     }
 383 
 384     public boolean testEq16_2(Object u, Object[] a) {
 385         return u == get(a); // old acmp
 386     }
 387 
 388     public boolean testEq16_3(Object u, Object[] a) {
 389         return get(u) == get(a); // old acmp
 390     }
 391 
 392     public boolean testEq17_1(Object[] a, MyValue1 v) {
 393         return get(a) == (Object)v; // only true if both null
 394     }
 395 
 396     public boolean testEq17_2(Object[] a, MyValue1 v) {
 397         return a == get(v); // only true if both null
 398     }
 399 
 400     public boolean testEq17_3(Object[] a, MyValue1 v) {
 401         return get(a) == get(v); // only true if both null
 402     }
 403 
 404     public boolean testEq18_1(MyValue1 v, Object[] a) {
 405         return get(v) == a; // only true if both null
 406     }
 407 
 408     public boolean testEq18_2(MyValue1 v, Object[] a) {
 409         return (Object)v == get(a); // only true if both null
 410     }
 411 
 412     public boolean testEq18_3(MyValue1 v, Object[] a) {
 413         return get(v) == get(a); // only true if both null
 414     }
 415 
 416     @AlwaysFalse
 417     public boolean testEq19_1(Object[] a, MyValue1 v) {
 418         return getNotNull(a) == (Object)v; // false
 419     }
 420 
 421     @AlwaysFalse
 422     public boolean testEq19_2(Object[] a, MyValue1 v) {
 423         return a == getNotNull(v); // false
 424     }
 425 
 426     @AlwaysFalse
 427     public boolean testEq19_3(Object[] a, MyValue1 v) {
 428         return getNotNull(a) == getNotNull(v); // false
 429     }
 430 
 431     @AlwaysFalse
 432     public boolean testEq20_1(MyValue1 v, Object[] a) {
 433         return getNotNull(v) == a; // false
 434     }
 435 
 436     @AlwaysFalse
 437     public boolean testEq20_2(MyValue1 v, Object[] a) {
 438         return (Object)v == getNotNull(a); // false
 439     }
 440 
 441     @AlwaysFalse
 442     public boolean testEq20_3(MyValue1 v, Object[] a) {
 443         return getNotNull(v) == getNotNull(a); // false
 444     }
 445 
 446     public boolean testEq21_1(MyInterface u1, MyInterface u2) {
 447         return get(u1) == u2; // new acmp
 448     }
 449 
 450     public boolean testEq21_2(MyInterface u1, MyInterface u2) {
 451         return u1 == get(u2); // new acmp
 452     }
 453 
 454     public boolean testEq21_3(MyInterface u1, MyInterface u2) {
 455         return get(u1) == get(u2); // new acmp
 456     }
 457 
 458     @FalseIfNull
 459     public boolean testEq21_4(MyInterface u1, MyInterface u2) {
 460         return getNotNull(u1) == u2; // new acmp without null check
 461     }
 462 
 463     @FalseIfNull
 464     public boolean testEq21_5(MyInterface u1, MyInterface u2) {
 465         return u1 == getNotNull(u2); // new acmp without null check
 466     }
 467 
 468     @FalseIfNull
 469     public boolean testEq21_6(MyInterface u1, MyInterface u2) {
 470         return getNotNull(u1) == getNotNull(u2); // new acmp without null check
 471     }
 472 
 473     public boolean testEq22_1(MyValue1 v, MyInterface u) {
 474         return get(v) == u; // only true if both null
 475     }
 476 
 477     public boolean testEq22_2(MyValue1 v, MyInterface u) {
 478         return (Object)v == get(u); // only true if both null
 479     }
 480 
 481     public boolean testEq22_3(MyValue1 v, MyInterface u) {
 482         return get(v) == get(u); // only true if both null
 483     }
 484 
 485     public boolean testEq23_1(MyInterface u, MyValue1 v) {
 486         return get(u) == (Object)v; // only true if both null
 487     }
 488 
 489     public boolean testEq23_2(MyInterface u, MyValue1 v) {
 490         return u == get(v); // only true if both null
 491     }
 492 
 493     public boolean testEq23_3(MyInterface u, MyValue1 v) {
 494         return get(u) == get(v); // only true if both null
 495     }
 496 
 497     @AlwaysFalse
 498     public boolean testEq24_1(MyValue1 v, MyInterface u) {
 499         return getNotNull(v) == u; // false
 500     }
 501 
 502     @AlwaysFalse
 503     public boolean testEq24_2(MyValue1 v, MyInterface u) {
 504         return (Object)v == getNotNull(u); // false
 505     }
 506 
 507     @AlwaysFalse
 508     public boolean testEq24_3(MyValue1 v, MyInterface u) {
 509         return getNotNull(v) == getNotNull(u); // false
 510     }
 511 
 512     @AlwaysFalse
 513     public boolean testEq25_1(MyInterface u, MyValue1 v) {
 514         return getNotNull(u) == (Object)v; // false
 515     }
 516 
 517     @AlwaysFalse
 518     public boolean testEq25_2(MyInterface u, MyValue1 v) {
 519         return u == getNotNull(v); // false
 520     }
 521 
 522     @AlwaysFalse
 523     public boolean testEq25_3(MyInterface u, MyValue1 v) {
 524         return getNotNull(u) == getNotNull(v); // false
 525     }
 526 
 527     public boolean testEq26_1(MyInterface u, MyObject o) {
 528         return get(u) == o; // old acmp
 529     }
 530 
 531     public boolean testEq26_2(MyInterface u, MyObject o) {
 532         return u == get(o); // old acmp
 533     }
 534 
 535     public boolean testEq26_3(MyInterface u, MyObject o) {
 536         return get(u) == get(o); // old acmp
 537     }
 538 
 539     public boolean testEq27_1(MyObject o, MyInterface u) {
 540         return get(o) == u; // old acmp
 541     }
 542 
 543     public boolean testEq27_2(MyObject o, MyInterface u) {
 544         return o == get(u); // old acmp
 545     }
 546 
 547     public boolean testEq27_3(MyObject o, MyInterface u) {
 548         return get(o) == get(u); // old acmp
 549     }
 550 
 551     public boolean testEq28_1(MyInterface[] a, MyInterface u) {
 552         return get(a) == u; // old acmp
 553     }
 554 
 555     public boolean testEq28_2(MyInterface[] a, MyInterface u) {
 556         return a == get(u); // old acmp
 557     }
 558 
 559     public boolean testEq28_3(MyInterface[] a, MyInterface u) {
 560         return get(a) == get(u); // old acmp
 561     }
 562 
 563     public boolean testEq29_1(MyInterface u, MyInterface[] a) {
 564         return get(u) == a; // old acmp
 565     }
 566 
 567     public boolean testEq29_2(MyInterface u, MyInterface[] a) {
 568         return u == get(a); // old acmp
 569     }
 570 
 571     public boolean testEq29_3(MyInterface u, MyInterface[] a) {
 572         return get(u) == get(a); // old acmp
 573     }
 574 
 575     public boolean testEq30_1(MyInterface[] a, MyValue1 v) {
 576         return get(a) == (Object)v; // only true if both null
 577     }
 578 
 579     public boolean testEq30_2(MyInterface[] a, MyValue1 v) {
 580         return a == get(v); // only true if both null
 581     }
 582 
 583     public boolean testEq30_3(MyInterface[] a, MyValue1 v) {
 584         return get(a) == get(v); // only true if both null
 585     }
 586 
 587     public boolean testEq31_1(MyValue1 v, MyInterface[] a) {
 588         return get(v) == a; // only true if both null
 589     }
 590 
 591     public boolean testEq31_2(MyValue1 v, MyInterface[] a) {
 592         return (Object)v == get(a); // only true if both null
 593     }
 594 
 595     public boolean testEq31_3(MyValue1 v, MyInterface[] a) {
 596         return get(v) == get(a); // only true if both null
 597     }
 598 
 599     @AlwaysFalse
 600     public boolean testEq32_1(MyInterface[] a, MyValue1 v) {
 601         return getNotNull(a) == (Object)v; // false
 602     }
 603 
 604     @AlwaysFalse
 605     public boolean testEq32_2(MyInterface[] a, MyValue1 v) {
 606         return a == getNotNull(v); // false
 607     }
 608 
 609     @AlwaysFalse
 610     public boolean testEq32_3(MyInterface[] a, MyValue1 v) {
 611         return getNotNull(a) == getNotNull(v); // false
 612     }
 613 
 614     @AlwaysFalse
 615     public boolean testEq33_1(MyValue1 v, MyInterface[] a) {
 616         return getNotNull(v) == a; // false
 617     }
 618 
 619     @AlwaysFalse
 620     public boolean testEq33_2(MyValue1 v, MyInterface[] a) {
 621         return (Object)v == getNotNull(a); // false
 622     }
 623 
 624     @AlwaysFalse
 625     public boolean testEq33_3(MyValue1 v, MyInterface[] a) {
 626         return getNotNull(v) == getNotNull(a); // false
 627     }
 628 
 629 
 630     // Null tests
 631 
 632     public boolean testNull01_1(MyValue1 v) {
 633         return (Object)v == null; // old acmp
 634     }
 635 
 636     public boolean testNull01_2(MyValue1 v) {
 637         return get(v) == null; // old acmp
 638     }
 639 
 640     public boolean testNull01_3(MyValue1 v) {
 641         return (Object)v == get((Object)null); // old acmp
 642     }
 643 
 644     public boolean testNull01_4(MyValue1 v) {
 645         return get(v) == get((Object)null); // old acmp
 646     }
 647 
 648     public boolean testNull02_1(MyValue1 v) {
 649         return null == (Object)v; // old acmp
 650     }
 651 
 652     public boolean testNull02_2(MyValue1 v) {
 653         return get((Object)null) == (Object)v; // old acmp
 654     }
 655 
 656     public boolean testNull02_3(MyValue1 v) {
 657         return null == get(v); // old acmp
 658     }
 659 
 660     public boolean testNull02_4(MyValue1 v) {
 661         return get((Object)null) == get(v); // old acmp
 662     }
 663 
 664     public boolean testNull03_1(Object u) {
 665         return u == null; // old acmp
 666     }
 667 
 668     public boolean testNull03_2(Object u) {
 669         return get(u) == null; // old acmp
 670     }
 671 
 672     public boolean testNull03_3(Object u) {
 673         return u == get((Object)null); // old acmp
 674     }
 675 
 676     public boolean testNull03_4(Object u) {
 677         return get(u) == get((Object)null); // old acmp
 678     }
 679 
 680     public boolean testNull04_1(Object u) {
 681         return null == u; // old acmp
 682     }
 683 
 684     public boolean testNull04_2(Object u) {
 685         return get((Object)null) == u; // old acmp
 686     }
 687 
 688     public boolean testNull04_3(Object u) {
 689         return null == get(u); // old acmp
 690     }
 691 
 692     public boolean testNull04_4(Object u) {
 693         return get((Object)null) == get(u); // old acmp
 694     }
 695 
 696     public boolean testNull05_1(MyObject o) {
 697         return o == null; // old acmp
 698     }
 699 
 700     public boolean testNull05_2(MyObject o) {
 701         return get(o) == null; // old acmp
 702     }
 703 
 704     public boolean testNull05_3(MyObject o) {
 705         return o == get((Object)null); // old acmp
 706     }
 707 
 708     public boolean testNull05_4(MyObject o) {
 709         return get(o) == get((Object)null); // old acmp
 710     }
 711 
 712     public boolean testNull06_1(MyObject o) {
 713         return null == o; // old acmp
 714     }
 715 
 716     public boolean testNull06_2(MyObject o) {
 717         return get((Object)null) == o; // old acmp
 718     }
 719 
 720     public boolean testNull06_3(MyObject o) {
 721         return null == get(o); // old acmp
 722     }
 723 
 724     public boolean testNull06_4(MyObject o) {
 725         return get((Object)null) == get(o); // old acmp
 726     }
 727 
 728     public boolean testNull07_1(MyInterface u) {
 729         return u == null; // old acmp
 730     }
 731 
 732     public boolean testNull07_2(MyInterface u) {
 733         return get(u) == null; // old acmp
 734     }
 735 
 736     public boolean testNull07_3(MyInterface u) {
 737         return u == get((Object)null); // old acmp
 738     }
 739 
 740     public boolean testNull07_4(MyInterface u) {
 741         return get(u) == get((Object)null); // old acmp
 742     }
 743 
 744     public boolean testNull08_1(MyInterface u) {
 745         return null == u; // old acmp
 746     }
 747 
 748     public boolean testNull08_2(MyInterface u) {
 749         return get((Object)null) == u; // old acmp
 750     }
 751 
 752     public boolean testNull08_3(MyInterface u) {
 753         return null == get(u); // old acmp
 754     }
 755 
 756     public boolean testNull08_4(MyInterface u) {
 757         return get((Object)null) == get(u); // old acmp
 758     }
 759 
 760     // Same tests as above but negated
 761 
 762     public boolean testNotEq01_1(Object u1, Object u2) {
 763         return get(u1) != u2; // new acmp
 764     }
 765 
 766     public boolean testNotEq01_2(Object u1, Object u2) {
 767         return u1 != get(u2); // new acmp
 768     }
 769 
 770     public boolean testNotEq01_3(Object u1, Object u2) {
 771         return get(u1) != get(u2); // new acmp
 772     }
 773 
 774     @TrueIfNull
 775     public boolean testNotEq01_4(Object u1, Object u2) {
 776         return getNotNull(u1) != u2; // new acmp without null check
 777     }
 778 
 779     @TrueIfNull
 780     public boolean testNotEq01_5(Object u1, Object u2) {
 781         return u1 != getNotNull(u2); // new acmp without null check
 782     }
 783 
 784     @TrueIfNull
 785     public boolean testNotEq01_6(Object u1, Object u2) {
 786         return getNotNull(u1) != getNotNull(u2); // new acmp without null check
 787     }
 788 
 789     public boolean testNotEq02_1(MyValue1 v1, MyValue1 v2) {
 790         return get(v1) != (Object)v2; // only false if both null
 791     }
 792 
 793     public boolean testNotEq02_2(MyValue1 v1, MyValue1 v2) {
 794         return (Object)v1 != get(v2); // only false if both null
 795     }
 796 
 797     public boolean testNotEq02_3(MyValue1 v1, MyValue1 v2) {
 798         return get(v1) != get(v2); // only false if both null
 799     }
 800 
 801     public boolean testNotEq03_1(MyValue1 v, Object u) {
 802         return get(v) != u; // only false if both null
 803     }
 804 
 805     public boolean testNotEq03_2(MyValue1 v, Object u) {
 806         return (Object)v != get(u); // only false if both null
 807     }
 808 
 809     public boolean testNotEq03_3(MyValue1 v, Object u) {
 810         return get(v) != get(u); // only false if both null
 811     }
 812 
 813     public boolean testNotEq04_1(Object u, MyValue1 v) {
 814         return get(u) != (Object)v; // only false if both null
 815     }
 816 
 817     public boolean testNotEq04_2(Object u, MyValue1 v) {
 818         return u != get(v); // only false if both null
 819     }
 820 
 821     public boolean testNotEq04_3(Object u, MyValue1 v) {
 822         return get(u) != get(v); // only false if both null
 823     }
 824 
 825     public boolean testNotEq05_1(MyObject o, MyValue1 v) {
 826         return get(o) != (Object)v; // only false if both null
 827     }
 828 
 829     public boolean testNotEq05_2(MyObject o, MyValue1 v) {
 830         return o != get(v); // only false if both null
 831     }
 832 
 833     public boolean testNotEq05_3(MyObject o, MyValue1 v) {
 834         return get(o) != get(v); // only false if both null
 835     }
 836 
 837     public boolean testNotEq06_1(MyValue1 v, MyObject o) {
 838         return get(v) != o; // only false if both null
 839     }
 840 
 841     public boolean testNotEq06_2(MyValue1 v, MyObject o) {
 842         return (Object)v != get(o); // only false if both null
 843     }
 844 
 845     public boolean testNotEq06_3(MyValue1 v, MyObject o) {
 846         return get(v) != get(o); // only false if both null
 847     }
 848 
 849     @AlwaysTrue
 850     public boolean testNotEq07_1(MyValue1 v1, MyValue1 v2) {
 851         return getNotNull(v1) != (Object)v2; // true
 852     }
 853 
 854     @AlwaysTrue
 855     public boolean testNotEq07_2(MyValue1 v1, MyValue1 v2) {
 856         return (Object)v1 != getNotNull(v2); // true
 857     }
 858 
 859     @AlwaysTrue
 860     public boolean testNotEq07_3(MyValue1 v1, MyValue1 v2) {
 861         return getNotNull(v1) != getNotNull(v2); // true
 862     }
 863 
 864     @AlwaysTrue
 865     public boolean testNotEq08_1(MyValue1 v, Object u) {
 866         return getNotNull(v) != u; // true
 867     }
 868 
 869     @AlwaysTrue
 870     public boolean testNotEq08_2(MyValue1 v, Object u) {
 871         return (Object)v != getNotNull(u); // true
 872     }
 873 
 874     @AlwaysTrue
 875     public boolean testNotEq08_3(MyValue1 v, Object u) {
 876         return getNotNull(v) != getNotNull(u); // true
 877     }
 878 
 879     @AlwaysTrue
 880     public boolean testNotEq09_1(Object u, MyValue1 v) {
 881         return getNotNull(u) != (Object)v; // true
 882     }
 883 
 884     @AlwaysTrue
 885     public boolean testNotEq09_2(Object u, MyValue1 v) {
 886         return u != getNotNull(v); // true
 887     }
 888 
 889     @AlwaysTrue
 890     public boolean testNotEq09_3(Object u, MyValue1 v) {
 891         return getNotNull(u) != getNotNull(v); // true
 892     }
 893 
 894     @AlwaysTrue
 895     public boolean testNotEq10_1(MyObject o, MyValue1 v) {
 896         return getNotNull(o) != (Object)v; // true
 897     }
 898 
 899     @AlwaysTrue
 900     public boolean testNotEq10_2(MyObject o, MyValue1 v) {
 901         return o != getNotNull(v); // true
 902     }
 903 
 904     @AlwaysTrue
 905     public boolean testNotEq10_3(MyObject o, MyValue1 v) {
 906         return getNotNull(o) != getNotNull(v); // true
 907     }
 908 
 909     @AlwaysTrue
 910     public boolean testNotEq11_1(MyValue1 v, MyObject o) {
 911         return getNotNull(v) != o; // true
 912     }
 913 
 914     @AlwaysTrue
 915     public boolean testNotEq11_2(MyValue1 v, MyObject o) {
 916         return (Object)v != getNotNull(o); // true
 917     }
 918 
 919     @AlwaysTrue
 920     public boolean testNotEq11_3(MyValue1 v, MyObject o) {
 921         return getNotNull(v) != getNotNull(o); // true
 922     }
 923 
 924     public boolean testNotEq12_1(MyObject o1, MyObject o2) {
 925         return get(o1) != o2; // old acmp
 926     }
 927 
 928     public boolean testNotEq12_2(MyObject o1, MyObject o2) {
 929         return o1 != get(o2); // old acmp
 930     }
 931 
 932     public boolean testNotEq12_3(MyObject o1, MyObject o2) {
 933         return get(o1) != get(o2); // old acmp
 934     }
 935 
 936     public boolean testNotEq13_1(Object u, MyObject o) {
 937         return get(u) != o; // old acmp
 938     }
 939 
 940     public boolean testNotEq13_2(Object u, MyObject o) {
 941         return u != get(o); // old acmp
 942     }
 943 
 944     public boolean testNotEq13_3(Object u, MyObject o) {
 945         return get(u) != get(o); // old acmp
 946     }
 947 
 948     public boolean testNotEq14_1(MyObject o, Object u) {
 949         return get(o) != u; // old acmp
 950     }
 951 
 952     public boolean testNotEq14_2(MyObject o, Object u) {
 953         return o != get(u); // old acmp
 954     }
 955 
 956     public boolean testNotEq14_3(MyObject o, Object u) {
 957         return get(o) != get(u); // old acmp
 958     }
 959 
 960     public boolean testNotEq15_1(Object[] a, Object u) {
 961         return get(a) != u; // old acmp
 962     }
 963 
 964     public boolean testNotEq15_2(Object[] a, Object u) {
 965         return a != get(u); // old acmp
 966     }
 967 
 968     public boolean testNotEq15_3(Object[] a, Object u) {
 969         return get(a) != get(u); // old acmp
 970     }
 971 
 972     public boolean testNotEq16_1(Object u, Object[] a) {
 973         return get(u) != a; // old acmp
 974     }
 975 
 976     public boolean testNotEq16_2(Object u, Object[] a) {
 977         return u != get(a); // old acmp
 978     }
 979 
 980     public boolean testNotEq16_3(Object u, Object[] a) {
 981         return get(u) != get(a); // old acmp
 982     }
 983 
 984     public boolean testNotEq17_1(Object[] a, MyValue1 v) {
 985         return get(a) != (Object)v; // only false if both null
 986     }
 987 
 988     public boolean testNotEq17_2(Object[] a, MyValue1 v) {
 989         return a != get(v); // only false if both null
 990     }
 991 
 992     public boolean testNotEq17_3(Object[] a, MyValue1 v) {
 993         return get(a) != get(v); // only false if both null
 994     }
 995 
 996     public boolean testNotEq18_1(MyValue1 v, Object[] a) {
 997         return get(v) != a; // only false if both null
 998     }
 999 
1000     public boolean testNotEq18_2(MyValue1 v, Object[] a) {
1001         return (Object)v != get(a); // only false if both null
1002     }
1003 
1004     public boolean testNotEq18_3(MyValue1 v, Object[] a) {
1005         return get(v) != get(a); // only false if both null
1006     }
1007 
1008     @AlwaysTrue
1009     public boolean testNotEq19_1(Object[] a, MyValue1 v) {
1010         return getNotNull(a) != (Object)v; // true
1011     }
1012 
1013     @AlwaysTrue
1014     public boolean testNotEq19_2(Object[] a, MyValue1 v) {
1015         return a != getNotNull(v); // true
1016     }
1017 
1018     @AlwaysTrue
1019     public boolean testNotEq19_3(Object[] a, MyValue1 v) {
1020         return getNotNull(a) != getNotNull(v); // true
1021     }
1022 
1023     @AlwaysTrue
1024     public boolean testNotEq20_1(MyValue1 v, Object[] a) {
1025         return getNotNull(v) != a; // true
1026     }
1027 
1028     @AlwaysTrue
1029     public boolean testNotEq20_2(MyValue1 v, Object[] a) {
1030         return (Object)v != getNotNull(a); // true
1031     }
1032 
1033     @AlwaysTrue
1034     public boolean testNotEq20_3(MyValue1 v, Object[] a) {
1035         return getNotNull(v) != getNotNull(a); // true
1036     }
1037 
1038     public boolean testNotEq21_1(MyInterface u1, MyInterface u2) {
1039         return get(u1) != u2; // new acmp
1040     }
1041 
1042     public boolean testNotEq21_2(MyInterface u1, MyInterface u2) {
1043         return u1 != get(u2); // new acmp
1044     }
1045 
1046     public boolean testNotEq21_3(MyInterface u1, MyInterface u2) {
1047         return get(u1) != get(u2); // new acmp
1048     }
1049 
1050     @TrueIfNull
1051     public boolean testNotEq21_4(MyInterface u1, MyInterface u2) {
1052         return getNotNull(u1) != u2; // new acmp without null check
1053     }
1054 
1055     @TrueIfNull
1056     public boolean testNotEq21_5(MyInterface u1, MyInterface u2) {
1057         return u1 != getNotNull(u2); // new acmp without null check
1058     }
1059 
1060     @TrueIfNull
1061     public boolean testNotEq21_6(MyInterface u1, MyInterface u2) {
1062         return getNotNull(u1) != getNotNull(u2); // new acmp without null check
1063     }
1064 
1065     public boolean testNotEq22_1(MyValue1 v, MyInterface u) {
1066         return get(v) != u; // only false if both null
1067     }
1068 
1069     public boolean testNotEq22_2(MyValue1 v, MyInterface u) {
1070         return (Object)v != get(u); // only false if both null
1071     }
1072 
1073     public boolean testNotEq22_3(MyValue1 v, MyInterface u) {
1074         return get(v) != get(u); // only false if both null
1075     }
1076 
1077     public boolean testNotEq23_1(MyInterface u, MyValue1 v) {
1078         return get(u) != (Object)v; // only false if both null
1079     }
1080 
1081     public boolean testNotEq23_2(MyInterface u, MyValue1 v) {
1082         return u != get(v); // only false if both null
1083     }
1084 
1085     public boolean testNotEq23_3(MyInterface u, MyValue1 v) {
1086         return get(u) != get(v); // only false if both null
1087     }
1088 
1089     @AlwaysTrue
1090     public boolean testNotEq24_1(MyValue1 v, MyInterface u) {
1091         return getNotNull(v) != u; // true
1092     }
1093 
1094     @AlwaysTrue
1095     public boolean testNotEq24_2(MyValue1 v, MyInterface u) {
1096         return (Object)v != getNotNull(u); // true
1097     }
1098 
1099     @AlwaysTrue
1100     public boolean testNotEq24_3(MyValue1 v, MyInterface u) {
1101         return getNotNull(v) != getNotNull(u); // true
1102     }
1103 
1104     @AlwaysTrue
1105     public boolean testNotEq25_1(MyInterface u, MyValue1 v) {
1106         return getNotNull(u) != (Object)v; // true
1107     }
1108 
1109     @AlwaysTrue
1110     public boolean testNotEq25_2(MyInterface u, MyValue1 v) {
1111         return u != getNotNull(v); // true
1112     }
1113 
1114     @AlwaysTrue
1115     public boolean testNotEq25_3(MyInterface u, MyValue1 v) {
1116         return getNotNull(u) != getNotNull(v); // true
1117     }
1118 
1119     public boolean testNotEq26_1(MyInterface u, MyObject o) {
1120         return get(u) != o; // old acmp
1121     }
1122 
1123     public boolean testNotEq26_2(MyInterface u, MyObject o) {
1124         return u != get(o); // old acmp
1125     }
1126 
1127     public boolean testNotEq26_3(MyInterface u, MyObject o) {
1128         return get(u) != get(o); // old acmp
1129     }
1130 
1131     public boolean testNotEq27_1(MyObject o, MyInterface u) {
1132         return get(o) != u; // old acmp
1133     }
1134 
1135     public boolean testNotEq27_2(MyObject o, MyInterface u) {
1136         return o != get(u); // old acmp
1137     }
1138 
1139     public boolean testNotEq27_3(MyObject o, MyInterface u) {
1140         return get(o) != get(u); // old acmp
1141     }
1142 
1143     public boolean testNotEq28_1(MyInterface[] a, MyInterface u) {
1144         return get(a) != u; // old acmp
1145     }
1146 
1147     public boolean testNotEq28_2(MyInterface[] a, MyInterface u) {
1148         return a != get(u); // old acmp
1149     }
1150 
1151     public boolean testNotEq28_3(MyInterface[] a, MyInterface u) {
1152         return get(a) != get(u); // old acmp
1153     }
1154 
1155     public boolean testNotEq29_1(MyInterface u, MyInterface[] a) {
1156         return get(u) != a; // old acmp
1157     }
1158 
1159     public boolean testNotEq29_2(MyInterface u, MyInterface[] a) {
1160         return u != get(a); // old acmp
1161     }
1162 
1163     public boolean testNotEq29_3(MyInterface u, MyInterface[] a) {
1164         return get(u) != get(a); // old acmp
1165     }
1166 
1167     public boolean testNotEq30_1(MyInterface[] a, MyValue1 v) {
1168         return get(a) != (Object)v; // only false if both null
1169     }
1170 
1171     public boolean testNotEq30_2(MyInterface[] a, MyValue1 v) {
1172         return a != get(v); // only false if both null
1173     }
1174 
1175     public boolean testNotEq30_3(MyInterface[] a, MyValue1 v) {
1176         return get(a) != get(v); // only false if both null
1177     }
1178 
1179     public boolean testNotEq31_1(MyValue1 v, MyInterface[] a) {
1180         return get(v) != a; // only false if both null
1181     }
1182 
1183     public boolean testNotEq31_2(MyValue1 v, MyInterface[] a) {
1184         return (Object)v != get(a); // only false if both null
1185     }
1186 
1187     public boolean testNotEq31_3(MyValue1 v, MyInterface[] a) {
1188         return get(v) != get(a); // only false if both null
1189     }
1190 
1191     @AlwaysTrue
1192     public boolean testNotEq32_1(MyInterface[] a, MyValue1 v) {
1193         return getNotNull(a) != (Object)v; // true
1194     }
1195 
1196     @AlwaysTrue
1197     public boolean testNotEq32_2(MyInterface[] a, MyValue1 v) {
1198         return a != getNotNull(v); // true
1199     }
1200 
1201     @AlwaysTrue
1202     public boolean testNotEq32_3(MyInterface[] a, MyValue1 v) {
1203         return getNotNull(a) != getNotNull(v); // true
1204     }
1205 
1206     @AlwaysTrue
1207     public boolean testNotEq33_1(MyValue1 v, MyInterface[] a) {
1208         return getNotNull(v) != a; // true
1209     }
1210 
1211     @AlwaysTrue
1212     public boolean testNotEq33_2(MyValue1 v, MyInterface[] a) {
1213         return (Object)v != getNotNull(a); // true
1214     }
1215 
1216     @AlwaysTrue
1217     public boolean testNotEq33_3(MyValue1 v, MyInterface[] a) {
1218         return getNotNull(v) != getNotNull(a); // true
1219     }
1220 
1221     // Null tests
1222 
1223     public boolean testNotNull01_1(MyValue1 v) {
1224         return (Object)v != null; // old acmp
1225     }
1226 
1227     public boolean testNotNull01_2(MyValue1 v) {
1228         return get(v) != null; // old acmp
1229     }
1230 
1231     public boolean testNotNull01_3(MyValue1 v) {
1232         return (Object)v != get((Object)null); // old acmp
1233     }
1234 
1235     public boolean testNotNull01_4(MyValue1 v) {
1236         return get(v) != get((Object)null); // old acmp
1237     }
1238 
1239     public boolean testNotNull02_1(MyValue1 v) {
1240         return null != (Object)v; // old acmp
1241     }
1242 
1243     public boolean testNotNull02_2(MyValue1 v) {
1244         return get((Object)null) != (Object)v; // old acmp
1245     }
1246 
1247     public boolean testNotNull02_3(MyValue1 v) {
1248         return null != get(v); // old acmp
1249     }
1250 
1251     public boolean testNotNull02_4(MyValue1 v) {
1252         return get((Object)null) != get(v); // old acmp
1253     }
1254 
1255     public boolean testNotNull03_1(Object u) {
1256         return u != null; // old acmp
1257     }
1258 
1259     public boolean testNotNull03_2(Object u) {
1260         return get(u) != null; // old acmp
1261     }
1262 
1263     public boolean testNotNull03_3(Object u) {
1264         return u != get((Object)null); // old acmp
1265     }
1266 
1267     public boolean testNotNull03_4(Object u) {
1268         return get(u) != get((Object)null); // old acmp
1269     }
1270 
1271     public boolean testNotNull04_1(Object u) {
1272         return null != u; // old acmp
1273     }
1274 
1275     public boolean testNotNull04_2(Object u) {
1276         return get((Object)null) != u; // old acmp
1277     }
1278 
1279     public boolean testNotNull04_3(Object u) {
1280         return null != get(u); // old acmp
1281     }
1282 
1283     public boolean testNotNull04_4(Object u) {
1284         return get((Object)null) != get(u); // old acmp
1285     }
1286 
1287     public boolean testNotNull05_1(MyObject o) {
1288         return o != null; // old acmp
1289     }
1290 
1291     public boolean testNotNull05_2(MyObject o) {
1292         return get(o) != null; // old acmp
1293     }
1294 
1295     public boolean testNotNull05_3(MyObject o) {
1296         return o != get((Object)null); // old acmp
1297     }
1298 
1299     public boolean testNotNull05_4(MyObject o) {
1300         return get(o) != get((Object)null); // old acmp
1301     }
1302 
1303     public boolean testNotNull06_1(MyObject o) {
1304         return null != o; // old acmp
1305     }
1306 
1307     public boolean testNotNull06_2(MyObject o) {
1308         return get((Object)null) != o; // old acmp
1309     }
1310 
1311     public boolean testNotNull06_3(MyObject o) {
1312         return null != get(o); // old acmp
1313     }
1314 
1315     public boolean testNotNull06_4(MyObject o) {
1316         return get((Object)null) != get(o); // old acmp
1317     }
1318 
1319     public boolean testNotNull07_1(MyInterface u) {
1320         return u != null; // old acmp
1321     }
1322 
1323     public boolean testNotNull07_2(MyInterface u) {
1324         return get(u) != null; // old acmp
1325     }
1326 
1327     public boolean testNotNull07_3(MyInterface u) {
1328         return u != get((Object)null); // old acmp
1329     }
1330 
1331     public boolean testNotNull07_4(MyInterface u) {
1332         return get(u) != get((Object)null); // old acmp
1333     }
1334 
1335     public boolean testNotNull08_1(MyInterface u) {
1336         return null != u; // old acmp
1337     }
1338 
1339     public boolean testNotNull08_2(MyInterface u) {
1340         return get((Object)null) != u; // old acmp
1341     }
1342 
1343     public boolean testNotNull08_3(MyInterface u) {
1344         return null != get(u); // old acmp
1345     }
1346 
1347     public boolean testNotNull08_4(MyInterface u) {
1348         return get((Object)null) != get(u); // old acmp
1349     }
1350 
1351     // The following methods are used with -XX:+AlwaysIncrementalInline to hide exact types during parsing
1352 
1353     public Object get(Object u) {
1354         return u;
1355     }
1356 
1357     public Object getNotNull(Object u) {
1358         return (u != null) ? u : new Object();
1359     }
1360 
1361     public Object get(MyValue1 v) {
1362         return v;
1363     }
1364 
1365     public Object getNotNull(MyValue1 v) {
1366         return ((Object)v != null) ? v : MyValue1.createDefault();
1367     }
1368 
1369     public Object get(MyObject o) {
1370         return o;
1371     }
1372 
1373     public Object getNotNull(MyObject o) {
1374         return (o != null) ? o : MyValue1.createDefault();
1375     }
1376 
1377     public Object get(Object[] a) {
1378         return a;
1379     }
1380 
1381     public Object getNotNull(Object[] a) {
1382         return (a != null) ? a : new Object[1];
1383     }
1384 
1385     public boolean trueIfNull(Method m) {
1386         return m.isAnnotationPresent(TrueIfNull.class);
1387     }
1388 
1389     public boolean falseIfNull(Method m) {
1390         return m.isAnnotationPresent(FalseIfNull.class);
1391     }
1392 
1393     public boolean alwaysTrue(Method m) {
1394         return m.isAnnotationPresent(AlwaysTrue.class) &&
1395             Arrays.asList(((AlwaysTrue)m.getAnnotation(AlwaysTrue.class)).valid_for()).contains(ACmpOnValues);
1396     }
1397 
1398     public boolean alwaysFalse(Method m) {
1399         return m.isAnnotationPresent(AlwaysFalse.class) &&
1400             Arrays.asList(((AlwaysFalse)m.getAnnotation(AlwaysFalse.class)).valid_for()).contains(ACmpOnValues);
1401     }
1402 
1403     public boolean isNegated(Method m) {
1404         return m.getName().startsWith("testNot");
1405     }
1406 
1407     // Tests with profiling
1408     public boolean cmpAlwaysEqual1(Object a, Object b) {
1409         return a == b;
1410     }
1411 
1412     public boolean cmpAlwaysEqual2(Object a, Object b) {
1413         return a != b;
1414     }
1415 
1416     public boolean cmpAlwaysEqual3(Object a) {
1417         return a == a;
1418     }
1419 
1420     public boolean cmpAlwaysEqual4(Object a) {
1421         return a != a;
1422     }
1423 
1424     public boolean cmpAlwaysUnEqual1(Object a, Object b) {
1425         return a == b;
1426     }
1427 
1428     public boolean cmpAlwaysUnEqual2(Object a, Object b) {
1429         return a != b;
1430     }
1431 
1432     public boolean cmpAlwaysUnEqual3(Object a) {
1433         return a == a;
1434     }
1435 
1436     public boolean cmpAlwaysUnEqual4(Object a) {
1437         return a != a;
1438     }
1439 
1440     public boolean cmpSometimesEqual1(Object a) {
1441         return a == a;
1442     }
1443 
1444     public boolean cmpSometimesEqual2(Object a) {
1445         return a != a;
1446     }
1447 
1448     protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
1449     protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
1450     protected static final long ACmpOnValues = (Long)WHITE_BOX.getVMFlag("ACmpOnValues");
1451 
1452     public void runTest(Method m, Object[] args, int warmup, int nullMode, boolean[][] equalities) throws Exception {
1453         Class<?>[] parameterTypes = m.getParameterTypes();
1454         int parameterCount = parameterTypes.length;
1455         // Nullness mode for first argument
1456         // 0: default, 1: never null, 2: always null
1457         int start = (nullMode != 1) ? 0 : 1;
1458         int end = (nullMode != 2) ? args.length : 1;
1459         for (int i = start; i < end; ++i) {
1460             if (args[i] != null && !parameterTypes[0].isInstance(args[i])) {
1461                 continue;
1462             }
1463             if (args[i] == null && parameterTypes[0] == MyValue1.class.asValueType()) {
1464                 continue;
1465             }
1466             if (parameterCount == 1) {
1467                 // Null checks
1468                 System.out.print("Testing " + m.getName() + "(" + args[i] + ")");
1469                 // Avoid acmp in the computation of the expected result!
1470                 boolean expected = isNegated(m) ? (i != 0) : (i == 0);
1471                 for (int run = 0; run < warmup; ++run) {
1472                     Boolean result = (Boolean)m.invoke(this, args[i]);
1473                     if (result != expected && WHITE_BOX.isMethodCompiled(m, false)) {
1474                         System.out.println(" = " + result);
1475                         throw new RuntimeException("Test failed: should return " + expected);
1476                     }
1477                 }
1478                 System.out.println(" = " + expected);
1479             } else {
1480                 // Equality checks
1481                 for (int j = 0; j < args.length; ++j) {
1482                     if (args[j] != null && !parameterTypes[1].isInstance(args[j])) {
1483                         continue;
1484                     }
1485                     if (args[j] == null && parameterTypes[1] == MyValue1.class.asValueType()) {
1486                         continue;
1487                     }
1488                     System.out.print("Testing " + m.getName() + "(" + args[i] + ", " + args[j] + ")");
1489                     // Avoid acmp in the computation of the expected result!
1490                     boolean equal = equalities[i][j];
1491                     equal = isNegated(m) ? !equal : equal;
1492                     boolean expected = alwaysTrue(m) || ((i == 0 || j == 0) && trueIfNull(m)) || (!alwaysFalse(m) && equal && !(i == 0 && falseIfNull(m)));
1493                     for (int run = 0; run < warmup; ++run) {
1494                         Boolean result = (Boolean)m.invoke(this, args[i], args[j]);
1495                         if (result != expected && WHITE_BOX.isMethodCompiled(m, false) && warmup == 1) {
1496                             System.out.println(" = " + result);
1497                             throw new RuntimeException("Test failed: should return " + expected);
1498                         }
1499                     }
1500                     System.out.println(" = " + expected);
1501                 }
1502             }
1503         }
1504     }
1505 
1506     public void run(int nullMode) throws Exception {
1507         // Prepare test arguments
1508         Object[] args =  { null,
1509                            new Object(),
1510                            new MyObject(),
1511                            MyValue1.setX(MyValue1.createDefault(), 42),
1512                            new Object[10],
1513                            new MyObject[10],
1514                            MyValue1.setX(MyValue1.createDefault(), 0x42),
1515                            MyValue1.setX(MyValue1.createDefault(), 42),
1516                            MyValue2.setX(MyValue2.createDefault(), 42), };
1517 
1518         boolean[][] equalities = { { true,  false,  false, false,            false, false, false,             false,             false             },
1519                                    { false, true,   false, false,            false, false, false,             false,             false             },
1520                                    { false, false,  true,  false,            false, false, false,             false,             false             },
1521                                    { false, false,  false, ACmpOnValues == 3,false, false, false,             ACmpOnValues == 3, false             },
1522                                    { false, false,  false, false,            true,  false, false,             false,             false             },
1523                                    { false, false,  false, false,            false, true,  false,             false,             false             },
1524                                    { false, false,  false, false,            false, false, ACmpOnValues == 3, false,             false             },
1525                                    { false, false,  false, ACmpOnValues == 3,false, false, false,             ACmpOnValues == 3, false             },
1526                                    { false, false,  false, false,            false, false, false,             false,             ACmpOnValues == 3 } };
1527 
1528         // Run tests
1529         for (Method m : getClass().getMethods()) {
1530             if (m.getName().startsWith("test")) {
1531                 // Do some warmup runs
1532                 runTest(m, args, 1000, nullMode, equalities);
1533                 // Make sure method is compiled
1534                 WHITE_BOX.enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
1535                 Asserts.assertTrue(WHITE_BOX.isMethodCompiled(m, false), m + " not compiled");
1536                 // Run again to verify correctness of compiled code
1537                 runTest(m, args, 1, nullMode, equalities);
1538             }
1539         }
1540 
1541         Method cmpAlwaysUnEqual3_m = getClass().getMethod("cmpAlwaysUnEqual3", Object.class);
1542         Method cmpAlwaysUnEqual4_m = getClass().getMethod("cmpAlwaysUnEqual4", Object.class);
1543         Method cmpSometimesEqual1_m = getClass().getMethod("cmpSometimesEqual1", Object.class);
1544         Method cmpSometimesEqual2_m = getClass().getMethod("cmpSometimesEqual2", Object.class);
1545 
1546         for (int i = 0; i < 20_000; ++i) {
1547             Asserts.assertTrue(cmpAlwaysEqual1(args[1], args[1]));
1548             Asserts.assertFalse(cmpAlwaysEqual2(args[1], args[1]));
1549             Asserts.assertTrue(cmpAlwaysEqual3(args[1]));
1550             Asserts.assertFalse(cmpAlwaysEqual4(args[1]));
1551 
1552             Asserts.assertFalse(cmpAlwaysUnEqual1(args[1], args[2]));
1553             Asserts.assertTrue(cmpAlwaysUnEqual2(args[1], args[2]));
1554             boolean compiled = WHITE_BOX.isMethodCompiled(cmpAlwaysUnEqual3_m, false);
1555             boolean res = cmpAlwaysUnEqual3(args[3]);
1556             if (ACmpOnValues != 3) {
1557                 Asserts.assertFalse(res);
1558             } else if (compiled) {
1559                 Asserts.assertTrue(res);
1560             }
1561             compiled = WHITE_BOX.isMethodCompiled(cmpAlwaysUnEqual4_m, false);
1562             res = cmpAlwaysUnEqual4(args[3]);
1563             if (ACmpOnValues != 3) {
1564                 Asserts.assertTrue(res);
1565             } else if (compiled) {
1566                 Asserts.assertFalse(res);
1567             }
1568 
1569             int idx = i % args.length;
1570             compiled = WHITE_BOX.isMethodCompiled(cmpSometimesEqual1_m, false);
1571             res = cmpSometimesEqual1(args[idx]);
1572             if (ACmpOnValues != 3) {
1573                 Asserts.assertEQ(res, args[idx] == null || !args[idx].getClass().isValue());
1574             } else if (compiled) {
1575                 Asserts.assertTrue(res);
1576             }
1577             compiled = WHITE_BOX.isMethodCompiled(cmpSometimesEqual2_m, false);
1578             res = cmpSometimesEqual2(args[idx]);
1579             if (ACmpOnValues != 3) {
1580                 Asserts.assertNE(res, args[idx] == null || !args[idx].getClass().isValue());
1581             } else if (compiled) {
1582                 Asserts.assertFalse(res);
1583             }
1584         }
1585     }
1586 
1587     public static void main(String[] args) throws Exception {
1588         if (Boolean.getBoolean("test.c1")) {
1589             System.out.println("new acmp is not implemented for C1");
1590             return;
1591         }
1592 
1593         int nullMode = Integer.valueOf(args[0]);
1594         TestNewAcmp t = new TestNewAcmp();
1595         t.run(nullMode);
1596     }
1597 }