src/share/vm/opto/parse3.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File valhalla-experimental Cdiff src/share/vm/opto/parse3.cpp

src/share/vm/opto/parse3.cpp

Print this page

        

*** 149,159 **** // fixme null/top check? bool will_link; ciField* field = iter().get_field(will_link); BasicType bt = field->layout_type(); ValueTypeNode* vt = pop()->as_ValueType(); ! Node* value = vt->get_field_value_by_offset(field->offset()); push_node(bt, value); } void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { BasicType bt = field->layout_type(); --- 149,159 ---- // fixme null/top check? bool will_link; ciField* field = iter().get_field(will_link); BasicType bt = field->layout_type(); ValueTypeNode* vt = pop()->as_ValueType(); ! Node* value = vt->field_value_by_offset(field->offset()); push_node(bt, value); } void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { BasicType bt = field->layout_type();
*** 520,524 **** --- 520,574 ---- // 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 a value type from the top of the stack + ValueTypeNode* vt = pop()->as_ValueType(); + + // Obtain types + bool will_link; + ciValueKlass* dvt_klass = gvn().type(vt)->is_valuetype()->value_klass(); + ciInstanceKlass* vcc_klass = iter().get_klass(will_link)->as_instance_klass(); + guarantee(will_link, "value-capable class must be loaded"); + + kill_dead_locals(); + + // TODO: Generate all (or some) of the following checks + // (1) if target is not an value-capable instance, throw ClassCastException + // (2) if source is not a value type instance, throw ClassCastException + // (3) if target type is not a value type derived from source + + // create new object + Node* kls = makecon(TypeKlassPtr::make(vcc_klass)); + 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. + // TODO: Once the layout of the two is not the same, update code below. + vt->store_values(this, vcc_klass, obj); + + // Push the new object onto the stack + push(obj); + } + + void Parse::do_vunbox() { + // Obtain object from the top of the stack + Node* obj = pop(); + + // Obtain types + bool will_link; + ciInstanceKlass* vcc_klass = gvn().type(obj)->is_oopptr()->klass()->as_instance_klass(); + ciValueKlass* dvt_klass = iter().get_klass(will_link)->as_value_klass(); + guarantee(will_link, "derived value type must be loaded"); + + // TOOD: Generate all the checks. Similar to vbox + + // Create a value type node with the corresponding type + Node* vt = ValueTypeNode::make(gvn(), dvt_klass, map()->memory(), vcc_klass, obj, dvt_klass->first_field_offset()); + + // Push the value type onto the stack + push(vt); + }
src/share/vm/opto/parse3.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File