< prev index next >

src/share/vm/opto/parse3.cpp

Print this page




 300   // Conservatively release stores of object references.
 301   const MemNode::MemOrd mo =
 302     is_vol ?
 303     // Volatile fields need releasing stores.
 304     MemNode::release :
 305     // Non-volatile fields also need releasing stores if they hold an
 306     // object reference, because the object reference might point to
 307     // a freshly created object.
 308     StoreNode::release_if_reference(bt);
 309 
 310   // Store the value.
 311   if (bt == T_OBJECT || bt == T_VALUETYPE) {
 312     const TypeOopPtr* field_type;
 313     if (!field->type()->is_loaded()) {
 314       field_type = TypeInstPtr::BOTTOM;
 315     } else {
 316       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
 317     }
 318     if (bt == T_VALUETYPE && !field->is_static()) {
 319       // Store flattened value type to non-static field
 320       val->as_ValueType()->store(this, obj, obj, field->holder(), offset);
 321     } else {
 322       store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo);
 323     }
 324   } else {
 325     bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
 326     store_to_memory(control(), adr, val, bt, adr_type, mo, needs_atomic_access);
 327   }
 328 
 329   // If reference is volatile, prevent following volatiles ops from
 330   // floating up before the volatile write.
 331   if (is_vol) {
 332     // If not multiple copy atomic, we do the MemBarVolatile before the load.
 333     if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
 334       insert_mem_bar(Op_MemBarVolatile); // Use fat membar
 335     }
 336     // Remember we wrote a volatile field.
 337     // For not multiple copy atomic cpu (ppc64) a barrier should be issued
 338     // in constructors which have such stores. See do_exits() in parse1.cpp.
 339     if (is_field) {
 340       set_wrote_volatile(true);


 555 }
 556 
 557 void Parse::do_vbox() {
 558   // Obtain target type (from bytecodes)
 559   bool will_link;
 560   ciKlass* target_klass = iter().get_klass(will_link);
 561   guarantee(will_link, "vbox: Value-capable class must be loaded");
 562   guarantee(target_klass->is_instance_klass(), "vbox: Target class must be an instance type");
 563 
 564   // Obtain source type
 565   ValueTypeNode* vt = peek()->as_ValueType();
 566   const TypeValueType* src_type = gvn().type(vt)->isa_valuetype();
 567   guarantee(src_type != NULL, "vbox: Source type must not be null");
 568   ciValueKlass* src_vk = src_type->value_klass();
 569   guarantee(src_vk != NULL && src_vk->is_loaded() && src_vk->exact_klass(),
 570             "vbox: Source class must be a value type and must be loaded and exact");
 571 
 572   kill_dead_locals();
 573 
 574   ciInstanceKlass* target_vcc_klass = target_klass->as_instance_klass();
 575   ciInstanceKlass* src_vcc_klass = src_vk->vcc_klass();;
 576 
 577   // TODO: Extend type check below if (and once) value type class hierarchies become available.
 578   // (incl. extension to support dynamic type checks).
 579   if (!src_vcc_klass->equals(target_vcc_klass)) {
 580     builtin_throw(Deoptimization::Reason_class_check);
 581     guarantee(stopped(), "A ClassCastException must be always thrown on this path");
 582     return;
 583   }
 584   guarantee(src_vk->is_valuetype(), "vbox: Target DVT must be a value type");
 585   pop();
 586 
 587   // Create new object
 588   Node* kls = makecon(TypeKlassPtr::make(target_vcc_klass));
 589   Node* obj = new_instance(kls);
 590 
 591   // Store all field values to the newly created object.
 592   // The code below relies on the assumption that the VCC has the
 593   // same memory layout as the derived value type.
 594   // TODO: Once the layout of the two is not the same, update code below.
 595   vt->as_ValueType()->store_values(this, obj, obj, target_vcc_klass);
 596 
 597   // Push the new object onto the stack
 598   push(obj);
 599 }
 600 
 601 void Parse::do_vunbox() {
 602   kill_dead_locals();
 603 
 604   // Check if the VCC instance is null.
 605   Node* not_null_obj = null_check(peek());
 606 
 607   // Value determined to be null at compile time
 608   if (stopped()) {
 609     return;
 610   }
 611 
 612   // Obtain target type (from bytecodes)
 613   bool will_link;
 614   ciKlass* target_klass = iter().get_klass(will_link);
 615   guarantee(will_link, "vunbox: Derived value type must be loaded");




 300   // Conservatively release stores of object references.
 301   const MemNode::MemOrd mo =
 302     is_vol ?
 303     // Volatile fields need releasing stores.
 304     MemNode::release :
 305     // Non-volatile fields also need releasing stores if they hold an
 306     // object reference, because the object reference might point to
 307     // a freshly created object.
 308     StoreNode::release_if_reference(bt);
 309 
 310   // Store the value.
 311   if (bt == T_OBJECT || bt == T_VALUETYPE) {
 312     const TypeOopPtr* field_type;
 313     if (!field->type()->is_loaded()) {
 314       field_type = TypeInstPtr::BOTTOM;
 315     } else {
 316       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
 317     }
 318     if (bt == T_VALUETYPE && !field->is_static()) {
 319       // Store flattened value type to non-static field
 320       val->as_ValueType()->store_flattened(this, obj, obj, field->holder(), offset);
 321     } else {
 322       store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo);
 323     }
 324   } else {
 325     bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
 326     store_to_memory(control(), adr, val, bt, adr_type, mo, needs_atomic_access);
 327   }
 328 
 329   // If reference is volatile, prevent following volatiles ops from
 330   // floating up before the volatile write.
 331   if (is_vol) {
 332     // If not multiple copy atomic, we do the MemBarVolatile before the load.
 333     if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
 334       insert_mem_bar(Op_MemBarVolatile); // Use fat membar
 335     }
 336     // Remember we wrote a volatile field.
 337     // For not multiple copy atomic cpu (ppc64) a barrier should be issued
 338     // in constructors which have such stores. See do_exits() in parse1.cpp.
 339     if (is_field) {
 340       set_wrote_volatile(true);


 555 }
 556 
 557 void Parse::do_vbox() {
 558   // Obtain target type (from bytecodes)
 559   bool will_link;
 560   ciKlass* target_klass = iter().get_klass(will_link);
 561   guarantee(will_link, "vbox: Value-capable class must be loaded");
 562   guarantee(target_klass->is_instance_klass(), "vbox: Target class must be an instance type");
 563 
 564   // Obtain source type
 565   ValueTypeNode* vt = peek()->as_ValueType();
 566   const TypeValueType* src_type = gvn().type(vt)->isa_valuetype();
 567   guarantee(src_type != NULL, "vbox: Source type must not be null");
 568   ciValueKlass* src_vk = src_type->value_klass();
 569   guarantee(src_vk != NULL && src_vk->is_loaded() && src_vk->exact_klass(),
 570             "vbox: Source class must be a value type and must be loaded and exact");
 571 
 572   kill_dead_locals();
 573 
 574   ciInstanceKlass* target_vcc_klass = target_klass->as_instance_klass();
 575   ciInstanceKlass* src_vcc_klass = src_vk->vcc_klass();
 576 
 577   // TODO: Extend type check below if (and once) value type class hierarchies become available.
 578   // (incl. extension to support dynamic type checks).
 579   if (!src_vcc_klass->equals(target_vcc_klass)) {
 580     builtin_throw(Deoptimization::Reason_class_check);
 581     guarantee(stopped(), "A ClassCastException must be always thrown on this path");
 582     return;
 583   }
 584   guarantee(src_vk->is_valuetype(), "vbox: Target DVT must be a value type");
 585   pop();
 586 
 587   // Create new object
 588   Node* kls = makecon(TypeKlassPtr::make(target_vcc_klass));
 589   Node* obj = new_instance(kls);
 590 
 591   // Store all field values to the newly created object.
 592   // The code below relies on the assumption that the VCC has the
 593   // same memory layout as the derived value type.
 594   // TODO: Once the layout of the two is not the same, update code below.
 595   vt->as_ValueType()->store(this, obj, obj, target_vcc_klass);
 596 
 597   // Push the new object onto the stack
 598   push(obj);
 599 }
 600 
 601 void Parse::do_vunbox() {
 602   kill_dead_locals();
 603 
 604   // Check if the VCC instance is null.
 605   Node* not_null_obj = null_check(peek());
 606 
 607   // Value determined to be null at compile time
 608   if (stopped()) {
 609     return;
 610   }
 611 
 612   // Obtain target type (from bytecodes)
 613   bool will_link;
 614   ciKlass* target_klass = iter().get_klass(will_link);
 615   guarantee(will_link, "vunbox: Derived value type must be loaded");


< prev index next >