src/share/vm/ci/bcEscapeAnalyzer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8168926-work Sdiff src/share/vm/ci

src/share/vm/ci/bcEscapeAnalyzer.cpp

Print this page




 878           } else {
 879             state.lpop();
 880           }
 881           if (s.cur_bc() != Bytecodes::_putstatic) {
 882             ArgumentMap p = state.apop();
 883             set_method_escape(p);
 884             set_modified(p, will_link ? field->offset() : OFFSET_ANY, type2size[field_type]*HeapWordSize);
 885           }
 886         }
 887         break;
 888       case Bytecodes::_invokevirtual:
 889       case Bytecodes::_invokespecial:
 890       case Bytecodes::_invokestatic:
 891       case Bytecodes::_invokedynamic:
 892       case Bytecodes::_invokeinterface:
 893         { bool ignored_will_link;
 894           ciSignature* declared_signature = NULL;
 895           ciMethod* target = s.get_method(ignored_will_link, &declared_signature);
 896           ciKlass*  holder = s.get_declared_method_holder();
 897           assert(declared_signature != NULL, "cannot be null");
 898           // Push appendix argument, if one.
 899           if (s.has_appendix()) {
























 900             state.apush(unknown_obj);
 901           }
 902           // Pass in raw bytecode because we need to see invokehandle instructions.
 903           invoke(state, s.cur_bc_raw(), target, holder);
 904           // We are using the return type of the declared signature here because
 905           // it might be a more concrete type than the one from the target (for
 906           // e.g. invokedynamic and invokehandle).
 907           ciType* return_type = declared_signature->return_type();
 908           if (!return_type->is_primitive_type()) {
 909             state.apush(unknown_obj);
 910           } else if (return_type->is_one_word()) {
 911             state.spush();
 912           } else if (return_type->is_two_word()) {
 913             state.lpush();
 914           }
 915         }
 916         break;
 917       case Bytecodes::_new:
 918         state.apush(allocated_obj);
 919         break;




 878           } else {
 879             state.lpop();
 880           }
 881           if (s.cur_bc() != Bytecodes::_putstatic) {
 882             ArgumentMap p = state.apop();
 883             set_method_escape(p);
 884             set_modified(p, will_link ? field->offset() : OFFSET_ANY, type2size[field_type]*HeapWordSize);
 885           }
 886         }
 887         break;
 888       case Bytecodes::_invokevirtual:
 889       case Bytecodes::_invokespecial:
 890       case Bytecodes::_invokestatic:
 891       case Bytecodes::_invokedynamic:
 892       case Bytecodes::_invokeinterface:
 893         { bool ignored_will_link;
 894           ciSignature* declared_signature = NULL;
 895           ciMethod* target = s.get_method(ignored_will_link, &declared_signature);
 896           ciKlass*  holder = s.get_declared_method_holder();
 897           assert(declared_signature != NULL, "cannot be null");
 898           // If the current bytecode has an attached appendix argument,
 899           // push an unknown object to represent that argument. (Analysis
 900           // of dynamic call sites, especially invokehandle calls needs
 901           // the appendix argument on the stack, in addition to "regular" arguments
 902           // pushed onto the stack by bytecode instructions preceding the call.)
 903           //
 904           // The escape analyzer does _not_ use the ciBytecodeStream::has_appendix(s)
 905           // method to determine whether the current bytecode has an appendix argument.
 906           // The has_appendix() method obtains the appendix from the
 907           // ConstantPoolCacheEntry::_f1 field, which can happen concurrently with
 908           // resolution of dynamic call sites. Callees in the
 909           // ciBytecodeStream::get_method() call above also access the _f1 field;
 910           // interleaving the get_method() and has_appendix() calls in the current
 911           // method with call site resolution can lead to an inconsistent view of
 912           // the current method's argument count. In particular, some interleaving(s)
 913           // can cause the method's argument count to not include the appendix, which
 914           // then leads to stack over-/underflow in the escape analyzer.
 915           //
 916           // Instead of pushing the argument if has_appendix() is true, the escape analyzer
 917           // pushes an appendix for all call sites targeted by invokedynamic and invokehandle
 918           // instructions, except if the call site is the _invokeBasic intrinsic
 919           // (that instrinsic is always targeted by an invokehandle instruction but does
 920           // not have an appendix argument).
 921           if (target->is_loaded() &&
 922               Bytecodes::has_optional_appendix(s.cur_bc_raw()) &&
 923               target->intrinsic_id() != vmIntrinsics::_invokeBasic) {
 924             state.apush(unknown_obj);
 925           }
 926           // Pass in raw bytecode because we need to see invokehandle instructions.
 927           invoke(state, s.cur_bc_raw(), target, holder);
 928           // We are using the return type of the declared signature here because
 929           // it might be a more concrete type than the one from the target (for
 930           // e.g. invokedynamic and invokehandle).
 931           ciType* return_type = declared_signature->return_type();
 932           if (!return_type->is_primitive_type()) {
 933             state.apush(unknown_obj);
 934           } else if (return_type->is_one_word()) {
 935             state.spush();
 936           } else if (return_type->is_two_word()) {
 937             state.lpush();
 938           }
 939         }
 940         break;
 941       case Bytecodes::_new:
 942         state.apush(allocated_obj);
 943         break;


src/share/vm/ci/bcEscapeAnalyzer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File