comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 1936:8d88c9ac9247

Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Thu, 23 Dec 2010 18:13:28 +0100
parents b1f2e875300a
children 00bc9eaf0e24
comparison
equal deleted inserted replaced
1935:98dbef29f10b 1936:8d88c9ac9247
49 private static final Integer MARK_VERIFIED_ENTRY = 0x0001; 49 private static final Integer MARK_VERIFIED_ENTRY = 0x0001;
50 private static final Integer MARK_UNVERIFIED_ENTRY = 0x0002; 50 private static final Integer MARK_UNVERIFIED_ENTRY = 0x0002;
51 private static final Integer MARK_OSR_ENTRY = 0x0003; 51 private static final Integer MARK_OSR_ENTRY = 0x0003;
52 private static final Integer MARK_UNWIND_ENTRY = 0x0004; 52 private static final Integer MARK_UNWIND_ENTRY = 0x0004;
53 private static final Integer MARK_EXCEPTION_HANDLER_ENTRY = 0x0005; 53 private static final Integer MARK_EXCEPTION_HANDLER_ENTRY = 0x0005;
54 private static final Integer MARK_DEOPT_HANDLER_ENTRY = 0x0006;
54 55
55 private static final Integer MARK_STATIC_CALL_STUB = 0x1000; 56 private static final Integer MARK_STATIC_CALL_STUB = 0x1000;
56 57
57 private static final Integer MARK_INVOKE_INVALID = 0x2000; 58 private static final Integer MARK_INVOKE_INVALID = 0x2000;
58 private static final Integer MARK_INVOKEINTERFACE = 0x2001; 59 private static final Integer MARK_INVOKEINTERFACE = 0x2001;
124 asm.callRuntime(config.unwindExceptionStub, null, exceptionOop); 125 asm.callRuntime(config.unwindExceptionStub, null, exceptionOop);
125 asm.shouldNotReachHere(); 126 asm.shouldNotReachHere();
126 127
127 asm.mark(MARK_EXCEPTION_HANDLER_ENTRY); 128 asm.mark(MARK_EXCEPTION_HANDLER_ENTRY);
128 asm.callRuntime(config.handleExceptionStub, null); 129 asm.callRuntime(config.handleExceptionStub, null);
130 asm.shouldNotReachHere();
131
132 asm.nop(1);
133 asm.mark(MARK_DEOPT_HANDLER_ENTRY);
134 asm.callRuntime(config.handleDeoptStub, null);
129 asm.shouldNotReachHere(); 135 asm.shouldNotReachHere();
130 136
131 if (!is(STATIC_METHOD, flags)) { 137 if (!is(STATIC_METHOD, flags)) {
132 asm.bindOutOfLine(unverifiedStub); 138 asm.bindOutOfLine(unverifiedStub);
133 asm.jmpRuntime(config.inlineCacheMissStub); 139 asm.jmpRuntime(config.inlineCacheMissStub);
649 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { 655 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) {
650 XirOperand result = asm.restart(kind); 656 XirOperand result = asm.restart(kind);
651 XirParameter array = asm.createInputParameter("array", CiKind.Object); 657 XirParameter array = asm.createInputParameter("array", CiKind.Object);
652 XirParameter index = asm.createInputParameter("index", CiKind.Int); 658 XirParameter index = asm.createInputParameter("index", CiKind.Int);
653 XirLabel failBoundsCheck = null; 659 XirLabel failBoundsCheck = null;
660 // if the length is known the array cannot be null
661 boolean implicitNullException = is(NULL_CHECK, flags);
662
663 if (is(BOUNDS_CHECK, flags)) {
664 // load the array length and check the index
665 failBoundsCheck = asm.createOutOfLineLabel("failBoundsCheck");
666 XirOperand length;
667 if (is(GIVEN_LENGTH, flags)) {
668 length = asm.createInputParameter("length", CiKind.Int);
669 } else {
670 length = asm.createTemp("length", CiKind.Int);
671 if (implicitNullException) {
672 //asm.nop(1);
673 asm.mark(MARK_IMPLICIT_NULL);
674 }
675 asm.pload(CiKind.Int, length, array, asm.i(config.arrayLengthOffset), implicitNullException);
676 }
677 asm.jugteq(failBoundsCheck, index, length);
678 implicitNullException = false;
679 }
680 int elemSize = target.sizeInBytes(kind);
681 if (implicitNullException) {
682 asm.nop(1);
683 asm.mark(MARK_IMPLICIT_NULL);
684 }
685 asm.pload(kind, result, array, index, config.getArrayOffset(kind), Scale.fromInt(elemSize), implicitNullException);
686 if (is(BOUNDS_CHECK, flags)) {
687 asm.bindOutOfLine(failBoundsCheck);
688 asm.callRuntime(config.throwArrayIndexException, null);
689 asm.shouldNotReachHere();
690 }
691 return asm.finishTemplate("arrayload<" + kind + ">");
692 }
693 };
694
695 private KindTemplates arrayStoreTemplates = new KindTemplates(NULL_CHECK, WRITE_BARRIER, BOUNDS_CHECK, STORE_CHECK, GIVEN_LENGTH) {
696
697 @Override
698 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) {
699 asm.restart(CiKind.Void);
700 XirParameter array = asm.createInputParameter("array", CiKind.Object);
701 XirParameter index = asm.createInputParameter("index", CiKind.Int);
702 XirParameter value = asm.createInputParameter("value", kind);
703 XirOperand temp = asm.createTemp("temp", CiKind.Word);
704 XirOperand valueHub = null;
705 XirOperand compHub = null;
706 XirLabel store = asm.createInlineLabel("store");
707 XirLabel failBoundsCheck = null;
708 XirLabel slowStoreCheck = null;
654 // if the length is known the array cannot be null 709 // if the length is known the array cannot be null
655 boolean implicitNullException = is(NULL_CHECK, flags); 710 boolean implicitNullException = is(NULL_CHECK, flags);
656 711
657 if (is(BOUNDS_CHECK, flags)) { 712 if (is(BOUNDS_CHECK, flags)) {
658 // load the array length and check the index 713 // load the array length and check the index
668 } 723 }
669 asm.pload(CiKind.Int, length, array, asm.i(config.arrayLengthOffset), implicitNullException); 724 asm.pload(CiKind.Int, length, array, asm.i(config.arrayLengthOffset), implicitNullException);
670 implicitNullException = false; 725 implicitNullException = false;
671 } 726 }
672 asm.jugteq(failBoundsCheck, index, length); 727 asm.jugteq(failBoundsCheck, index, length);
673 implicitNullException = false;
674 }
675 int elemSize = target.sizeInBytes(kind);
676 if (implicitNullException) {
677 asm.nop(1);
678 asm.mark(MARK_IMPLICIT_NULL);
679 }
680 asm.pload(kind, result, array, index, config.getArrayOffset(kind), Scale.fromInt(elemSize), implicitNullException);
681 if (is(BOUNDS_CHECK, flags)) {
682 asm.bindOutOfLine(failBoundsCheck);
683 asm.callRuntime(config.throwArrayIndexException, null);
684 asm.shouldNotReachHere();
685 }
686 return asm.finishTemplate("arrayload<" + kind + ">");
687 }
688 };
689
690 private KindTemplates arrayStoreTemplates = new KindTemplates(NULL_CHECK, WRITE_BARRIER, BOUNDS_CHECK, STORE_CHECK, GIVEN_LENGTH) {
691
692 @Override
693 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) {
694 asm.restart(CiKind.Void);
695 XirParameter array = asm.createInputParameter("array", CiKind.Object);
696 XirParameter index = asm.createInputParameter("index", CiKind.Int);
697 XirParameter value = asm.createInputParameter("value", kind);
698 XirOperand temp = asm.createTemp("temp", CiKind.Word);
699 XirOperand valueHub = null;
700 XirOperand compHub = null;
701 XirLabel store = asm.createInlineLabel("store");
702 XirLabel failBoundsCheck = null;
703 XirLabel slowStoreCheck = null;
704 // if the length is known the array cannot be null
705 boolean implicitNullException = is(NULL_CHECK, flags);
706
707 if (is(BOUNDS_CHECK, flags)) {
708 // load the array length and check the index
709 failBoundsCheck = asm.createOutOfLineLabel("failBoundsCheck");
710 XirOperand length;
711 if (is(GIVEN_LENGTH, flags)) {
712 length = asm.createInputParameter("length", CiKind.Int);
713 } else {
714 length = asm.createTemp("length", CiKind.Int);
715 if (implicitNullException) {
716 asm.nop(1);
717 asm.mark(MARK_IMPLICIT_NULL);
718 }
719 asm.pload(CiKind.Int, length, array, asm.i(config.arrayLengthOffset), implicitNullException);
720 implicitNullException = false;
721 }
722 asm.jugteq(failBoundsCheck, index, length);
723 728
724 } 729 }
725 if (is(STORE_CHECK, flags) && kind == CiKind.Object) { 730 if (is(STORE_CHECK, flags) && kind == CiKind.Object) {
726 slowStoreCheck = asm.createOutOfLineLabel("slowStoreCheck"); 731 slowStoreCheck = asm.createOutOfLineLabel("slowStoreCheck");
727 asm.jeq(store, value, asm.o(null)); // first check if value is null 732 asm.jeq(store, value, asm.o(null)); // first check if value is null
1086 asm.mark(MARK_ACCESS_FIELD_PATCHING, begin, end); 1091 asm.mark(MARK_ACCESS_FIELD_PATCHING, begin, end);
1087 asm.bindOutOfLine(patchStub); 1092 asm.bindOutOfLine(patchStub);
1088 asm.callRuntime(config.accessFieldStub, null); 1093 asm.callRuntime(config.accessFieldStub, null);
1089 asm.jmp(patchSite); 1094 asm.jmp(patchSite);
1090 1095
1096 // Check if we need NOP instructions like in C1 to "not destroy the world".
1097
1091 state = State.Finished; 1098 state = State.Finished;
1092 } 1099 }
1093 } 1100 }
1094 1101
1095 private void verifyPointer(CiXirAssembler asm, XirOperand pointer) { 1102 private void verifyPointer(CiXirAssembler asm, XirOperand pointer) {