762 res->dump();
763 #ifdef ASSERT
764 if (disq_node != NULL) {
765 tty->print(" >>>> ");
766 disq_node->dump();
767 }
768 #endif /*ASSERT*/
769 }
770 }
771 #endif
772 return can_eliminate;
773 }
774
775 // Do scalar replacement.
776 bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints) {
777 GrowableArray <SafePointNode *> safepoints_done;
778
779 ciKlass* klass = NULL;
780 ciInstanceKlass* iklass = NULL;
781 int nfields = 0;
782 int array_base;
783 int element_size;
784 BasicType basic_elem_type;
785 ciType* elem_type;
786
787 Node* res = alloc->result_cast();
788 assert(res == NULL || res->is_CheckCastPP(), "unexpected AllocateNode result");
789 const TypeOopPtr* res_type = NULL;
790 if (res != NULL) { // Could be NULL when there are no users
791 res_type = _igvn.type(res)->isa_oopptr();
792 }
793
794 if (res != NULL) {
795 klass = res_type->klass();
796 if (res_type->isa_instptr()) {
797 // find the fields of the class which will be needed for safepoint debug information
798 assert(klass->is_instance_klass(), "must be an instance klass.");
799 iklass = klass->as_instance_klass();
800 nfields = iklass->nof_nonstatic_fields();
801 } else {
802 // find the array's elements which will be needed for safepoint debug information
803 nfields = alloc->in(AllocateNode::ALength)->find_int_con(-1);
804 assert(klass->is_array_klass() && nfields >= 0, "must be an array klass.");
805 elem_type = klass->as_array_klass()->element_type();
1288
1289 void PhaseMacroExpand::expand_allocate_common(
1290 AllocateNode* alloc, // allocation node to be expanded
1291 Node* length, // array length for an array allocation
1292 const TypeFunc* slow_call_type, // Type of slow call
1293 address slow_call_address // Address of slow call
1294 )
1295 {
1296
1297 Node* ctrl = alloc->in(TypeFunc::Control);
1298 Node* mem = alloc->in(TypeFunc::Memory);
1299 Node* i_o = alloc->in(TypeFunc::I_O);
1300 Node* size_in_bytes = alloc->in(AllocateNode::AllocSize);
1301 Node* klass_node = alloc->in(AllocateNode::KlassNode);
1302 Node* initial_slow_test = alloc->in(AllocateNode::InitialTest);
1303
1304 assert(ctrl != NULL, "must have control");
1305 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results.
1306 // they will not be used if "always_slow" is set
1307 enum { slow_result_path = 1, fast_result_path = 2 };
1308 Node *result_region;
1309 Node *result_phi_rawmem;
1310 Node *result_phi_rawoop;
1311 Node *result_phi_i_o;
1312
1313 // The initial slow comparison is a size check, the comparison
1314 // we want to do is a BoolTest::gt
1315 bool always_slow = false;
1316 int tv = _igvn.find_int_con(initial_slow_test, -1);
1317 if (tv >= 0) {
1318 always_slow = (tv == 1);
1319 initial_slow_test = NULL;
1320 } else {
1321 initial_slow_test = BoolNode::make_predicate(initial_slow_test, &_igvn);
1322 }
1323
1324 if (C->env()->dtrace_alloc_probes() ||
1325 !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) {
1326 // Force slow-path allocation
1327 always_slow = true;
1328 initial_slow_test = NULL;
1329 }
1330
1331
|
762 res->dump();
763 #ifdef ASSERT
764 if (disq_node != NULL) {
765 tty->print(" >>>> ");
766 disq_node->dump();
767 }
768 #endif /*ASSERT*/
769 }
770 }
771 #endif
772 return can_eliminate;
773 }
774
775 // Do scalar replacement.
776 bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints) {
777 GrowableArray <SafePointNode *> safepoints_done;
778
779 ciKlass* klass = NULL;
780 ciInstanceKlass* iklass = NULL;
781 int nfields = 0;
782 int array_base = 0;
783 int element_size = 0;
784 BasicType basic_elem_type = T_ILLEGAL;
785 ciType* elem_type = NULL;
786
787 Node* res = alloc->result_cast();
788 assert(res == NULL || res->is_CheckCastPP(), "unexpected AllocateNode result");
789 const TypeOopPtr* res_type = NULL;
790 if (res != NULL) { // Could be NULL when there are no users
791 res_type = _igvn.type(res)->isa_oopptr();
792 }
793
794 if (res != NULL) {
795 klass = res_type->klass();
796 if (res_type->isa_instptr()) {
797 // find the fields of the class which will be needed for safepoint debug information
798 assert(klass->is_instance_klass(), "must be an instance klass.");
799 iklass = klass->as_instance_klass();
800 nfields = iklass->nof_nonstatic_fields();
801 } else {
802 // find the array's elements which will be needed for safepoint debug information
803 nfields = alloc->in(AllocateNode::ALength)->find_int_con(-1);
804 assert(klass->is_array_klass() && nfields >= 0, "must be an array klass.");
805 elem_type = klass->as_array_klass()->element_type();
1288
1289 void PhaseMacroExpand::expand_allocate_common(
1290 AllocateNode* alloc, // allocation node to be expanded
1291 Node* length, // array length for an array allocation
1292 const TypeFunc* slow_call_type, // Type of slow call
1293 address slow_call_address // Address of slow call
1294 )
1295 {
1296
1297 Node* ctrl = alloc->in(TypeFunc::Control);
1298 Node* mem = alloc->in(TypeFunc::Memory);
1299 Node* i_o = alloc->in(TypeFunc::I_O);
1300 Node* size_in_bytes = alloc->in(AllocateNode::AllocSize);
1301 Node* klass_node = alloc->in(AllocateNode::KlassNode);
1302 Node* initial_slow_test = alloc->in(AllocateNode::InitialTest);
1303
1304 assert(ctrl != NULL, "must have control");
1305 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results.
1306 // they will not be used if "always_slow" is set
1307 enum { slow_result_path = 1, fast_result_path = 2 };
1308 Node *result_region = NULL;
1309 Node *result_phi_rawmem = NULL;
1310 Node *result_phi_rawoop = NULL;
1311 Node *result_phi_i_o = NULL;
1312
1313 // The initial slow comparison is a size check, the comparison
1314 // we want to do is a BoolTest::gt
1315 bool always_slow = false;
1316 int tv = _igvn.find_int_con(initial_slow_test, -1);
1317 if (tv >= 0) {
1318 always_slow = (tv == 1);
1319 initial_slow_test = NULL;
1320 } else {
1321 initial_slow_test = BoolNode::make_predicate(initial_slow_test, &_igvn);
1322 }
1323
1324 if (C->env()->dtrace_alloc_probes() ||
1325 !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) {
1326 // Force slow-path allocation
1327 always_slow = true;
1328 initial_slow_test = NULL;
1329 }
1330
1331
|