< prev index next >

src/hotspot/share/opto/parse3.cpp

Print this page

        

*** 545,630 **** // Possible improvements: // - Make a fast path for small multi-arrays. (W/ implicit init. loops.) // - Issue CastII against length[*] values, to TypeInt::POS. } - - void Parse::do_vbox() { - // Obtain target value-capable class - bool will_link; - ciInstanceKlass* dst_vcc = iter().get_klass(will_link)->as_instance_klass(); - assert(will_link, "vbox: Target value-capable class must be loaded"); - - // Obtain source value type instance and type - const ValueTypeNode* vt = peek()->as_ValueType(); - ciValueKlass* src_vk = vt->type()->is_valuetype()->value_klass(); - assert(src_vk != NULL && src_vk->is_loaded() && src_vk->exact_klass(), - "vbox: Source class must be a value type and must be loaded and exact"); - - // Verify that the vcc derived from the source value klass is equal to the target vcc - const ciInstanceKlass* src_vcc = src_vk->vcc_klass(); - assert(src_vcc, "vbox: Source value-capable class must not be null"); - if (!src_vcc->equals(dst_vcc)) { - builtin_throw(Deoptimization::Reason_class_check); - assert(stopped(), "A ClassCastException must be always thrown on this path"); - return; - } - - // Create new object - pop(); - kill_dead_locals(); - Node* kls = makecon(TypeKlassPtr::make(dst_vcc)); - Node* obj = new_instance(kls); - - // Store all field values to the newly created object. - // The code below relies on the assumption that the VCC has the - // same memory layout as the derived value type. - vt->store(this, obj, obj, dst_vcc); - - // Push the new object onto the stack - push(obj); - } - - void Parse::do_vunbox() { - // Obtain target value klass - bool will_link; - ciValueKlass* dst_vk = iter().get_klass(will_link)->as_value_klass(); - assert(will_link, "vunbox: Derived value type must be loaded"); - - // Obtain source value-capable class instance and type - Node* vcc = null_check(peek()); - if (stopped()) { - return; // Always null - } - ciKlass* src_vcc = gvn().type(vcc)->isa_oopptr()->klass(); - assert(src_vcc != NULL && src_vcc->is_instance_klass() && src_vcc->is_loaded(), - "vunbox: Source class must be an instance type and must be loaded"); - - // Verify that the source vcc is equal to the vcc derived from the target value klass - ciInstanceKlass* dst_vcc = dst_vk->vcc_klass(); - assert(dst_vcc != NULL && dst_vcc->exact_klass(), "vunbox: Target value-capable class must not be null and exact"); - if (!src_vcc->equals(dst_vcc)) { - if (src_vcc->exact_klass()) { - // Source vcc is exact and therefore always incompatible with dst_vcc - builtin_throw(Deoptimization::Reason_class_check); - assert(stopped(), "A ClassCastException must be always thrown on this path"); - return; - } else { - // Emit a runtime check to verify that the dynamic type of vcc is equal to dst_vcc - Node* exact_vcc = vcc; - Node* slow_ctl = type_check_receiver(vcc, dst_vcc, 1.0, &exact_vcc); - { - PreserveJVMState pjvms(this); - set_control(slow_ctl); - builtin_throw(Deoptimization::Reason_class_check); - } - replace_in_map(vcc, exact_vcc); - vcc = exact_vcc; - } - } - - // Create a value type node with the corresponding type and push it onto the stack - pop(); - kill_dead_locals(); - ValueTypeNode* vt = ValueTypeNode::make_from_flattened(this, dst_vk, vcc, vcc, dst_vcc, dst_vk->first_field_offset()); - push(vt); - } --- 545,549 ----
< prev index next >