441 cik->as_array_klass()->base_element_type()->print_name_on(st);
442 st->print("[%d]", spobj->n_fields());
443 } else if (cik->is_obj_array_klass()) {
444 ciKlass* cie = cik->as_obj_array_klass()->base_element_klass();
445 if (cie->is_instance_klass()) {
446 cie->print_name_on(st);
447 } else if (cie->is_type_array_klass()) {
448 cie->as_array_klass()->base_element_type()->print_name_on(st);
449 } else {
450 ShouldNotReachHere();
451 }
452 st->print("[%d]", spobj->n_fields());
453 int ndim = cik->as_array_klass()->dimension() - 1;
454 while (ndim-- > 0) {
455 st->print("[]");
456 }
457 }
458 st->print("={");
459 uint nf = spobj->n_fields();
460 if (nf > 0) {
461 uint first_ind = spobj->first_index();
462 Node* fld_node = mcall->in(first_ind);
463 ciField* cifield;
464 if (iklass != NULL) {
465 st->print(" [");
466 cifield = iklass->nonstatic_field_at(0);
467 cifield->print_name_on(st);
468 format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
469 } else {
470 format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
471 }
472 for (uint j = 1; j < nf; j++) {
473 fld_node = mcall->in(first_ind+j);
474 if (iklass != NULL) {
475 st->print(", [");
476 cifield = iklass->nonstatic_field_at(j);
477 cifield->print_name_on(st);
478 format_helper(regalloc, st, fld_node, ":", j, &scobjs);
479 } else {
480 format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
481 }
1046 st->print(" SafePoint ");
1047 }
1048 #endif
1049
1050 const RegMask &SafePointNode::in_RegMask(uint idx) const {
1051 if( idx < TypeFunc::Parms ) return RegMask::Empty;
1052 // Values outside the domain represent debug info
1053 return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
1054 }
1055 const RegMask &SafePointNode::out_RegMask() const {
1056 return RegMask::Empty;
1057 }
1058
1059
1060 void SafePointNode::grow_stack(JVMState* jvms, uint grow_by) {
1061 assert((int)grow_by > 0, "sanity");
1062 int monoff = jvms->monoff();
1063 int scloff = jvms->scloff();
1064 int endoff = jvms->endoff();
1065 assert(endoff == (int)req(), "no other states or debug info after me");
1066 assert(jvms->scl_size() == 0, "parsed code should not have scalar objects");
1067 Node* top = Compile::current()->top();
1068 for (uint i = 0; i < grow_by; i++) {
1069 ins_req(monoff, top);
1070 }
1071 jvms->set_monoff(monoff + grow_by);
1072 jvms->set_scloff(scloff + grow_by);
1073 jvms->set_endoff(endoff + grow_by);
1074 }
1075
1076 void SafePointNode::push_monitor(const FastLockNode *lock) {
1077 // Add a LockNode, which points to both the original BoxLockNode (the
1078 // stack space for the monitor) and the Object being locked.
1079 const int MonitorEdges = 2;
1080 assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
1081 assert(req() == jvms()->endoff(), "correct sizing");
1082 assert((jvms()->scl_size() == 0), "parsed code should not have scalar objects");
1083 int nextmon = jvms()->scloff();
1084 if (GenerateSynchronizationCode) {
1085 add_req(lock->box_node());
1086 add_req(lock->obj_node());
1087 } else {
1088 Node* top = Compile::current()->top();
1089 add_req(top);
1090 add_req(top);
1091 }
1092 jvms()->set_scloff(nextmon+MonitorEdges);
1093 jvms()->set_endoff(req());
1094 }
1095
1096 void SafePointNode::pop_monitor() {
1097 // Delete last monitor from debug info
1098 assert((jvms()->scl_size() == 0), "parsed code should not have scalar objects");
1099 debug_only(int num_before_pop = jvms()->nof_monitors());
1100 const int MonitorEdges = (1<<JVMState::logMonitorEdges);
1101 int scloff = jvms()->scloff();
1102 int endoff = jvms()->endoff();
1103 int new_scloff = scloff - MonitorEdges;
1104 int new_endoff = endoff - MonitorEdges;
1105 jvms()->set_scloff(new_scloff);
1106 jvms()->set_endoff(new_endoff);
1107 while (scloff > new_scloff) del_req(--scloff);
1108 assert(jvms()->nof_monitors() == num_before_pop-1, "");
1109 }
1110
1111 Node *SafePointNode::peek_monitor_box() const {
1112 int mon = jvms()->nof_monitors() - 1;
1113 assert(mon >= 0, "most have a monitor");
1114 return monitor_box(jvms(), mon);
1115 }
1116
1117 Node *SafePointNode::peek_monitor_obj() const {
1118 int mon = jvms()->nof_monitors() - 1;
1119 assert(mon >= 0, "most have a monitor");
1120 return monitor_obj(jvms(), mon);
1121 }
1122
1123 // Do we Match on this edge index or not? Match no edges
1124 uint SafePointNode::match_edge(uint idx) const {
1125 if( !needs_polling_address_input() )
1126 return 0;
1127
1152 return (&n == this); // Always fail except on self
1153 }
1154
1155 uint SafePointScalarObjectNode::ideal_reg() const {
1156 return 0; // No matching to machine instruction
1157 }
1158
1159 const RegMask &SafePointScalarObjectNode::in_RegMask(uint idx) const {
1160 return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
1161 }
1162
1163 const RegMask &SafePointScalarObjectNode::out_RegMask() const {
1164 return RegMask::Empty;
1165 }
1166
1167 uint SafePointScalarObjectNode::match_edge(uint idx) const {
1168 return 0;
1169 }
1170
1171 SafePointScalarObjectNode*
1172 SafePointScalarObjectNode::clone(int jvms_adj, Dict* sosn_map) const {
1173 void* cached = (*sosn_map)[(void*)this];
1174 if (cached != NULL) {
1175 return (SafePointScalarObjectNode*)cached;
1176 }
1177 SafePointScalarObjectNode* res = (SafePointScalarObjectNode*)Node::clone();
1178 res->_first_index += jvms_adj;
1179 sosn_map->Insert((void*)this, (void*)res);
1180 return res;
1181 }
1182
1183
1184 #ifndef PRODUCT
1185 void SafePointScalarObjectNode::dump_spec(outputStream *st) const {
1186 st->print(" # fields@[%d..%d]", first_index(),
1187 first_index() + n_fields() - 1);
1188 }
1189
1190 #endif
1191
1192 //=============================================================================
1193 uint AllocateNode::size_of() const { return sizeof(*this); }
1194
1195 AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
1196 Node *ctrl, Node *mem, Node *abio,
1197 Node *size, Node *klass_node, Node *initial_test)
1198 : CallNode(atype, NULL, TypeRawPtr::BOTTOM)
|
441 cik->as_array_klass()->base_element_type()->print_name_on(st);
442 st->print("[%d]", spobj->n_fields());
443 } else if (cik->is_obj_array_klass()) {
444 ciKlass* cie = cik->as_obj_array_klass()->base_element_klass();
445 if (cie->is_instance_klass()) {
446 cie->print_name_on(st);
447 } else if (cie->is_type_array_klass()) {
448 cie->as_array_klass()->base_element_type()->print_name_on(st);
449 } else {
450 ShouldNotReachHere();
451 }
452 st->print("[%d]", spobj->n_fields());
453 int ndim = cik->as_array_klass()->dimension() - 1;
454 while (ndim-- > 0) {
455 st->print("[]");
456 }
457 }
458 st->print("={");
459 uint nf = spobj->n_fields();
460 if (nf > 0) {
461 uint first_ind = spobj->first_index(mcall->jvms());
462 Node* fld_node = mcall->in(first_ind);
463 ciField* cifield;
464 if (iklass != NULL) {
465 st->print(" [");
466 cifield = iklass->nonstatic_field_at(0);
467 cifield->print_name_on(st);
468 format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
469 } else {
470 format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
471 }
472 for (uint j = 1; j < nf; j++) {
473 fld_node = mcall->in(first_ind+j);
474 if (iklass != NULL) {
475 st->print(", [");
476 cifield = iklass->nonstatic_field_at(j);
477 cifield->print_name_on(st);
478 format_helper(regalloc, st, fld_node, ":", j, &scobjs);
479 } else {
480 format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
481 }
1046 st->print(" SafePoint ");
1047 }
1048 #endif
1049
1050 const RegMask &SafePointNode::in_RegMask(uint idx) const {
1051 if( idx < TypeFunc::Parms ) return RegMask::Empty;
1052 // Values outside the domain represent debug info
1053 return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
1054 }
1055 const RegMask &SafePointNode::out_RegMask() const {
1056 return RegMask::Empty;
1057 }
1058
1059
1060 void SafePointNode::grow_stack(JVMState* jvms, uint grow_by) {
1061 assert((int)grow_by > 0, "sanity");
1062 int monoff = jvms->monoff();
1063 int scloff = jvms->scloff();
1064 int endoff = jvms->endoff();
1065 assert(endoff == (int)req(), "no other states or debug info after me");
1066 Node* top = Compile::current()->top();
1067 for (uint i = 0; i < grow_by; i++) {
1068 ins_req(monoff, top);
1069 }
1070 jvms->set_monoff(monoff + grow_by);
1071 jvms->set_scloff(scloff + grow_by);
1072 jvms->set_endoff(endoff + grow_by);
1073 }
1074
1075 void SafePointNode::push_monitor(const FastLockNode *lock) {
1076 // Add a LockNode, which points to both the original BoxLockNode (the
1077 // stack space for the monitor) and the Object being locked.
1078 const int MonitorEdges = 2;
1079 assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
1080 assert(req() == jvms()->endoff(), "correct sizing");
1081 int nextmon = jvms()->scloff();
1082 if (GenerateSynchronizationCode) {
1083 ins_req(nextmon, lock->box_node());
1084 ins_req(nextmon+1, lock->obj_node());
1085 } else {
1086 Node* top = Compile::current()->top();
1087 ins_req(nextmon, top);
1088 ins_req(nextmon, top);
1089 }
1090 jvms()->set_scloff(nextmon + MonitorEdges);
1091 jvms()->set_endoff(req());
1092 }
1093
1094 void SafePointNode::pop_monitor() {
1095 // Delete last monitor from debug info
1096 debug_only(int num_before_pop = jvms()->nof_monitors());
1097 const int MonitorEdges = 2;
1098 assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
1099 int scloff = jvms()->scloff();
1100 int endoff = jvms()->endoff();
1101 int new_scloff = scloff - MonitorEdges;
1102 int new_endoff = endoff - MonitorEdges;
1103 jvms()->set_scloff(new_scloff);
1104 jvms()->set_endoff(new_endoff);
1105 while (scloff > new_scloff) del_req_ordered(--scloff);
1106 assert(jvms()->nof_monitors() == num_before_pop-1, "");
1107 }
1108
1109 Node *SafePointNode::peek_monitor_box() const {
1110 int mon = jvms()->nof_monitors() - 1;
1111 assert(mon >= 0, "most have a monitor");
1112 return monitor_box(jvms(), mon);
1113 }
1114
1115 Node *SafePointNode::peek_monitor_obj() const {
1116 int mon = jvms()->nof_monitors() - 1;
1117 assert(mon >= 0, "most have a monitor");
1118 return monitor_obj(jvms(), mon);
1119 }
1120
1121 // Do we Match on this edge index or not? Match no edges
1122 uint SafePointNode::match_edge(uint idx) const {
1123 if( !needs_polling_address_input() )
1124 return 0;
1125
1150 return (&n == this); // Always fail except on self
1151 }
1152
1153 uint SafePointScalarObjectNode::ideal_reg() const {
1154 return 0; // No matching to machine instruction
1155 }
1156
1157 const RegMask &SafePointScalarObjectNode::in_RegMask(uint idx) const {
1158 return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
1159 }
1160
1161 const RegMask &SafePointScalarObjectNode::out_RegMask() const {
1162 return RegMask::Empty;
1163 }
1164
1165 uint SafePointScalarObjectNode::match_edge(uint idx) const {
1166 return 0;
1167 }
1168
1169 SafePointScalarObjectNode*
1170 SafePointScalarObjectNode::clone(Dict* sosn_map) const {
1171 void* cached = (*sosn_map)[(void*)this];
1172 if (cached != NULL) {
1173 return (SafePointScalarObjectNode*)cached;
1174 }
1175 SafePointScalarObjectNode* res = (SafePointScalarObjectNode*)Node::clone();
1176 sosn_map->Insert((void*)this, (void*)res);
1177 return res;
1178 }
1179
1180
1181 #ifndef PRODUCT
1182 void SafePointScalarObjectNode::dump_spec(outputStream *st) const {
1183 st->print(" # fields@[%d..%d]", first_index(),
1184 first_index() + n_fields() - 1);
1185 }
1186
1187 #endif
1188
1189 //=============================================================================
1190 uint AllocateNode::size_of() const { return sizeof(*this); }
1191
1192 AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
1193 Node *ctrl, Node *mem, Node *abio,
1194 Node *size, Node *klass_node, Node *initial_test)
1195 : CallNode(atype, NULL, TypeRawPtr::BOTTOM)
|