--- old/src/hotspot/share/oops/generateOopMap.cpp 2019-03-11 14:26:16.758355009 +0100 +++ new/src/hotspot/share/oops/generateOopMap.cpp 2019-03-11 14:26:16.446355013 +0100 @@ -122,6 +122,7 @@ virtual void do_int () { set(CellTypeState::value); }; virtual void do_void () { set(CellTypeState::bottom);}; virtual void do_object(int begin, int end) { set(CellTypeState::ref); }; + virtual void do_valuetype(int begin, int end) { set(CellTypeState::ref); }; virtual void do_array (int begin, int end) { set(CellTypeState::ref); }; void do_double() { set(CellTypeState::value); @@ -137,8 +138,9 @@ _idx = 0; _effect = effect; - if (!is_static) + if (!is_static) { effect[_idx++] = CellTypeState::ref; + } iterate_parameters(); @@ -176,6 +178,7 @@ virtual void do_int () { set(CellTypeState::value); }; virtual void do_void () { set(CellTypeState::bottom);}; virtual void do_object(int begin, int end) { set(CellTypeState::make_slot_ref(_idx)); } + virtual void do_valuetype(int begin, int end) { set(CellTypeState::make_slot_ref(_idx)); } virtual void do_array (int begin, int end) { set(CellTypeState::make_slot_ref(_idx)); } void do_double() { set(CellTypeState::value); @@ -1376,6 +1379,9 @@ case Bytecodes::_new: ppush1(CellTypeState::make_line_ref(itr->bci())); break; + case Bytecodes::_defaultvalue: ppush1(CellTypeState::make_line_ref(itr->bci())); break; + case Bytecodes::_withfield: do_withfield(itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_iconst_m1: case Bytecodes::_iconst_0: case Bytecodes::_iconst_1: @@ -1589,16 +1595,16 @@ case Bytecodes::_jsr: do_jsr(itr->dest()); break; case Bytecodes::_jsr_w: do_jsr(itr->dest_w()); break; - case Bytecodes::_getstatic: do_field(true, true, itr->get_index_u2_cpcache(), itr->bci()); break; - case Bytecodes::_putstatic: do_field(false, true, itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_getstatic: do_field(true, true, itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_putstatic: do_field(false, true, itr->get_index_u2_cpcache(), itr->bci()); break; case Bytecodes::_getfield: do_field(true, false, itr->get_index_u2_cpcache(), itr->bci()); break; case Bytecodes::_putfield: do_field(false, false, itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_invokeinterface: case Bytecodes::_invokevirtual: - case Bytecodes::_invokespecial: do_method(false, false, itr->get_index_u2_cpcache(), itr->bci()); break; - case Bytecodes::_invokestatic: do_method(true, false, itr->get_index_u2_cpcache(), itr->bci()); break; - case Bytecodes::_invokedynamic: do_method(true, false, itr->get_index_u4(), itr->bci()); break; - case Bytecodes::_invokeinterface: do_method(false, true, itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_invokespecial: do_method(false, itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_invokestatic: do_method(true , itr->get_index_u2_cpcache(), itr->bci()); break; + case Bytecodes::_invokedynamic: do_method(true , itr->get_index_u4(), itr->bci()); break; case Bytecodes::_newarray: case Bytecodes::_anewarray: pp_new_ref(vCTS, itr->bci()); break; case Bytecodes::_checkcast: do_checkcast(); break; @@ -1618,6 +1624,7 @@ case Bytecodes::_areturn: do_return_monitor_check(); ppop1(refCTS); break; + case Bytecodes::_ifnull: case Bytecodes::_ifnonnull: ppop1(refCTS); break; case Bytecodes::_multianewarray: do_multianewarray(*(itr->bcp()+3), itr->bci()); break; @@ -1724,7 +1731,7 @@ } void GenerateOopMap::ppush1(CellTypeState in) { - assert(in.is_reference() | in.is_value(), "sanity check"); + assert(in.is_reference() || in.is_value(), "sanity check"); push(in); } @@ -1947,13 +1954,15 @@ out = epsilonCTS; i = copy_cts(in, eff); } - if (!is_static) in[i++] = CellTypeState::ref; + if (!is_static) { + in[i++] = CellTypeState::ref; + } in[i] = CellTypeState::bottom; assert(i<=3, "sanity check"); pp(in, out); } -void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci) { +void GenerateOopMap::do_method(int is_static, int idx, int bci) { // Dig up signature for field in constant pool ConstantPool* cp = _method->constants(); Symbol* signature = cp->signature_ref_at(idx); @@ -1990,10 +1999,38 @@ ppush(out); } +void GenerateOopMap::do_withfield(int idx, int bci) { + // Dig up signature for field in constant pool + ConstantPool* cp = method()->constants(); + int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); + int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); + Symbol* signature = cp->symbol_at(signatureIdx); + + // Parse signature (especially simple for fields) + assert(signature->utf8_length() > 0, + "field signatures cannot have zero length"); + // The signature is UFT8 encoded, but the first char is always ASCII for signatures. + char sigch = (char) *(signature->base()); + CellTypeState temp[4]; + CellTypeState *eff = sigchar_to_effect(sigch, bci, temp); + + CellTypeState in[4]; + int i = copy_cts(in, eff); + in[i++] = CellTypeState::ref; + in[i] = CellTypeState::bottom; + assert(i <= 3, "sanity check"); + + CellTypeState out[2]; + out[0] = CellTypeState::ref; + out[1] = CellTypeState::bottom; + + pp(in, out); +} + // This is used to parse the signature for fields, since they are very simple... CellTypeState *GenerateOopMap::sigchar_to_effect(char sigch, int bci, CellTypeState *out) { // Object and array - if (sigch=='L' || sigch=='[') { + if (sigch=='L' || sigch=='[' || sigch=='Q') { out[0] = CellTypeState::make_line_ref(bci); out[1] = CellTypeState::bottom; return out;