< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page
rev 55090 : secret-sfac


1417       }
1418     }
1419   }
1420   // _this will always be set at this point
1421   ObjArrayKlass* oak = (ObjArrayKlass*)array_klasses();
1422   if (or_null) {
1423     return oak->array_klass_or_null(n);
1424   }
1425   return oak->array_klass(n, THREAD);
1426 }
1427 
1428 Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
1429   return array_klass_impl(or_null, 1, THREAD);
1430 }
1431 
1432 static int call_class_initializer_counter = 0;   // for debugging
1433 
1434 Method* InstanceKlass::class_initializer() const {
1435   Method* clinit = find_method(
1436       vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
1437   if (clinit != NULL && clinit->has_valid_initializer_flags()) {
1438     return clinit;
1439   }
1440   return NULL;
1441 }
1442 
1443 void InstanceKlass::call_class_initializer(TRAPS) {
1444   if (ReplayCompiles &&
1445       (ReplaySuppressInitializers == 1 ||
1446        (ReplaySuppressInitializers >= 2 && class_loader() != NULL))) {
1447     // Hide the existence of the initializer for the purpose of replaying the compile
1448     return;
1449   }
1450 
1451   methodHandle h_method(THREAD, class_initializer());
1452   assert(!is_initialized(), "we cannot initialize twice");
1453   LogTarget(Info, class, init) lt;
1454   if (lt.is_enabled()) {
1455     ResourceMark rm;
1456     LogStream ls(lt);
1457     ls.print("%d Initializing ", call_class_initializer_counter++);


1896 }
1897 
1898 // uncached_lookup_method searches both the local class methods array and all
1899 // superclasses methods arrays, skipping any overpass methods in superclasses,
1900 // and possibly skipping private methods.
1901 Method* InstanceKlass::uncached_lookup_method(const Symbol* name,
1902                                               const Symbol* signature,
1903                                               OverpassLookupMode overpass_mode,
1904                                               PrivateLookupMode private_mode) const {
1905   OverpassLookupMode overpass_local_mode = overpass_mode;
1906   const Klass* klass = this;
1907   while (klass != NULL) {
1908     Method* const method = InstanceKlass::cast(klass)->find_method_impl(name,
1909                                                                         signature,
1910                                                                         overpass_local_mode,
1911                                                                         find_static,
1912                                                                         private_mode);
1913     if (method != NULL) {
1914       return method;
1915     }



1916     klass = klass->super();
1917     overpass_local_mode = skip_overpass;   // Always ignore overpass methods in superclasses
1918   }
1919   return NULL;
1920 }
1921 
1922 #ifdef ASSERT
1923 // search through class hierarchy and return true if this class or
1924 // one of the superclasses was redefined
1925 bool InstanceKlass::has_redefined_this_or_super() const {
1926   const Klass* klass = this;
1927   while (klass != NULL) {
1928     if (InstanceKlass::cast(klass)->has_been_redefined()) {
1929       return true;
1930     }
1931     klass = klass->super();
1932   }
1933   return false;
1934 }
1935 #endif




1417       }
1418     }
1419   }
1420   // _this will always be set at this point
1421   ObjArrayKlass* oak = (ObjArrayKlass*)array_klasses();
1422   if (or_null) {
1423     return oak->array_klass_or_null(n);
1424   }
1425   return oak->array_klass(n, THREAD);
1426 }
1427 
1428 Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
1429   return array_klass_impl(or_null, 1, THREAD);
1430 }
1431 
1432 static int call_class_initializer_counter = 0;   // for debugging
1433 
1434 Method* InstanceKlass::class_initializer() const {
1435   Method* clinit = find_method(
1436       vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
1437   if (clinit != NULL && clinit->is_class_initializer()) {
1438     return clinit;
1439   }
1440   return NULL;
1441 }
1442 
1443 void InstanceKlass::call_class_initializer(TRAPS) {
1444   if (ReplayCompiles &&
1445       (ReplaySuppressInitializers == 1 ||
1446        (ReplaySuppressInitializers >= 2 && class_loader() != NULL))) {
1447     // Hide the existence of the initializer for the purpose of replaying the compile
1448     return;
1449   }
1450 
1451   methodHandle h_method(THREAD, class_initializer());
1452   assert(!is_initialized(), "we cannot initialize twice");
1453   LogTarget(Info, class, init) lt;
1454   if (lt.is_enabled()) {
1455     ResourceMark rm;
1456     LogStream ls(lt);
1457     ls.print("%d Initializing ", call_class_initializer_counter++);


1896 }
1897 
1898 // uncached_lookup_method searches both the local class methods array and all
1899 // superclasses methods arrays, skipping any overpass methods in superclasses,
1900 // and possibly skipping private methods.
1901 Method* InstanceKlass::uncached_lookup_method(const Symbol* name,
1902                                               const Symbol* signature,
1903                                               OverpassLookupMode overpass_mode,
1904                                               PrivateLookupMode private_mode) const {
1905   OverpassLookupMode overpass_local_mode = overpass_mode;
1906   const Klass* klass = this;
1907   while (klass != NULL) {
1908     Method* const method = InstanceKlass::cast(klass)->find_method_impl(name,
1909                                                                         signature,
1910                                                                         overpass_local_mode,
1911                                                                         find_static,
1912                                                                         private_mode);
1913     if (method != NULL) {
1914       return method;
1915     }
1916     if (name == vmSymbols::object_initializer_name()) {
1917       break;  // <init> is never inherited, not even as a static factory
1918     }
1919     klass = klass->super();
1920     overpass_local_mode = skip_overpass;   // Always ignore overpass methods in superclasses
1921   }
1922   return NULL;
1923 }
1924 
1925 #ifdef ASSERT
1926 // search through class hierarchy and return true if this class or
1927 // one of the superclasses was redefined
1928 bool InstanceKlass::has_redefined_this_or_super() const {
1929   const Klass* klass = this;
1930   while (klass != NULL) {
1931     if (InstanceKlass::cast(klass)->has_been_redefined()) {
1932       return true;
1933     }
1934     klass = klass->super();
1935   }
1936   return false;
1937 }
1938 #endif


< prev index next >