< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page
rev 48545 : Value-based classes (vbc) / Oop value test via metadata ptr

@@ -110,10 +110,14 @@
 bool        SystemDictionary::_has_checkPackageAccess     =  false;
 
 // lazily initialized klass variables
 InstanceKlass* volatile SystemDictionary::_abstract_ownable_synchronizer_klass = NULL;
 
+#if INCLUDE_VBC
+GrowableArray<Symbol*>* SystemDictionary::_value_based_classes    = NULL;
+#endif
+
 // Default ProtectionDomainCacheSize value
 
 const int defaultProtectionDomainCacheSize = 1009;
 
 

@@ -2044,10 +2048,55 @@
   _loader_constraints  = new LoaderConstraintTable(_loader_constraint_size);
   _resolution_errors   = new ResolutionErrorTable(_resolution_error_size);
   _invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
 
+#if INCLUDE_VBC
+  if (ValueBasedClasses == NULL) {
+    // Quick dirty hard-coded JDK value classes...
+    ValueBasedClasses = "java/lang/Runtime$Version,"
+      "java/time/Duration,"
+      "java/time/Instant,"
+      "java/time/LocalDate,"
+      "java/time/LocalDateTime,"
+      "java/time/LocalTime,"
+      "java/time/MonthDay,"
+      "java/time/OffsetDateTime,"
+      "java/time/OffsetTime,"
+      "java/time/Period,"
+      "java/time/Year,"
+      "java/time/YearMonth,"
+      "java/time/ZonedDateTime,"
+      "java/time/ZoneId,"
+      "java/time/ZoneOffset,"
+      "java/time/chrono/HijrahDate,"
+      "java/time/chrono/JapaneseDate,"
+      "java/time/chrono/MinguoDate,"
+      "java/time/chrono/ThaiBuddhistDate,"
+      "java/util/KeyValueHolder,"
+      "java/util/Optional,"
+      "java/util/OptionalDouble,"
+      "java/util/OptionalInt,"
+      "java/util/OptionalLong";
+  }
+  if (ValueBasedClasses != NULL) {
+    Symbol* name_sym;
+    _value_based_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Symbol*>(3, true);
+    char* name = os::strdup_check_oom(ValueBasedClasses);
+    char* next = strchr(name, ',');
+    while (next != NULL) {
+      *next = '\0';
+      name_sym = SymbolTable::new_permanent_symbol(name, CHECK);
+      _value_based_classes->append(name_sym);
+      name = next + 1;
+      next = strchr(name, ',');
+    }
+    name_sym = SymbolTable::new_permanent_symbol(name, CHECK);
+    _value_based_classes->append(name_sym);
+  }
+#endif
+
   // Allocate private object used as system class loader lock
   _system_loader_lock_obj = oopFactory::new_intArray(0, CHECK);
   // Initialize basic classes
   initialize_preloaded_classes(CHECK);
 }
< prev index next >