< prev index next >

src/hotspot/share/ci/ciObject.cpp

Print this page
*** 23,10 ***
--- 23,11 ---
   */
  
  #include "precompiled.hpp"
  #include "ci/ciObject.hpp"
  #include "ci/ciUtilities.inline.hpp"
+ #include "code/SCCache.hpp"
  #include "gc/shared/collectedHeap.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/jniHandles.inline.hpp"
  
  // ciObject

*** 201,24 ***
  }
  
  // ------------------------------------------------------------------
  // ciObject::should_be_constant()
  bool ciObject::should_be_constant() {
!   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
!   if (is_null_object()) return true;
! 
    ciEnv* env = CURRENT_ENV;
  
!     // We want Strings and Classes to be embeddable by default since
!     // they used to be in the perm world.  Not all Strings used to be
!     // embeddable but there's no easy way to distinguish the interned
!     // from the regulars ones so just treat them all that way.
!     if (klass() == env->String_klass() || klass() == env->Class_klass()) {
!       return true;
!     }
!   if (klass()->is_subclass_of(env->MethodHandle_klass()) ||
!       klass()->is_subclass_of(env->CallSite_klass())) {
      // We want to treat these aggressively.
      return true;
    }
  
    return handle() == nullptr;
--- 202,28 ---
  }
  
  // ------------------------------------------------------------------
  // ciObject::should_be_constant()
  bool ciObject::should_be_constant() {
!   if (ScavengeRootsInCode >= 2 && !(SCCache::is_on_for_write())) {
!     return true;  // force everybody to be a constant
!   }
+   if (is_null_object()) {
+     return true;
+   }
    ciEnv* env = CURRENT_ENV;
  
!   // We want Strings and Classes to be embeddable by default since
!   // they used to be in the perm world.  Not all Strings used to be
!   // embeddable but there's no easy way to distinguish the interned
!   // from the regulars ones so just treat them all that way.
!   if (klass() == env->String_klass() || klass() == env->Class_klass()) {
!     return true;
!   }
!   if ((klass()->is_subclass_of(env->MethodHandle_klass()) ||
!        klass()->is_subclass_of(env->CallSite_klass())) &&
+       !(SCCache::is_on_for_write())) { // For now disable it when caching startup code.
      // We want to treat these aggressively.
      return true;
    }
  
    return handle() == nullptr;
< prev index next >