< prev index next >

src/hotspot/share/oops/generateOopMap.cpp

Print this page
*** 137,12 ***
    // Compute methods
    int compute_for_parameters(bool is_static, CellTypeState *effect) {
      _idx    = 0;
      _effect = effect;
  
!     if (!is_static)
        effect[_idx++] = CellTypeState::ref;
  
      do_parameters_on(this);
  
      return length();
    };
--- 137,13 ---
    // Compute methods
    int compute_for_parameters(bool is_static, CellTypeState *effect) {
      _idx    = 0;
      _effect = effect;
  
!     if (!is_static) {
        effect[_idx++] = CellTypeState::ref;
+     }
  
      do_parameters_on(this);
  
      return length();
    };

*** 835,11 ***
  void GenerateOopMap::merge_state(GenerateOopMap *gom, int bci, int* data) {
     gom->merge_state_into_bb(gom->get_basic_block_at(bci));
  }
  
  void GenerateOopMap::set_var(int localNo, CellTypeState cts) {
!   assert(cts.is_reference() || cts.is_value() || cts.is_address(),
           "wrong celltypestate");
    if (localNo < 0 || localNo > _max_locals) {
      verify_error("variable write error: r%d", localNo);
      return;
    }
--- 836,11 ---
  void GenerateOopMap::merge_state(GenerateOopMap *gom, int bci, int* data) {
     gom->merge_state_into_bb(gom->get_basic_block_at(bci));
  }
  
  void GenerateOopMap::set_var(int localNo, CellTypeState cts) {
!   assert(cts.is_reference() || cts.is_inline_type() || cts.is_address(),
           "wrong celltypestate");
    if (localNo < 0 || localNo > _max_locals) {
      verify_error("variable write error: r%d", localNo);
      return;
    }

*** 1376,10 ***
--- 1377,13 ---
  
      case Bytecodes::_aconst_null:
      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:
      case Bytecodes::_iconst_2:
      case Bytecodes::_iconst_3:

*** 1589,20 ***
      case Bytecodes::_if_acmpne:         ppop(rrCTS);                 break;
  
      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::_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::_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::_newarray:
      case Bytecodes::_anewarray:         pp_new_ref(vCTS, itr->bci()); break;
      case Bytecodes::_checkcast:         do_checkcast(); break;
      case Bytecodes::_arraylength:
      case Bytecodes::_instanceof:        pp(rCTS, vCTS); break;
--- 1593,20 ---
      case Bytecodes::_if_acmpne:         ppop(rrCTS);                 break;
  
      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::_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, 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;
      case Bytecodes::_arraylength:
      case Bytecodes::_instanceof:        pp(rCTS, vCTS); break;

*** 1618,10 ***
--- 1622,11 ---
                                          break;
  
      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;
  
      case Bytecodes::_wide:              fatal("Iterator should skip this bytecode"); break;

*** 1724,11 ***
      ppop1(*out++);
    }
  }
  
  void GenerateOopMap::ppush1(CellTypeState in) {
!   assert(in.is_reference() | in.is_value(), "sanity check");
    push(in);
  }
  
  void GenerateOopMap::ppush(CellTypeState *in) {
    while (!(*in).is_bottom()) {
--- 1729,11 ---
      ppop1(*out++);
    }
  }
  
  void GenerateOopMap::ppush1(CellTypeState in) {
!   assert(in.is_reference() || in.is_inline_type(), "sanity check");
    push(in);
  }
  
  void GenerateOopMap::ppush(CellTypeState *in) {
    while (!(*in).is_bottom()) {

*** 1943,17 ***
      out = eff;
    } else {
      out = epsilonCTS;
      i   = copy_cts(in, eff);
    }
!   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) {
   // Dig up signature for field in constant pool
    ConstantPool* cp  = _method->constants();
    Symbol* signature   = cp->signature_ref_at(idx);
  
    // Parse method signature
--- 1948,19 ---
      out = eff;
    } else {
      out = epsilonCTS;
      i   = copy_cts(in, eff);
    }
!   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 idx, int bci) {
   // Dig up signature for field in constant pool
    ConstantPool* cp  = _method->constants();
    Symbol* signature   = cp->signature_ref_at(idx);
  
    // Parse method signature

*** 1986,10 ***
--- 1993,37 ---
  
    // Push return address
    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.
+   CellTypeState temp[4];
+   CellTypeState *eff = signature_to_effect(signature, 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::signature_to_effect(const Symbol* sig, int bci, CellTypeState *out) {
    // Object and array
    BasicType bt = Signature::basic_type(sig);
    if (is_reference_type(bt)) {
< prev index next >