< prev index next >

src/share/vm/opto/valuetypenode.cpp

Print this page




 330 }
 331 
 332 ciType* ValueTypeNode::field_type(uint index) const {
 333   assert(index < field_count(), "index out of bounds");
 334   return value_klass()->field_type_by_index(index);
 335 }
 336 
 337 void ValueTypeNode::make_scalar_in_safepoints(Compile* C) {
 338   const TypeValueTypePtr* res_type = TypeValueTypePtr::make(bottom_type()->isa_valuetype(), TypePtr::NotNull);
 339   ciValueKlass* vk = value_klass();
 340   uint nfields = vk->flattened_field_count();
 341   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
 342     Node* u = fast_out(i);
 343     if (u->is_SafePoint() && (!u->is_Call() || u->as_Call()->has_debug_use(this))) {
 344       Node* in_oop = get_oop();
 345       const Type* oop_type = in_oop->bottom_type();
 346       SafePointNode* sfpt = u->as_SafePoint();
 347       JVMState* jvms = sfpt->jvms();
 348       int start = jvms->debug_start();
 349       int end   = jvms->debug_end();
 350       if (oop_type->meet(TypePtr::NULL_PTR) != oop_type) {
 351         // Replace safepoint edge by oop
 352         int nb = sfpt->replace_edges_in_range(this, in_oop, start, end);
 353         --i; imax -= nb;
 354       } else {
 355         // Replace safepoint edge by SafePointScalarObjectNode and add field values
 356         assert(jvms != NULL, "missing JVMS");
 357         uint first_ind = (sfpt->req() - jvms->scloff());
 358         SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type,
 359 #ifdef ASSERT
 360                                                                         NULL,
 361 #endif
 362                                                                         first_ind, nfields);
 363         sobj->init_req(0, C->root());
 364         // Iterate over the value type fields in order of increasing
 365         // offset and add the field values to the safepoint.
 366         for (uint j = 0; j < nfields; ++j) {
 367           int offset = vk->nonstatic_field_at(j)->offset();
 368           Node* value = field_value_by_offset(offset, true /* include flattened value type fields */);
 369           sfpt->add_req(value);
 370         }
 371         jvms->set_endoff(sfpt->req());
 372         int nb = sfpt->replace_edges_in_range(this, sobj, start, end);
 373         --i; imax -= nb;
 374       }
 375     }
 376   }
 377 }
 378 
 379 uint ValueTypeNode::set_arguments_for_java_call(CallJavaNode* call, int base_input, const GraphKit& kit, ciValueKlass* base_vk, int base_offset) {
 380   ciValueKlass* vk = value_klass();
 381   if (base_vk == NULL) {
 382     base_vk = vk;
 383   }
 384   uint edges = 0;
 385   for (uint i = 0; i < field_count(); i++) {
 386     ciType* f_type = field_type(i);
 387     int offset = base_offset + field_offset(i) - (base_offset > 0 ? vk->first_field_offset() : 0);
 388     Node* arg = field_value(i);
 389     if (f_type->is_valuetype()) {
 390       ciValueKlass* embedded_vk = f_type->as_value_klass();
 391       edges += arg->as_ValueType()->set_arguments_for_java_call(call, base_input, kit, base_vk, offset);
 392     } else {
 393       int j = 0; int extra = 0;
 394       for (; j < base_vk->nof_nonstatic_fields(); j++) {




 330 }
 331 
 332 ciType* ValueTypeNode::field_type(uint index) const {
 333   assert(index < field_count(), "index out of bounds");
 334   return value_klass()->field_type_by_index(index);
 335 }
 336 
 337 void ValueTypeNode::make_scalar_in_safepoints(Compile* C) {
 338   const TypeValueTypePtr* res_type = TypeValueTypePtr::make(bottom_type()->isa_valuetype(), TypePtr::NotNull);
 339   ciValueKlass* vk = value_klass();
 340   uint nfields = vk->flattened_field_count();
 341   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
 342     Node* u = fast_out(i);
 343     if (u->is_SafePoint() && (!u->is_Call() || u->as_Call()->has_debug_use(this))) {
 344       Node* in_oop = get_oop();
 345       const Type* oop_type = in_oop->bottom_type();
 346       SafePointNode* sfpt = u->as_SafePoint();
 347       JVMState* jvms = sfpt->jvms();
 348       int start = jvms->debug_start();
 349       int end   = jvms->debug_end();
 350       assert(oop_type->meet(TypePtr::NULL_PTR) == oop_type, "already available object should be linked directly");




 351       // Replace safepoint edge by SafePointScalarObjectNode and add field values
 352       assert(jvms != NULL, "missing JVMS");
 353       uint first_ind = (sfpt->req() - jvms->scloff());
 354       SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type,
 355 #ifdef ASSERT
 356                                                                       NULL,
 357 #endif
 358                                                                       first_ind, nfields);
 359       sobj->init_req(0, C->root());
 360       // Iterate over the value type fields in order of increasing
 361       // offset and add the field values to the safepoint.
 362       for (uint j = 0; j < nfields; ++j) {
 363         int offset = vk->nonstatic_field_at(j)->offset();
 364         Node* value = field_value_by_offset(offset, true /* include flattened value type fields */);
 365         sfpt->add_req(value);
 366       }
 367       jvms->set_endoff(sfpt->req());
 368       int nb = sfpt->replace_edges_in_range(this, sobj, start, end);
 369       --i; imax -= nb;

 370     }
 371   }
 372 }
 373 
 374 uint ValueTypeNode::set_arguments_for_java_call(CallJavaNode* call, int base_input, const GraphKit& kit, ciValueKlass* base_vk, int base_offset) {
 375   ciValueKlass* vk = value_klass();
 376   if (base_vk == NULL) {
 377     base_vk = vk;
 378   }
 379   uint edges = 0;
 380   for (uint i = 0; i < field_count(); i++) {
 381     ciType* f_type = field_type(i);
 382     int offset = base_offset + field_offset(i) - (base_offset > 0 ? vk->first_field_offset() : 0);
 383     Node* arg = field_value(i);
 384     if (f_type->is_valuetype()) {
 385       ciValueKlass* embedded_vk = f_type->as_value_klass();
 386       edges += arg->as_ValueType()->set_arguments_for_java_call(call, base_input, kit, base_vk, offset);
 387     } else {
 388       int j = 0; int extra = 0;
 389       for (; j < base_vk->nof_nonstatic_fields(); j++) {


< prev index next >