src/share/vm/oops/methodOop.cpp

changeset 2571
a97fd181b813
parent 2563
173926398291
parent 2550
f77b3ec064b0
child 2616
dbad0519a1c4
     1.1 --- a/src/share/vm/oops/methodOop.cpp	Tue Feb 22 15:26:36 2011 -0800
     1.2 +++ b/src/share/vm/oops/methodOop.cpp	Wed Feb 23 11:18:16 2011 -0800
     1.3 @@ -985,9 +985,11 @@
     1.4                                                IsUnsafeConc,
     1.5                                                CHECK_(methodHandle()));
     1.6    methodHandle newm (THREAD, newm_oop);
     1.7 +  NOT_PRODUCT(int nmsz = newm->is_parsable() ? newm->size() : -1;)
     1.8    int new_method_size = newm->method_size();
     1.9    // Create a shallow copy of methodOopDesc part, but be careful to preserve the new constMethodOop
    1.10    constMethodOop newcm = newm->constMethod();
    1.11 +  NOT_PRODUCT(int ncmsz = newcm->is_parsable() ? newcm->size() : -1;)
    1.12    int new_const_method_size = newm->constMethod()->object_size();
    1.13  
    1.14    memcpy(newm(), m(), sizeof(methodOopDesc));
    1.15 @@ -999,9 +1001,19 @@
    1.16    // or concurrent marking but those phases will be correct.  Setting and
    1.17    // resetting is done in preference to a careful copying into newcm to
    1.18    // avoid having to know the precise layout of a constMethodOop.
    1.19 -  m->constMethod()->set_is_conc_safe(false);
    1.20 +  m->constMethod()->set_is_conc_safe(oopDesc::IsUnsafeConc);
    1.21 +  assert(m->constMethod()->is_parsable(), "Should remain parsable");
    1.22 +
    1.23 +  // NOTE: this is a reachable object that transiently signals "conc_unsafe"
    1.24 +  // However, no allocations are done during this window
    1.25 +  // during which it is tagged conc_unsafe, so we are assured that any concurrent
    1.26 +  // thread will not wait forever for the object to revert to "conc_safe".
    1.27 +  // Further, any such conc_unsafe object will indicate a stable size
    1.28 +  // through the transition.
    1.29    memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc));
    1.30 -  m->constMethod()->set_is_conc_safe(true);
    1.31 +  m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc);
    1.32 +  assert(m->constMethod()->is_parsable(), "Should remain parsable");
    1.33 +
    1.34    // Reset correct method/const method, method size, and parameter info
    1.35    newcm->set_method(newm());
    1.36    newm->set_constMethod(newcm);
    1.37 @@ -1035,6 +1047,8 @@
    1.38  
    1.39    // Only set is_conc_safe to true when changes to newcm are
    1.40    // complete.
    1.41 +  assert(!newm->is_parsable()  || nmsz  < 0 || newm->size()  == nmsz,  "newm->size()  inconsistency");
    1.42 +  assert(!newcm->is_parsable() || ncmsz < 0 || newcm->size() == ncmsz, "newcm->size() inconsistency");
    1.43    newcm->set_is_conc_safe(true);
    1.44    return newm;
    1.45  }
    1.46 @@ -1372,7 +1386,7 @@
    1.47  }
    1.48  
    1.49  // See comment in methodOop.hpp which explains why this exists.
    1.50 -#if defined(_M_AMD64) && MSC_VER >= 1400
    1.51 +#if defined(_M_AMD64) && _MSC_VER >= 1400
    1.52  #pragma optimize("", off)
    1.53  void CompressedLineNumberWriteStream::write_pair(int bci, int line) {
    1.54    write_pair_inline(bci, line);

mercurial