323 klass == C->env()->StringBuffer_klass())) { 324 C->set_has_stringbuilder(true); 325 } 326 327 // Keep track of boxed values for EliminateAutoBox optimizations. 328 if (C->eliminate_boxing() && klass->is_box_klass()) { 329 C->set_has_boxed_value(true); 330 } 331 } 332 333 //------------------------------do_defaultvalue--------------------------------- 334 void Parse::do_defaultvalue() { 335 bool will_link; 336 ciValueKlass* vk = iter().get_klass(will_link)->as_value_klass(); 337 assert(will_link, "defaultvalue: typeflow responsibility"); 338 339 // Should initialize, or throw an InstantiationError? 340 emit_guard_for_new(vk); 341 if (stopped()) return; 342 343 // Create and push a new default ValueTypeNode 344 push(ValueTypeNode::make_default(_gvn, vk)); 345 } 346 347 //------------------------------do_withfield------------------------------------ 348 void Parse::do_withfield() { 349 bool will_link; 350 ciField* field = iter().get_field(will_link); 351 assert(will_link, "withfield: typeflow responsibility"); 352 BasicType bt = field->layout_type(); 353 Node* val = type2size[bt] == 1 ? pop() : pop_pair(); 354 Node* vt = pop(); 355 assert(vt->is_ValueType(), "value type expected here"); 356 357 ValueTypeNode* new_vt = vt->clone()->as_ValueType(); 358 new_vt->set_oop(_gvn.zerocon(T_VALUETYPE)); 359 int offset = field->offset(); 360 uint i = 0; 361 for (; i < new_vt->field_count() && new_vt->field_offset(i) != offset; i++) {} 362 assert(i < new_vt->field_count(), "field not found"); 363 new_vt->set_field_value(i, val); 364 365 push(_gvn.transform(new_vt)); 366 } 367 368 #ifndef PRODUCT 369 //------------------------------dump_map_adr_mem------------------------------- 370 // Debug dump of the mapping from address types to MergeMemNode indices. 371 void Parse::dump_map_adr_mem() const { 372 tty->print_cr("--- Mapping from address types to memory Nodes ---"); 373 MergeMemNode *mem = map() == NULL ? NULL : (map()->memory()->is_MergeMem() ? 374 map()->memory()->as_MergeMem() : NULL); 375 for (uint i = 0; i < (uint)C->num_alias_types(); i++) { 376 C->alias_type(i)->print_on(tty); 377 tty->print("\t"); 378 // Node mapping, if any 379 if (mem && i < mem->req() && mem->in(i) && mem->in(i) != mem->empty_memory()) { 380 mem->in(i)->dump(); 381 } else { 382 tty->cr(); 383 } 384 } 385 } | 323 klass == C->env()->StringBuffer_klass())) { 324 C->set_has_stringbuilder(true); 325 } 326 327 // Keep track of boxed values for EliminateAutoBox optimizations. 328 if (C->eliminate_boxing() && klass->is_box_klass()) { 329 C->set_has_boxed_value(true); 330 } 331 } 332 333 //------------------------------do_defaultvalue--------------------------------- 334 void Parse::do_defaultvalue() { 335 bool will_link; 336 ciValueKlass* vk = iter().get_klass(will_link)->as_value_klass(); 337 assert(will_link, "defaultvalue: typeflow responsibility"); 338 339 // Should initialize, or throw an InstantiationError? 340 emit_guard_for_new(vk); 341 if (stopped()) return; 342 343 // Always scalarize default value because it's not NULL by definition 344 push(ValueTypeNode::make_default(_gvn, vk)); 345 } 346 347 //------------------------------do_withfield------------------------------------ 348 void Parse::do_withfield() { 349 bool will_link; 350 ciField* field = iter().get_field(will_link); 351 assert(will_link, "withfield: typeflow responsibility"); 352 BasicType bt = field->layout_type(); 353 Node* val = type2size[bt] == 1 ? pop() : pop_pair(); 354 ciValueKlass* holder_klass = field->holder()->as_value_klass(); 355 Node* holder = pop(); 356 357 if (!holder->is_ValueType()) { 358 assert(!gvn().type(holder)->maybe_null(), "should never be null"); 359 inc_sp(2); 360 holder = ValueTypeNode::make_from_oop(this, holder, holder_klass); 361 if (field->is_flattenable() && !val->is_ValueType() && gvn().type(val)->maybe_null()) { 362 assert(val->bottom_type()->remove_speculative() == TypePtr::NULL_PTR, "Anything other than null?"); 363 uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none); 364 return; 365 } 366 dec_sp(2); 367 } 368 369 // Clone the value type node and set the new field value 370 ValueTypeNode* new_vt = holder->clone()->as_ValueType(); 371 new_vt->set_oop(_gvn.zerocon(T_VALUETYPE)); 372 gvn().set_type(new_vt, new_vt->bottom_type()); 373 new_vt->set_field_value_by_offset(field->offset(), val); 374 375 if (holder_klass->is_scalarizable()) { 376 push(_gvn.transform(new_vt)); 377 } else { 378 push(new_vt->allocate(this)->get_oop()); 379 } 380 } 381 382 #ifndef PRODUCT 383 //------------------------------dump_map_adr_mem------------------------------- 384 // Debug dump of the mapping from address types to MergeMemNode indices. 385 void Parse::dump_map_adr_mem() const { 386 tty->print_cr("--- Mapping from address types to memory Nodes ---"); 387 MergeMemNode *mem = map() == NULL ? NULL : (map()->memory()->is_MergeMem() ? 388 map()->memory()->as_MergeMem() : NULL); 389 for (uint i = 0; i < (uint)C->num_alias_types(); i++) { 390 C->alias_type(i)->print_on(tty); 391 tty->print("\t"); 392 // Node mapping, if any 393 if (mem && i < mem->req() && mem->in(i) && mem->in(i) != mem->empty_memory()) { 394 mem->in(i)->dump(); 395 } else { 396 tty->cr(); 397 } 398 } 399 } |