< prev index next >

src/hotspot/share/opto/castnode.cpp

Print this page




 394   //   TypePtr::PTR type_ptr = _type->is_ptr()->_ptr;
 395   //   // If there isn't any NotNull'ness to preserve
 396   //   // OR if join preserved NotNull'ness then return it
 397   //   if( type_ptr == TypePtr::BotPTR  || type_ptr == TypePtr::Null ||
 398   //       join_ptr == TypePtr::NotNull || join_ptr == TypePtr::Constant ) {
 399   //     return join;
 400   //   }
 401   //   // ELSE return same old type as before
 402   //   return _type;
 403   // }
 404   // // Not joining two pointers
 405   // return join;
 406 }
 407 
 408 Node* CheckCastPPNode::Ideal(PhaseGVN *phase, bool can_reshape) {
 409   // This is a value type. Its input is the return of a call: the call
 410   // returns a value type and we now know its exact type: build a
 411   // ValueTypePtrNode from the call.
 412   if (can_reshape &&
 413       in(0) == NULL &&
 414       phase->C->can_add_value_type_ptr() &&
 415       type()->isa_valuetypeptr() &&
 416       in(1) != NULL && in(1)->is_Proj() &&
 417       in(1)->in(0) != NULL && in(1)->in(0)->is_CallStaticJava() &&
 418       in(1)->in(0)->as_CallStaticJava()->method() != NULL &&
 419       in(1)->as_Proj()->_con == TypeFunc::Parms) {
 420     const TypeValueTypePtr* cast_type = type()->is_valuetypeptr();
 421     ciValueKlass* vk = cast_type->value_type()->value_klass();
 422     assert(!vk->is__Value(), "why cast to __Value?");
 423     PhaseIterGVN* igvn = phase->is_IterGVN();
 424 
 425     if (ValueTypeReturnedAsFields && vk->can_be_returned_as_fields()) {
 426       igvn->set_delay_transform(true);
 427       CallNode* call = in(1)->in(0)->as_Call();
 428       igvn->C->remove_macro_node(call);
 429       // We now know the return type of the call
 430       const TypeTuple* range_sig = TypeTuple::make_range(vk, false);
 431       const TypeTuple* range_cc = TypeTuple::make_range(vk, true);
 432       assert(range_sig != call->_tf->range_sig() && range_cc != call->_tf->range_cc(), "type should change");
 433       call->_tf = TypeFunc::make(call->_tf->domain_sig(), call->_tf->domain_cc(),
 434                                  range_sig, range_cc);




 394   //   TypePtr::PTR type_ptr = _type->is_ptr()->_ptr;
 395   //   // If there isn't any NotNull'ness to preserve
 396   //   // OR if join preserved NotNull'ness then return it
 397   //   if( type_ptr == TypePtr::BotPTR  || type_ptr == TypePtr::Null ||
 398   //       join_ptr == TypePtr::NotNull || join_ptr == TypePtr::Constant ) {
 399   //     return join;
 400   //   }
 401   //   // ELSE return same old type as before
 402   //   return _type;
 403   // }
 404   // // Not joining two pointers
 405   // return join;
 406 }
 407 
 408 Node* CheckCastPPNode::Ideal(PhaseGVN *phase, bool can_reshape) {
 409   // This is a value type. Its input is the return of a call: the call
 410   // returns a value type and we now know its exact type: build a
 411   // ValueTypePtrNode from the call.
 412   if (can_reshape &&
 413       in(0) == NULL &&
 414       phase->C->can_add_value_type() &&
 415       type()->isa_valuetypeptr() &&
 416       in(1) != NULL && in(1)->is_Proj() &&
 417       in(1)->in(0) != NULL && in(1)->in(0)->is_CallStaticJava() &&
 418       in(1)->in(0)->as_CallStaticJava()->method() != NULL &&
 419       in(1)->as_Proj()->_con == TypeFunc::Parms) {
 420     const TypeValueTypePtr* cast_type = type()->is_valuetypeptr();
 421     ciValueKlass* vk = cast_type->value_type()->value_klass();
 422     assert(!vk->is__Value(), "why cast to __Value?");
 423     PhaseIterGVN* igvn = phase->is_IterGVN();
 424 
 425     if (ValueTypeReturnedAsFields && vk->can_be_returned_as_fields()) {
 426       igvn->set_delay_transform(true);
 427       CallNode* call = in(1)->in(0)->as_Call();
 428       igvn->C->remove_macro_node(call);
 429       // We now know the return type of the call
 430       const TypeTuple* range_sig = TypeTuple::make_range(vk, false);
 431       const TypeTuple* range_cc = TypeTuple::make_range(vk, true);
 432       assert(range_sig != call->_tf->range_sig() && range_cc != call->_tf->range_cc(), "type should change");
 433       call->_tf = TypeFunc::make(call->_tf->domain_sig(), call->_tf->domain_cc(),
 434                                  range_sig, range_cc);


< prev index next >