< prev index next >

src/hotspot/share/gc/shared/weakProcessorPhases.cpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "gc/shared/weakProcessorPhases.hpp"
  29 #include "prims/resolvedMethodTable.hpp"

  30 #include "runtime/jniHandles.hpp"
  31 #include "utilities/debug.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 #if INCLUDE_JFR
  35 #include "jfr/jfr.hpp"
  36 #endif // INCLUDE_JFR
  37 
  38 #if INCLUDE_JVMTI
  39 #include "prims/jvmtiExport.hpp"
  40 #endif // INCLUDE_JVMTI
  41 
  42 WeakProcessorPhases::Phase WeakProcessorPhases::phase(uint value) {
  43   assert(value < phase_count, "Invalid phase value %u", value);
  44   return static_cast<Phase>(value);
  45 }
  46 
  47 uint WeakProcessorPhases::index(Phase phase) {
  48   uint value = static_cast<uint>(phase);
  49   assert(value < phase_count, "Invalid phase %u", value);


  66 #if INCLUDE_JVMTI || INCLUDE_JFR
  67   return (index(phase) - serial_phase_start) < serial_phase_count;
  68 #else
  69   STATIC_ASSERT(serial_phase_count == 0);
  70   return false;
  71 #endif
  72 }
  73 
  74 bool WeakProcessorPhases::is_oop_storage(Phase phase) {
  75   return (index(phase) - oop_storage_phase_start) < oop_storage_phase_count;
  76 }
  77 
  78 const char* WeakProcessorPhases::description(Phase phase) {
  79   switch (phase) {
  80   JVMTI_ONLY(case jvmti: return "JVMTI weak processing";)
  81   JFR_ONLY(case jfr: return "JFR weak processing";)
  82   case jni: return "JNI weak processing";
  83   case stringtable: return "StringTable weak processing";
  84   case resolved_method_table: return "ResolvedMethodTable weak processing";
  85   case vm: return "VM weak processing";

  86   default:
  87     ShouldNotReachHere();
  88     return "Invalid weak processing phase";
  89   }
  90 }
  91 
  92 WeakProcessorPhases::Processor WeakProcessorPhases::processor(Phase phase) {
  93   switch (phase) {
  94   JVMTI_ONLY(case jvmti: return &JvmtiExport::weak_oops_do;)
  95   JFR_ONLY(case jfr: return &Jfr::weak_oops_do;)
  96   default:
  97     ShouldNotReachHere();
  98     return NULL;
  99   }
 100 }
 101 
 102 OopStorage* WeakProcessorPhases::oop_storage(Phase phase) {
 103   switch (phase) {
 104   case jni: return JNIHandles::weak_global_handles();
 105   case stringtable: return StringTable::weak_storage();
 106   case resolved_method_table: return ResolvedMethodTable::weak_storage();
 107   case vm: return SystemDictionary::vm_weak_oop_storage();

 108   default:
 109     ShouldNotReachHere();
 110     return NULL;
 111   }
 112 }
 113 
 114 bool WeakProcessorPhases::is_stringtable(Phase phase) {
 115   return phase == stringtable;
 116 }
 117 
 118 bool WeakProcessorPhases::is_resolved_method_table(Phase phase) {
 119   return phase == resolved_method_table;
 120 }


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "gc/shared/weakProcessorPhases.hpp"
  29 #include "prims/resolvedMethodTable.hpp"
  30 #include "runtime/continuation.hpp"
  31 #include "runtime/jniHandles.hpp"
  32 #include "utilities/debug.hpp"
  33 #include "utilities/macros.hpp"
  34 
  35 #if INCLUDE_JFR
  36 #include "jfr/jfr.hpp"
  37 #endif // INCLUDE_JFR
  38 
  39 #if INCLUDE_JVMTI
  40 #include "prims/jvmtiExport.hpp"
  41 #endif // INCLUDE_JVMTI
  42 
  43 WeakProcessorPhases::Phase WeakProcessorPhases::phase(uint value) {
  44   assert(value < phase_count, "Invalid phase value %u", value);
  45   return static_cast<Phase>(value);
  46 }
  47 
  48 uint WeakProcessorPhases::index(Phase phase) {
  49   uint value = static_cast<uint>(phase);
  50   assert(value < phase_count, "Invalid phase %u", value);


  67 #if INCLUDE_JVMTI || INCLUDE_JFR
  68   return (index(phase) - serial_phase_start) < serial_phase_count;
  69 #else
  70   STATIC_ASSERT(serial_phase_count == 0);
  71   return false;
  72 #endif
  73 }
  74 
  75 bool WeakProcessorPhases::is_oop_storage(Phase phase) {
  76   return (index(phase) - oop_storage_phase_start) < oop_storage_phase_count;
  77 }
  78 
  79 const char* WeakProcessorPhases::description(Phase phase) {
  80   switch (phase) {
  81   JVMTI_ONLY(case jvmti: return "JVMTI weak processing";)
  82   JFR_ONLY(case jfr: return "JFR weak processing";)
  83   case jni: return "JNI weak processing";
  84   case stringtable: return "StringTable weak processing";
  85   case resolved_method_table: return "ResolvedMethodTable weak processing";
  86   case vm: return "VM weak processing";
  87   case nmethod_keepalive: return "NMethod keepalive (continuations)";
  88   default:
  89     ShouldNotReachHere();
  90     return "Invalid weak processing phase";
  91   }
  92 }
  93 
  94 WeakProcessorPhases::Processor WeakProcessorPhases::processor(Phase phase) {
  95   switch (phase) {
  96   JVMTI_ONLY(case jvmti: return &JvmtiExport::weak_oops_do;)
  97   JFR_ONLY(case jfr: return &Jfr::weak_oops_do;)
  98   default:
  99     ShouldNotReachHere();
 100     return NULL;
 101   }
 102 }
 103 
 104 OopStorage* WeakProcessorPhases::oop_storage(Phase phase) {
 105   switch (phase) {
 106   case jni: return JNIHandles::weak_global_handles();
 107   case stringtable: return StringTable::weak_storage();
 108   case resolved_method_table: return ResolvedMethodTable::weak_storage();
 109   case vm: return SystemDictionary::vm_weak_oop_storage();
 110   case nmethod_keepalive: return Continuation::weak_storage();
 111   default:
 112     ShouldNotReachHere();
 113     return NULL;
 114   }
 115 }
 116 
 117 bool WeakProcessorPhases::is_stringtable(Phase phase) {
 118   return phase == stringtable;
 119 }
 120 
 121 bool WeakProcessorPhases::is_resolved_method_table(Phase phase) {
 122   return phase == resolved_method_table;
 123 }
< prev index next >