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");
625 case vmIntrinsics::_roundF:
626 case vmIntrinsics::_min:
627 case vmIntrinsics::_max:
628 case vmIntrinsics::_min_strict:
629 case vmIntrinsics::_max_strict:
630 case vmIntrinsics::_arraycopy:
631 case vmIntrinsics::_arraySort:
632 case vmIntrinsics::_arrayPartition:
633 case vmIntrinsics::_indexOfL:
634 case vmIntrinsics::_indexOfU:
635 case vmIntrinsics::_indexOfUL:
636 case vmIntrinsics::_indexOfIL:
637 case vmIntrinsics::_indexOfIU:
638 case vmIntrinsics::_indexOfIUL:
639 case vmIntrinsics::_indexOfU_char:
640 case vmIntrinsics::_indexOfL_char:
641 case vmIntrinsics::_toBytesStringU:
642 case vmIntrinsics::_getCharsStringU:
643 case vmIntrinsics::_getCharStringU:
644 case vmIntrinsics::_putCharStringU:
645 case vmIntrinsics::_getReference:
646 case vmIntrinsics::_getBoolean:
647 case vmIntrinsics::_getByte:
648 case vmIntrinsics::_getShort:
649 case vmIntrinsics::_getChar:
650 case vmIntrinsics::_getInt:
651 case vmIntrinsics::_getLong:
652 case vmIntrinsics::_getFloat:
653 case vmIntrinsics::_getDouble:
654 case vmIntrinsics::_putReference:
655 case vmIntrinsics::_putBoolean:
656 case vmIntrinsics::_putByte:
657 case vmIntrinsics::_putShort:
658 case vmIntrinsics::_putChar:
659 case vmIntrinsics::_putInt:
660 case vmIntrinsics::_putLong:
661 case vmIntrinsics::_putFloat:
662 case vmIntrinsics::_putDouble:
663 case vmIntrinsics::_getReferenceVolatile:
664 case vmIntrinsics::_getBooleanVolatile:
665 case vmIntrinsics::_getByteVolatile:
666 case vmIntrinsics::_getShortVolatile:
667 case vmIntrinsics::_getCharVolatile:
668 case vmIntrinsics::_getIntVolatile:
669 case vmIntrinsics::_getLongVolatile:
670 case vmIntrinsics::_getFloatVolatile:
671 case vmIntrinsics::_getDoubleVolatile:
672 case vmIntrinsics::_putReferenceVolatile:
673 case vmIntrinsics::_putBooleanVolatile:
674 case vmIntrinsics::_putByteVolatile:
675 case vmIntrinsics::_putShortVolatile:
676 case vmIntrinsics::_putCharVolatile:
677 case vmIntrinsics::_putIntVolatile:
678 case vmIntrinsics::_putLongVolatile:
679 case vmIntrinsics::_putFloatVolatile:
680 case vmIntrinsics::_putDoubleVolatile:
681 case vmIntrinsics::_getReferenceAcquire:
682 case vmIntrinsics::_getBooleanAcquire:
723 case vmIntrinsics::_putIntUnaligned:
724 case vmIntrinsics::_putLongUnaligned:
725 case vmIntrinsics::_loadFence:
726 case vmIntrinsics::_storeFence:
727 case vmIntrinsics::_storeStoreFence:
728 case vmIntrinsics::_fullFence:
729 case vmIntrinsics::_currentCarrierThread:
730 case vmIntrinsics::_currentThread:
731 case vmIntrinsics::_setCurrentThread:
732 case vmIntrinsics::_scopedValueCache:
733 case vmIntrinsics::_setScopedValueCache:
734 #ifdef JFR_HAVE_INTRINSICS
735 case vmIntrinsics::_counterTime:
736 case vmIntrinsics::_getEventWriter:
737 case vmIntrinsics::_jvm_commit:
738 #endif
739 case vmIntrinsics::_currentTimeMillis:
740 case vmIntrinsics::_nanoTime:
741 case vmIntrinsics::_allocateInstance:
742 case vmIntrinsics::_allocateUninitializedArray:
743 case vmIntrinsics::_newArray:
744 case vmIntrinsics::_getLength:
745 case vmIntrinsics::_copyOf:
746 case vmIntrinsics::_copyOfRange:
747 case vmIntrinsics::_clone:
748 case vmIntrinsics::_isAssignableFrom:
749 case vmIntrinsics::_isInstance:
750 case vmIntrinsics::_getModifiers:
751 case vmIntrinsics::_isInterface:
752 case vmIntrinsics::_isArray:
753 case vmIntrinsics::_isPrimitive:
754 case vmIntrinsics::_isHidden:
755 case vmIntrinsics::_getSuperclass:
756 case vmIntrinsics::_getClassAccessFlags:
757 case vmIntrinsics::_floatToRawIntBits:
758 case vmIntrinsics::_floatToIntBits:
759 case vmIntrinsics::_intBitsToFloat:
760 case vmIntrinsics::_doubleToRawLongBits:
761 case vmIntrinsics::_doubleToLongBits:
762 case vmIntrinsics::_longBitsToDouble:
763 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");
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::_makePrivateBuffer:
647 case vmIntrinsics::_finishPrivateBuffer:
648 case vmIntrinsics::_getReference:
649 case vmIntrinsics::_getBoolean:
650 case vmIntrinsics::_getByte:
651 case vmIntrinsics::_getShort:
652 case vmIntrinsics::_getChar:
653 case vmIntrinsics::_getInt:
654 case vmIntrinsics::_getLong:
655 case vmIntrinsics::_getFloat:
656 case vmIntrinsics::_getDouble:
657 case vmIntrinsics::_getValue:
658 case vmIntrinsics::_putReference:
659 case vmIntrinsics::_putBoolean:
660 case vmIntrinsics::_putByte:
661 case vmIntrinsics::_putShort:
662 case vmIntrinsics::_putChar:
663 case vmIntrinsics::_putInt:
664 case vmIntrinsics::_putLong:
665 case vmIntrinsics::_putFloat:
666 case vmIntrinsics::_putDouble:
667 case vmIntrinsics::_putValue:
668 case vmIntrinsics::_getReferenceVolatile:
669 case vmIntrinsics::_getBooleanVolatile:
670 case vmIntrinsics::_getByteVolatile:
671 case vmIntrinsics::_getShortVolatile:
672 case vmIntrinsics::_getCharVolatile:
673 case vmIntrinsics::_getIntVolatile:
674 case vmIntrinsics::_getLongVolatile:
675 case vmIntrinsics::_getFloatVolatile:
676 case vmIntrinsics::_getDoubleVolatile:
677 case vmIntrinsics::_putReferenceVolatile:
678 case vmIntrinsics::_putBooleanVolatile:
679 case vmIntrinsics::_putByteVolatile:
680 case vmIntrinsics::_putShortVolatile:
681 case vmIntrinsics::_putCharVolatile:
682 case vmIntrinsics::_putIntVolatile:
683 case vmIntrinsics::_putLongVolatile:
684 case vmIntrinsics::_putFloatVolatile:
685 case vmIntrinsics::_putDoubleVolatile:
686 case vmIntrinsics::_getReferenceAcquire:
687 case vmIntrinsics::_getBooleanAcquire:
728 case vmIntrinsics::_putIntUnaligned:
729 case vmIntrinsics::_putLongUnaligned:
730 case vmIntrinsics::_loadFence:
731 case vmIntrinsics::_storeFence:
732 case vmIntrinsics::_storeStoreFence:
733 case vmIntrinsics::_fullFence:
734 case vmIntrinsics::_currentCarrierThread:
735 case vmIntrinsics::_currentThread:
736 case vmIntrinsics::_setCurrentThread:
737 case vmIntrinsics::_scopedValueCache:
738 case vmIntrinsics::_setScopedValueCache:
739 #ifdef JFR_HAVE_INTRINSICS
740 case vmIntrinsics::_counterTime:
741 case vmIntrinsics::_getEventWriter:
742 case vmIntrinsics::_jvm_commit:
743 #endif
744 case vmIntrinsics::_currentTimeMillis:
745 case vmIntrinsics::_nanoTime:
746 case vmIntrinsics::_allocateInstance:
747 case vmIntrinsics::_allocateUninitializedArray:
748 case vmIntrinsics::_isFlatArray:
749 case vmIntrinsics::_newArray:
750 case vmIntrinsics::_newNullRestrictedArray:
751 case vmIntrinsics::_getLength:
752 case vmIntrinsics::_copyOf:
753 case vmIntrinsics::_copyOfRange:
754 case vmIntrinsics::_clone:
755 case vmIntrinsics::_isAssignableFrom:
756 case vmIntrinsics::_isInstance:
757 case vmIntrinsics::_getModifiers:
758 case vmIntrinsics::_isInterface:
759 case vmIntrinsics::_isArray:
760 case vmIntrinsics::_isPrimitive:
761 case vmIntrinsics::_isHidden:
762 case vmIntrinsics::_getSuperclass:
763 case vmIntrinsics::_getClassAccessFlags:
764 case vmIntrinsics::_floatToRawIntBits:
765 case vmIntrinsics::_floatToIntBits:
766 case vmIntrinsics::_intBitsToFloat:
767 case vmIntrinsics::_doubleToRawLongBits:
768 case vmIntrinsics::_doubleToLongBits:
769 case vmIntrinsics::_longBitsToDouble:
770 case vmIntrinsics::_Reference_get:
|