763 return inline_vector_convert();
764 case vmIntrinsics::_VectorInsert:
765 return inline_vector_insert();
766 case vmIntrinsics::_VectorExtract:
767 return inline_vector_extract();
768 case vmIntrinsics::_VectorCompressExpand:
769 return inline_vector_compress_expand();
770 case vmIntrinsics::_VectorSelectFromTwoVectorOp:
771 return inline_vector_select_from_two_vectors();
772 case vmIntrinsics::_IndexVector:
773 return inline_index_vector();
774 case vmIntrinsics::_IndexPartiallyInUpperRange:
775 return inline_index_partially_in_upper_range();
776
777 case vmIntrinsics::_getObjectSize:
778 return inline_getObjectSize();
779
780 case vmIntrinsics::_blackhole:
781 return inline_blackhole();
782
783 default:
784 // If you get here, it may be that someone has added a new intrinsic
785 // to the list in vmIntrinsics.hpp without implementing it here.
786 #ifndef PRODUCT
787 if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
788 tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
789 vmIntrinsics::name_at(intrinsic_id()), vmIntrinsics::as_int(intrinsic_id()));
790 }
791 #endif
792 return false;
793 }
794 }
795
796 Node* LibraryCallKit::try_to_predicate(int predicate) {
797 if (!jvms()->has_method()) {
798 // Root JVMState has a null method.
799 assert(map()->memory()->Opcode() == Op_Parm, "");
800 // Insert the memory aliasing node
801 set_all_memory(reset_memory());
802 }
8898 Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
8899 C->record_for_igvn(profile);
8900 set_result(profile);
8901 return true;
8902 } else {
8903 // Continue profiling.
8904 // Profile data isn't available at the moment. So, execute method's bytecode version.
8905 // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
8906 // is compiled and counters aren't available since corresponding MethodHandle
8907 // isn't a compile-time constant.
8908 return false;
8909 }
8910 }
8911
8912 bool LibraryCallKit::inline_isCompileConstant() {
8913 Node* n = argument(0);
8914 set_result(n->is_Con() ? intcon(1) : intcon(0));
8915 return true;
8916 }
8917
8918 //------------------------------- inline_getObjectSize --------------------------------------
8919 //
8920 // Calculate the runtime size of the object/array.
8921 // native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
8922 //
8923 bool LibraryCallKit::inline_getObjectSize() {
8924 Node* obj = argument(3);
8925 Node* klass_node = load_object_klass(obj);
8926
8927 jint layout_con = Klass::_lh_neutral_value;
8928 Node* layout_val = get_layout_helper(klass_node, layout_con);
8929 int layout_is_con = (layout_val == nullptr);
8930
8931 if (layout_is_con) {
8932 // Layout helper is constant, can figure out things at compile time.
8933
8934 if (Klass::layout_helper_is_instance(layout_con)) {
8935 // Instance case: layout_con contains the size itself.
8936 Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
8937 set_result(size);
8938 } else {
8939 // Array case: size is round(header + element_size*arraylength).
8940 // Since arraylength is different for every array instance, we have to
8941 // compute the whole thing at runtime.
8942
8943 Node* arr_length = load_array_length(obj);
8944
9149
9150 Node* result = nullptr;
9151 switch (id) {
9152 // Unary operations
9153 case vmIntrinsics::_sqrt_float16:
9154 result = _gvn.transform(new SqrtHFNode(C, control(), fld1));
9155 break;
9156 // Ternary operations
9157 case vmIntrinsics::_fma_float16:
9158 result = _gvn.transform(new FmaHFNode(fld1, fld2, fld3));
9159 break;
9160 default:
9161 fatal_unexpected_iid(id);
9162 break;
9163 }
9164 result = _gvn.transform(new ReinterpretHF2SNode(result));
9165 set_result(box_fp16_value(float16_box_type, field, result));
9166 return true;
9167 }
9168
|
763 return inline_vector_convert();
764 case vmIntrinsics::_VectorInsert:
765 return inline_vector_insert();
766 case vmIntrinsics::_VectorExtract:
767 return inline_vector_extract();
768 case vmIntrinsics::_VectorCompressExpand:
769 return inline_vector_compress_expand();
770 case vmIntrinsics::_VectorSelectFromTwoVectorOp:
771 return inline_vector_select_from_two_vectors();
772 case vmIntrinsics::_IndexVector:
773 return inline_index_vector();
774 case vmIntrinsics::_IndexPartiallyInUpperRange:
775 return inline_index_partially_in_upper_range();
776
777 case vmIntrinsics::_getObjectSize:
778 return inline_getObjectSize();
779
780 case vmIntrinsics::_blackhole:
781 return inline_blackhole();
782
783 case vmIntrinsics::_shipilev_magic_timestamp:
784 return inline_timestamp(false);
785 case vmIntrinsics::_shipilev_magic_timestamp_serial:
786 return inline_timestamp(true);
787 case vmIntrinsics::_shipilev_magic_sizeOf:
788 return inline_sizeOf();
789 case vmIntrinsics::_shipilev_magic_addressOf:
790 return inline_addressOf();
791
792 default:
793 // If you get here, it may be that someone has added a new intrinsic
794 // to the list in vmIntrinsics.hpp without implementing it here.
795 #ifndef PRODUCT
796 if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
797 tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
798 vmIntrinsics::name_at(intrinsic_id()), vmIntrinsics::as_int(intrinsic_id()));
799 }
800 #endif
801 return false;
802 }
803 }
804
805 Node* LibraryCallKit::try_to_predicate(int predicate) {
806 if (!jvms()->has_method()) {
807 // Root JVMState has a null method.
808 assert(map()->memory()->Opcode() == Op_Parm, "");
809 // Insert the memory aliasing node
810 set_all_memory(reset_memory());
811 }
8907 Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
8908 C->record_for_igvn(profile);
8909 set_result(profile);
8910 return true;
8911 } else {
8912 // Continue profiling.
8913 // Profile data isn't available at the moment. So, execute method's bytecode version.
8914 // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
8915 // is compiled and counters aren't available since corresponding MethodHandle
8916 // isn't a compile-time constant.
8917 return false;
8918 }
8919 }
8920
8921 bool LibraryCallKit::inline_isCompileConstant() {
8922 Node* n = argument(0);
8923 set_result(n->is_Con() ? intcon(1) : intcon(0));
8924 return true;
8925 }
8926
8927 //------------------------------- inline_getObjectSize/sizeOf --------------------------------------
8928 //
8929 // Calculate the runtime size of the object/array.
8930 //
8931 // long java.lang.Runtime.sizeOf(Object obj)
8932 // native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
8933 //
8934 bool LibraryCallKit::inline_sizeOf() {
8935 Node* obj = argument(0);
8936 return inline_sizeOf_impl(obj);
8937 }
8938
8939 bool LibraryCallKit::inline_getObjectSize() {
8940 Node* obj = argument(3);
8941 return inline_sizeOf_impl(obj);
8942 }
8943
8944 bool LibraryCallKit::inline_sizeOf_impl(Node* obj) {
8945 Node* klass_node = load_object_klass(obj);
8946
8947 jint layout_con = Klass::_lh_neutral_value;
8948 Node* layout_val = get_layout_helper(klass_node, layout_con);
8949 int layout_is_con = (layout_val == nullptr);
8950
8951 if (layout_is_con) {
8952 // Layout helper is constant, can figure out things at compile time.
8953
8954 if (Klass::layout_helper_is_instance(layout_con)) {
8955 // Instance case: layout_con contains the size itself.
8956 Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
8957 set_result(size);
8958 } else {
8959 // Array case: size is round(header + element_size*arraylength).
8960 // Since arraylength is different for every array instance, we have to
8961 // compute the whole thing at runtime.
8962
8963 Node* arr_length = load_array_length(obj);
8964
9169
9170 Node* result = nullptr;
9171 switch (id) {
9172 // Unary operations
9173 case vmIntrinsics::_sqrt_float16:
9174 result = _gvn.transform(new SqrtHFNode(C, control(), fld1));
9175 break;
9176 // Ternary operations
9177 case vmIntrinsics::_fma_float16:
9178 result = _gvn.transform(new FmaHFNode(fld1, fld2, fld3));
9179 break;
9180 default:
9181 fatal_unexpected_iid(id);
9182 break;
9183 }
9184 result = _gvn.transform(new ReinterpretHF2SNode(result));
9185 set_result(box_fp16_value(float16_box_type, field, result));
9186 return true;
9187 }
9188
9189 bool LibraryCallKit::inline_timestamp(bool serial) {
9190 insert_mem_bar(Op_MemBarCPUOrder);
9191 Node* node = serial ?
9192 _gvn.transform(new TimestampSerialNode(control())) :
9193 _gvn.transform(new TimestampNode(control()));
9194 set_result(node);
9195 insert_mem_bar(Op_MemBarCPUOrder);
9196 return true;
9197 }
9198
9199 bool LibraryCallKit::inline_addressOf() {
9200 Node* obj = argument(0);
9201 Node* raw_val = _gvn.transform(new CastP2XNode(nullptr, obj));
9202 Node* long_val = ConvX2L(raw_val);
9203 set_result(long_val);
9204 return true;
9205 }
|