< prev index next >

test/hotspot/jtreg/compiler/gcbarriers/TestG1BarrierGeneration.java

Print this page

711     @IR(applyIf = {"UseCompressedOops", "true"},
712         counts = {IRNode.G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
713         phase = CompilePhase.FINAL_CODE)
714     static Object testCompareAndExchange(Outer o, Object oldVal, Object newVal) {
715         return fVarHandle.compareAndExchange(o, oldVal, newVal);
716     }
717 
718     @Test
719     @IR(applyIf = {"UseCompressedOops", "false"},
720         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
721         phase = CompilePhase.FINAL_CODE)
722     @IR(applyIf = {"UseCompressedOops", "true"},
723         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
724         phase = CompilePhase.FINAL_CODE)
725     static boolean testCompareAndSwap(Outer o, Object oldVal, Object newVal) {
726         return fVarHandle.compareAndSet(o, oldVal, newVal);
727     }
728 
729     @Test
730     @IR(applyIf = {"UseCompressedOops", "false"},
731         counts = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
732         phase = CompilePhase.FINAL_CODE)
733     @IR(applyIf = {"UseCompressedOops", "true"},
734         counts = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
735         phase = CompilePhase.FINAL_CODE)
736     static Object testGetAndSet(Outer o, Object newVal) {
737         return fVarHandle.getAndSet(o, newVal);
738     }
739 
740     // IR checks are disabled for s390 because barriers are not elided (to be investigated).
741     @Test
742     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
743         applyIfPlatform = {"s390", "false"},
744         counts = {IRNode.G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
745         phase = CompilePhase.FINAL_CODE)
746     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
747         applyIfPlatform = {"s390", "false"},
748         counts = {IRNode.G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
749         phase = CompilePhase.FINAL_CODE)
750     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
751         applyIfPlatform = {"s390", "false"},
752         failOn = {IRNode.G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG, ANY},
753         phase = CompilePhase.FINAL_CODE)
754     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},

