< prev index next >

test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java

Print this page




  22  */
  23 
  24 /*
  25  * common code to run and validate tests of code generation for
  26  * volatile ops on AArch64
  27  *
  28  * incoming args are <testclass> <testtype>
  29  *
  30  * where <testclass> in {TestVolatileLoad,
  31  *                       TestVolatileStore,
  32  *                       TestUnsafeVolatileLoad,
  33  *                       TestUnsafeVolatileStore,
  34  *                       TestUnsafeVolatileCAS,
  35  *                       TestUnsafeVolatileWeakCAS,
  36  *                       TestUnsafeVolatileCAE,
  37  *                       TestUnsafeVolatileGAS}
  38  * and <testtype> in {G1,
  39  *                    CMS,
  40  *                    CMSCondMark,
  41  *                    Serial,
  42  *                    Parallel}


  43  */
  44 
  45 
  46 package compiler.c2.aarch64;
  47 
  48 import java.util.List;
  49 import java.util.ListIterator;
  50 import java.util.Iterator;
  51 import java.util.regex.Pattern;
  52 import java.io.*;
  53 
  54 import jdk.test.lib.Asserts;
  55 import jdk.test.lib.compiler.InMemoryJavaCompiler;
  56 import jdk.test.lib.process.OutputAnalyzer;
  57 import jdk.test.lib.process.ProcessTools;
  58 import sun.hotspot.WhiteBox;
  59 
  60 // runner class that spawns a new JVM to exercises a combination of
  61 // volatile MemOp and GC. The ops are compiled with the dmb -->
  62 // ldar/stlr transforms either enabled or disabled. this runner parses


  83             procArgs = new String[argcount];
  84             procArgs[argcount - 2] = "-XX:+UseParallelGC";
  85             break;
  86         case "Serial":
  87             argcount = 9;
  88             procArgs = new String[argcount];
  89             procArgs[argcount - 2] = "-XX:+UseSerialGC";
  90             break;
  91         case "CMS":
  92             argcount = 10;
  93             procArgs = new String[argcount];
  94             procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC";
  95             procArgs[argcount - 2] = "-XX:-UseCondCardMark";
  96             break;
  97         case "CMSCondMark":
  98             argcount = 10;
  99             procArgs = new String[argcount];
 100             procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC";
 101             procArgs[argcount - 2] = "-XX:+UseCondCardMark";
 102             break;













 103         default:
 104             throw new RuntimeException("unexpected test type " + testType);
 105         }
 106 
 107         // fill in arguments common to all cases
 108 
 109         // the first round of test enables transform of barriers to
 110         // use acquiring loads and releasing stores by setting arg
 111         // zero appropriately. this arg is reset in the second run to
 112         // disable the transform.
 113 
 114         procArgs[0] = "-XX:-UseBarriersForVolatile";
 115         procArgs[1] = "-XX:+UseCompressedOops";
 116 
 117         procArgs[2] = "-XX:-TieredCompilation";
 118         procArgs[3] = "-XX:+PrintOptoAssembly";
 119         procArgs[4] = "-XX:CompileCommand=compileonly," + fullclassname + "::" + "test*";
 120         procArgs[5] = "--add-exports";
 121         procArgs[6] = "java.base/jdk.internal.misc=ALL-UNNAMED";
 122         procArgs[argcount - 1] = fullclassname;


 338                     "strb",
 339                     "membar_volatile \\(elided\\)",
 340                     "ret"
 341                 };
 342                 break;
 343             case "CMS":
 344                 // a volatile card mark membar should not be generated
 345                 // before the card mark strb from the StoreCM and the
 346                 // storestore barrier from the StoreCM should be
 347                 // generated as "dmb ishst"
 348                 matches = new String[] {
 349                     "membar_release \\(elided\\)",
 350                     useCompressedOops ? "stlrw?" : "stlr",
 351                     "storestore",
 352                     "dmb ishst",
 353                     "strb",
 354                     "membar_volatile \\(elided\\)",
 355                     "ret"
 356                 };
 357                 break;











 358             }
 359         } else {
 360             switch (testType) {
 361             default:
 362                 // this is the basic sequence of instructions
 363                 matches = new String[] {
 364                     "membar_release",
 365                     "dmb ish",
 366                     useCompressedOops ? "strw?" : "str",
 367                     "membar_volatile",
 368                     "dmb ish",
 369                     "ret"
 370                 };
 371                 break;
 372             case "G1":
 373                 // a card mark volatile barrier should be generated
 374                 // before the card mark strb
 375                 matches = new String[] {
 376                     "membar_release",
 377                     "dmb ish",


 401                     "ret"
 402                 };
 403                 break;
 404             case "CMS":
 405                 // a volatile card mark membar should not be generated
 406                 // before the card mark strb from the StoreCM and the
 407                 // storestore barrier from the StoreCM should be generated
 408                 // as "dmb ishst"
 409                 matches = new String[] {
 410                     "membar_release",
 411                     "dmb ish",
 412                     useCompressedOops ? "strw?" : "str",
 413                     "storestore",
 414                     "dmb ishst",
 415                     "strb",
 416                     "membar_volatile",
 417                     "dmb ish",
 418                     "ret"
 419                 };
 420                 break;














 421             }
 422         }
 423 
 424         checkCompile(iter, "testObj", matches, output, true);
 425     }
 426 
 427     // check for expected asm output from a volatile cas
 428 
 429     private void checkcas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
 430     {
 431         Iterator<String> iter = output.asLines().listIterator();
 432 
 433         String[] matches;
 434         String[][] tests = {
 435             { "testInt", "cmpxchgw" },
 436             { "testLong", "cmpxchg" },
 437             { "testByte", "cmpxchgb" },
 438             { "testShort", "cmpxchgs" },
 439         };
 440 


 503                     "storestore \\(elided\\)",
 504                     "strb",
 505                     "membar_acquire \\(elided\\)",
 506                     "ret"
 507                 };
 508                 break;
 509             case "CMS":
 510                 // a volatile card mark membar should not be generated
 511                 // before the card mark strb from the StoreCM and the
 512                 // storestore barrier from the StoreCM should be elided
 513                 matches = new String[] {
 514                     "membar_release \\(elided\\)",
 515                     useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
 516                     "storestore",
 517                     "dmb ishst",
 518                     "strb",
 519                     "membar_acquire \\(elided\\)",
 520                     "ret"
 521                 };
 522                 break;











 523             }
 524         } else {
 525             switch (testType) {
 526             default:
 527                 // this is the basic sequence of instructions
 528                 matches = new String[] {
 529                     "membar_release",
 530                     "dmb ish",
 531                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 532                     "membar_acquire",
 533                     "dmb ish",
 534                     "ret"
 535                 };
 536                 break;
 537             case "G1":
 538                 // a card mark volatile barrier should be generated
 539                 // before the card mark strb
 540                 matches = new String[] {
 541                     "membar_release",
 542                     "dmb ish",


 566                     "ret"
 567                 };
 568                 break;
 569             case "CMS":
 570                 // a volatile card mark membar should not be generated
 571                 // before the card mark strb from the StoreCM and the
 572                 // storestore barrier from the StoreCM should be generated
 573                 // as "dmb ishst"
 574                 matches = new String[] {
 575                     "membar_release",
 576                     "dmb ish",
 577                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 578                     "storestore",
 579                     "dmb ishst",
 580                     "strb",
 581                     "membar_acquire",
 582                     "dmb ish",
 583                     "ret"
 584                 };
 585                 break;













 586             }
 587         }
 588 
 589         checkCompile(iter, "testObj", matches, output, true);
 590     }
 591 
 592     private void checkcae(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
 593     {
 594         ListIterator<String> iter = output.asLines().listIterator();
 595 
 596         String[] matches;
 597         String[][] tests = {
 598             { "testInt", "cmpxchgw" },
 599             { "testLong", "cmpxchg" },
 600             { "testByte", "cmpxchgb" },
 601             { "testShort", "cmpxchgs" },
 602         };
 603 
 604         for (String[] test : tests) {
 605             // non object stores are straightforward


 684                     "storestore \\(elided\\)",
 685                     "strb",
 686                     "membar_acquire \\(elided\\)",
 687                     "ret"
 688                 };
 689                 break;
 690             case "CMS":
 691                 // a volatile card mark membar should not be generated
 692                 // before the card mark strb from the StoreCM and the
 693                 // storestore barrier from the StoreCM should be elided
 694                 matches = new String[] {
 695                     "membar_release \\(elided\\)",
 696                     useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
 697                     "storestore",
 698                     "dmb ishst",
 699                     "strb",
 700                     "membar_acquire \\(elided\\)",
 701                     "ret"
 702                 };
 703                 break;











 704             }
 705         } else {
 706             switch (testType) {
 707             default:
 708                 // this is the basic sequence of instructions
 709                 matches = new String[] {
 710                     "membar_release",
 711                     "dmb ish",
 712                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 713                     "membar_acquire",
 714                     "dmb ish",
 715                     "ret"
 716                 };
 717                 break;
 718             case "G1":
 719                 // a card mark volatile barrier should be generated
 720                 // before the card mark strb
 721                 matches = new String[] {
 722                     "membar_release",
 723                     "dmb ish",


 747                     "ret"
 748                 };
 749                 break;
 750             case "CMS":
 751                 // a volatile card mark membar should not be generated
 752                 // before the card mark strb from the StoreCM and the
 753                 // storestore barrier from the StoreCM should be generated
 754                 // as "dmb ishst"
 755                 matches = new String[] {
 756                     "membar_release",
 757                     "dmb ish",
 758                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 759                     "storestore",
 760                     "dmb ishst",
 761                     "strb",
 762                     "membar_acquire",
 763                     "dmb ish",
 764                     "ret"
 765                 };
 766                 break;













 767             }
 768         }
 769 
 770         checkCompile(iter, "testObj", matches, output, true);
 771     }
 772 
 773     private void checkgas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
 774     {
 775         Iterator<String> iter = output.asLines().listIterator();
 776 
 777         String[] matches;
 778         String[][] tests = {
 779             { "testInt", "atomic_xchgw" },
 780             { "testLong", "atomic_xchg" },
 781         };
 782 
 783         for (String[] test : tests) {
 784             // non object stores are straightforward
 785             if (!useBarriersForVolatile) {
 786                 // this is the sequence of instructions for all cases


 845                     "storestore \\(elided\\)",
 846                     "strb",
 847                     "membar_acquire \\(elided\\)",
 848                     "ret"
 849                 };
 850                 break;
 851             case "CMS":
 852                 // a volatile card mark membar should not be generated
 853                 // before the card mark strb from the StoreCM and the
 854                 // storestore barrier from the StoreCM should be elided
 855                 matches = new String[] {
 856                     "membar_release \\(elided\\)",
 857                     useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
 858                     "storestore",
 859                     "dmb ishst",
 860                     "strb",
 861                     "membar_acquire \\(elided\\)",
 862                     "ret"
 863                 };
 864                 break;









 865             }
 866         } else {
 867             switch (testType) {
 868             default:
 869                 // this is the basic sequence of instructions
 870                 matches = new String[] {
 871                     "membar_release",
 872                     "dmb ish",
 873                     useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
 874                     "membar_acquire",
 875                     "dmb ish",
 876                     "ret"
 877                 };
 878                 break;
 879             case "G1":
 880                 // a card mark volatile barrier should be generated
 881                 // before the card mark strb
 882                 matches = new String[] {
 883                     "membar_release",
 884                     "dmb ish",


 903                     "dmb ish",
 904                     "storestore \\(elided\\)",
 905                     "strb",
 906                     "membar_acquire",
 907                     "dmb ish",
 908                     "ret"
 909                 };
 910                 break;
 911             case "CMS":
 912                 // a volatile card mark membar should not be generated
 913                 // before the card mark strb from the StoreCM and the
 914                 // storestore barrier from the StoreCM should be generated
 915                 // as "dmb ishst"
 916                 matches = new String[] {
 917                     "membar_release",
 918                     "dmb ish",
 919                     useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
 920                     "storestore",
 921                     "dmb ishst",
 922                     "strb",











 923                     "membar_acquire",
 924                     "dmb ish",
 925                     "ret"
 926                 };
 927                 break;
 928             }
 929         }
 930 
 931         checkCompile(iter, "testObj", matches, output, true);
 932     }
 933 
 934     private void checkgaa(OutputAnalyzer output, String testType, boolean useBarriersForVolatile) throws Throwable
 935     {
 936         Iterator<String> iter = output.asLines().listIterator();
 937 
 938         String[] matches;
 939         String[][] tests = {
 940             { "testInt", "get_and_addI" },
 941             { "testLong", "get_and_addL" },
 942         };




  22  */
  23 
  24 /*
  25  * common code to run and validate tests of code generation for
  26  * volatile ops on AArch64
  27  *
  28  * incoming args are <testclass> <testtype>
  29  *
  30  * where <testclass> in {TestVolatileLoad,
  31  *                       TestVolatileStore,
  32  *                       TestUnsafeVolatileLoad,
  33  *                       TestUnsafeVolatileStore,
  34  *                       TestUnsafeVolatileCAS,
  35  *                       TestUnsafeVolatileWeakCAS,
  36  *                       TestUnsafeVolatileCAE,
  37  *                       TestUnsafeVolatileGAS}
  38  * and <testtype> in {G1,
  39  *                    CMS,
  40  *                    CMSCondMark,
  41  *                    Serial,
  42  *                    Parallel,
  43  *                    Shenandoah,
  44  *                    ShenandoahTraversal}
  45  */
  46 
  47 
  48 package compiler.c2.aarch64;
  49 
  50 import java.util.List;
  51 import java.util.ListIterator;
  52 import java.util.Iterator;
  53 import java.util.regex.Pattern;
  54 import java.io.*;
  55 
  56 import jdk.test.lib.Asserts;
  57 import jdk.test.lib.compiler.InMemoryJavaCompiler;
  58 import jdk.test.lib.process.OutputAnalyzer;
  59 import jdk.test.lib.process.ProcessTools;
  60 import sun.hotspot.WhiteBox;
  61 
  62 // runner class that spawns a new JVM to exercises a combination of
  63 // volatile MemOp and GC. The ops are compiled with the dmb -->
  64 // ldar/stlr transforms either enabled or disabled. this runner parses


  85             procArgs = new String[argcount];
  86             procArgs[argcount - 2] = "-XX:+UseParallelGC";
  87             break;
  88         case "Serial":
  89             argcount = 9;
  90             procArgs = new String[argcount];
  91             procArgs[argcount - 2] = "-XX:+UseSerialGC";
  92             break;
  93         case "CMS":
  94             argcount = 10;
  95             procArgs = new String[argcount];
  96             procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC";
  97             procArgs[argcount - 2] = "-XX:-UseCondCardMark";
  98             break;
  99         case "CMSCondMark":
 100             argcount = 10;
 101             procArgs = new String[argcount];
 102             procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC";
 103             procArgs[argcount - 2] = "-XX:+UseCondCardMark";
 104             break;
 105         case "Shenandoah":
 106             argcount = 10;
 107             procArgs = new String[argcount];
 108             procArgs[argcount - 3] = "-XX:+UnlockExperimentalVMOptions";
 109             procArgs[argcount - 2] = "-XX:+UseShenandoahGC";
 110             break;
 111         case "ShenandoahTraversal":
 112             argcount = 11;
 113             procArgs = new String[argcount];
 114             procArgs[argcount - 4] = "-XX:+UnlockExperimentalVMOptions";
 115             procArgs[argcount - 3] = "-XX:+UseShenandoahGC";
 116             procArgs[argcount - 2] = "-XX:ShenandoahGCHeuristics=traversal";
 117             break;
 118         default:
 119             throw new RuntimeException("unexpected test type " + testType);
 120         }
 121 
 122         // fill in arguments common to all cases
 123 
 124         // the first round of test enables transform of barriers to
 125         // use acquiring loads and releasing stores by setting arg
 126         // zero appropriately. this arg is reset in the second run to
 127         // disable the transform.
 128 
 129         procArgs[0] = "-XX:-UseBarriersForVolatile";
 130         procArgs[1] = "-XX:+UseCompressedOops";
 131 
 132         procArgs[2] = "-XX:-TieredCompilation";
 133         procArgs[3] = "-XX:+PrintOptoAssembly";
 134         procArgs[4] = "-XX:CompileCommand=compileonly," + fullclassname + "::" + "test*";
 135         procArgs[5] = "--add-exports";
 136         procArgs[6] = "java.base/jdk.internal.misc=ALL-UNNAMED";
 137         procArgs[argcount - 1] = fullclassname;


 353                     "strb",
 354                     "membar_volatile \\(elided\\)",
 355                     "ret"
 356                 };
 357                 break;
 358             case "CMS":
 359                 // a volatile card mark membar should not be generated
 360                 // before the card mark strb from the StoreCM and the
 361                 // storestore barrier from the StoreCM should be
 362                 // generated as "dmb ishst"
 363                 matches = new String[] {
 364                     "membar_release \\(elided\\)",
 365                     useCompressedOops ? "stlrw?" : "stlr",
 366                     "storestore",
 367                     "dmb ishst",
 368                     "strb",
 369                     "membar_volatile \\(elided\\)",
 370                     "ret"
 371                 };
 372                 break;
 373             case "Shenandoah":
 374             case "ShenandoahTraversal":
 375                  // Shenandoah generates normal object graphs for
 376                  // volatile stores
 377                 matches = new String[] {
 378                     "membar_release \\(elided\\)",
 379                     useCompressedOops ? "stlrw?" : "stlr",
 380                     "membar_volatile \\(elided\\)",
 381                     "ret"
 382                 };
 383                 break;
 384             }
 385         } else {
 386             switch (testType) {
 387             default:
 388                 // this is the basic sequence of instructions
 389                 matches = new String[] {
 390                     "membar_release",
 391                     "dmb ish",
 392                     useCompressedOops ? "strw?" : "str",
 393                     "membar_volatile",
 394                     "dmb ish",
 395                     "ret"
 396                 };
 397                 break;
 398             case "G1":
 399                 // a card mark volatile barrier should be generated
 400                 // before the card mark strb
 401                 matches = new String[] {
 402                     "membar_release",
 403                     "dmb ish",


 427                     "ret"
 428                 };
 429                 break;
 430             case "CMS":
 431                 // a volatile card mark membar should not be generated
 432                 // before the card mark strb from the StoreCM and the
 433                 // storestore barrier from the StoreCM should be generated
 434                 // as "dmb ishst"
 435                 matches = new String[] {
 436                     "membar_release",
 437                     "dmb ish",
 438                     useCompressedOops ? "strw?" : "str",
 439                     "storestore",
 440                     "dmb ishst",
 441                     "strb",
 442                     "membar_volatile",
 443                     "dmb ish",
 444                     "ret"
 445                 };
 446                 break;
 447 
 448             case "Shenandoah":
 449             case "ShenandoahTraversal":
 450                  // Shenandoah generates normal object graphs for
 451                  // volatile stores
 452                 matches = new String[] {
 453                     "membar_release",
 454                     "dmb ish",
 455                     useCompressedOops ? "strw?" : "str",
 456                     "membar_volatile",
 457                     "dmb ish",
 458                     "ret"
 459                 };
 460                 break;
 461             }
 462         }
 463 
 464         checkCompile(iter, "testObj", matches, output, true);
 465     }
 466 
 467     // check for expected asm output from a volatile cas
 468 
 469     private void checkcas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
 470     {
 471         Iterator<String> iter = output.asLines().listIterator();
 472 
 473         String[] matches;
 474         String[][] tests = {
 475             { "testInt", "cmpxchgw" },
 476             { "testLong", "cmpxchg" },
 477             { "testByte", "cmpxchgb" },
 478             { "testShort", "cmpxchgs" },
 479         };
 480 


 543                     "storestore \\(elided\\)",
 544                     "strb",
 545                     "membar_acquire \\(elided\\)",
 546                     "ret"
 547                 };
 548                 break;
 549             case "CMS":
 550                 // a volatile card mark membar should not be generated
 551                 // before the card mark strb from the StoreCM and the
 552                 // storestore barrier from the StoreCM should be elided
 553                 matches = new String[] {
 554                     "membar_release \\(elided\\)",
 555                     useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
 556                     "storestore",
 557                     "dmb ishst",
 558                     "strb",
 559                     "membar_acquire \\(elided\\)",
 560                     "ret"
 561                 };
 562                 break;
 563             case "Shenandoah":
 564             case "ShenandoahTraversal":
 565                 // For volatile CAS, Shenanodoah generates normal
 566                 // graphs with a shenandoah-specific cmpxchg
 567                 matches = new String[] {
 568                     "membar_release \\(elided\\)",
 569                     useCompressedOops ? "cmpxchgw?_acq_shenandoah" : "cmpxchg_acq_shenandoah",
 570                     "membar_acquire \\(elided\\)",
 571                     "ret"
 572                 };
 573                 break;
 574             }
 575         } else {
 576             switch (testType) {
 577             default:
 578                 // this is the basic sequence of instructions
 579                 matches = new String[] {
 580                     "membar_release",
 581                     "dmb ish",
 582                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 583                     "membar_acquire",
 584                     "dmb ish",
 585                     "ret"
 586                 };
 587                 break;
 588             case "G1":
 589                 // a card mark volatile barrier should be generated
 590                 // before the card mark strb
 591                 matches = new String[] {
 592                     "membar_release",
 593                     "dmb ish",


 617                     "ret"
 618                 };
 619                 break;
 620             case "CMS":
 621                 // a volatile card mark membar should not be generated
 622                 // before the card mark strb from the StoreCM and the
 623                 // storestore barrier from the StoreCM should be generated
 624                 // as "dmb ishst"
 625                 matches = new String[] {
 626                     "membar_release",
 627                     "dmb ish",
 628                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 629                     "storestore",
 630                     "dmb ishst",
 631                     "strb",
 632                     "membar_acquire",
 633                     "dmb ish",
 634                     "ret"
 635                 };
 636                 break;
 637             case "Shenandoah":
 638             case "ShenandoahTraversal":
 639                 // For volatile CAS, Shenanodoah generates normal
 640                 // graphs with a shenandoah-specific cmpxchg
 641                 matches = new String[] {
 642                     "membar_release",
 643                     "dmb ish",
 644                     useCompressedOops ? "cmpxchgw?_shenandoah" : "cmpxchg_shenandoah",
 645                     "membar_acquire",
 646                     "dmb ish",
 647                     "ret"
 648                 };
 649                 break;
 650             }
 651         }
 652 
 653         checkCompile(iter, "testObj", matches, output, true);
 654     }
 655 
 656     private void checkcae(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
 657     {
 658         ListIterator<String> iter = output.asLines().listIterator();
 659 
 660         String[] matches;
 661         String[][] tests = {
 662             { "testInt", "cmpxchgw" },
 663             { "testLong", "cmpxchg" },
 664             { "testByte", "cmpxchgb" },
 665             { "testShort", "cmpxchgs" },
 666         };
 667 
 668         for (String[] test : tests) {
 669             // non object stores are straightforward


 748                     "storestore \\(elided\\)",
 749                     "strb",
 750                     "membar_acquire \\(elided\\)",
 751                     "ret"
 752                 };
 753                 break;
 754             case "CMS":
 755                 // a volatile card mark membar should not be generated
 756                 // before the card mark strb from the StoreCM and the
 757                 // storestore barrier from the StoreCM should be elided
 758                 matches = new String[] {
 759                     "membar_release \\(elided\\)",
 760                     useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
 761                     "storestore",
 762                     "dmb ishst",
 763                     "strb",
 764                     "membar_acquire \\(elided\\)",
 765                     "ret"
 766                 };
 767                 break;
 768             case "Shenandoah":
 769             case "ShenandoahTraversal":
 770                 // For volatile CAS, Shenanodoah generates normal
 771                 // graphs with a shenandoah-specific cmpxchg
 772                 matches = new String[] {
 773                     "membar_release \\(elided\\)",
 774                     useCompressedOops ? "cmpxchgw?_acq_shenandoah" : "cmpxchg_acq_shenandoah",
 775                     "membar_acquire \\(elided\\)",
 776                     "ret"
 777                 };
 778                 break;
 779             }
 780         } else {
 781             switch (testType) {
 782             default:
 783                 // this is the basic sequence of instructions
 784                 matches = new String[] {
 785                     "membar_release",
 786                     "dmb ish",
 787                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 788                     "membar_acquire",
 789                     "dmb ish",
 790                     "ret"
 791                 };
 792                 break;
 793             case "G1":
 794                 // a card mark volatile barrier should be generated
 795                 // before the card mark strb
 796                 matches = new String[] {
 797                     "membar_release",
 798                     "dmb ish",


 822                     "ret"
 823                 };
 824                 break;
 825             case "CMS":
 826                 // a volatile card mark membar should not be generated
 827                 // before the card mark strb from the StoreCM and the
 828                 // storestore barrier from the StoreCM should be generated
 829                 // as "dmb ishst"
 830                 matches = new String[] {
 831                     "membar_release",
 832                     "dmb ish",
 833                     useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
 834                     "storestore",
 835                     "dmb ishst",
 836                     "strb",
 837                     "membar_acquire",
 838                     "dmb ish",
 839                     "ret"
 840                 };
 841                 break;
 842             case "Shenandoah":
 843             case "ShenandoahTraversal":
 844                 // For volatile CAS, Shenanodoah generates normal
 845                 // graphs with a shenandoah-specific cmpxchg
 846                 matches = new String[] {
 847                     "membar_release",
 848                     "dmb ish",
 849                     useCompressedOops ? "cmpxchgw?_shenandoah" : "cmpxchg_shenandoah",
 850                     "membar_acquire",
 851                     "dmb ish",
 852                     "ret"
 853                 };
 854                 break;
 855             }
 856         }
 857 
 858         checkCompile(iter, "testObj", matches, output, true);
 859     }
 860 
 861     private void checkgas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
 862     {
 863         Iterator<String> iter = output.asLines().listIterator();
 864 
 865         String[] matches;
 866         String[][] tests = {
 867             { "testInt", "atomic_xchgw" },
 868             { "testLong", "atomic_xchg" },
 869         };
 870 
 871         for (String[] test : tests) {
 872             // non object stores are straightforward
 873             if (!useBarriersForVolatile) {
 874                 // this is the sequence of instructions for all cases


 933                     "storestore \\(elided\\)",
 934                     "strb",
 935                     "membar_acquire \\(elided\\)",
 936                     "ret"
 937                 };
 938                 break;
 939             case "CMS":
 940                 // a volatile card mark membar should not be generated
 941                 // before the card mark strb from the StoreCM and the
 942                 // storestore barrier from the StoreCM should be elided
 943                 matches = new String[] {
 944                     "membar_release \\(elided\\)",
 945                     useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
 946                     "storestore",
 947                     "dmb ishst",
 948                     "strb",
 949                     "membar_acquire \\(elided\\)",
 950                     "ret"
 951                 };
 952                 break;
 953             case "Shenandoah":
 954             case "ShenandoahTraversal":
 955                 matches = new String[] {
 956                     "membar_release \\(elided\\)",
 957                     useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
 958                     "membar_acquire \\(elided\\)",
 959                     "ret"
 960                 };
 961                 break;
 962             }
 963         } else {
 964             switch (testType) {
 965             default:
 966                 // this is the basic sequence of instructions
 967                 matches = new String[] {
 968                     "membar_release",
 969                     "dmb ish",
 970                     useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
 971                     "membar_acquire",
 972                     "dmb ish",
 973                     "ret"
 974                 };
 975                 break;
 976             case "G1":
 977                 // a card mark volatile barrier should be generated
 978                 // before the card mark strb
 979                 matches = new String[] {
 980                     "membar_release",
 981                     "dmb ish",


1000                     "dmb ish",
1001                     "storestore \\(elided\\)",
1002                     "strb",
1003                     "membar_acquire",
1004                     "dmb ish",
1005                     "ret"
1006                 };
1007                 break;
1008             case "CMS":
1009                 // a volatile card mark membar should not be generated
1010                 // before the card mark strb from the StoreCM and the
1011                 // storestore barrier from the StoreCM should be generated
1012                 // as "dmb ishst"
1013                 matches = new String[] {
1014                     "membar_release",
1015                     "dmb ish",
1016                     useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
1017                     "storestore",
1018                     "dmb ishst",
1019                     "strb",
1020                     "membar_acquire",
1021                     "dmb ish",
1022                     "ret"
1023                 };
1024                 break;
1025             case "Shenandoah":
1026             case "ShenandoahTraversal":
1027                 matches = new String[] {
1028                     "membar_release",
1029                     "dmb ish",
1030                     useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
1031                     "membar_acquire",
1032                     "dmb ish",
1033                     "ret"
1034                 };
1035                 break;
1036             }
1037         }
1038 
1039         checkCompile(iter, "testObj", matches, output, true);
1040     }
1041 
1042     private void checkgaa(OutputAnalyzer output, String testType, boolean useBarriersForVolatile) throws Throwable
1043     {
1044         Iterator<String> iter = output.asLines().listIterator();
1045 
1046         String[] matches;
1047         String[][] tests = {
1048             { "testInt", "get_and_addI" },
1049             { "testLong", "get_and_addL" },
1050         };


< prev index next >