622 if (local == top()) {
623 return;
624 }
625 array->pop();
626 }
627 const Type *t = local->bottom_type();
628
629 // Is it a safepoint scalar object node?
630 if (local->is_SafePointScalarObject()) {
631 SafePointScalarObjectNode* spobj = local->as_SafePointScalarObject();
632
633 ObjectValue* sv = Compile::sv_for_node_id(objs, spobj->_idx);
634 if (sv == NULL) {
635 ciKlass* cik = t->is_oopptr()->klass();
636 assert(cik->is_instance_klass() ||
637 cik->is_array_klass(), "Not supported allocation.");
638 sv = new ObjectValue(spobj->_idx,
639 new ConstantOopWriteValue(cik->java_mirror()->constant_encoding()));
640 Compile::set_sv_for_object_node(objs, sv);
641
642 uint first_ind = spobj->first_index();
643 for (uint i = 0; i < spobj->n_fields(); i++) {
644 Node* fld_node = sfpt->in(first_ind+i);
645 (void)FillLocArray(sv->field_values()->length(), sfpt, fld_node, sv->field_values(), objs);
646 }
647 }
648 array->append(sv);
649 return;
650 }
651
652 // Grab the register number for the local
653 OptoReg::Name regnum = _regalloc->get_reg_first(local);
654 if( OptoReg::is_valid(regnum) ) {// Got a register/stack?
655 // Record the double as two float registers.
656 // The register mask for such a value always specifies two adjacent
657 // float registers, with the lower register number even.
658 // Normally, the allocation of high and low words to these registers
659 // is irrelevant, because nearly all operations on register pairs
660 // (e.g., StoreD) treat them as a single unit.
661 // Here, we assume in addition that the words in these two registers
662 // stored "naturally" (by operations like StoreD and double stores
877 }
878
879 // Insert expression stack entries into the exparray
880 GrowableArray<ScopeValue*> *exparray = new GrowableArray<ScopeValue*>(num_exps);
881 for( idx = 0; idx < num_exps; idx++ ) {
882 FillLocArray( idx, sfn, sfn->stack(jvms, idx), exparray, objs );
883 }
884
885 // Add in mappings of the monitors
886 assert( !method ||
887 !method->is_synchronized() ||
888 method->is_native() ||
889 num_mon > 0 ||
890 !GenerateSynchronizationCode,
891 "monitors must always exist for synchronized methods");
892
893 // Build the growable array of ScopeValues for exp stack
894 GrowableArray<MonitorValue*> *monarray = new GrowableArray<MonitorValue*>(num_mon);
895
896 // Loop over monitors and insert into array
897 for(idx = 0; idx < num_mon; idx++) {
898 // Grab the node that defines this monitor
899 Node* box_node = sfn->monitor_box(jvms, idx);
900 Node* obj_node = sfn->monitor_obj(jvms, idx);
901
902 // Create ScopeValue for object
903 ScopeValue *scval = NULL;
904
905 if( obj_node->is_SafePointScalarObject() ) {
906 SafePointScalarObjectNode* spobj = obj_node->as_SafePointScalarObject();
907 scval = Compile::sv_for_node_id(objs, spobj->_idx);
908 if (scval == NULL) {
909 const Type *t = obj_node->bottom_type();
910 ciKlass* cik = t->is_oopptr()->klass();
911 assert(cik->is_instance_klass() ||
912 cik->is_array_klass(), "Not supported allocation.");
913 ObjectValue* sv = new ObjectValue(spobj->_idx,
914 new ConstantOopWriteValue(cik->java_mirror()->constant_encoding()));
915 Compile::set_sv_for_object_node(objs, sv);
916
917 uint first_ind = spobj->first_index();
918 for (uint i = 0; i < spobj->n_fields(); i++) {
919 Node* fld_node = sfn->in(first_ind+i);
920 (void)FillLocArray(sv->field_values()->length(), sfn, fld_node, sv->field_values(), objs);
921 }
922 scval = sv;
923 }
924 } else if( !obj_node->is_Con() ) {
925 OptoReg::Name obj_reg = _regalloc->get_reg_first(obj_node);
926 if( obj_node->bottom_type()->base() == Type::NarrowOop ) {
927 scval = new_loc_value( _regalloc, obj_reg, Location::narrowoop );
928 } else {
929 scval = new_loc_value( _regalloc, obj_reg, Location::oop );
930 }
931 } else {
932 const TypePtr *tp = obj_node->get_ptr_type();
933 scval = new ConstantOopWriteValue(tp->is_oopptr()->const_oop()->constant_encoding());
934 }
935
936 OptoReg::Name box_reg = BoxLockNode::reg(box_node);
937 Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg));
938 bool eliminated = (box_node->is_BoxLock() && box_node->as_BoxLock()->is_eliminated());
939 monarray->append(new MonitorValue(scval, basic_lock, eliminated));
940 }
941
942 // We dump the object pool first, since deoptimization reads it in first.
943 debug_info()->dump_object_pool(objs);
944
|
622 if (local == top()) {
623 return;
624 }
625 array->pop();
626 }
627 const Type *t = local->bottom_type();
628
629 // Is it a safepoint scalar object node?
630 if (local->is_SafePointScalarObject()) {
631 SafePointScalarObjectNode* spobj = local->as_SafePointScalarObject();
632
633 ObjectValue* sv = Compile::sv_for_node_id(objs, spobj->_idx);
634 if (sv == NULL) {
635 ciKlass* cik = t->is_oopptr()->klass();
636 assert(cik->is_instance_klass() ||
637 cik->is_array_klass(), "Not supported allocation.");
638 sv = new ObjectValue(spobj->_idx,
639 new ConstantOopWriteValue(cik->java_mirror()->constant_encoding()));
640 Compile::set_sv_for_object_node(objs, sv);
641
642 uint first_ind = spobj->first_index(sfpt->jvms());
643 for (uint i = 0; i < spobj->n_fields(); i++) {
644 Node* fld_node = sfpt->in(first_ind+i);
645 (void)FillLocArray(sv->field_values()->length(), sfpt, fld_node, sv->field_values(), objs);
646 }
647 }
648 array->append(sv);
649 return;
650 }
651
652 // Grab the register number for the local
653 OptoReg::Name regnum = _regalloc->get_reg_first(local);
654 if( OptoReg::is_valid(regnum) ) {// Got a register/stack?
655 // Record the double as two float registers.
656 // The register mask for such a value always specifies two adjacent
657 // float registers, with the lower register number even.
658 // Normally, the allocation of high and low words to these registers
659 // is irrelevant, because nearly all operations on register pairs
660 // (e.g., StoreD) treat them as a single unit.
661 // Here, we assume in addition that the words in these two registers
662 // stored "naturally" (by operations like StoreD and double stores
877 }
878
879 // Insert expression stack entries into the exparray
880 GrowableArray<ScopeValue*> *exparray = new GrowableArray<ScopeValue*>(num_exps);
881 for( idx = 0; idx < num_exps; idx++ ) {
882 FillLocArray( idx, sfn, sfn->stack(jvms, idx), exparray, objs );
883 }
884
885 // Add in mappings of the monitors
886 assert( !method ||
887 !method->is_synchronized() ||
888 method->is_native() ||
889 num_mon > 0 ||
890 !GenerateSynchronizationCode,
891 "monitors must always exist for synchronized methods");
892
893 // Build the growable array of ScopeValues for exp stack
894 GrowableArray<MonitorValue*> *monarray = new GrowableArray<MonitorValue*>(num_mon);
895
896 // Loop over monitors and insert into array
897 for (idx = 0; idx < num_mon; idx++) {
898 // Grab the node that defines this monitor
899 Node* box_node = sfn->monitor_box(jvms, idx);
900 Node* obj_node = sfn->monitor_obj(jvms, idx);
901
902 // Create ScopeValue for object
903 ScopeValue *scval = NULL;
904
905 if (obj_node->is_SafePointScalarObject()) {
906 SafePointScalarObjectNode* spobj = obj_node->as_SafePointScalarObject();
907 scval = Compile::sv_for_node_id(objs, spobj->_idx);
908 if (scval == NULL) {
909 const Type *t = spobj->bottom_type();
910 ciKlass* cik = t->is_oopptr()->klass();
911 assert(cik->is_instance_klass() ||
912 cik->is_array_klass(), "Not supported allocation.");
913 ObjectValue* sv = new ObjectValue(spobj->_idx,
914 new ConstantOopWriteValue(cik->java_mirror()->constant_encoding()));
915 Compile::set_sv_for_object_node(objs, sv);
916
917 uint first_ind = spobj->first_index(youngest_jvms);
918 for (uint i = 0; i < spobj->n_fields(); i++) {
919 Node* fld_node = sfn->in(first_ind+i);
920 (void)FillLocArray(sv->field_values()->length(), sfn, fld_node, sv->field_values(), objs);
921 }
922 scval = sv;
923 }
924 } else if (!obj_node->is_Con()) {
925 OptoReg::Name obj_reg = _regalloc->get_reg_first(obj_node);
926 if( obj_node->bottom_type()->base() == Type::NarrowOop ) {
927 scval = new_loc_value( _regalloc, obj_reg, Location::narrowoop );
928 } else {
929 scval = new_loc_value( _regalloc, obj_reg, Location::oop );
930 }
931 } else {
932 const TypePtr *tp = obj_node->get_ptr_type();
933 scval = new ConstantOopWriteValue(tp->is_oopptr()->const_oop()->constant_encoding());
934 }
935
936 OptoReg::Name box_reg = BoxLockNode::reg(box_node);
937 Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg));
938 bool eliminated = (box_node->is_BoxLock() && box_node->as_BoxLock()->is_eliminated());
939 monarray->append(new MonitorValue(scval, basic_lock, eliminated));
940 }
941
942 // We dump the object pool first, since deoptimization reads it in first.
943 debug_info()->dump_object_pool(objs);
944
|