1 /*
   2  * Copyright (c) 2019, 2024, 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 acmp bytecode with value object operands.
  27  * @library /testlibrary /test/lib /compiler/whitebox /
  28  * @enablePreview
  29  * @build jdk.test.whitebox.WhiteBox
  30  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
  31  * @run main/othervm/timeout=300 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  32  *                               compiler.valhalla.inlinetypes.TestNewAcmp
  33  */
  34 
  35 package compiler.valhalla.inlinetypes;
  36 
  37 import compiler.lib.ir_framework.CompLevel;
  38 import compiler.lib.ir_framework.TestFramework;
  39 import jdk.test.lib.Asserts;
  40 import jdk.test.lib.process.ProcessTools;
  41 import jdk.test.lib.process.OutputAnalyzer;
  42 import java.lang.annotation.Retention;
  43 import java.lang.annotation.RetentionPolicy;
  44 import java.lang.invoke.*;
  45 import java.lang.reflect.Method;
  46 import java.util.regex.Pattern;
  47 import java.util.regex.Matcher;
  48 import java.util.ArrayList;
  49 import java.util.Arrays;
  50 import java.util.List;
  51 import jdk.test.whitebox.WhiteBox;
  52 
  53 interface MyInterface {
  54 
  55 }
  56 
  57 abstract value class MyAbstract implements MyInterface {
  58 
  59 }
  60 
  61 value class MyValue1 extends MyAbstract {
  62     int x;
  63 
  64     MyValue1(int x) {
  65         this.x = x;
  66     }
  67 
  68     static MyValue1 createDefault() {
  69         return new MyValue1(0);
  70     }
  71 
  72     static MyValue1 setX(MyValue1 v, int x) {
  73         return new MyValue1(x);
  74     }
  75 }
  76 
  77 value class MyValue2 extends MyAbstract {
  78     int x;
  79 
  80     MyValue2(int x) {
  81         this.x = x;
  82     }
  83 
  84     static MyValue2 createDefault() {
  85         return new MyValue2(0);
  86     }
  87 
  88     static MyValue2 setX(MyValue2 v, int x) {
  89         return new MyValue2(x);
  90     }
  91 }
  92 
  93 class MyObject extends MyAbstract {
  94     int x;
  95 }
  96 
  97 // Mark test methods that return false if the argument is null
  98 @Retention(RetentionPolicy.RUNTIME)
  99 @interface FalseIfNull { }
 100 
 101 // Mark test methods that return true if the argument is null
 102 @Retention(RetentionPolicy.RUNTIME)
 103 @interface TrueIfNull { }
 104 
 105 public class TestNewAcmp {
 106 
 107     public boolean testEq01_1(Object u1, Object u2) {
 108         return get(u1) == u2; // new acmp
 109     }
 110 
 111     public boolean testEq01_2(Object u1, Object u2) {
 112         return u1 == get(u2); // new acmp
 113     }
 114 
 115     public boolean testEq01_3(Object u1, Object u2) {
 116         return get(u1) == get(u2); // new acmp
 117     }
 118 
 119     @FalseIfNull
 120     public boolean testEq01_4(Object u1, Object u2) {
 121         return getNotNull(u1) == u2; // new acmp without null check
 122     }
 123 
 124     @FalseIfNull
 125     public boolean testEq01_5(Object u1, Object u2) {
 126         return u1 == getNotNull(u2); // new acmp without null check
 127     }
 128 
 129     @FalseIfNull
 130     public boolean testEq01_6(Object u1, Object u2) {
 131         return getNotNull(u1) == getNotNull(u2); // new acmp without null check
 132     }
 133 
 134     public boolean testEq02_1(MyValue1 v1, MyValue1 v2) {
 135         return get(v1) == (Object)v2; // only true if both null
 136     }
 137 
 138     public boolean testEq02_2(MyValue1 v1, MyValue1 v2) {
 139         return (Object)v1 == get(v2); // only true if both null
 140     }
 141 
 142     public boolean testEq02_3(MyValue1 v1, MyValue1 v2) {
 143         return get(v1) == get(v2); // only true if both null
 144     }
 145 
 146     public boolean testEq03_1(MyValue1 v, Object u) {
 147         return get(v) == u; // only true if both null
 148     }
 149 
 150     public boolean testEq03_2(MyValue1 v, Object u) {
 151         return (Object)v == get(u); // only true if both null
 152     }
 153 
 154     public boolean testEq03_3(MyValue1 v, Object u) {
 155         return get(v) == get(u); // only true if both null
 156     }
 157 
 158     public boolean testEq04_1(Object u, MyValue1 v) {
 159         return get(u) == (Object)v; // only true if both null
 160     }
 161 
 162     public boolean testEq04_2(Object u, MyValue1 v) {
 163         return u == get(v); // only true if both null
 164     }
 165 
 166     public boolean testEq04_3(Object u, MyValue1 v) {
 167         return get(u) == get(v); // only true if both null
 168     }
 169 
 170     public boolean testEq05_1(MyObject o, MyValue1 v) {
 171         return get(o) == (Object)v; // only true if both null
 172     }
 173 
 174     public boolean testEq05_2(MyObject o, MyValue1 v) {
 175         return o == get(v); // only true if both null
 176     }
 177 
 178     public boolean testEq05_3(MyObject o, MyValue1 v) {
 179         return get(o) == get(v); // only true if both null
 180     }
 181 
 182     public boolean testEq06_1(MyValue1 v, MyObject o) {
 183         return get(v) == o; // only true if both null
 184     }
 185 
 186     public boolean testEq06_2(MyValue1 v, MyObject o) {
 187         return (Object)v == get(o); // only true if both null
 188     }
 189 
 190     public boolean testEq06_3(MyValue1 v, MyObject o) {
 191         return get(v) == get(o); // only true if both null
 192     }
 193 
 194     public boolean testEq07_1(MyValue1 v1, MyValue1 v2) {
 195         return getNotNull(v1) == (Object)v2; // false
 196     }
 197 
 198     public boolean testEq07_2(MyValue1 v1, MyValue1 v2) {
 199         return (Object)v1 == getNotNull(v2); // false
 200     }
 201 
 202     public boolean testEq07_3(MyValue1 v1, MyValue1 v2) {
 203         return getNotNull(v1) == getNotNull(v2); // false
 204     }
 205 
 206     public boolean testEq08_1(MyValue1 v, Object u) {
 207         return getNotNull(v) == u; // false
 208     }
 209 
 210     public boolean testEq08_2(MyValue1 v, Object u) {
 211         return (Object)v == getNotNull(u); // false
 212     }
 213 
 214     public boolean testEq08_3(MyValue1 v, Object u) {
 215         return getNotNull(v) == getNotNull(u); // false
 216     }
 217 
 218     public boolean testEq09_1(Object u, MyValue1 v) {
 219         return getNotNull(u) == (Object)v; // false
 220     }
 221 
 222     public boolean testEq09_2(Object u, MyValue1 v) {
 223         return u == getNotNull(v); // false
 224     }
 225 
 226     public boolean testEq09_3(Object u, MyValue1 v) {
 227         return getNotNull(u) == getNotNull(v); // false
 228     }
 229 
 230     public boolean testEq10_1(MyObject o, MyValue1 v) {
 231         return getNotNull(o) == (Object)v; // false
 232     }
 233 
 234     public boolean testEq10_2(MyObject o, MyValue1 v) {
 235         return o == getNotNull(v); // false
 236     }
 237 
 238     public boolean testEq10_3(MyObject o, MyValue1 v) {
 239         return getNotNull(o) == getNotNull(v); // false
 240     }
 241 
 242     public boolean testEq11_1(MyValue1 v, MyObject o) {
 243         return getNotNull(v) == o; // false
 244     }
 245 
 246     public boolean testEq11_2(MyValue1 v, MyObject o) {
 247         return (Object)v == getNotNull(o); // false
 248     }
 249 
 250     public boolean testEq11_3(MyValue1 v, MyObject o) {
 251         return getNotNull(v) == getNotNull(o); // false
 252     }
 253 
 254     public boolean testEq12_1(MyObject o1, MyObject o2) {
 255         return get(o1) == o2; // old acmp
 256     }
 257 
 258     public boolean testEq12_2(MyObject o1, MyObject o2) {
 259         return o1 == get(o2); // old acmp
 260     }
 261 
 262     public boolean testEq12_3(MyObject o1, MyObject o2) {
 263         return get(o1) == get(o2); // old acmp
 264     }
 265 
 266     public boolean testEq13_1(Object u, MyObject o) {
 267         return get(u) == o; // old acmp
 268     }
 269 
 270     public boolean testEq13_2(Object u, MyObject o) {
 271         return u == get(o); // old acmp
 272     }
 273 
 274     public boolean testEq13_3(Object u, MyObject o) {
 275         return get(u) == get(o); // old acmp
 276     }
 277 
 278     public boolean testEq14_1(MyObject o, Object u) {
 279         return get(o) == u; // old acmp
 280     }
 281 
 282     public boolean testEq14_2(MyObject o, Object u) {
 283         return o == get(u); // old acmp
 284     }
 285 
 286     public boolean testEq14_3(MyObject o, Object u) {
 287         return get(o) == get(u); // old acmp
 288     }
 289 
 290     public boolean testEq15_1(Object[] a, Object u) {
 291         return get(a) == u; // old acmp
 292     }
 293 
 294     public boolean testEq15_2(Object[] a, Object u) {
 295         return a == get(u); // old acmp
 296     }
 297 
 298     public boolean testEq15_3(Object[] a, Object u) {
 299         return get(a) == get(u); // old acmp
 300     }
 301 
 302     public boolean testEq16_1(Object u, Object[] a) {
 303         return get(u) == a; // old acmp
 304     }
 305 
 306     public boolean testEq16_2(Object u, Object[] a) {
 307         return u == get(a); // old acmp
 308     }
 309 
 310     public boolean testEq16_3(Object u, Object[] a) {
 311         return get(u) == get(a); // old acmp
 312     }
 313 
 314     public boolean testEq17_1(Object[] a, MyValue1 v) {
 315         return get(a) == (Object)v; // only true if both null
 316     }
 317 
 318     public boolean testEq17_2(Object[] a, MyValue1 v) {
 319         return a == get(v); // only true if both null
 320     }
 321 
 322     public boolean testEq17_3(Object[] a, MyValue1 v) {
 323         return get(a) == get(v); // only true if both null
 324     }
 325 
 326     public boolean testEq18_1(MyValue1 v, Object[] a) {
 327         return get(v) == a; // only true if both null
 328     }
 329 
 330     public boolean testEq18_2(MyValue1 v, Object[] a) {
 331         return (Object)v == get(a); // only true if both null
 332     }
 333 
 334     public boolean testEq18_3(MyValue1 v, Object[] a) {
 335         return get(v) == get(a); // only true if both null
 336     }
 337 
 338     public boolean testEq19_1(Object[] a, MyValue1 v) {
 339         return getNotNull(a) == (Object)v; // false
 340     }
 341 
 342     public boolean testEq19_2(Object[] a, MyValue1 v) {
 343         return a == getNotNull(v); // false
 344     }
 345 
 346     public boolean testEq19_3(Object[] a, MyValue1 v) {
 347         return getNotNull(a) == getNotNull(v); // false
 348     }
 349 
 350     public boolean testEq20_1(MyValue1 v, Object[] a) {
 351         return getNotNull(v) == a; // false
 352     }
 353 
 354     public boolean testEq20_2(MyValue1 v, Object[] a) {
 355         return (Object)v == getNotNull(a); // false
 356     }
 357 
 358     public boolean testEq20_3(MyValue1 v, Object[] a) {
 359         return getNotNull(v) == getNotNull(a); // false
 360     }
 361 
 362     public boolean testEq21_1(MyInterface u1, MyInterface u2) {
 363         return get(u1) == u2; // new acmp
 364     }
 365 
 366     public boolean testEq21_2(MyInterface u1, MyInterface u2) {
 367         return u1 == get(u2); // new acmp
 368     }
 369 
 370     public boolean testEq21_3(MyInterface u1, MyInterface u2) {
 371         return get(u1) == get(u2); // new acmp
 372     }
 373 
 374     @FalseIfNull
 375     public boolean testEq21_4(MyInterface u1, MyInterface u2) {
 376         return getNotNull(u1) == u2; // new acmp without null check
 377     }
 378 
 379     @FalseIfNull
 380     public boolean testEq21_5(MyInterface u1, MyInterface u2) {
 381         return u1 == getNotNull(u2); // new acmp without null check
 382     }
 383 
 384     @FalseIfNull
 385     public boolean testEq21_6(MyInterface u1, MyInterface u2) {
 386         return getNotNull(u1) == getNotNull(u2); // new acmp without null check
 387     }
 388 
 389     public boolean testEq21_7(MyAbstract u1, MyAbstract u2) {
 390         return get(u1) == u2; // new acmp
 391     }
 392 
 393     public boolean testEq21_8(MyAbstract u1, MyAbstract u2) {
 394         return u1 == get(u2); // new acmp
 395     }
 396 
 397     public boolean testEq21_9(MyAbstract u1, MyAbstract u2) {
 398         return get(u1) == get(u2); // new acmp
 399     }
 400 
 401     @FalseIfNull
 402     public boolean testEq21_10(MyAbstract u1, MyAbstract u2) {
 403         return getNotNull(u1) == u2; // new acmp without null check
 404     }
 405 
 406     @FalseIfNull
 407     public boolean testEq21_11(MyAbstract u1, MyAbstract u2) {
 408         return u1 == getNotNull(u2); // new acmp without null check
 409     }
 410 
 411     @FalseIfNull
 412     public boolean testEq21_12(MyAbstract u1, MyAbstract u2) {
 413         return getNotNull(u1) == getNotNull(u2); // new acmp without null check
 414     }
 415 
 416     public boolean testEq22_1(MyValue1 v, MyInterface u) {
 417         return get(v) == u; // only true if both null
 418     }
 419 
 420     public boolean testEq22_2(MyValue1 v, MyInterface u) {
 421         return (Object)v == get(u); // only true if both null
 422     }
 423 
 424     public boolean testEq22_3(MyValue1 v, MyInterface u) {
 425         return get(v) == get(u); // only true if both null
 426     }
 427 
 428     public boolean testEq22_4(MyValue1 v, MyAbstract u) {
 429         return get(v) == u; // only true if both null
 430     }
 431 
 432     public boolean testEq22_5(MyValue1 v, MyAbstract u) {
 433         return (Object)v == get(u); // only true if both null
 434     }
 435 
 436     public boolean testEq22_6(MyValue1 v, MyAbstract u) {
 437         return get(v) == get(u); // only true if both null
 438     }
 439 
 440     public boolean testEq23_1(MyInterface u, MyValue1 v) {
 441         return get(u) == (Object)v; // only true if both null
 442     }
 443 
 444     public boolean testEq23_2(MyInterface u, MyValue1 v) {
 445         return u == get(v); // only true if both null
 446     }
 447 
 448     public boolean testEq23_3(MyInterface u, MyValue1 v) {
 449         return get(u) == get(v); // only true if both null
 450     }
 451 
 452     public boolean testEq23_4(MyAbstract u, MyValue1 v) {
 453         return get(u) == (Object)v; // only true if both null
 454     }
 455 
 456     public boolean testEq23_5(MyAbstract u, MyValue1 v) {
 457         return u == get(v); // only true if both null
 458     }
 459 
 460     public boolean testEq23_6(MyAbstract u, MyValue1 v) {
 461         return get(u) == get(v); // only true if both null
 462     }
 463 
 464     public boolean testEq24_1(MyValue1 v, MyInterface u) {
 465         return getNotNull(v) == u; // false
 466     }
 467 
 468     public boolean testEq24_2(MyValue1 v, MyInterface u) {
 469         return (Object)v == getNotNull(u); // false
 470     }
 471 
 472     public boolean testEq24_3(MyValue1 v, MyInterface u) {
 473         return getNotNull(v) == getNotNull(u); // false
 474     }
 475 
 476     public boolean testEq24_4(MyValue1 v, MyAbstract u) {
 477         return getNotNull(v) == u; // false
 478     }
 479 
 480     public boolean testEq24_5(MyValue1 v, MyAbstract u) {
 481         return (Object)v == getNotNull(u); // false
 482     }
 483 
 484     public boolean testEq24_6(MyValue1 v, MyAbstract u) {
 485         return getNotNull(v) == getNotNull(u); // false
 486     }
 487 
 488     public boolean testEq25_1(MyInterface u, MyValue1 v) {
 489         return getNotNull(u) == (Object)v; // false
 490     }
 491 
 492     public boolean testEq25_2(MyInterface u, MyValue1 v) {
 493         return u == getNotNull(v); // false
 494     }
 495 
 496     public boolean testEq25_3(MyInterface u, MyValue1 v) {
 497         return getNotNull(u) == getNotNull(v); // false
 498     }
 499 
 500     public boolean testEq25_4(MyAbstract u, MyValue1 v) {
 501         return getNotNull(u) == (Object)v; // false
 502     }
 503 
 504     public boolean testEq25_5(MyAbstract u, MyValue1 v) {
 505         return u == getNotNull(v); // false
 506     }
 507 
 508     public boolean testEq25_6(MyAbstract u, MyValue1 v) {
 509         return getNotNull(u) == getNotNull(v); // false
 510     }
 511 
 512     public boolean testEq26_1(MyInterface u, MyObject o) {
 513         return get(u) == o; // old acmp
 514     }
 515 
 516     public boolean testEq26_2(MyInterface u, MyObject o) {
 517         return u == get(o); // old acmp
 518     }
 519 
 520     public boolean testEq26_3(MyInterface u, MyObject o) {
 521         return get(u) == get(o); // old acmp
 522     }
 523 
 524     public boolean testEq26_4(MyAbstract u, MyObject o) {
 525         return get(u) == o; // old acmp
 526     }
 527 
 528     public boolean testEq26_5(MyAbstract u, MyObject o) {
 529         return u == get(o); // old acmp
 530     }
 531 
 532     public boolean testEq26_6(MyAbstract u, MyObject o) {
 533         return get(u) == get(o); // old acmp
 534     }
 535 
 536     public boolean testEq27_1(MyObject o, MyInterface u) {
 537         return get(o) == u; // old acmp
 538     }
 539 
 540     public boolean testEq27_2(MyObject o, MyInterface u) {
 541         return o == get(u); // old acmp
 542     }
 543 
 544     public boolean testEq27_3(MyObject o, MyInterface u) {
 545         return get(o) == get(u); // old acmp
 546     }
 547 
 548     public boolean testEq27_4(MyObject o, MyAbstract u) {
 549         return get(o) == u; // old acmp
 550     }
 551 
 552     public boolean testEq27_5(MyObject o, MyAbstract u) {
 553         return o == get(u); // old acmp
 554     }
 555 
 556     public boolean testEq27_6(MyObject o, MyAbstract u) {
 557         return get(o) == get(u); // old acmp
 558     }
 559 
 560     public boolean testEq28_1(MyInterface[] a, MyInterface u) {
 561         return get(a) == u; // old acmp
 562     }
 563 
 564     public boolean testEq28_2(MyInterface[] a, MyInterface u) {
 565         return a == get(u); // old acmp
 566     }
 567 
 568     public boolean testEq28_3(MyInterface[] a, MyInterface u) {
 569         return get(a) == get(u); // old acmp
 570     }
 571 
 572     public boolean testEq28_4(MyAbstract[] a, MyAbstract u) {
 573         return get(a) == u; // old acmp
 574     }
 575 
 576     public boolean testEq28_5(MyAbstract[] a, MyAbstract u) {
 577         return a == get(u); // old acmp
 578     }
 579 
 580     public boolean testEq28_6(MyAbstract[] a, MyAbstract u) {
 581         return get(a) == get(u); // old acmp
 582     }
 583 
 584     public boolean testEq29_1(MyInterface u, MyInterface[] a) {
 585         return get(u) == a; // old acmp
 586     }
 587 
 588     public boolean testEq29_2(MyInterface u, MyInterface[] a) {
 589         return u == get(a); // old acmp
 590     }
 591 
 592     public boolean testEq29_3(MyInterface u, MyInterface[] a) {
 593         return get(u) == get(a); // old acmp
 594     }
 595 
 596     public boolean testEq29_4(MyAbstract u, MyAbstract[] a) {
 597         return get(u) == a; // old acmp
 598     }
 599 
 600     public boolean testEq29_5(MyAbstract u, MyAbstract[] a) {
 601         return u == get(a); // old acmp
 602     }
 603 
 604     public boolean testEq29_6(MyAbstract u, MyAbstract[] a) {
 605         return get(u) == get(a); // old acmp
 606     }
 607 
 608     public boolean testEq30_1(MyInterface[] a, MyValue1 v) {
 609         return get(a) == (Object)v; // only true if both null
 610     }
 611 
 612     public boolean testEq30_2(MyInterface[] a, MyValue1 v) {
 613         return a == get(v); // only true if both null
 614     }
 615 
 616     public boolean testEq30_3(MyInterface[] a, MyValue1 v) {
 617         return get(a) == get(v); // only true if both null
 618     }
 619 
 620     public boolean testEq30_4(MyAbstract[] a, MyValue1 v) {
 621         return get(a) == (Object)v; // only true if both null
 622     }
 623 
 624     public boolean testEq30_5(MyAbstract[] a, MyValue1 v) {
 625         return a == get(v); // only true if both null
 626     }
 627 
 628     public boolean testEq30_6(MyAbstract[] a, MyValue1 v) {
 629         return get(a) == get(v); // only true if both null
 630     }
 631 
 632     public boolean testEq31_1(MyValue1 v, MyInterface[] a) {
 633         return get(v) == a; // only true if both null
 634     }
 635 
 636     public boolean testEq31_2(MyValue1 v, MyInterface[] a) {
 637         return (Object)v == get(a); // only true if both null
 638     }
 639 
 640     public boolean testEq31_3(MyValue1 v, MyInterface[] a) {
 641         return get(v) == get(a); // only true if both null
 642     }
 643 
 644     public boolean testEq31_4(MyValue1 v, MyAbstract[] a) {
 645         return get(v) == a; // only true if both null
 646     }
 647 
 648     public boolean testEq31_5(MyValue1 v, MyAbstract[] a) {
 649         return (Object)v == get(a); // only true if both null
 650     }
 651 
 652     public boolean testEq31_6(MyValue1 v, MyAbstract[] a) {
 653         return get(v) == get(a); // only true if both null
 654     }
 655 
 656     public boolean testEq32_1(MyInterface[] a, MyValue1 v) {
 657         return getNotNull(a) == (Object)v; // false
 658     }
 659 
 660     public boolean testEq32_2(MyInterface[] a, MyValue1 v) {
 661         return a == getNotNull(v); // false
 662     }
 663 
 664     public boolean testEq32_3(MyInterface[] a, MyValue1 v) {
 665         return getNotNull(a) == getNotNull(v); // false
 666     }
 667 
 668     public boolean testEq32_4(MyAbstract[] a, MyValue1 v) {
 669         return getNotNull(a) == (Object)v; // false
 670     }
 671 
 672     public boolean testEq32_5(MyAbstract[] a, MyValue1 v) {
 673         return a == getNotNull(v); // false
 674     }
 675 
 676     public boolean testEq32_6(MyAbstract[] a, MyValue1 v) {
 677         return getNotNull(a) == getNotNull(v); // false
 678     }
 679 
 680     public boolean testEq33_1(MyValue1 v, MyInterface[] a) {
 681         return getNotNull(v) == a; // false
 682     }
 683 
 684     public boolean testEq33_2(MyValue1 v, MyInterface[] a) {
 685         return (Object)v == getNotNull(a); // false
 686     }
 687 
 688     public boolean testEq33_3(MyValue1 v, MyInterface[] a) {
 689         return getNotNull(v) == getNotNull(a); // false
 690     }
 691 
 692     public boolean testEq33_4(MyValue1 v, MyAbstract[] a) {
 693         return getNotNull(v) == a; // false
 694     }
 695 
 696     public boolean testEq33_5(MyValue1 v, MyAbstract[] a) {
 697         return (Object)v == getNotNull(a); // false
 698     }
 699 
 700     public boolean testEq33_6(MyValue1 v, MyAbstract[] a) {
 701         return getNotNull(v) == getNotNull(a); // false
 702     }
 703 
 704 
 705     // Null tests
 706 
 707     public boolean testNull01_1(MyValue1 v) {
 708         return (Object)v == null; // old acmp
 709     }
 710 
 711     public boolean testNull01_2(MyValue1 v) {
 712         return get(v) == null; // old acmp
 713     }
 714 
 715     public boolean testNull01_3(MyValue1 v) {
 716         return (Object)v == get((Object)null); // old acmp
 717     }
 718 
 719     public boolean testNull01_4(MyValue1 v) {
 720         return get(v) == get((Object)null); // old acmp
 721     }
 722 
 723     public boolean testNull02_1(MyValue1 v) {
 724         return null == (Object)v; // old acmp
 725     }
 726 
 727     public boolean testNull02_2(MyValue1 v) {
 728         return get((Object)null) == (Object)v; // old acmp
 729     }
 730 
 731     public boolean testNull02_3(MyValue1 v) {
 732         return null == get(v); // old acmp
 733     }
 734 
 735     public boolean testNull02_4(MyValue1 v) {
 736         return get((Object)null) == get(v); // old acmp
 737     }
 738 
 739     public boolean testNull03_1(Object u) {
 740         return u == null; // old acmp
 741     }
 742 
 743     public boolean testNull03_2(Object u) {
 744         return get(u) == null; // old acmp
 745     }
 746 
 747     public boolean testNull03_3(Object u) {
 748         return u == get((Object)null); // old acmp
 749     }
 750 
 751     public boolean testNull03_4(Object u) {
 752         return get(u) == get((Object)null); // old acmp
 753     }
 754 
 755     public boolean testNull04_1(Object u) {
 756         return null == u; // old acmp
 757     }
 758 
 759     public boolean testNull04_2(Object u) {
 760         return get((Object)null) == u; // old acmp
 761     }
 762 
 763     public boolean testNull04_3(Object u) {
 764         return null == get(u); // old acmp
 765     }
 766 
 767     public boolean testNull04_4(Object u) {
 768         return get((Object)null) == get(u); // old acmp
 769     }
 770 
 771     public boolean testNull05_1(MyObject o) {
 772         return o == null; // old acmp
 773     }
 774 
 775     public boolean testNull05_2(MyObject o) {
 776         return get(o) == null; // old acmp
 777     }
 778 
 779     public boolean testNull05_3(MyObject o) {
 780         return o == get((Object)null); // old acmp
 781     }
 782 
 783     public boolean testNull05_4(MyObject o) {
 784         return get(o) == get((Object)null); // old acmp
 785     }
 786 
 787     public boolean testNull06_1(MyObject o) {
 788         return null == o; // old acmp
 789     }
 790 
 791     public boolean testNull06_2(MyObject o) {
 792         return get((Object)null) == o; // old acmp
 793     }
 794 
 795     public boolean testNull06_3(MyObject o) {
 796         return null == get(o); // old acmp
 797     }
 798 
 799     public boolean testNull06_4(MyObject o) {
 800         return get((Object)null) == get(o); // old acmp
 801     }
 802 
 803     public boolean testNull07_1(MyInterface u) {
 804         return u == null; // old acmp
 805     }
 806 
 807     public boolean testNull07_2(MyInterface u) {
 808         return get(u) == null; // old acmp
 809     }
 810 
 811     public boolean testNull07_3(MyInterface u) {
 812         return u == get((Object)null); // old acmp
 813     }
 814 
 815     public boolean testNull07_4(MyInterface u) {
 816         return get(u) == get((Object)null); // old acmp
 817     }
 818 
 819     public boolean testNull07_5(MyAbstract u) {
 820         return u == null; // old acmp
 821     }
 822 
 823     public boolean testNull07_6(MyAbstract u) {
 824         return get(u) == null; // old acmp
 825     }
 826 
 827     public boolean testNull07_7(MyAbstract u) {
 828         return u == get((Object)null); // old acmp
 829     }
 830 
 831     public boolean testNull07_8(MyAbstract u) {
 832         return get(u) == get((Object)null); // old acmp
 833     }
 834 
 835     public boolean testNull08_1(MyInterface u) {
 836         return null == u; // old acmp
 837     }
 838 
 839     public boolean testNull08_2(MyInterface u) {
 840         return get((Object)null) == u; // old acmp
 841     }
 842 
 843     public boolean testNull08_3(MyInterface u) {
 844         return null == get(u); // old acmp
 845     }
 846 
 847     public boolean testNull08_4(MyInterface u) {
 848         return get((Object)null) == get(u); // old acmp
 849     }
 850 
 851     public boolean testNull08_5(MyAbstract u) {
 852         return null == u; // old acmp
 853     }
 854 
 855     public boolean testNull08_6(MyAbstract u) {
 856         return get((Object)null) == u; // old acmp
 857     }
 858 
 859     public boolean testNull08_7(MyAbstract u) {
 860         return null == get(u); // old acmp
 861     }
 862 
 863     public boolean testNull08_8(MyAbstract u) {
 864         return get((Object)null) == get(u); // old acmp
 865     }
 866 
 867     // Same tests as above but negated
 868 
 869     public boolean testNotEq01_1(Object u1, Object u2) {
 870         return get(u1) != u2; // new acmp
 871     }
 872 
 873     public boolean testNotEq01_2(Object u1, Object u2) {
 874         return u1 != get(u2); // new acmp
 875     }
 876 
 877     public boolean testNotEq01_3(Object u1, Object u2) {
 878         return get(u1) != get(u2); // new acmp
 879     }
 880 
 881     @TrueIfNull
 882     public boolean testNotEq01_4(Object u1, Object u2) {
 883         return getNotNull(u1) != u2; // new acmp without null check
 884     }
 885 
 886     @TrueIfNull
 887     public boolean testNotEq01_5(Object u1, Object u2) {
 888         return u1 != getNotNull(u2); // new acmp without null check
 889     }
 890 
 891     @TrueIfNull
 892     public boolean testNotEq01_6(Object u1, Object u2) {
 893         return getNotNull(u1) != getNotNull(u2); // new acmp without null check
 894     }
 895 
 896     public boolean testNotEq02_1(MyValue1 v1, MyValue1 v2) {
 897         return get(v1) != (Object)v2; // only false if both null
 898     }
 899 
 900     public boolean testNotEq02_2(MyValue1 v1, MyValue1 v2) {
 901         return (Object)v1 != get(v2); // only false if both null
 902     }
 903 
 904     public boolean testNotEq02_3(MyValue1 v1, MyValue1 v2) {
 905         return get(v1) != get(v2); // only false if both null
 906     }
 907 
 908     public boolean testNotEq03_1(MyValue1 v, Object u) {
 909         return get(v) != u; // only false if both null
 910     }
 911 
 912     public boolean testNotEq03_2(MyValue1 v, Object u) {
 913         return (Object)v != get(u); // only false if both null
 914     }
 915 
 916     public boolean testNotEq03_3(MyValue1 v, Object u) {
 917         return get(v) != get(u); // only false if both null
 918     }
 919 
 920     public boolean testNotEq04_1(Object u, MyValue1 v) {
 921         return get(u) != (Object)v; // only false if both null
 922     }
 923 
 924     public boolean testNotEq04_2(Object u, MyValue1 v) {
 925         return u != get(v); // only false if both null
 926     }
 927 
 928     public boolean testNotEq04_3(Object u, MyValue1 v) {
 929         return get(u) != get(v); // only false if both null
 930     }
 931 
 932     public boolean testNotEq05_1(MyObject o, MyValue1 v) {
 933         return get(o) != (Object)v; // only false if both null
 934     }
 935 
 936     public boolean testNotEq05_2(MyObject o, MyValue1 v) {
 937         return o != get(v); // only false if both null
 938     }
 939 
 940     public boolean testNotEq05_3(MyObject o, MyValue1 v) {
 941         return get(o) != get(v); // only false if both null
 942     }
 943 
 944     public boolean testNotEq06_1(MyValue1 v, MyObject o) {
 945         return get(v) != o; // only false if both null
 946     }
 947 
 948     public boolean testNotEq06_2(MyValue1 v, MyObject o) {
 949         return (Object)v != get(o); // only false if both null
 950     }
 951 
 952     public boolean testNotEq06_3(MyValue1 v, MyObject o) {
 953         return get(v) != get(o); // only false if both null
 954     }
 955 
 956     public boolean testNotEq07_1(MyValue1 v1, MyValue1 v2) {
 957         return getNotNull(v1) != (Object)v2; // true
 958     }
 959 
 960     public boolean testNotEq07_2(MyValue1 v1, MyValue1 v2) {
 961         return (Object)v1 != getNotNull(v2); // true
 962     }
 963 
 964     public boolean testNotEq07_3(MyValue1 v1, MyValue1 v2) {
 965         return getNotNull(v1) != getNotNull(v2); // true
 966     }
 967 
 968     public boolean testNotEq08_1(MyValue1 v, Object u) {
 969         return getNotNull(v) != u; // true
 970     }
 971 
 972     public boolean testNotEq08_2(MyValue1 v, Object u) {
 973         return (Object)v != getNotNull(u); // true
 974     }
 975 
 976     public boolean testNotEq08_3(MyValue1 v, Object u) {
 977         return getNotNull(v) != getNotNull(u); // true
 978     }
 979 
 980     public boolean testNotEq09_1(Object u, MyValue1 v) {
 981         return getNotNull(u) != (Object)v; // true
 982     }
 983 
 984     public boolean testNotEq09_2(Object u, MyValue1 v) {
 985         return u != getNotNull(v); // true
 986     }
 987 
 988     public boolean testNotEq09_3(Object u, MyValue1 v) {
 989         return getNotNull(u) != getNotNull(v); // true
 990     }
 991 
 992     public boolean testNotEq10_1(MyObject o, MyValue1 v) {
 993         return getNotNull(o) != (Object)v; // true
 994     }
 995 
 996     public boolean testNotEq10_2(MyObject o, MyValue1 v) {
 997         return o != getNotNull(v); // true
 998     }
 999 
1000     public boolean testNotEq10_3(MyObject o, MyValue1 v) {
1001         return getNotNull(o) != getNotNull(v); // true
1002     }
1003 
1004     public boolean testNotEq11_1(MyValue1 v, MyObject o) {
1005         return getNotNull(v) != o; // true
1006     }
1007 
1008     public boolean testNotEq11_2(MyValue1 v, MyObject o) {
1009         return (Object)v != getNotNull(o); // true
1010     }
1011 
1012     public boolean testNotEq11_3(MyValue1 v, MyObject o) {
1013         return getNotNull(v) != getNotNull(o); // true
1014     }
1015 
1016     public boolean testNotEq12_1(MyObject o1, MyObject o2) {
1017         return get(o1) != o2; // old acmp
1018     }
1019 
1020     public boolean testNotEq12_2(MyObject o1, MyObject o2) {
1021         return o1 != get(o2); // old acmp
1022     }
1023 
1024     public boolean testNotEq12_3(MyObject o1, MyObject o2) {
1025         return get(o1) != get(o2); // old acmp
1026     }
1027 
1028     public boolean testNotEq13_1(Object u, MyObject o) {
1029         return get(u) != o; // old acmp
1030     }
1031 
1032     public boolean testNotEq13_2(Object u, MyObject o) {
1033         return u != get(o); // old acmp
1034     }
1035 
1036     public boolean testNotEq13_3(Object u, MyObject o) {
1037         return get(u) != get(o); // old acmp
1038     }
1039 
1040     public boolean testNotEq14_1(MyObject o, Object u) {
1041         return get(o) != u; // old acmp
1042     }
1043 
1044     public boolean testNotEq14_2(MyObject o, Object u) {
1045         return o != get(u); // old acmp
1046     }
1047 
1048     public boolean testNotEq14_3(MyObject o, Object u) {
1049         return get(o) != get(u); // old acmp
1050     }
1051 
1052     public boolean testNotEq15_1(Object[] a, Object u) {
1053         return get(a) != u; // old acmp
1054     }
1055 
1056     public boolean testNotEq15_2(Object[] a, Object u) {
1057         return a != get(u); // old acmp
1058     }
1059 
1060     public boolean testNotEq15_3(Object[] a, Object u) {
1061         return get(a) != get(u); // old acmp
1062     }
1063 
1064     public boolean testNotEq16_1(Object u, Object[] a) {
1065         return get(u) != a; // old acmp
1066     }
1067 
1068     public boolean testNotEq16_2(Object u, Object[] a) {
1069         return u != get(a); // old acmp
1070     }
1071 
1072     public boolean testNotEq16_3(Object u, Object[] a) {
1073         return get(u) != get(a); // old acmp
1074     }
1075 
1076     public boolean testNotEq17_1(Object[] a, MyValue1 v) {
1077         return get(a) != (Object)v; // only false if both null
1078     }
1079 
1080     public boolean testNotEq17_2(Object[] a, MyValue1 v) {
1081         return a != get(v); // only false if both null
1082     }
1083 
1084     public boolean testNotEq17_3(Object[] a, MyValue1 v) {
1085         return get(a) != get(v); // only false if both null
1086     }
1087 
1088     public boolean testNotEq18_1(MyValue1 v, Object[] a) {
1089         return get(v) != a; // only false if both null
1090     }
1091 
1092     public boolean testNotEq18_2(MyValue1 v, Object[] a) {
1093         return (Object)v != get(a); // only false if both null
1094     }
1095 
1096     public boolean testNotEq18_3(MyValue1 v, Object[] a) {
1097         return get(v) != get(a); // only false if both null
1098     }
1099 
1100     public boolean testNotEq19_1(Object[] a, MyValue1 v) {
1101         return getNotNull(a) != (Object)v; // true
1102     }
1103 
1104     public boolean testNotEq19_2(Object[] a, MyValue1 v) {
1105         return a != getNotNull(v); // true
1106     }
1107 
1108     public boolean testNotEq19_3(Object[] a, MyValue1 v) {
1109         return getNotNull(a) != getNotNull(v); // true
1110     }
1111 
1112     public boolean testNotEq20_1(MyValue1 v, Object[] a) {
1113         return getNotNull(v) != a; // true
1114     }
1115 
1116     public boolean testNotEq20_2(MyValue1 v, Object[] a) {
1117         return (Object)v != getNotNull(a); // true
1118     }
1119 
1120     public boolean testNotEq20_3(MyValue1 v, Object[] a) {
1121         return getNotNull(v) != getNotNull(a); // true
1122     }
1123 
1124     public boolean testNotEq21_1(MyInterface u1, MyInterface u2) {
1125         return get(u1) != u2; // new acmp
1126     }
1127 
1128     public boolean testNotEq21_2(MyInterface u1, MyInterface u2) {
1129         return u1 != get(u2); // new acmp
1130     }
1131 
1132     public boolean testNotEq21_3(MyInterface u1, MyInterface u2) {
1133         return get(u1) != get(u2); // new acmp
1134     }
1135 
1136     @TrueIfNull
1137     public boolean testNotEq21_4(MyInterface u1, MyInterface u2) {
1138         return getNotNull(u1) != u2; // new acmp without null check
1139     }
1140 
1141     @TrueIfNull
1142     public boolean testNotEq21_5(MyInterface u1, MyInterface u2) {
1143         return u1 != getNotNull(u2); // new acmp without null check
1144     }
1145 
1146     @TrueIfNull
1147     public boolean testNotEq21_6(MyInterface u1, MyInterface u2) {
1148         return getNotNull(u1) != getNotNull(u2); // new acmp without null check
1149     }
1150 
1151     public boolean testNotEq21_7(MyAbstract u1, MyAbstract u2) {
1152         return get(u1) != u2; // new acmp
1153     }
1154 
1155     public boolean testNotEq21_8(MyAbstract u1, MyAbstract u2) {
1156         return u1 != get(u2); // new acmp
1157     }
1158 
1159     public boolean testNotEq21_9(MyAbstract u1, MyAbstract u2) {
1160         return get(u1) != get(u2); // new acmp
1161     }
1162 
1163     @TrueIfNull
1164     public boolean testNotEq21_10(MyAbstract u1, MyAbstract u2) {
1165         return getNotNull(u1) != u2; // new acmp without null check
1166     }
1167 
1168     @TrueIfNull
1169     public boolean testNotEq21_11(MyAbstract u1, MyAbstract u2) {
1170         return u1 != getNotNull(u2); // new acmp without null check
1171     }
1172 
1173     @TrueIfNull
1174     public boolean testNotEq21_12(MyAbstract u1, MyAbstract u2) {
1175         return getNotNull(u1) != getNotNull(u2); // new acmp without null check
1176     }
1177 
1178     public boolean testNotEq22_1(MyValue1 v, MyInterface u) {
1179         return get(v) != u; // only false if both null
1180     }
1181 
1182     public boolean testNotEq22_2(MyValue1 v, MyInterface u) {
1183         return (Object)v != get(u); // only false if both null
1184     }
1185 
1186     public boolean testNotEq22_3(MyValue1 v, MyInterface u) {
1187         return get(v) != get(u); // only false if both null
1188     }
1189 
1190     public boolean testNotEq22_4(MyValue1 v, MyAbstract u) {
1191         return get(v) != u; // only false if both null
1192     }
1193 
1194     public boolean testNotEq22_5(MyValue1 v, MyAbstract u) {
1195         return (Object)v != get(u); // only false if both null
1196     }
1197 
1198     public boolean testNotEq22_6(MyValue1 v, MyAbstract u) {
1199         return get(v) != get(u); // only false if both null
1200     }
1201 
1202     public boolean testNotEq23_1(MyInterface u, MyValue1 v) {
1203         return get(u) != (Object)v; // only false if both null
1204     }
1205 
1206     public boolean testNotEq23_2(MyInterface u, MyValue1 v) {
1207         return u != get(v); // only false if both null
1208     }
1209 
1210     public boolean testNotEq23_3(MyInterface u, MyValue1 v) {
1211         return get(u) != get(v); // only false if both null
1212     }
1213 
1214     public boolean testNotEq23_4(MyAbstract u, MyValue1 v) {
1215         return get(u) != (Object)v; // only false if both null
1216     }
1217 
1218     public boolean testNotEq23_5(MyAbstract u, MyValue1 v) {
1219         return u != get(v); // only false if both null
1220     }
1221 
1222     public boolean testNotEq23_6(MyAbstract u, MyValue1 v) {
1223         return get(u) != get(v); // only false if both null
1224     }
1225 
1226     public boolean testNotEq24_1(MyValue1 v, MyInterface u) {
1227         return getNotNull(v) != u; // true
1228     }
1229 
1230     public boolean testNotEq24_2(MyValue1 v, MyInterface u) {
1231         return (Object)v != getNotNull(u); // true
1232     }
1233 
1234     public boolean testNotEq24_3(MyValue1 v, MyInterface u) {
1235         return getNotNull(v) != getNotNull(u); // true
1236     }
1237 
1238     public boolean testNotEq24_4(MyValue1 v, MyAbstract u) {
1239         return getNotNull(v) != u; // true
1240     }
1241 
1242     public boolean testNotEq24_5(MyValue1 v, MyAbstract u) {
1243         return (Object)v != getNotNull(u); // true
1244     }
1245 
1246     public boolean testNotEq24_6(MyValue1 v, MyAbstract u) {
1247         return getNotNull(v) != getNotNull(u); // true
1248     }
1249 
1250     public boolean testNotEq25_1(MyInterface u, MyValue1 v) {
1251         return getNotNull(u) != (Object)v; // true
1252     }
1253 
1254     public boolean testNotEq25_2(MyInterface u, MyValue1 v) {
1255         return u != getNotNull(v); // true
1256     }
1257 
1258     public boolean testNotEq25_3(MyInterface u, MyValue1 v) {
1259         return getNotNull(u) != getNotNull(v); // true
1260     }
1261 
1262     public boolean testNotEq25_4(MyAbstract u, MyValue1 v) {
1263         return getNotNull(u) != (Object)v; // true
1264     }
1265 
1266     public boolean testNotEq25_5(MyAbstract u, MyValue1 v) {
1267         return u != getNotNull(v); // true
1268     }
1269 
1270     public boolean testNotEq25_6(MyAbstract u, MyValue1 v) {
1271         return getNotNull(u) != getNotNull(v); // true
1272     }
1273 
1274     public boolean testNotEq26_1(MyInterface u, MyObject o) {
1275         return get(u) != o; // old acmp
1276     }
1277 
1278     public boolean testNotEq26_2(MyInterface u, MyObject o) {
1279         return u != get(o); // old acmp
1280     }
1281 
1282     public boolean testNotEq26_3(MyInterface u, MyObject o) {
1283         return get(u) != get(o); // old acmp
1284     }
1285 
1286     public boolean testNotEq26_4(MyAbstract u, MyObject o) {
1287         return get(u) != o; // old acmp
1288     }
1289 
1290     public boolean testNotEq26_5(MyAbstract u, MyObject o) {
1291         return u != get(o); // old acmp
1292     }
1293 
1294     public boolean testNotEq26_6(MyAbstract u, MyObject o) {
1295         return get(u) != get(o); // old acmp
1296     }
1297 
1298     public boolean testNotEq27_1(MyObject o, MyInterface u) {
1299         return get(o) != u; // old acmp
1300     }
1301 
1302     public boolean testNotEq27_2(MyObject o, MyInterface u) {
1303         return o != get(u); // old acmp
1304     }
1305 
1306     public boolean testNotEq27_3(MyObject o, MyInterface u) {
1307         return get(o) != get(u); // old acmp
1308     }
1309 
1310     public boolean testNotEq27_4(MyObject o, MyAbstract u) {
1311         return get(o) != u; // old acmp
1312     }
1313 
1314     public boolean testNotEq27_5(MyObject o, MyAbstract u) {
1315         return o != get(u); // old acmp
1316     }
1317 
1318     public boolean testNotEq27_6(MyObject o, MyAbstract u) {
1319         return get(o) != get(u); // old acmp
1320     }
1321 
1322     public boolean testNotEq28_1(MyInterface[] a, MyInterface u) {
1323         return get(a) != u; // old acmp
1324     }
1325 
1326     public boolean testNotEq28_2(MyInterface[] a, MyInterface u) {
1327         return a != get(u); // old acmp
1328     }
1329 
1330     public boolean testNotEq28_3(MyInterface[] a, MyInterface u) {
1331         return get(a) != get(u); // old acmp
1332     }
1333 
1334     public boolean testNotEq28_4(MyAbstract[] a, MyAbstract u) {
1335         return get(a) != u; // old acmp
1336     }
1337 
1338     public boolean testNotEq28_5(MyAbstract[] a, MyAbstract u) {
1339         return a != get(u); // old acmp
1340     }
1341 
1342     public boolean testNotEq28_6(MyAbstract[] a, MyAbstract u) {
1343         return get(a) != get(u); // old acmp
1344     }
1345 
1346     public boolean testNotEq29_1(MyInterface u, MyInterface[] a) {
1347         return get(u) != a; // old acmp
1348     }
1349 
1350     public boolean testNotEq29_2(MyInterface u, MyInterface[] a) {
1351         return u != get(a); // old acmp
1352     }
1353 
1354     public boolean testNotEq29_3(MyInterface u, MyInterface[] a) {
1355         return get(u) != get(a); // old acmp
1356     }
1357 
1358     public boolean testNotEq29_4(MyAbstract u, MyAbstract[] a) {
1359         return get(u) != a; // old acmp
1360     }
1361 
1362     public boolean testNotEq29_5(MyAbstract u, MyAbstract[] a) {
1363         return u != get(a); // old acmp
1364     }
1365 
1366     public boolean testNotEq29_6(MyAbstract u, MyAbstract[] a) {
1367         return get(u) != get(a); // old acmp
1368     }
1369 
1370     public boolean testNotEq30_1(MyInterface[] a, MyValue1 v) {
1371         return get(a) != (Object)v; // only false if both null
1372     }
1373 
1374     public boolean testNotEq30_2(MyInterface[] a, MyValue1 v) {
1375         return a != get(v); // only false if both null
1376     }
1377 
1378     public boolean testNotEq30_3(MyInterface[] a, MyValue1 v) {
1379         return get(a) != get(v); // only false if both null
1380     }
1381 
1382     public boolean testNotEq30_4(MyAbstract[] a, MyValue1 v) {
1383         return get(a) != (Object)v; // only false if both null
1384     }
1385 
1386     public boolean testNotEq30_5(MyAbstract[] a, MyValue1 v) {
1387         return a != get(v); // only false if both null
1388     }
1389 
1390     public boolean testNotEq30_6(MyAbstract[] a, MyValue1 v) {
1391         return get(a) != get(v); // only false if both null
1392     }
1393 
1394     public boolean testNotEq31_1(MyValue1 v, MyInterface[] a) {
1395         return get(v) != a; // only false if both null
1396     }
1397 
1398     public boolean testNotEq31_2(MyValue1 v, MyInterface[] a) {
1399         return (Object)v != get(a); // only false if both null
1400     }
1401 
1402     public boolean testNotEq31_3(MyValue1 v, MyInterface[] a) {
1403         return get(v) != get(a); // only false if both null
1404     }
1405 
1406     public boolean testNotEq31_4(MyValue1 v, MyAbstract[] a) {
1407         return get(v) != a; // only false if both null
1408     }
1409 
1410     public boolean testNotEq31_5(MyValue1 v, MyAbstract[] a) {
1411         return (Object)v != get(a); // only false if both null
1412     }
1413 
1414     public boolean testNotEq31_6(MyValue1 v, MyAbstract[] a) {
1415         return get(v) != get(a); // only false if both null
1416     }
1417 
1418     public boolean testNotEq32_1(MyInterface[] a, MyValue1 v) {
1419         return getNotNull(a) != (Object)v; // true
1420     }
1421 
1422     public boolean testNotEq32_2(MyInterface[] a, MyValue1 v) {
1423         return a != getNotNull(v); // true
1424     }
1425 
1426     public boolean testNotEq32_3(MyInterface[] a, MyValue1 v) {
1427         return getNotNull(a) != getNotNull(v); // true
1428     }
1429 
1430     public boolean testNotEq32_4(MyAbstract[] a, MyValue1 v) {
1431         return getNotNull(a) != (Object)v; // true
1432     }
1433 
1434     public boolean testNotEq32_5(MyAbstract[] a, MyValue1 v) {
1435         return a != getNotNull(v); // true
1436     }
1437 
1438     public boolean testNotEq32_6(MyAbstract[] a, MyValue1 v) {
1439         return getNotNull(a) != getNotNull(v); // true
1440     }
1441 
1442     public boolean testNotEq33_1(MyValue1 v, MyInterface[] a) {
1443         return getNotNull(v) != a; // true
1444     }
1445 
1446     public boolean testNotEq33_2(MyValue1 v, MyInterface[] a) {
1447         return (Object)v != getNotNull(a); // true
1448     }
1449 
1450     public boolean testNotEq33_3(MyValue1 v, MyInterface[] a) {
1451         return getNotNull(v) != getNotNull(a); // true
1452     }
1453 
1454     public boolean testNotEq33_4(MyValue1 v, MyAbstract[] a) {
1455         return getNotNull(v) != a; // true
1456     }
1457 
1458     public boolean testNotEq33_5(MyValue1 v, MyAbstract[] a) {
1459         return (Object)v != getNotNull(a); // true
1460     }
1461 
1462     public boolean testNotEq33_6(MyValue1 v, MyAbstract[] a) {
1463         return getNotNull(v) != getNotNull(a); // true
1464     }
1465 
1466     // Null tests
1467 
1468     public boolean testNotNull01_1(MyValue1 v) {
1469         return (Object)v != null; // old acmp
1470     }
1471 
1472     public boolean testNotNull01_2(MyValue1 v) {
1473         return get(v) != null; // old acmp
1474     }
1475 
1476     public boolean testNotNull01_3(MyValue1 v) {
1477         return (Object)v != get((Object)null); // old acmp
1478     }
1479 
1480     public boolean testNotNull01_4(MyValue1 v) {
1481         return get(v) != get((Object)null); // old acmp
1482     }
1483 
1484     public boolean testNotNull02_1(MyValue1 v) {
1485         return null != (Object)v; // old acmp
1486     }
1487 
1488     public boolean testNotNull02_2(MyValue1 v) {
1489         return get((Object)null) != (Object)v; // old acmp
1490     }
1491 
1492     public boolean testNotNull02_3(MyValue1 v) {
1493         return null != get(v); // old acmp
1494     }
1495 
1496     public boolean testNotNull02_4(MyValue1 v) {
1497         return get((Object)null) != get(v); // old acmp
1498     }
1499 
1500     public boolean testNotNull03_1(Object u) {
1501         return u != null; // old acmp
1502     }
1503 
1504     public boolean testNotNull03_2(Object u) {
1505         return get(u) != null; // old acmp
1506     }
1507 
1508     public boolean testNotNull03_3(Object u) {
1509         return u != get((Object)null); // old acmp
1510     }
1511 
1512     public boolean testNotNull03_4(Object u) {
1513         return get(u) != get((Object)null); // old acmp
1514     }
1515 
1516     public boolean testNotNull04_1(Object u) {
1517         return null != u; // old acmp
1518     }
1519 
1520     public boolean testNotNull04_2(Object u) {
1521         return get((Object)null) != u; // old acmp
1522     }
1523 
1524     public boolean testNotNull04_3(Object u) {
1525         return null != get(u); // old acmp
1526     }
1527 
1528     public boolean testNotNull04_4(Object u) {
1529         return get((Object)null) != get(u); // old acmp
1530     }
1531 
1532     public boolean testNotNull05_1(MyObject o) {
1533         return o != null; // old acmp
1534     }
1535 
1536     public boolean testNotNull05_2(MyObject o) {
1537         return get(o) != null; // old acmp
1538     }
1539 
1540     public boolean testNotNull05_3(MyObject o) {
1541         return o != get((Object)null); // old acmp
1542     }
1543 
1544     public boolean testNotNull05_4(MyObject o) {
1545         return get(o) != get((Object)null); // old acmp
1546     }
1547 
1548     public boolean testNotNull06_1(MyObject o) {
1549         return null != o; // old acmp
1550     }
1551 
1552     public boolean testNotNull06_2(MyObject o) {
1553         return get((Object)null) != o; // old acmp
1554     }
1555 
1556     public boolean testNotNull06_3(MyObject o) {
1557         return null != get(o); // old acmp
1558     }
1559 
1560     public boolean testNotNull06_4(MyObject o) {
1561         return get((Object)null) != get(o); // old acmp
1562     }
1563 
1564     public boolean testNotNull07_1(MyInterface u) {
1565         return u != null; // old acmp
1566     }
1567 
1568     public boolean testNotNull07_2(MyInterface u) {
1569         return get(u) != null; // old acmp
1570     }
1571 
1572     public boolean testNotNull07_3(MyInterface u) {
1573         return u != get((Object)null); // old acmp
1574     }
1575 
1576     public boolean testNotNull07_4(MyInterface u) {
1577         return get(u) != get((Object)null); // old acmp
1578     }
1579 
1580     public boolean testNotNull07_5(MyAbstract u) {
1581         return u != null; // old acmp
1582     }
1583 
1584     public boolean testNotNull07_6(MyAbstract u) {
1585         return get(u) != null; // old acmp
1586     }
1587 
1588     public boolean testNotNull07_7(MyAbstract u) {
1589         return u != get((Object)null); // old acmp
1590     }
1591 
1592     public boolean testNotNull07_8(MyAbstract u) {
1593         return get(u) != get((Object)null); // old acmp
1594     }
1595 
1596     public boolean testNotNull08_1(MyInterface u) {
1597         return null != u; // old acmp
1598     }
1599 
1600     public boolean testNotNull08_2(MyInterface u) {
1601         return get((Object)null) != u; // old acmp
1602     }
1603 
1604     public boolean testNotNull08_3(MyInterface u) {
1605         return null != get(u); // old acmp
1606     }
1607 
1608     public boolean testNotNull08_4(MyInterface u) {
1609         return get((Object)null) != get(u); // old acmp
1610     }
1611 
1612     public boolean testNotNull08_5(MyAbstract u) {
1613         return null != u; // old acmp
1614     }
1615 
1616     public boolean testNotNull08_6(MyAbstract u) {
1617         return get((Object)null) != u; // old acmp
1618     }
1619 
1620     public boolean testNotNull08_7(MyAbstract u) {
1621         return null != get(u); // old acmp
1622     }
1623 
1624     public boolean testNotNull08_8(MyAbstract u) {
1625         return get((Object)null) != get(u); // old acmp
1626     }
1627 
1628     // The following methods are used with -XX:+AlwaysIncrementalInline to hide exact types during parsing
1629 
1630     public Object get(Object u) {
1631         return u;
1632     }
1633 
1634     public Object getNotNull(Object u) {
1635         return (u != null) ? u : new Object();
1636     }
1637 
1638     public Object get(MyValue1 v) {
1639         return v;
1640     }
1641 
1642     public Object getNotNull(MyValue1 v) {
1643         return ((Object)v != null) ? v : MyValue1.createDefault();
1644     }
1645 
1646     public Object get(MyObject o) {
1647         return o;
1648     }
1649 
1650     public Object getNotNull(MyObject o) {
1651         return (o != null) ? o : MyValue1.createDefault();
1652     }
1653 
1654     public Object get(Object[] a) {
1655         return a;
1656     }
1657 
1658     public Object getNotNull(Object[] a) {
1659         return (a != null) ? a : new Object[1];
1660     }
1661 
1662     public boolean trueIfNull(Method m) {
1663         return m.isAnnotationPresent(TrueIfNull.class);
1664     }
1665 
1666     public boolean falseIfNull(Method m) {
1667         return m.isAnnotationPresent(FalseIfNull.class);
1668     }
1669 
1670     public boolean isNegated(Method m) {
1671         return m.getName().startsWith("testNot");
1672     }
1673 
1674     // Tests with profiling
1675     public boolean cmpAlwaysEqual1(Object a, Object b) {
1676         return a == b;
1677     }
1678 
1679     public boolean cmpAlwaysEqual2(Object a, Object b) {
1680         return a != b;
1681     }
1682 
1683     public boolean cmpAlwaysEqual3(Object a) {
1684         return a == a;
1685     }
1686 
1687     public boolean cmpAlwaysEqual4(Object a) {
1688         return a != a;
1689     }
1690 
1691     public boolean cmpAlwaysUnEqual1(Object a, Object b) {
1692         return a == b;
1693     }
1694 
1695     public boolean cmpAlwaysUnEqual2(Object a, Object b) {
1696         return a != b;
1697     }
1698 
1699     public boolean cmpAlwaysUnEqual3(Object a) {
1700         return a == a;
1701     }
1702 
1703     public boolean cmpAlwaysUnEqual4(Object a) {
1704         return a != a;
1705     }
1706 
1707     public boolean cmpSometimesEqual1(Object a) {
1708         return a == a;
1709     }
1710 
1711     public boolean cmpSometimesEqual2(Object a) {
1712         return a != a;
1713     }
1714 
1715     static int get_full_opt_level() {
1716         int n = (int)TieredStopAtLevel;
1717         if (n >= 4) {
1718             n = 4;
1719         }
1720         return n;
1721     }
1722     protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
1723     protected static final long TieredStopAtLevel = (Long)WHITE_BOX.getVMFlag("TieredStopAtLevel");
1724     protected static final int COMP_LEVEL_FULL_OPTIMIZATION = get_full_opt_level();
1725 
1726     public void runTest(Method m, Object[] args, int warmup, int nullMode, boolean[][] equalities) throws Exception {
1727         Class<?>[] parameterTypes = m.getParameterTypes();
1728         int parameterCount = parameterTypes.length;
1729         // Nullness mode for first argument
1730         // 0: default, 1: never null, 2: always null
1731         int start = (nullMode != 1) ? 0 : 1;
1732         int end = (nullMode != 2) ? args.length : 1;
1733         for (int i = start; i < end; ++i) {
1734             if (args[i] != null && !parameterTypes[0].isInstance(args[i])) {
1735                 continue;
1736             }
1737             if (args[i] == null && parameterTypes[0] == MyValue1.class) {
1738                 continue;
1739             }
1740             if (parameterCount == 1) {
1741                 // Null checks
1742                 System.out.print("Testing " + m.getName() + "(" + args[i] + ")");
1743                 // Avoid acmp in the computation of the expected result!
1744                 boolean expected = isNegated(m) ? (i != 0) : (i == 0);
1745                 for (int run = 0; run < warmup; ++run) {
1746                     Boolean result = (Boolean)m.invoke(this, args[i]);
1747                     if (result != expected && WHITE_BOX.isMethodCompiled(m, false)) {
1748                         System.out.println(" = " + result);
1749                         throw new RuntimeException("Test failed: should return " + expected);
1750                     }
1751                 }
1752                 System.out.println(" = " + expected);
1753             } else {
1754                 // Equality checks
1755                 for (int j = 0; j < args.length; ++j) {
1756                     if (args[j] != null && !parameterTypes[1].isInstance(args[j])) {
1757                         continue;
1758                     }
1759                     if (args[j] == null && parameterTypes[1] == MyValue1.class) {
1760                         continue;
1761                     }
1762                     System.out.print("Testing " + m.getName() + "(" + args[i] + ", " + args[j] + ")");
1763                     // Avoid acmp in the computation of the expected result!
1764                     boolean equal = equalities[i][j];
1765                     equal = isNegated(m) ? !equal : equal;
1766                     boolean expected = ((i == 0 || j == 0) && trueIfNull(m)) || (equal && !(i == 0 && falseIfNull(m)));
1767                     for (int run = 0; run < warmup; ++run) {
1768                         Boolean result = (Boolean)m.invoke(this, args[i], args[j]);
1769                         if (result != expected && WHITE_BOX.isMethodCompiled(m, false) && warmup == 1) {
1770                             System.out.println(" = " + result);
1771                             throw new RuntimeException("Test failed: should return " + expected);
1772                         }
1773                     }
1774                     System.out.println(" = " + expected);
1775                 }
1776             }
1777         }
1778     }
1779 
1780     public void run(int nullMode) throws Exception {
1781         // Prepare test arguments
1782         Object[] args =  { null,
1783                            new Object(),
1784                            new MyObject(),
1785                            MyValue1.setX(MyValue1.createDefault(), 42),
1786                            new Object[10],
1787                            new MyObject[10],
1788                            MyValue1.setX(MyValue1.createDefault(), 0x42),
1789                            MyValue1.setX(MyValue1.createDefault(), 42),
1790                            MyValue2.setX(MyValue2.createDefault(), 42), };
1791 
1792         boolean[][] equalities = { { true,  false, false, false, false, false, false, false, false },
1793                                    { false, true,  false, false, false, false, false, false, false },
1794                                    { false, false, true,  false, false, false, false, false, false },
1795                                    { false, false, false, true,  false, false, false, true,  false },
1796                                    { false, false, false, false, true,  false, false, false, false },
1797                                    { false, false, false, false, false, true,  false, false, false },
1798                                    { false, false, false, false, false, false, true,  false, false },
1799                                    { false, false, false, true,  false, false, false, true,  false },
1800                                    { false, false, false, false, false, false, false, false, true  } };
1801 
1802         // Run tests
1803         for (Method m : getClass().getMethods()) {
1804             if (m.getName().startsWith("test")) {
1805                 // Do some warmup runs
1806                 runTest(m, args, 1000, nullMode, equalities);
1807                 // Make sure method is compiled
1808                 TestFramework.compile(m, CompLevel.ANY);
1809                 Asserts.assertTrue(WHITE_BOX.isMethodCompiled(m, false), m + " not compiled");
1810                 // Run again to verify correctness of compiled code
1811                 runTest(m, args, 1, nullMode, equalities);
1812             }
1813         }
1814 
1815         Method cmpAlwaysUnEqual3_m = getClass().getMethod("cmpAlwaysUnEqual3", Object.class);
1816         Method cmpAlwaysUnEqual4_m = getClass().getMethod("cmpAlwaysUnEqual4", Object.class);
1817         Method cmpSometimesEqual1_m = getClass().getMethod("cmpSometimesEqual1", Object.class);
1818         Method cmpSometimesEqual2_m = getClass().getMethod("cmpSometimesEqual2", Object.class);
1819 
1820         for (int i = 0; i < 20_000; ++i) {
1821             Asserts.assertTrue(cmpAlwaysEqual1(args[1], args[1]));
1822             Asserts.assertFalse(cmpAlwaysEqual2(args[1], args[1]));
1823             Asserts.assertTrue(cmpAlwaysEqual3(args[1]));
1824             Asserts.assertFalse(cmpAlwaysEqual4(args[1]));
1825 
1826             Asserts.assertFalse(cmpAlwaysUnEqual1(args[1], args[2]));
1827             Asserts.assertTrue(cmpAlwaysUnEqual2(args[1], args[2]));
1828             boolean res = cmpAlwaysUnEqual3(args[3]);
1829             Asserts.assertTrue(res);
1830             res = cmpAlwaysUnEqual4(args[3]);
1831             Asserts.assertFalse(res);
1832 
1833             int idx = i % args.length;
1834             res = cmpSometimesEqual1(args[idx]);
1835             Asserts.assertTrue(res);
1836             res = cmpSometimesEqual2(args[idx]);
1837             Asserts.assertFalse(res);
1838         }
1839     }
1840 
1841     public static void main(String[] args) throws Exception {
1842         if (args.length == 0) {
1843             enumerateVMOptions();
1844         } else {
1845             int nullMode = Integer.valueOf(args[0]);
1846             TestNewAcmp t = new TestNewAcmp();
1847             t.run(nullMode);
1848         }
1849     }
1850 
1851     private static String[] addOptions(String prefix[], String... extra) {
1852         ArrayList<String> list = new ArrayList<String>();
1853         if (prefix != null) {
1854             for (String s : prefix) {
1855                 list.add(s);
1856             }
1857         }
1858         if (extra != null) {
1859             for (String s : extra) {
1860                 System.out.println("    " + s);
1861                 list.add(s);
1862             }
1863         }
1864 
1865         return list.toArray(new String[list.size()]);
1866     }
1867 
1868     private static void enumerateVMOptions() throws Exception {
1869         String[] baseOptions = {
1870             "--enable-preview",
1871             "-Xbootclasspath/a:.",
1872             "-XX:+UnlockDiagnosticVMOptions",
1873             "-XX:+WhiteBoxAPI",
1874             "-Xbatch",
1875             "-XX:TypeProfileLevel=222",
1876             "--add-exports", "java.base/jdk.internal.value=ALL-UNNAMED",
1877             "-XX:CompileCommand=dontinline,compiler.valhalla.inlinetypes.TestNewAcmp::test*",
1878             "-XX:CompileCommand=dontinline,compiler.valhalla.inlinetypes.TestNewAcmp::cmp*"};
1879 
1880         String SCENARIOS = System.getProperty("Scenarios", "");
1881         List<String> scenarios = null;
1882         if (!SCENARIOS.isEmpty()) {
1883            scenarios = Arrays.asList(SCENARIOS.split(","));
1884         }
1885 
1886         int scenario = -1;
1887         for (int nullMode = 0; nullMode <= 2; nullMode++) {          // null mode
1888             for (int incrInline = 0; incrInline < 2; incrInline++) { // 0 = default, 1 = -XX:+AlwaysIncrementalInline
1889                 scenario++;
1890                 System.out.println("Scenario #" + scenario + " -------------------");
1891                 String[] cmds = baseOptions;
1892                 if (incrInline != 0) {
1893                     cmds = addOptions(cmds, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AlwaysIncrementalInline");
1894                 }
1895 
1896                 cmds = addOptions(cmds, "compiler.valhalla.inlinetypes.TestNewAcmp");
1897                 cmds = addOptions(cmds, Integer.toString(nullMode));
1898 
1899                 if (scenarios != null && !scenarios.contains(Integer.toString(scenario))) {
1900                     System.out.println("Scenario #" + scenario + " is skipped due to -Dscenarios=" + SCENARIOS);
1901                     continue;
1902                 }
1903 
1904                 OutputAnalyzer oa = ProcessTools.executeTestJava(cmds);
1905                 String output = oa.getOutput();
1906                 oa.shouldHaveExitValue(0);
1907                 System.out.println(output);
1908             }
1909         }
1910     }
1911 }