330 case Bytecodes::_jsr_w:
331 {
332 dest = _block_map->at(bytes.get_far_dest());
333 assert(dest != NULL, "branch desination must start a block.");
334 dest->add_normal_predecessor(current_block);
335 BasicBlock *jsrExit = _block_map->at(current_block->limit_bci());
336 assert(jsrExit != NULL, "jsr return bci must start a block.");
337 jsr_exit_list->append(jsrExit);
338 break;
339 }
340
341 case Bytecodes::_wide:
342 assert(false, "wide opcodes should not be seen here");
343 break;
344 case Bytecodes::_athrow:
345 case Bytecodes::_ireturn:
346 case Bytecodes::_lreturn:
347 case Bytecodes::_freturn:
348 case Bytecodes::_dreturn:
349 case Bytecodes::_areturn:
350 case Bytecodes::_vreturn:
351 case Bytecodes::_return:
352 // These opcodes are not the normal predecessors of any other opcodes.
353 break;
354 case Bytecodes::_ret:
355 // We will patch up jsr/rets in a subsequent pass.
356 ret_list->append(current_block);
357 break;
358 case Bytecodes::_breakpoint:
359 // Bail out of there are breakpoints in here.
360 bailout = true;
361 break;
362 default:
363 // Do nothing.
364 break;
365 }
366 }
367 // Patch up the jsr/ret's. We conservatively assume that any ret
368 // can return to any jsr site.
369 int ret_list_len = ret_list->length();
370 int jsr_exit_list_len = jsr_exit_list->length();
626 _kill.clear();
627
628 while (bytes->next() != ciBytecodeStream::EOBC()) {
629 compute_gen_kill_single(bytes);
630 }
631 }
632
633 void MethodLiveness::BasicBlock::compute_gen_kill_single(ciBytecodeStream *instruction) {
634 int localNum;
635
636 // We prohibit _gen and _kill from having locals in common. If we
637 // know that one is definitely going to be applied before the other,
638 // we could save some computation time by relaxing this prohibition.
639
640 switch (instruction->cur_bc()) {
641 case Bytecodes::_nop:
642 case Bytecodes::_goto:
643 case Bytecodes::_goto_w:
644 case Bytecodes::_aconst_null:
645 case Bytecodes::_new:
646 case Bytecodes::_vdefault:
647 case Bytecodes::_vwithfield:
648 case Bytecodes::_iconst_m1:
649 case Bytecodes::_iconst_0:
650 case Bytecodes::_iconst_1:
651 case Bytecodes::_iconst_2:
652 case Bytecodes::_iconst_3:
653 case Bytecodes::_iconst_4:
654 case Bytecodes::_iconst_5:
655 case Bytecodes::_fconst_0:
656 case Bytecodes::_fconst_1:
657 case Bytecodes::_fconst_2:
658 case Bytecodes::_bipush:
659 case Bytecodes::_sipush:
660 case Bytecodes::_lconst_0:
661 case Bytecodes::_lconst_1:
662 case Bytecodes::_dconst_0:
663 case Bytecodes::_dconst_1:
664 case Bytecodes::_ldc2_w:
665 case Bytecodes::_ldc:
666 case Bytecodes::_ldc_w:
667 case Bytecodes::_iaload:
668 case Bytecodes::_faload:
669 case Bytecodes::_baload:
670 case Bytecodes::_caload:
671 case Bytecodes::_saload:
672 case Bytecodes::_laload:
673 case Bytecodes::_daload:
674 case Bytecodes::_vaload:
675 case Bytecodes::_aaload:
676 case Bytecodes::_iastore:
677 case Bytecodes::_fastore:
678 case Bytecodes::_bastore:
679 case Bytecodes::_castore:
680 case Bytecodes::_sastore:
681 case Bytecodes::_lastore:
682 case Bytecodes::_dastore:
683 case Bytecodes::_vastore:
684 case Bytecodes::_aastore:
685 case Bytecodes::_pop:
686 case Bytecodes::_pop2:
687 case Bytecodes::_dup:
688 case Bytecodes::_dup_x1:
689 case Bytecodes::_dup_x2:
690 case Bytecodes::_dup2:
691 case Bytecodes::_dup2_x1:
692 case Bytecodes::_dup2_x2:
693 case Bytecodes::_swap:
694 case Bytecodes::_iadd:
695 case Bytecodes::_fadd:
696 case Bytecodes::_isub:
697 case Bytecodes::_fsub:
698 case Bytecodes::_imul:
699 case Bytecodes::_fmul:
700 case Bytecodes::_idiv:
701 case Bytecodes::_fdiv:
702 case Bytecodes::_irem:
703 case Bytecodes::_frem:
767 case Bytecodes::_if_acmpeq:
768 case Bytecodes::_if_acmpne:
769 case Bytecodes::_jsr:
770 case Bytecodes::_jsr_w:
771 case Bytecodes::_getstatic:
772 case Bytecodes::_putstatic:
773 case Bytecodes::_getfield:
774 case Bytecodes::_putfield:
775 case Bytecodes::_invokevirtual:
776 case Bytecodes::_invokespecial:
777 case Bytecodes::_invokestatic:
778 case Bytecodes::_invokeinterface:
779 case Bytecodes::_invokedynamic:
780 case Bytecodes::_newarray:
781 case Bytecodes::_anewarray:
782 case Bytecodes::_checkcast:
783 case Bytecodes::_arraylength:
784 case Bytecodes::_instanceof:
785 case Bytecodes::_athrow:
786 case Bytecodes::_areturn:
787 case Bytecodes::_vreturn:
788 case Bytecodes::_monitorenter:
789 case Bytecodes::_monitorexit:
790 case Bytecodes::_ifnull:
791 case Bytecodes::_ifnonnull:
792 case Bytecodes::_multianewarray:
793 case Bytecodes::_lookupswitch:
794 case Bytecodes::_vbox:
795 case Bytecodes::_vunbox:
796 // These bytecodes have no effect on the method's locals.
797 break;
798
799 case Bytecodes::_return:
800 if (instruction->method()->intrinsic_id() == vmIntrinsics::_Object_init) {
801 // return from Object.init implicitly registers a finalizer
802 // for the receiver if needed, so keep it alive.
803 load_one(0);
804 }
805 break;
806
807
808 case Bytecodes::_lload:
809 case Bytecodes::_dload:
810 load_two(instruction->get_index());
811 break;
812
813 case Bytecodes::_lload_0:
814 case Bytecodes::_dload_0:
815 load_two(0);
817
818 case Bytecodes::_lload_1:
819 case Bytecodes::_dload_1:
820 load_two(1);
821 break;
822
823 case Bytecodes::_lload_2:
824 case Bytecodes::_dload_2:
825 load_two(2);
826 break;
827
828 case Bytecodes::_lload_3:
829 case Bytecodes::_dload_3:
830 load_two(3);
831 break;
832
833 case Bytecodes::_iload:
834 case Bytecodes::_iinc:
835 case Bytecodes::_fload:
836 case Bytecodes::_aload:
837 case Bytecodes::_vload:
838 case Bytecodes::_ret:
839 load_one(instruction->get_index());
840 break;
841
842 case Bytecodes::_iload_0:
843 case Bytecodes::_fload_0:
844 case Bytecodes::_aload_0:
845 load_one(0);
846 break;
847
848 case Bytecodes::_iload_1:
849 case Bytecodes::_fload_1:
850 case Bytecodes::_aload_1:
851 load_one(1);
852 break;
853
854 case Bytecodes::_iload_2:
855 case Bytecodes::_fload_2:
856 case Bytecodes::_aload_2:
857 load_one(2);
874 break;
875
876 case Bytecodes::_lstore_1:
877 case Bytecodes::_dstore_1:
878 store_two(1);
879 break;
880
881 case Bytecodes::_lstore_2:
882 case Bytecodes::_dstore_2:
883 store_two(2);
884 break;
885
886 case Bytecodes::_lstore_3:
887 case Bytecodes::_dstore_3:
888 store_two(3);
889 break;
890
891 case Bytecodes::_istore:
892 case Bytecodes::_fstore:
893 case Bytecodes::_astore:
894 case Bytecodes::_vstore:
895 store_one(instruction->get_index());
896 break;
897
898 case Bytecodes::_istore_0:
899 case Bytecodes::_fstore_0:
900 case Bytecodes::_astore_0:
901 store_one(0);
902 break;
903
904 case Bytecodes::_istore_1:
905 case Bytecodes::_fstore_1:
906 case Bytecodes::_astore_1:
907 store_one(1);
908 break;
909
910 case Bytecodes::_istore_2:
911 case Bytecodes::_fstore_2:
912 case Bytecodes::_astore_2:
913 store_one(2);
914 break;
|
330 case Bytecodes::_jsr_w:
331 {
332 dest = _block_map->at(bytes.get_far_dest());
333 assert(dest != NULL, "branch desination must start a block.");
334 dest->add_normal_predecessor(current_block);
335 BasicBlock *jsrExit = _block_map->at(current_block->limit_bci());
336 assert(jsrExit != NULL, "jsr return bci must start a block.");
337 jsr_exit_list->append(jsrExit);
338 break;
339 }
340
341 case Bytecodes::_wide:
342 assert(false, "wide opcodes should not be seen here");
343 break;
344 case Bytecodes::_athrow:
345 case Bytecodes::_ireturn:
346 case Bytecodes::_lreturn:
347 case Bytecodes::_freturn:
348 case Bytecodes::_dreturn:
349 case Bytecodes::_areturn:
350 case Bytecodes::_return:
351 // These opcodes are not the normal predecessors of any other opcodes.
352 break;
353 case Bytecodes::_ret:
354 // We will patch up jsr/rets in a subsequent pass.
355 ret_list->append(current_block);
356 break;
357 case Bytecodes::_breakpoint:
358 // Bail out of there are breakpoints in here.
359 bailout = true;
360 break;
361 default:
362 // Do nothing.
363 break;
364 }
365 }
366 // Patch up the jsr/ret's. We conservatively assume that any ret
367 // can return to any jsr site.
368 int ret_list_len = ret_list->length();
369 int jsr_exit_list_len = jsr_exit_list->length();
625 _kill.clear();
626
627 while (bytes->next() != ciBytecodeStream::EOBC()) {
628 compute_gen_kill_single(bytes);
629 }
630 }
631
632 void MethodLiveness::BasicBlock::compute_gen_kill_single(ciBytecodeStream *instruction) {
633 int localNum;
634
635 // We prohibit _gen and _kill from having locals in common. If we
636 // know that one is definitely going to be applied before the other,
637 // we could save some computation time by relaxing this prohibition.
638
639 switch (instruction->cur_bc()) {
640 case Bytecodes::_nop:
641 case Bytecodes::_goto:
642 case Bytecodes::_goto_w:
643 case Bytecodes::_aconst_null:
644 case Bytecodes::_new:
645 case Bytecodes::_defaultvalue:
646 case Bytecodes::_withfield:
647 case Bytecodes::_iconst_m1:
648 case Bytecodes::_iconst_0:
649 case Bytecodes::_iconst_1:
650 case Bytecodes::_iconst_2:
651 case Bytecodes::_iconst_3:
652 case Bytecodes::_iconst_4:
653 case Bytecodes::_iconst_5:
654 case Bytecodes::_fconst_0:
655 case Bytecodes::_fconst_1:
656 case Bytecodes::_fconst_2:
657 case Bytecodes::_bipush:
658 case Bytecodes::_sipush:
659 case Bytecodes::_lconst_0:
660 case Bytecodes::_lconst_1:
661 case Bytecodes::_dconst_0:
662 case Bytecodes::_dconst_1:
663 case Bytecodes::_ldc2_w:
664 case Bytecodes::_ldc:
665 case Bytecodes::_ldc_w:
666 case Bytecodes::_iaload:
667 case Bytecodes::_faload:
668 case Bytecodes::_baload:
669 case Bytecodes::_caload:
670 case Bytecodes::_saload:
671 case Bytecodes::_laload:
672 case Bytecodes::_daload:
673 case Bytecodes::_aaload:
674 case Bytecodes::_iastore:
675 case Bytecodes::_fastore:
676 case Bytecodes::_bastore:
677 case Bytecodes::_castore:
678 case Bytecodes::_sastore:
679 case Bytecodes::_lastore:
680 case Bytecodes::_dastore:
681 case Bytecodes::_aastore:
682 case Bytecodes::_pop:
683 case Bytecodes::_pop2:
684 case Bytecodes::_dup:
685 case Bytecodes::_dup_x1:
686 case Bytecodes::_dup_x2:
687 case Bytecodes::_dup2:
688 case Bytecodes::_dup2_x1:
689 case Bytecodes::_dup2_x2:
690 case Bytecodes::_swap:
691 case Bytecodes::_iadd:
692 case Bytecodes::_fadd:
693 case Bytecodes::_isub:
694 case Bytecodes::_fsub:
695 case Bytecodes::_imul:
696 case Bytecodes::_fmul:
697 case Bytecodes::_idiv:
698 case Bytecodes::_fdiv:
699 case Bytecodes::_irem:
700 case Bytecodes::_frem:
764 case Bytecodes::_if_acmpeq:
765 case Bytecodes::_if_acmpne:
766 case Bytecodes::_jsr:
767 case Bytecodes::_jsr_w:
768 case Bytecodes::_getstatic:
769 case Bytecodes::_putstatic:
770 case Bytecodes::_getfield:
771 case Bytecodes::_putfield:
772 case Bytecodes::_invokevirtual:
773 case Bytecodes::_invokespecial:
774 case Bytecodes::_invokestatic:
775 case Bytecodes::_invokeinterface:
776 case Bytecodes::_invokedynamic:
777 case Bytecodes::_newarray:
778 case Bytecodes::_anewarray:
779 case Bytecodes::_checkcast:
780 case Bytecodes::_arraylength:
781 case Bytecodes::_instanceof:
782 case Bytecodes::_athrow:
783 case Bytecodes::_areturn:
784 case Bytecodes::_monitorenter:
785 case Bytecodes::_monitorexit:
786 case Bytecodes::_ifnull:
787 case Bytecodes::_ifnonnull:
788 case Bytecodes::_multianewarray:
789 case Bytecodes::_lookupswitch:
790 // These bytecodes have no effect on the method's locals.
791 break;
792
793 case Bytecodes::_return:
794 if (instruction->method()->intrinsic_id() == vmIntrinsics::_Object_init) {
795 // return from Object.init implicitly registers a finalizer
796 // for the receiver if needed, so keep it alive.
797 load_one(0);
798 }
799 break;
800
801
802 case Bytecodes::_lload:
803 case Bytecodes::_dload:
804 load_two(instruction->get_index());
805 break;
806
807 case Bytecodes::_lload_0:
808 case Bytecodes::_dload_0:
809 load_two(0);
811
812 case Bytecodes::_lload_1:
813 case Bytecodes::_dload_1:
814 load_two(1);
815 break;
816
817 case Bytecodes::_lload_2:
818 case Bytecodes::_dload_2:
819 load_two(2);
820 break;
821
822 case Bytecodes::_lload_3:
823 case Bytecodes::_dload_3:
824 load_two(3);
825 break;
826
827 case Bytecodes::_iload:
828 case Bytecodes::_iinc:
829 case Bytecodes::_fload:
830 case Bytecodes::_aload:
831 case Bytecodes::_ret:
832 load_one(instruction->get_index());
833 break;
834
835 case Bytecodes::_iload_0:
836 case Bytecodes::_fload_0:
837 case Bytecodes::_aload_0:
838 load_one(0);
839 break;
840
841 case Bytecodes::_iload_1:
842 case Bytecodes::_fload_1:
843 case Bytecodes::_aload_1:
844 load_one(1);
845 break;
846
847 case Bytecodes::_iload_2:
848 case Bytecodes::_fload_2:
849 case Bytecodes::_aload_2:
850 load_one(2);
867 break;
868
869 case Bytecodes::_lstore_1:
870 case Bytecodes::_dstore_1:
871 store_two(1);
872 break;
873
874 case Bytecodes::_lstore_2:
875 case Bytecodes::_dstore_2:
876 store_two(2);
877 break;
878
879 case Bytecodes::_lstore_3:
880 case Bytecodes::_dstore_3:
881 store_two(3);
882 break;
883
884 case Bytecodes::_istore:
885 case Bytecodes::_fstore:
886 case Bytecodes::_astore:
887 store_one(instruction->get_index());
888 break;
889
890 case Bytecodes::_istore_0:
891 case Bytecodes::_fstore_0:
892 case Bytecodes::_astore_0:
893 store_one(0);
894 break;
895
896 case Bytecodes::_istore_1:
897 case Bytecodes::_fstore_1:
898 case Bytecodes::_astore_1:
899 store_one(1);
900 break;
901
902 case Bytecodes::_istore_2:
903 case Bytecodes::_fstore_2:
904 case Bytecodes::_astore_2:
905 store_one(2);
906 break;
|