comparison src/share/vm/opto/callGenerator.cpp @ 4062:83d0b5cd1438

7087727: JSR 292: C2 crash if ScavengeRootsInCode=2 when "static final" MethodHandle constants are in use Reviewed-by: jrose, kvn, never
author twisti
date Wed, 09 Nov 2011 00:42:33 -0800
parents c26de9aef2ed
children a04a201f0f5a
comparison
equal deleted inserted replaced
4061:e3e363b2bf19 4062:83d0b5cd1438
773 const TypeOopPtr* predicted_mh_ptr = TypeOopPtr::make_from_constant(_predicted_method_handle, true); 773 const TypeOopPtr* predicted_mh_ptr = TypeOopPtr::make_from_constant(_predicted_method_handle, true);
774 Node* predicted_mh = kit.makecon(predicted_mh_ptr); 774 Node* predicted_mh = kit.makecon(predicted_mh_ptr);
775 775
776 Node* bol = NULL; 776 Node* bol = NULL;
777 int bc = jvms->method()->java_code_at_bci(jvms->bci()); 777 int bc = jvms->method()->java_code_at_bci(jvms->bci());
778 if (bc == Bytecodes::_invokespecial) { 778 if (bc != Bytecodes::_invokedynamic) {
779 // This is the selectAlternative idiom for guardWithTest 779 // This is the selectAlternative idiom for guardWithTest or
780 // similar idioms.
780 Node* receiver = kit.argument(0); 781 Node* receiver = kit.argument(0);
781 782
782 // Check if the MethodHandle is the expected one 783 // Check if the MethodHandle is the expected one
783 Node* cmp = gvn.transform(new(kit.C, 3) CmpPNode(receiver, predicted_mh)); 784 Node* cmp = gvn.transform(new(kit.C, 3) CmpPNode(receiver, predicted_mh));
784 bol = gvn.transform(new(kit.C, 2) BoolNode(cmp, BoolTest::eq) ); 785 bol = gvn.transform(new(kit.C, 2) BoolNode(cmp, BoolTest::eq) );
785 } else { 786 } else {
786 assert(bc == Bytecodes::_invokedynamic, "must be");
787 // Get the constant pool cache from the caller class. 787 // Get the constant pool cache from the caller class.
788 ciMethod* caller_method = jvms->method(); 788 ciMethod* caller_method = jvms->method();
789 ciBytecodeStream str(caller_method); 789 ciBytecodeStream str(caller_method);
790 str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 790 str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci.
791 ciCPCache* cpcache = str.get_cpcache(); 791 ciCPCache* cpcache = str.get_cpcache();