107 // There is a race possible once at startup and then we're fine
108
109 // Note that this is being called from a compiler thread not the
110 // main startup thread.
111 if (should_perform_init()) {
112 bool successful = C2Compiler::init_c2_runtime();
113 int new_state = (successful) ? initialized : failed;
114 set_state(new_state);
115 }
116 }
117
118 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
119 assert(is_initialized(), "Compiler thread must be initialized");
120
121 CompilationMemoryStatisticMark cmsm(directive);
122
123 bool subsume_loads = SubsumeLoads;
124 bool do_escape_analysis = DoEscapeAnalysis;
125 bool do_iterative_escape_analysis = DoEscapeAnalysis;
126 bool do_reduce_allocation_merges = ReduceAllocationMerges && EliminateAllocations;
127 bool eliminate_boxing = EliminateAutoBox;
128 bool do_locks_coarsening = EliminateLocks;
129 bool do_superword = UseSuperWord;
130
131 while (!env->failing()) {
132 ResourceMark rm;
133 // Attempt to compile while subsuming loads into machine instructions.
134 Options options(subsume_loads,
135 do_escape_analysis,
136 do_iterative_escape_analysis,
137 do_reduce_allocation_merges,
138 eliminate_boxing,
139 do_locks_coarsening,
140 do_superword,
141 install_code);
142 Compile C(env, target, entry_bci, options, directive);
143
144 // Check result and retry if appropriate.
145 if (C.failure_reason() != nullptr) {
146 if (C.failure_reason_is(retry_no_subsuming_loads())) {
147 assert(subsume_loads, "must make progress");
626 case vmIntrinsics::_roundF:
627 case vmIntrinsics::_min:
628 case vmIntrinsics::_max:
629 case vmIntrinsics::_min_strict:
630 case vmIntrinsics::_max_strict:
631 case vmIntrinsics::_arraycopy:
632 case vmIntrinsics::_arraySort:
633 case vmIntrinsics::_arrayPartition:
634 case vmIntrinsics::_indexOfL:
635 case vmIntrinsics::_indexOfU:
636 case vmIntrinsics::_indexOfUL:
637 case vmIntrinsics::_indexOfIL:
638 case vmIntrinsics::_indexOfIU:
639 case vmIntrinsics::_indexOfIUL:
640 case vmIntrinsics::_indexOfU_char:
641 case vmIntrinsics::_indexOfL_char:
642 case vmIntrinsics::_toBytesStringU:
643 case vmIntrinsics::_getCharsStringU:
644 case vmIntrinsics::_getCharStringU:
645 case vmIntrinsics::_putCharStringU:
646 case vmIntrinsics::_getReference:
647 case vmIntrinsics::_getBoolean:
648 case vmIntrinsics::_getByte:
649 case vmIntrinsics::_getShort:
650 case vmIntrinsics::_getChar:
651 case vmIntrinsics::_getInt:
652 case vmIntrinsics::_getLong:
653 case vmIntrinsics::_getFloat:
654 case vmIntrinsics::_getDouble:
655 case vmIntrinsics::_putReference:
656 case vmIntrinsics::_putBoolean:
657 case vmIntrinsics::_putByte:
658 case vmIntrinsics::_putShort:
659 case vmIntrinsics::_putChar:
660 case vmIntrinsics::_putInt:
661 case vmIntrinsics::_putLong:
662 case vmIntrinsics::_putFloat:
663 case vmIntrinsics::_putDouble:
664 case vmIntrinsics::_getReferenceVolatile:
665 case vmIntrinsics::_getBooleanVolatile:
666 case vmIntrinsics::_getByteVolatile:
667 case vmIntrinsics::_getShortVolatile:
668 case vmIntrinsics::_getCharVolatile:
669 case vmIntrinsics::_getIntVolatile:
670 case vmIntrinsics::_getLongVolatile:
671 case vmIntrinsics::_getFloatVolatile:
672 case vmIntrinsics::_getDoubleVolatile:
673 case vmIntrinsics::_putReferenceVolatile:
674 case vmIntrinsics::_putBooleanVolatile:
675 case vmIntrinsics::_putByteVolatile:
676 case vmIntrinsics::_putShortVolatile:
677 case vmIntrinsics::_putCharVolatile:
678 case vmIntrinsics::_putIntVolatile:
679 case vmIntrinsics::_putLongVolatile:
680 case vmIntrinsics::_putFloatVolatile:
681 case vmIntrinsics::_putDoubleVolatile:
682 case vmIntrinsics::_getReferenceAcquire:
683 case vmIntrinsics::_getBooleanAcquire:
726 case vmIntrinsics::_loadFence:
727 case vmIntrinsics::_storeFence:
728 case vmIntrinsics::_storeStoreFence:
729 case vmIntrinsics::_fullFence:
730 case vmIntrinsics::_currentCarrierThread:
731 case vmIntrinsics::_currentThread:
732 case vmIntrinsics::_setCurrentThread:
733 case vmIntrinsics::_scopedValueCache:
734 case vmIntrinsics::_setScopedValueCache:
735 case vmIntrinsics::_Continuation_pin:
736 case vmIntrinsics::_Continuation_unpin:
737 #ifdef JFR_HAVE_INTRINSICS
738 case vmIntrinsics::_counterTime:
739 case vmIntrinsics::_getEventWriter:
740 case vmIntrinsics::_jvm_commit:
741 #endif
742 case vmIntrinsics::_currentTimeMillis:
743 case vmIntrinsics::_nanoTime:
744 case vmIntrinsics::_allocateInstance:
745 case vmIntrinsics::_allocateUninitializedArray:
746 case vmIntrinsics::_newArray:
747 case vmIntrinsics::_getLength:
748 case vmIntrinsics::_copyOf:
749 case vmIntrinsics::_copyOfRange:
750 case vmIntrinsics::_clone:
751 case vmIntrinsics::_isAssignableFrom:
752 case vmIntrinsics::_isInstance:
753 case vmIntrinsics::_getModifiers:
754 case vmIntrinsics::_isInterface:
755 case vmIntrinsics::_isArray:
756 case vmIntrinsics::_isPrimitive:
757 case vmIntrinsics::_isHidden:
758 case vmIntrinsics::_getSuperclass:
759 case vmIntrinsics::_getClassAccessFlags:
760 case vmIntrinsics::_floatToRawIntBits:
761 case vmIntrinsics::_floatToIntBits:
762 case vmIntrinsics::_intBitsToFloat:
763 case vmIntrinsics::_doubleToRawLongBits:
764 case vmIntrinsics::_doubleToLongBits:
765 case vmIntrinsics::_longBitsToDouble:
766 case vmIntrinsics::_Reference_get:
|
107 // There is a race possible once at startup and then we're fine
108
109 // Note that this is being called from a compiler thread not the
110 // main startup thread.
111 if (should_perform_init()) {
112 bool successful = C2Compiler::init_c2_runtime();
113 int new_state = (successful) ? initialized : failed;
114 set_state(new_state);
115 }
116 }
117
118 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
119 assert(is_initialized(), "Compiler thread must be initialized");
120
121 CompilationMemoryStatisticMark cmsm(directive);
122
123 bool subsume_loads = SubsumeLoads;
124 bool do_escape_analysis = DoEscapeAnalysis;
125 bool do_iterative_escape_analysis = DoEscapeAnalysis;
126 bool do_reduce_allocation_merges = ReduceAllocationMerges && EliminateAllocations;
127 // TODO 8328675 Re-enable
128 bool eliminate_boxing = false; // EliminateAutoBox;
129 bool do_locks_coarsening = EliminateLocks;
130 bool do_superword = UseSuperWord;
131
132 while (!env->failing()) {
133 ResourceMark rm;
134 // Attempt to compile while subsuming loads into machine instructions.
135 Options options(subsume_loads,
136 do_escape_analysis,
137 do_iterative_escape_analysis,
138 do_reduce_allocation_merges,
139 eliminate_boxing,
140 do_locks_coarsening,
141 do_superword,
142 install_code);
143 Compile C(env, target, entry_bci, options, directive);
144
145 // Check result and retry if appropriate.
146 if (C.failure_reason() != nullptr) {
147 if (C.failure_reason_is(retry_no_subsuming_loads())) {
148 assert(subsume_loads, "must make progress");
627 case vmIntrinsics::_roundF:
628 case vmIntrinsics::_min:
629 case vmIntrinsics::_max:
630 case vmIntrinsics::_min_strict:
631 case vmIntrinsics::_max_strict:
632 case vmIntrinsics::_arraycopy:
633 case vmIntrinsics::_arraySort:
634 case vmIntrinsics::_arrayPartition:
635 case vmIntrinsics::_indexOfL:
636 case vmIntrinsics::_indexOfU:
637 case vmIntrinsics::_indexOfUL:
638 case vmIntrinsics::_indexOfIL:
639 case vmIntrinsics::_indexOfIU:
640 case vmIntrinsics::_indexOfIUL:
641 case vmIntrinsics::_indexOfU_char:
642 case vmIntrinsics::_indexOfL_char:
643 case vmIntrinsics::_toBytesStringU:
644 case vmIntrinsics::_getCharsStringU:
645 case vmIntrinsics::_getCharStringU:
646 case vmIntrinsics::_putCharStringU:
647 case vmIntrinsics::_makePrivateBuffer:
648 case vmIntrinsics::_finishPrivateBuffer:
649 case vmIntrinsics::_getReference:
650 case vmIntrinsics::_getBoolean:
651 case vmIntrinsics::_getByte:
652 case vmIntrinsics::_getShort:
653 case vmIntrinsics::_getChar:
654 case vmIntrinsics::_getInt:
655 case vmIntrinsics::_getLong:
656 case vmIntrinsics::_getFloat:
657 case vmIntrinsics::_getDouble:
658 case vmIntrinsics::_getValue:
659 case vmIntrinsics::_putReference:
660 case vmIntrinsics::_putBoolean:
661 case vmIntrinsics::_putByte:
662 case vmIntrinsics::_putShort:
663 case vmIntrinsics::_putChar:
664 case vmIntrinsics::_putInt:
665 case vmIntrinsics::_putLong:
666 case vmIntrinsics::_putFloat:
667 case vmIntrinsics::_putDouble:
668 case vmIntrinsics::_putValue:
669 case vmIntrinsics::_getReferenceVolatile:
670 case vmIntrinsics::_getBooleanVolatile:
671 case vmIntrinsics::_getByteVolatile:
672 case vmIntrinsics::_getShortVolatile:
673 case vmIntrinsics::_getCharVolatile:
674 case vmIntrinsics::_getIntVolatile:
675 case vmIntrinsics::_getLongVolatile:
676 case vmIntrinsics::_getFloatVolatile:
677 case vmIntrinsics::_getDoubleVolatile:
678 case vmIntrinsics::_putReferenceVolatile:
679 case vmIntrinsics::_putBooleanVolatile:
680 case vmIntrinsics::_putByteVolatile:
681 case vmIntrinsics::_putShortVolatile:
682 case vmIntrinsics::_putCharVolatile:
683 case vmIntrinsics::_putIntVolatile:
684 case vmIntrinsics::_putLongVolatile:
685 case vmIntrinsics::_putFloatVolatile:
686 case vmIntrinsics::_putDoubleVolatile:
687 case vmIntrinsics::_getReferenceAcquire:
688 case vmIntrinsics::_getBooleanAcquire:
731 case vmIntrinsics::_loadFence:
732 case vmIntrinsics::_storeFence:
733 case vmIntrinsics::_storeStoreFence:
734 case vmIntrinsics::_fullFence:
735 case vmIntrinsics::_currentCarrierThread:
736 case vmIntrinsics::_currentThread:
737 case vmIntrinsics::_setCurrentThread:
738 case vmIntrinsics::_scopedValueCache:
739 case vmIntrinsics::_setScopedValueCache:
740 case vmIntrinsics::_Continuation_pin:
741 case vmIntrinsics::_Continuation_unpin:
742 #ifdef JFR_HAVE_INTRINSICS
743 case vmIntrinsics::_counterTime:
744 case vmIntrinsics::_getEventWriter:
745 case vmIntrinsics::_jvm_commit:
746 #endif
747 case vmIntrinsics::_currentTimeMillis:
748 case vmIntrinsics::_nanoTime:
749 case vmIntrinsics::_allocateInstance:
750 case vmIntrinsics::_allocateUninitializedArray:
751 case vmIntrinsics::_isFlatArray:
752 case vmIntrinsics::_newArray:
753 case vmIntrinsics::_newNullRestrictedArray:
754 case vmIntrinsics::_getLength:
755 case vmIntrinsics::_copyOf:
756 case vmIntrinsics::_copyOfRange:
757 case vmIntrinsics::_clone:
758 case vmIntrinsics::_isAssignableFrom:
759 case vmIntrinsics::_isInstance:
760 case vmIntrinsics::_getModifiers:
761 case vmIntrinsics::_isInterface:
762 case vmIntrinsics::_isArray:
763 case vmIntrinsics::_isPrimitive:
764 case vmIntrinsics::_isHidden:
765 case vmIntrinsics::_getSuperclass:
766 case vmIntrinsics::_getClassAccessFlags:
767 case vmIntrinsics::_floatToRawIntBits:
768 case vmIntrinsics::_floatToIntBits:
769 case vmIntrinsics::_intBitsToFloat:
770 case vmIntrinsics::_doubleToRawLongBits:
771 case vmIntrinsics::_doubleToLongBits:
772 case vmIntrinsics::_longBitsToDouble:
773 case vmIntrinsics::_Reference_get:
|