comparison src/share/vm/opto/doCall.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 9e69e8d1c900
children
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
113 // intrinsics handle strict f.p. correctly. 113 // intrinsics handle strict f.p. correctly.
114 CallGenerator* cg_intrinsic = NULL; 114 CallGenerator* cg_intrinsic = NULL;
115 if (allow_inline && allow_intrinsics) { 115 if (allow_inline && allow_intrinsics) {
116 CallGenerator* cg = find_intrinsic(callee, call_does_dispatch); 116 CallGenerator* cg = find_intrinsic(callee, call_does_dispatch);
117 if (cg != NULL) { 117 if (cg != NULL) {
118 if (cg->is_predicted()) { 118 if (cg->is_predicated()) {
119 // Code without intrinsic but, hopefully, inlined. 119 // Code without intrinsic but, hopefully, inlined.
120 CallGenerator* inline_cg = this->call_generator(callee, 120 CallGenerator* inline_cg = this->call_generator(callee,
121 vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, speculative_receiver_type, false); 121 vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, speculative_receiver_type, false);
122 if (inline_cg != NULL) { 122 if (inline_cg != NULL) {
123 cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg); 123 cg = CallGenerator::for_predicated_intrinsic(cg, inline_cg);
124 } 124 }
125 } 125 }
126 126
127 // If intrinsic does the virtual dispatch, we try to use the type profile 127 // If intrinsic does the virtual dispatch, we try to use the type profile
128 // first, and hopefully inline it as the regular virtual call below. 128 // first, and hopefully inline it as the regular virtual call below.
408 ciInstanceKlass* holder_klass = orig_callee->holder(); 408 ciInstanceKlass* holder_klass = orig_callee->holder();
409 ciKlass* holder = iter().get_declared_method_holder(); 409 ciKlass* holder = iter().get_declared_method_holder();
410 ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder); 410 ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
411 assert(declared_signature != NULL, "cannot be null"); 411 assert(declared_signature != NULL, "cannot be null");
412 412
413 // Bump max node limit for JSR292 users
414 if (bc() == Bytecodes::_invokedynamic || orig_callee->is_method_handle_intrinsic()) {
415 C->set_max_node_limit(3*MaxNodeLimit);
416 }
417
413 // uncommon-trap when callee is unloaded, uninitialized or will not link 418 // uncommon-trap when callee is unloaded, uninitialized or will not link
414 // bailout when too many arguments for register representation 419 // bailout when too many arguments for register representation
415 if (!will_link || can_not_compile_call_site(orig_callee, klass)) { 420 if (!will_link || can_not_compile_call_site(orig_callee, klass)) {
416 #ifndef PRODUCT 421 #ifndef PRODUCT
417 if (PrintOpto && (Verbose || WizardMode)) { 422 if (PrintOpto && (Verbose || WizardMode)) {
521 526
522 // Bump method data counters (We profile *before* the call is made 527 // Bump method data counters (We profile *before* the call is made
523 // because exceptions don't return to the call site.) 528 // because exceptions don't return to the call site.)
524 profile_call(receiver); 529 profile_call(receiver);
525 530
526 JVMState* new_jvms = cg->generate(jvms, this); 531 JVMState* new_jvms = cg->generate(jvms);
527 if (new_jvms == NULL) { 532 if (new_jvms == NULL) {
528 // When inlining attempt fails (e.g., too many arguments), 533 // When inlining attempt fails (e.g., too many arguments),
529 // it may contaminate the current compile state, making it 534 // it may contaminate the current compile state, making it
530 // impossible to pull back and try again. Once we call 535 // impossible to pull back and try again. Once we call
531 // cg->generate(), we are committed. If it fails, the whole 536 // cg->generate(), we are committed. If it fails, the whole
535 // This can happen if a library intrinsic is available, but refuses 540 // This can happen if a library intrinsic is available, but refuses
536 // the call site, perhaps because it did not match a pattern the 541 // the call site, perhaps because it did not match a pattern the
537 // intrinsic was expecting to optimize. Should always be possible to 542 // intrinsic was expecting to optimize. Should always be possible to
538 // get a normal java call that may inline in that case 543 // get a normal java call that may inline in that case
539 cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), speculative_receiver_type, /* allow_intrinsics= */ false); 544 cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), speculative_receiver_type, /* allow_intrinsics= */ false);
540 if ((new_jvms = cg->generate(jvms, this)) == NULL) { 545 if ((new_jvms = cg->generate(jvms)) == NULL) {
541 guarantee(failing(), "call failed to generate: calls should work"); 546 guarantee(failing(), "call failed to generate: calls should work");
542 return; 547 return;
543 } 548 }
544 } 549 }
545 550
789 794
790 // Get the exception oop klass from its header 795 // Get the exception oop klass from its header
791 Node* ex_klass_node = NULL; 796 Node* ex_klass_node = NULL;
792 if (has_ex_handler() && !ex_type->klass_is_exact()) { 797 if (has_ex_handler() && !ex_type->klass_is_exact()) {
793 Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes()); 798 Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes());
794 ex_klass_node = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); 799 ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
795 800
796 // Compute the exception klass a little more cleverly. 801 // Compute the exception klass a little more cleverly.
797 // Obvious solution is to simple do a LoadKlass from the 'ex_node'. 802 // Obvious solution is to simple do a LoadKlass from the 'ex_node'.
798 // However, if the ex_node is a PhiNode, I'm going to do a LoadKlass for 803 // However, if the ex_node is a PhiNode, I'm going to do a LoadKlass for
799 // each arm of the Phi. If I know something clever about the exceptions 804 // each arm of the Phi. If I know something clever about the exceptions
800 // I'm loading the class from, I can replace the LoadKlass with the 805 // I'm loading the class from, I can replace the LoadKlass with the
801 // klass constant for the exception oop. 806 // klass constant for the exception oop.
802 if( ex_node->is_Phi() ) { 807 if (ex_node->is_Phi()) {
803 ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); 808 ex_klass_node = new (C) PhiNode(ex_node->in(0), TypeKlassPtr::OBJECT);
804 for( uint i = 1; i < ex_node->req(); i++ ) { 809 for (uint i = 1; i < ex_node->req(); i++) {
805 Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); 810 Node* ex_in = ex_node->in(i);
806 Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); 811 if (ex_in == top() || ex_in == NULL) {
812 // This path was not taken.
813 ex_klass_node->init_req(i, top());
814 continue;
815 }
816 Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
817 Node* k = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
807 ex_klass_node->init_req( i, k ); 818 ex_klass_node->init_req( i, k );
808 } 819 }
809 _gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT); 820 _gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT);
810 821
811 } 822 }