Thu, 27 Feb 2014 10:36:50 +0100
8035746: Add missing Klass::oop_is_instanceClassLoader() function
Reviewed-by: mgerdin, coleenp
1.1 --- a/src/share/vm/oops/klass.cpp Thu Feb 27 10:34:55 2014 +0100 1.2 +++ b/src/share/vm/oops/klass.cpp Thu Feb 27 10:36:50 2014 +0100 1.3 @@ -699,3 +699,21 @@ 1.4 } 1.5 1.6 #endif 1.7 + 1.8 +/////////////// Unit tests /////////////// 1.9 + 1.10 +#ifndef PRODUCT 1.11 + 1.12 +class TestKlass { 1.13 + public: 1.14 + static void test_oop_is_instanceClassLoader() { 1.15 + assert(SystemDictionary::ClassLoader_klass()->oop_is_instanceClassLoader(), "assert"); 1.16 + assert(!SystemDictionary::String_klass()->oop_is_instanceClassLoader(), "assert"); 1.17 + } 1.18 +}; 1.19 + 1.20 +void TestKlass_test() { 1.21 + TestKlass::test_oop_is_instanceClassLoader(); 1.22 +} 1.23 + 1.24 +#endif
2.1 --- a/src/share/vm/oops/klass.hpp Thu Feb 27 10:34:55 2014 +0100 2.2 +++ b/src/share/vm/oops/klass.hpp Thu Feb 27 10:36:50 2014 +0100 2.3 @@ -499,6 +499,7 @@ 2.4 virtual bool oop_is_objArray_slow() const { return false; } 2.5 virtual bool oop_is_typeArray_slow() const { return false; } 2.6 public: 2.7 + virtual bool oop_is_instanceClassLoader() const { return false; } 2.8 virtual bool oop_is_instanceMirror() const { return false; } 2.9 virtual bool oop_is_instanceRef() const { return false; } 2.10
3.1 --- a/src/share/vm/oops/oop.hpp Thu Feb 27 10:34:55 2014 +0100 3.2 +++ b/src/share/vm/oops/oop.hpp Thu Feb 27 10:36:50 2014 +0100 3.3 @@ -109,12 +109,13 @@ 3.4 int size_given_klass(Klass* klass); 3.5 3.6 // type test operations (inlined in oop.inline.h) 3.7 - bool is_instance() const; 3.8 - bool is_instanceMirror() const; 3.9 - bool is_instanceRef() const; 3.10 - bool is_array() const; 3.11 - bool is_objArray() const; 3.12 - bool is_typeArray() const; 3.13 + bool is_instance() const; 3.14 + bool is_instanceMirror() const; 3.15 + bool is_instanceClassLoader() const; 3.16 + bool is_instanceRef() const; 3.17 + bool is_array() const; 3.18 + bool is_objArray() const; 3.19 + bool is_typeArray() const; 3.20 3.21 private: 3.22 // field addresses in oop
4.1 --- a/src/share/vm/oops/oop.inline.hpp Thu Feb 27 10:34:55 2014 +0100 4.2 +++ b/src/share/vm/oops/oop.inline.hpp Thu Feb 27 10:36:50 2014 +0100 4.3 @@ -148,12 +148,13 @@ 4.4 4.5 inline bool oopDesc::is_a(Klass* k) const { return klass()->is_subtype_of(k); } 4.6 4.7 -inline bool oopDesc::is_instance() const { return klass()->oop_is_instance(); } 4.8 -inline bool oopDesc::is_instanceMirror() const { return klass()->oop_is_instanceMirror(); } 4.9 -inline bool oopDesc::is_instanceRef() const { return klass()->oop_is_instanceRef(); } 4.10 -inline bool oopDesc::is_array() const { return klass()->oop_is_array(); } 4.11 -inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); } 4.12 -inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); } 4.13 +inline bool oopDesc::is_instance() const { return klass()->oop_is_instance(); } 4.14 +inline bool oopDesc::is_instanceClassLoader() const { return klass()->oop_is_instanceClassLoader(); } 4.15 +inline bool oopDesc::is_instanceMirror() const { return klass()->oop_is_instanceMirror(); } 4.16 +inline bool oopDesc::is_instanceRef() const { return klass()->oop_is_instanceRef(); } 4.17 +inline bool oopDesc::is_array() const { return klass()->oop_is_array(); } 4.18 +inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); } 4.19 +inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); } 4.20 4.21 inline void* oopDesc::field_base(int offset) const { return (void*)&((char*)this)[offset]; } 4.22
5.1 --- a/src/share/vm/prims/jni.cpp Thu Feb 27 10:34:55 2014 +0100 5.2 +++ b/src/share/vm/prims/jni.cpp Thu Feb 27 10:36:50 2014 +0100 5.3 @@ -5082,6 +5082,7 @@ 5.4 void TestMetachunk_test(); 5.5 void TestVirtualSpaceNode_test(); 5.6 void TestNewSize_test(); 5.7 +void TestKlass_test(); 5.8 #if INCLUDE_ALL_GCS 5.9 void TestOldFreeSpaceCalculation_test(); 5.10 void TestG1BiasedArray_test(); 5.11 @@ -5106,6 +5107,7 @@ 5.12 run_unit_test(AltHashing::test_alt_hash()); 5.13 run_unit_test(test_loggc_filename()); 5.14 run_unit_test(TestNewSize_test()); 5.15 + run_unit_test(TestKlass_test()); 5.16 #if INCLUDE_VM_STRUCTS 5.17 run_unit_test(VMStructs::test()); 5.18 #endif