comparison src/share/vm/opto/macro.cpp @ 12158:766fac3395d6

8012972: Incremental Inlining should support scalar replaced object in debug info Summary: store in _first_index not absolute index but an index relative to the last (youngest) jvms->_scloff value Reviewed-by: roland, twisti
author kvn
date Fri, 23 Aug 2013 11:41:37 -0700
parents 70120f47d403
children 7944aba7ba41
comparison
equal deleted inserted replaced
12094:73921c720b94 12158:766fac3395d6
70 uint old_dbg_start = oldcall->tf()->domain()->cnt(); 70 uint old_dbg_start = oldcall->tf()->domain()->cnt();
71 uint new_dbg_start = newcall->tf()->domain()->cnt(); 71 uint new_dbg_start = newcall->tf()->domain()->cnt();
72 int jvms_adj = new_dbg_start - old_dbg_start; 72 int jvms_adj = new_dbg_start - old_dbg_start;
73 assert (new_dbg_start == newcall->req(), "argument count mismatch"); 73 assert (new_dbg_start == newcall->req(), "argument count mismatch");
74 74
75 // SafePointScalarObject node could be referenced several times in debug info.
76 // Use Dict to record cloned nodes.
75 Dict* sosn_map = new Dict(cmpkey,hashkey); 77 Dict* sosn_map = new Dict(cmpkey,hashkey);
76 for (uint i = old_dbg_start; i < oldcall->req(); i++) { 78 for (uint i = old_dbg_start; i < oldcall->req(); i++) {
77 Node* old_in = oldcall->in(i); 79 Node* old_in = oldcall->in(i);
78 // Clone old SafePointScalarObjectNodes, adjusting their field contents. 80 // Clone old SafePointScalarObjectNodes, adjusting their field contents.
79 if (old_in != NULL && old_in->is_SafePointScalarObject()) { 81 if (old_in != NULL && old_in->is_SafePointScalarObject()) {
80 SafePointScalarObjectNode* old_sosn = old_in->as_SafePointScalarObject(); 82 SafePointScalarObjectNode* old_sosn = old_in->as_SafePointScalarObject();
81 uint old_unique = C->unique(); 83 uint old_unique = C->unique();
82 Node* new_in = old_sosn->clone(jvms_adj, sosn_map); 84 Node* new_in = old_sosn->clone(sosn_map);
83 if (old_unique != C->unique()) { 85 if (old_unique != C->unique()) { // New node?
84 new_in->set_req(0, C->root()); // reset control edge 86 new_in->set_req(0, C->root()); // reset control edge
85 new_in = transform_later(new_in); // Register new node. 87 new_in = transform_later(new_in); // Register new node.
86 } 88 }
87 old_in = new_in; 89 old_in = new_in;
88 } 90 }
723 // Process the safepoint uses 725 // Process the safepoint uses
724 // 726 //
725 while (safepoints.length() > 0) { 727 while (safepoints.length() > 0) {
726 SafePointNode* sfpt = safepoints.pop(); 728 SafePointNode* sfpt = safepoints.pop();
727 Node* mem = sfpt->memory(); 729 Node* mem = sfpt->memory();
728 uint first_ind = sfpt->req(); 730 assert(sfpt->jvms() != NULL, "missed JVMS");
731 // Fields of scalar objs are referenced only at the end
732 // of regular debuginfo at the last (youngest) JVMS.
733 // Record relative start index.
734 uint first_ind = (sfpt->req() - sfpt->jvms()->scloff());
729 SafePointScalarObjectNode* sobj = new (C) SafePointScalarObjectNode(res_type, 735 SafePointScalarObjectNode* sobj = new (C) SafePointScalarObjectNode(res_type,
730 #ifdef ASSERT 736 #ifdef ASSERT
731 alloc, 737 alloc,
732 #endif 738 #endif
733 first_ind, nfields); 739 first_ind, nfields);
797 int start = jvms->debug_start(); 803 int start = jvms->debug_start();
798 int end = jvms->debug_end(); 804 int end = jvms->debug_end();
799 for (int i = start; i < end; i++) { 805 for (int i = start; i < end; i++) {
800 if (sfpt_done->in(i)->is_SafePointScalarObject()) { 806 if (sfpt_done->in(i)->is_SafePointScalarObject()) {
801 SafePointScalarObjectNode* scobj = sfpt_done->in(i)->as_SafePointScalarObject(); 807 SafePointScalarObjectNode* scobj = sfpt_done->in(i)->as_SafePointScalarObject();
802 if (scobj->first_index() == sfpt_done->req() && 808 if (scobj->first_index(jvms) == sfpt_done->req() &&
803 scobj->n_fields() == (uint)nfields) { 809 scobj->n_fields() == (uint)nfields) {
804 assert(scobj->alloc() == alloc, "sanity"); 810 assert(scobj->alloc() == alloc, "sanity");
805 sfpt_done->set_req(i, res); 811 sfpt_done->set_req(i, res);
806 } 812 }
807 } 813 }