< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page




2773                                        const TypeInstPtr* box_type,
2774                                        const TypeVect* vect_type) {
2775   if (vbox->is_Phi() && vect->is_Phi()) {
2776     assert(vbox->as_Phi()->region() == vect->as_Phi()->region(), "");
2777     Node* new_phi = new PhiNode(vbox->as_Phi()->region(), box_type);
2778     for (uint i = 1; i < vbox->req(); i++) {
2779       Node* new_box = expand_vbox_node_helper(vbox->in(i), vect->in(i), box_type, vect_type);
2780       new_phi->set_req(i, new_box);
2781     }
2782     new_phi = initial_gvn()->transform(new_phi);
2783     return new_phi;
2784   } else if (vbox->is_Proj() && vbox->in(0)->Opcode() == Op_VectorBoxAllocate) {
2785     VectorBoxAllocateNode* vbox_alloc = static_cast<VectorBoxAllocateNode*>(vbox->in(0));
2786     return expand_vbox_alloc_node(vbox_alloc, vect, box_type, vect_type);
2787   } else {
2788     // TODO: ensure that expanded vbox is initialized with the same value (vect).
2789     return vbox; // already expanded
2790   }
2791 }
2792 









2793 Node* Compile::expand_vbox_alloc_node(VectorBoxAllocateNode* vbox_alloc,
2794                                       Node* value,
2795                                       const TypeInstPtr* box_type,
2796                                       const TypeVect* vect_type) {
2797   JVMState* jvms = clone_jvms(C, vbox_alloc);
2798   GraphKit kit(jvms);
2799   PhaseGVN& gvn = kit.gvn();
2800 
2801   ciInstanceKlass* box_klass = box_type->klass()->as_instance_klass();
2802   BasicType bt = vect_type->element_basic_type();
2803   int num_elem = vect_type->length();
2804 
2805   bool is_mask = box_klass->is_vectormask();
2806   //assert(!is_mask || vect_type->element_basic_type() == getMaskBasicType(bt), "consistent vector element type expected");
2807   if (is_mask && bt != T_BOOLEAN) {
2808     value = gvn.transform(new VectorStoreMaskNode(value, bt, num_elem));
2809     // Although type of mask depends on its definition, in terms of storage everything is stored in boolean array.
2810     bt = T_BOOLEAN;
2811     assert(value->as_Vector()->bottom_type()->is_vect()->element_basic_type() == bt,
2812            "must be consistent with mask representation");


2821   const TypeKlassPtr* array_klass = TypeKlassPtr::make(ciTypeArrayKlass::make(bt));
2822   Node* arr = kit.new_array(kit.makecon(array_klass), kit.intcon(num_elem), 1);
2823 
2824   // FIXME convert both stores into initializing stores
2825 
2826   // Store the vector value into the array.
2827   Node* arr_adr = kit.array_element_address(arr, kit.intcon(0), bt);
2828   const TypePtr* arr_adr_type = arr_adr->bottom_type()->is_ptr();
2829   Node* arr_mem = kit.memory(arr_adr);
2830   Node* vstore = gvn.transform(StoreVectorNode::make(0,
2831                                                      kit.control(),
2832                                                      arr_mem,
2833                                                      arr_adr,
2834                                                      arr_adr_type,
2835                                                      value,
2836                                                      num_elem));
2837   kit.set_memory(vstore, arr_adr_type);
2838 
2839 
2840   // Store the allocated array into object.
2841   ciField* field = box_klass->get_field_by_name(ciSymbol::make(is_mask ? "bits" : "vec"),
2842                                                 ciSymbol::make(TypeArrayKlass::external_name(bt)),
2843                                                 false);
2844   Node* vec_field = kit.basic_plus_adr(vec_obj, field->offset_in_bytes());
2845   const TypePtr* vec_adr_type = vec_field->bottom_type()->is_ptr();
2846   Node* field_store = gvn.transform(kit.access_store_at(vec_obj,
2847                                                             vec_field,
2848                                                             vec_adr_type,
2849                                                             arr,
2850                                                             TypeOopPtr::make_from_klass(field->type()->as_klass()),
2851                                                             T_OBJECT,
2852                                                             IN_HEAP));
2853 
2854   kit.set_memory(field_store, vec_adr_type);
2855 
2856   kit.replace_call(vbox_alloc, vec_obj, true);
2857   C->remove_macro_node(vbox_alloc);
2858   return vec_obj;
2859 }
2860 
2861 void Compile::expand_vunbox_node(VectorUnboxNode* vec_unbox) {




2773                                        const TypeInstPtr* box_type,
2774                                        const TypeVect* vect_type) {
2775   if (vbox->is_Phi() && vect->is_Phi()) {
2776     assert(vbox->as_Phi()->region() == vect->as_Phi()->region(), "");
2777     Node* new_phi = new PhiNode(vbox->as_Phi()->region(), box_type);
2778     for (uint i = 1; i < vbox->req(); i++) {
2779       Node* new_box = expand_vbox_node_helper(vbox->in(i), vect->in(i), box_type, vect_type);
2780       new_phi->set_req(i, new_box);
2781     }
2782     new_phi = initial_gvn()->transform(new_phi);
2783     return new_phi;
2784   } else if (vbox->is_Proj() && vbox->in(0)->Opcode() == Op_VectorBoxAllocate) {
2785     VectorBoxAllocateNode* vbox_alloc = static_cast<VectorBoxAllocateNode*>(vbox->in(0));
2786     return expand_vbox_alloc_node(vbox_alloc, vect, box_type, vect_type);
2787   } else {
2788     // TODO: ensure that expanded vbox is initialized with the same value (vect).
2789     return vbox; // already expanded
2790   }
2791 }
2792 
2793 static const char * get_field_name(ciInstanceKlass * box_class) {
2794    if(box_class->is_vectormask())
2795       return "bits";
2796    else if (box_class->is_vectorshuffle())
2797       return "reorder";
2798    else
2799       return "vec";
2800 }
2801 
2802 Node* Compile::expand_vbox_alloc_node(VectorBoxAllocateNode* vbox_alloc,
2803                                       Node* value,
2804                                       const TypeInstPtr* box_type,
2805                                       const TypeVect* vect_type) {
2806   JVMState* jvms = clone_jvms(C, vbox_alloc);
2807   GraphKit kit(jvms);
2808   PhaseGVN& gvn = kit.gvn();
2809 
2810   ciInstanceKlass* box_klass = box_type->klass()->as_instance_klass();
2811   BasicType bt = vect_type->element_basic_type();
2812   int num_elem = vect_type->length();
2813 
2814   bool is_mask = box_klass->is_vectormask();
2815   //assert(!is_mask || vect_type->element_basic_type() == getMaskBasicType(bt), "consistent vector element type expected");
2816   if (is_mask && bt != T_BOOLEAN) {
2817     value = gvn.transform(new VectorStoreMaskNode(value, bt, num_elem));
2818     // Although type of mask depends on its definition, in terms of storage everything is stored in boolean array.
2819     bt = T_BOOLEAN;
2820     assert(value->as_Vector()->bottom_type()->is_vect()->element_basic_type() == bt,
2821            "must be consistent with mask representation");


2830   const TypeKlassPtr* array_klass = TypeKlassPtr::make(ciTypeArrayKlass::make(bt));
2831   Node* arr = kit.new_array(kit.makecon(array_klass), kit.intcon(num_elem), 1);
2832 
2833   // FIXME convert both stores into initializing stores
2834 
2835   // Store the vector value into the array.
2836   Node* arr_adr = kit.array_element_address(arr, kit.intcon(0), bt);
2837   const TypePtr* arr_adr_type = arr_adr->bottom_type()->is_ptr();
2838   Node* arr_mem = kit.memory(arr_adr);
2839   Node* vstore = gvn.transform(StoreVectorNode::make(0,
2840                                                      kit.control(),
2841                                                      arr_mem,
2842                                                      arr_adr,
2843                                                      arr_adr_type,
2844                                                      value,
2845                                                      num_elem));
2846   kit.set_memory(vstore, arr_adr_type);
2847 
2848 
2849   // Store the allocated array into object.
2850   ciField* field = box_klass->get_field_by_name(ciSymbol::make(get_field_name(box_klass)),
2851                                                 ciSymbol::make(TypeArrayKlass::external_name(bt)),
2852                                                 false);
2853   Node* vec_field = kit.basic_plus_adr(vec_obj, field->offset_in_bytes());
2854   const TypePtr* vec_adr_type = vec_field->bottom_type()->is_ptr();
2855   Node* field_store = gvn.transform(kit.access_store_at(vec_obj,
2856                                                             vec_field,
2857                                                             vec_adr_type,
2858                                                             arr,
2859                                                             TypeOopPtr::make_from_klass(field->type()->as_klass()),
2860                                                             T_OBJECT,
2861                                                             IN_HEAP));
2862 
2863   kit.set_memory(field_store, vec_adr_type);
2864 
2865   kit.replace_call(vbox_alloc, vec_obj, true);
2866   C->remove_macro_node(vbox_alloc);
2867   return vec_obj;
2868 }
2869 
2870 void Compile::expand_vunbox_node(VectorUnboxNode* vec_unbox) {


< prev index next >