src/share/vm/ci/ciObject.cpp

changeset 1424
148e5441d916
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/ci/ciObject.cpp	Tue Sep 15 11:09:34 2009 -0700
     1.2 +++ b/src/share/vm/ci/ciObject.cpp	Tue Sep 15 21:53:47 2009 -0700
     1.3 @@ -55,6 +55,7 @@
     1.4    }
     1.5    _klass = NULL;
     1.6    _ident = 0;
     1.7 +  init_flags_from(o);
     1.8  }
     1.9  
    1.10  // ------------------------------------------------------------------
    1.11 @@ -69,6 +70,7 @@
    1.12    }
    1.13    _klass = NULL;
    1.14    _ident = 0;
    1.15 +  init_flags_from(h());
    1.16  }
    1.17  
    1.18  // ------------------------------------------------------------------
    1.19 @@ -158,7 +160,7 @@
    1.20  }
    1.21  
    1.22  // ------------------------------------------------------------------
    1.23 -// ciObject::encoding
    1.24 +// ciObject::constant_encoding
    1.25  //
    1.26  // The address which the compiler should embed into the
    1.27  // generated code to represent this oop.  This address
    1.28 @@ -172,16 +174,24 @@
    1.29  //
    1.30  // This method should be changed to return an generified address
    1.31  // to discourage use of the JNI handle.
    1.32 -jobject ciObject::encoding() {
    1.33 +jobject ciObject::constant_encoding() {
    1.34    assert(is_null_object() || handle() != NULL, "cannot embed null pointer");
    1.35 -  assert(has_encoding(), "oop must be NULL or perm");
    1.36 +  assert(can_be_constant(), "oop must be NULL or perm");
    1.37    return handle();
    1.38  }
    1.39  
    1.40  // ------------------------------------------------------------------
    1.41 -// ciObject::has_encoding
    1.42 -bool ciObject::has_encoding() {
    1.43 -  return handle() == NULL || is_perm();
    1.44 +// ciObject::can_be_constant
    1.45 +bool ciObject::can_be_constant() {
    1.46 +  if (ScavengeRootsInCode >= 1)  return true;  // now everybody can encode as a constant
    1.47 +  return handle() == NULL || !is_scavengable();
    1.48 +}
    1.49 +
    1.50 +// ------------------------------------------------------------------
    1.51 +// ciObject::should_be_constant()
    1.52 +bool ciObject::should_be_constant() {
    1.53 +  if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
    1.54 +  return handle() == NULL || !is_scavengable();
    1.55  }
    1.56  
    1.57  
    1.58 @@ -195,8 +205,9 @@
    1.59  void ciObject::print(outputStream* st) {
    1.60    st->print("<%s", type_string());
    1.61    GUARDED_VM_ENTRY(print_impl(st);)
    1.62 -  st->print(" ident=%d %s address=0x%x>", ident(),
    1.63 +  st->print(" ident=%d %s%s address=0x%x>", ident(),
    1.64          is_perm() ? "PERM" : "",
    1.65 +        is_scavengable() ? "SCAVENGABLE" : "",
    1.66          (address)this);
    1.67  }
    1.68  

mercurial