< prev index next >

src/hotspot/share/opto/vectorIntrinsics.cpp

Print this page

        

*** 27,58 **** #include "opto/library_call.hpp" #include "opto/runtime.hpp" #include "opto/vectornode.hpp" #include "prims/vectorSupport.hpp" ! bool LibraryCallKit::arch_supports_vector(int op, int num_elem, BasicType type, VectorMaskUseType mask_use_type) { // Check that the operation is valid. ! if (op <= 0) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr(" ** Rejected intrinsification because no valid vector op could be extracted"); } #endif return false; } // Check that architecture supports this op-size-type combination. ! if (!Matcher::match_rule_supported_vector(op, num_elem, type)) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr(" ** Rejected vector op (%s,%s,%d) because architecture does not support it", ! NodeClassNames[op], type2name(type), num_elem); } #endif return false; } else { ! assert(Matcher::match_rule_supported(op), "must be supported"); } // Check whether mask unboxing is supported. if (mask_use_type == VecMaskUseAll || mask_use_type == VecMaskUseLoad) { if (!Matcher::match_rule_supported_vector(Op_VectorLoadMask, num_elem, type)) { --- 27,67 ---- #include "opto/library_call.hpp" #include "opto/runtime.hpp" #include "opto/vectornode.hpp" #include "prims/vectorSupport.hpp" ! bool LibraryCallKit::arch_supports_vector(int sopc, int num_elem, BasicType type, VectorMaskUseType mask_use_type, bool has_scalar_args) { // Check that the operation is valid. ! if (sopc <= 0) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr(" ** Rejected intrinsification because no valid vector op could be extracted"); } #endif return false; } // Check that architecture supports this op-size-type combination. ! if (!Matcher::match_rule_supported_vector(sopc, num_elem, type)) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr(" ** Rejected vector op (%s,%s,%d) because architecture does not support it", ! NodeClassNames[sopc], type2name(type), num_elem); } #endif return false; } else { ! assert(Matcher::match_rule_supported(sopc), "must be supported"); ! } ! ! if (!has_scalar_args && VectorNode::is_vector_shift(sopc) && ! Matcher::supports_vector_variable_shifts() == false) { ! if (C->print_intrinsics()) { ! tty->print_cr(" ** Rejected vector op (%s,%s,%d) because architecture does not support variable vector shifts", ! NodeClassNames[sopc], type2name(type), num_elem); ! } ! return false; } // Check whether mask unboxing is supported. if (mask_use_type == VecMaskUseAll || mask_use_type == VecMaskUseLoad) { if (!Matcher::match_rule_supported_vector(Op_VectorLoadMask, num_elem, type)) {
*** 80,121 **** } return true; } - static int get_sopc(int opc, BasicType elem_bt, int arity) { - #ifdef X86 - // Variable shift handling - if (arity == 2) { - switch (opc) { - case Op_LShiftI: - case Op_LShiftL: - return Op_VLShiftV; - case Op_RShiftI: - case Op_RShiftL: - return Op_VRShiftV; - case Op_URShiftB: - case Op_URShiftS: - case Op_URShiftI: - case Op_URShiftL: - return Op_VURShiftV; - - default: break; - } - } - #endif - return VectorNode::opcode(opc, elem_bt); - } - static bool is_vector_mask(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorMask_klass()); } static bool is_vector_shuffle(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorShuffle_klass()); } #ifdef ASSERT static bool is_vector(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorPayload_klass()); } --- 89,112 ---- } return true; } static bool is_vector_mask(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorMask_klass()); } static bool is_vector_shuffle(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorShuffle_klass()); } + static bool is_klass_initialized(const TypeInstPtr* vec_klass) { + assert(vec_klass->const_oop()->as_instance()->java_lang_Class_klass(), "klass instance expected"); + ciInstanceKlass* klass = vec_klass->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass(); + return klass->is_initialized(); + } + #ifdef ASSERT static bool is_vector(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorPayload_klass()); }
*** 213,226 **** if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); } return false; // should be primitive type } BasicType elem_bt = elem_type->basic_type(); int num_elem = vlen->get_con(); int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); ! int sopc = get_sopc(opc, elem_bt, n); ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); // TODO When mask usage is supported, VecMaskNotUsed needs to be VecMaskUseLoad. if (!arch_supports_vector(sopc, num_elem, elem_bt, is_vector_mask(vbox_klass) ? VecMaskUseAll : VecMaskNotUsed)) { --- 204,223 ---- if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); } return false; // should be primitive type } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } BasicType elem_bt = elem_type->basic_type(); int num_elem = vlen->get_con(); int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); ! int sopc = VectorNode::opcode(opc, elem_bt); ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); // TODO When mask usage is supported, VecMaskNotUsed needs to be VecMaskUseLoad. if (!arch_supports_vector(sopc, num_elem, elem_bt, is_vector_mask(vbox_klass) ? VecMaskUseAll : VecMaskNotUsed)) {
*** 305,314 **** --- 302,317 ---- if (!vlen->is_con() || !is_power_of_2(vlen->get_con()) || shuffle_klass->const_oop() == NULL || !wrap->is_con()) { return false; // not enough info for intrinsification } + if (!is_klass_initialized(shuffle_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } int do_wrap = wrap->get_con(); int num_elem = vlen->get_con(); BasicType elem_bt = T_BYTE;
*** 384,396 **** const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); const TypeInstPtr* shuffle_klass = gvn().type(argument(2))->is_instptr(); Node* shuffle = argument(3); const TypeInt* vlen = gvn().type(argument(4))->is_int(); ! if (!vlen->is_con() || shuffle_klass->const_oop() == NULL) { return false; // not enough info for intrinsification } int num_elem = vlen->get_con(); ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); BasicType elem_bt = elem_type->basic_type(); --- 387,405 ---- const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); const TypeInstPtr* shuffle_klass = gvn().type(argument(2))->is_instptr(); Node* shuffle = argument(3); const TypeInt* vlen = gvn().type(argument(4))->is_int(); ! if (!vlen->is_con() || vector_klass->const_oop() == NULL || shuffle_klass->const_oop() == NULL) { return false; // not enough info for intrinsification } + if (!is_klass_initialized(shuffle_klass) || !is_klass_initialized(vector_klass) ) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } int num_elem = vlen->get_con(); ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); BasicType elem_bt = elem_type->basic_type();
*** 441,450 **** --- 450,465 ---- NodeClassNames[argument(2)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 455,465 **** ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); // TODO When mask usage is supported, VecMaskNotUsed needs to be VecMaskUseLoad. if (!arch_supports_vector(VectorNode::replicate_opcode(elem_bt), num_elem, elem_bt, ! is_vector_mask(vbox_klass) ? VecMaskUseStore : VecMaskNotUsed)) { if (C->print_intrinsics()) { tty->print_cr(" ** not supported: arity=0 op=broadcast vlen=%d etype=%s ismask=%d", num_elem, type2name(elem_bt), is_vector_mask(vbox_klass) ? 1 : 0); } --- 470,480 ---- ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); // TODO When mask usage is supported, VecMaskNotUsed needs to be VecMaskUseLoad. if (!arch_supports_vector(VectorNode::replicate_opcode(elem_bt), num_elem, elem_bt, ! (is_vector_mask(vbox_klass) ? VecMaskUseStore : VecMaskNotUsed), true /*has_scalar_args*/)) { if (C->print_intrinsics()) { tty->print_cr(" ** not supported: arity=0 op=broadcast vlen=%d etype=%s ismask=%d", num_elem, type2name(elem_bt), is_vector_mask(vbox_klass) ? 1 : 0); }
*** 529,538 **** --- 544,559 ---- NodeClassNames[argument(1)->Opcode()], NodeClassNames[argument(2)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type());
*** 687,696 **** --- 708,723 ---- NodeClassNames[argument(3)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass) || !is_klass_initialized(vector_idx_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 784,793 **** --- 811,826 ---- NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 865,874 **** --- 898,913 ---- NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 923,932 **** --- 962,977 ---- NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass) || !is_klass_initialized(mask_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 989,998 **** --- 1034,1049 ---- NodeClassNames[argument(3)->Opcode()], NodeClassNames[argument(4)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass) || !is_klass_initialized(mask_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 1047,1064 **** const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); const TypeInt* vlen = gvn().type(argument(3))->is_int(); if (shuffle_klass->const_oop() == NULL || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { - return false; // not enough info for intrinsification if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s sclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], NodeClassNames[argument(1)->Opcode()], NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); --- 1098,1121 ---- const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); const TypeInt* vlen = gvn().type(argument(3))->is_int(); if (shuffle_klass->const_oop() == NULL || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s sclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], NodeClassNames[argument(1)->Opcode()], NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } + return false; // not enough info for intrinsification + } + if (!is_klass_initialized(vector_klass) || !is_klass_initialized(shuffle_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type());
*** 1132,1156 **** NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } return false; // not enough info for intrinsification } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); } return false; // should be primitive type } BasicType elem_bt = elem_type->basic_type(); int num_elem = vlen->get_con(); int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); ! int sopc = get_sopc(opc, elem_bt, 1); // get_node_id(opr->get_con(), elem_bt); ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); ! if (!arch_supports_vector(sopc, num_elem, elem_bt, VecMaskNotUsed)) { if (C->print_intrinsics()) { tty->print_cr(" ** not supported: arity=0 op=int/%d vlen=%d etype=%s ismask=no", sopc, num_elem, type2name(elem_bt)); } return false; // not supported --- 1189,1219 ---- NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(3)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); } return false; // should be primitive type } BasicType elem_bt = elem_type->basic_type(); int num_elem = vlen->get_con(); int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); ! int sopc = VectorNode::opcode(opc, elem_bt); ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); ! if (!arch_supports_vector(sopc, num_elem, elem_bt, VecMaskNotUsed, true /*has_scalar_args*/)) { if (C->print_intrinsics()) { tty->print_cr(" ** not supported: arity=0 op=int/%d vlen=%d etype=%s ismask=no", sopc, num_elem, type2name(elem_bt)); } return false; // not supported
*** 1201,1210 **** --- 1264,1279 ---- NodeClassNames[argument(5)->Opcode()], NodeClassNames[argument(6)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass_from) || !is_klass_initialized(vector_klass_to)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } assert(opr->get_con() == VectorSupport::VECTOR_OP_CAST || opr->get_con() == VectorSupport::VECTOR_OP_REINTERPRET, "wrong opcode"); bool is_cast = (opr->get_con() == VectorSupport::VECTOR_OP_CAST);
*** 1369,1378 **** --- 1438,1453 ---- NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(4)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
*** 1453,1462 **** --- 1528,1543 ---- NodeClassNames[argument(2)->Opcode()], NodeClassNames[argument(4)->Opcode()]); } return false; // not enough info for intrinsification } + if (!is_klass_initialized(vector_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); if (!elem_type->is_primitive_type()) { if (C->print_intrinsics()) { tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); }
< prev index next >