769         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
770         phase = CompilePhase.FINAL_CODE)
771     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
772         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
773         phase = CompilePhase.FINAL_CODE)
774     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
775         applyIfPlatform = {"s390", "false"},
776         failOn = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, ANY},
777         phase = CompilePhase.FINAL_CODE)
778     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
779         failOn = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, ANY},
780         phase = CompilePhase.FINAL_CODE)
781     static boolean testCompareAndSwapOnNewObject(Object oldVal, Object newVal) {
782         Outer o = new Outer();
783         o.f = oldVal;
784         return fVarHandle.compareAndSet(o, oldVal, newVal);
785     }
786 
787     @Test
788     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
789         counts = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
790         phase = CompilePhase.FINAL_CODE)
791     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
792         counts = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
793         phase = CompilePhase.FINAL_CODE)
794     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
795         failOn = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, ANY},
796         phase = CompilePhase.FINAL_CODE)
797     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
798         failOn = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, ANY},
799         phase = CompilePhase.FINAL_CODE)
800     static Object testGetAndSetOnNewObject(Object oldVal, Object newVal) {
801         Outer o = new Outer();
802         o.f = oldVal;
803         return fVarHandle.getAndSet(o, newVal);
804     }
805 
806     @Test
807     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
808         counts = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
809         phase = CompilePhase.FINAL_CODE)
810     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
811         counts = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
812         phase = CompilePhase.FINAL_CODE)
813     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
814         failOn = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, ANY},
815         phase = CompilePhase.FINAL_CODE)
816     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
817         failOn = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, ANY},
818         phase = CompilePhase.FINAL_CODE)
819     static Object testGetAndSetConditionallyOnNewObject(Object oldVal, Object newVal, boolean c) {
820         Outer o = new Outer();
821         o.f = oldVal;
822         if (c) {
823             return fVarHandle.getAndSet(o, newVal);
824         }
825         return oldVal;
826     }
827 
828     @Test
829     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
830         counts = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
831         phase = CompilePhase.FINAL_CODE)
832     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
833         counts = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
834         phase = CompilePhase.FINAL_CODE)
835     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
836         failOn = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, ANY},
837         phase = CompilePhase.FINAL_CODE)
838     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
839         failOn = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, ANY},
840         phase = CompilePhase.FINAL_CODE)
841     static Object testGetAndSetOnNewObjectAfterException(Object oldVal, Object newVal, boolean c) throws Exception {
842         Outer o = new Outer();
843         if (c) {
844             throw new Exception("");
845         }
846         o.f = oldVal;
847         return fVarHandle.getAndSet(o, newVal);
848     }
849 
850     @Test
851     @IR(applyIf = {"UseCompressedOops", "false"},
852         counts = {IRNode.G1_GET_AND_SET_P_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
853         phase = CompilePhase.FINAL_CODE)
854     @IR(applyIf = {"UseCompressedOops", "true"},
855         counts = {IRNode.G1_GET_AND_SET_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
856         phase = CompilePhase.FINAL_CODE)
857     static Object testGetAndSetOnNewObjectAfterCall(Object oldVal, Object newVal) {
858         Outer o = new Outer();
859         nonInlinedMethod();
860         o.f = oldVal;
861         return fVarHandle.getAndSet(o, newVal);
862     }
863 
864     @Run(test = {"testCompareAndExchange",
865                  "testCompareAndSwap",
866                  "testGetAndSet",
867                  "testCompareAndExchangeOnNewObject",
868                  "testCompareAndSwapOnNewObject",
869                  "testGetAndSetOnNewObject",
870                  "testGetAndSetConditionallyOnNewObject",
871                  "testGetAndSetOnNewObjectAfterException",
872                  "testGetAndSetOnNewObjectAfterCall"})
873     public void runAtomicTests() {
874         {
875             Outer o = new Outer();

711     @IR(applyIf = {"UseCompressedOops", "true"},
712         counts = {IRNode.G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
713         phase = CompilePhase.FINAL_CODE)
714     static Object testCompareAndExchange(Outer o, Object oldVal, Object newVal) {
715         return fVarHandle.compareAndExchange(o, oldVal, newVal);
716     }
717 
718     @Test
719     @IR(applyIf = {"UseCompressedOops", "false"},
720         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
721         phase = CompilePhase.FINAL_CODE)
722     @IR(applyIf = {"UseCompressedOops", "true"},
723         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
724         phase = CompilePhase.FINAL_CODE)
725     static boolean testCompareAndSwap(Outer o, Object oldVal, Object newVal) {
726         return fVarHandle.compareAndSet(o, oldVal, newVal);
727     }
728 
729     @Test
730     @IR(applyIf = {"UseCompressedOops", "false"},
731         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
732         phase = CompilePhase.FINAL_CODE)
733     @IR(applyIf = {"UseCompressedOops", "true"},
734         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
735         phase = CompilePhase.FINAL_CODE)
736     static Object testGetAndSet(Outer o, Object newVal) {
737         return fVarHandle.getAndSet(o, newVal);
738     }
739 
740     // IR checks are disabled for s390 because barriers are not elided (to be investigated).
741     @Test
742     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
743         applyIfPlatform = {"s390", "false"},
744         counts = {IRNode.G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
745         phase = CompilePhase.FINAL_CODE)
746     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
747         applyIfPlatform = {"s390", "false"},
748         counts = {IRNode.G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
749         phase = CompilePhase.FINAL_CODE)
750     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
751         applyIfPlatform = {"s390", "false"},
752         failOn = {IRNode.G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG, ANY},
753         phase = CompilePhase.FINAL_CODE)
754     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},

769         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
770         phase = CompilePhase.FINAL_CODE)
771     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
772         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
773         phase = CompilePhase.FINAL_CODE)
774     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
775         applyIfPlatform = {"s390", "false"},
776         failOn = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, ANY},
777         phase = CompilePhase.FINAL_CODE)
778     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
779         failOn = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, ANY},
780         phase = CompilePhase.FINAL_CODE)
781     static boolean testCompareAndSwapOnNewObject(Object oldVal, Object newVal) {
782         Outer o = new Outer();
783         o.f = oldVal;
784         return fVarHandle.compareAndSet(o, oldVal, newVal);
785     }
786 
787     @Test
788     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
789         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
790         phase = CompilePhase.FINAL_CODE)
791     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
792         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
793         phase = CompilePhase.FINAL_CODE)
794     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
795         failOn = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, ANY},
796         phase = CompilePhase.FINAL_CODE)
797     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
798         failOn = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, ANY},
799         phase = CompilePhase.FINAL_CODE)
800     static Object testGetAndSetOnNewObject(Object oldVal, Object newVal) {
801         Outer o = new Outer();
802         o.f = oldVal;
803         return fVarHandle.getAndSet(o, newVal);
804     }
805 
806     @Test
807     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
808         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
809         phase = CompilePhase.FINAL_CODE)
810     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
811         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
812         phase = CompilePhase.FINAL_CODE)
813     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
814         failOn = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, ANY},
815         phase = CompilePhase.FINAL_CODE)
816     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
817         failOn = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, ANY},
818         phase = CompilePhase.FINAL_CODE)
819     static Object testGetAndSetConditionallyOnNewObject(Object oldVal, Object newVal, boolean c) {
820         Outer o = new Outer();
821         o.f = oldVal;
822         if (c) {
823             return fVarHandle.getAndSet(o, newVal);
824         }
825         return oldVal;
826     }
827 
828     @Test
829     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "false"},
830         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, POST_ONLY, "1"},
831         phase = CompilePhase.FINAL_CODE)
832     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "false"},
833         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, POST_ONLY, "1"},
834         phase = CompilePhase.FINAL_CODE)
835     @IR(applyIfAnd = {"UseCompressedOops", "false", "ReduceInitialCardMarks", "true"},
836         failOn = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, ANY},
837         phase = CompilePhase.FINAL_CODE)
838     @IR(applyIfAnd = {"UseCompressedOops", "true", "ReduceInitialCardMarks", "true"},
839         failOn = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, ANY},
840         phase = CompilePhase.FINAL_CODE)
841     static Object testGetAndSetOnNewObjectAfterException(Object oldVal, Object newVal, boolean c) throws Exception {
842         Outer o = new Outer();
843         if (c) {
844             throw new Exception("");
845         }
846         o.f = oldVal;
847         return fVarHandle.getAndSet(o, newVal);
848     }
849 
850     @Test
851     @IR(applyIf = {"UseCompressedOops", "false"},
852         counts = {IRNode.G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
853         phase = CompilePhase.FINAL_CODE)
854     @IR(applyIf = {"UseCompressedOops", "true"},
855         counts = {IRNode.G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, PRE_AND_POST, "1"},
856         phase = CompilePhase.FINAL_CODE)
857     static Object testGetAndSetOnNewObjectAfterCall(Object oldVal, Object newVal) {
858         Outer o = new Outer();
859         nonInlinedMethod();
860         o.f = oldVal;
861         return fVarHandle.getAndSet(o, newVal);
862     }
863 
864     @Run(test = {"testCompareAndExchange",
865                  "testCompareAndSwap",
866                  "testGetAndSet",
867                  "testCompareAndExchangeOnNewObject",
868                  "testCompareAndSwapOnNewObject",
869                  "testGetAndSetOnNewObject",
870                  "testGetAndSetConditionallyOnNewObject",
871                  "testGetAndSetOnNewObjectAfterException",
872                  "testGetAndSetOnNewObjectAfterCall"})
873     public void runAtomicTests() {
874         {
875             Outer o = new Outer();
< prev index next >