8035746: Add missing Klass::oop_is_instanceClassLoader() function

Reviewed-by: mgerdin, coleenp
This commit is contained in:
Stefan Karlsson 2014-02-27 10:36:50 +01:00
parent ba2326e19f
commit 959bdfb211
5 changed files with 35 additions and 12 deletions

View File

@ -692,3 +692,21 @@ bool Klass::verify_itable_index(int i) {
}
#endif
/////////////// Unit tests ///////////////
#ifndef PRODUCT
class TestKlass {
public:
static void test_oop_is_instanceClassLoader() {
assert(SystemDictionary::ClassLoader_klass()->oop_is_instanceClassLoader(), "assert");
assert(!SystemDictionary::String_klass()->oop_is_instanceClassLoader(), "assert");
}
};
void TestKlass_test() {
TestKlass::test_oop_is_instanceClassLoader();
}
#endif

View File

@ -498,6 +498,7 @@ class Klass : public Metadata {
virtual bool oop_is_objArray_slow() const { return false; }
virtual bool oop_is_typeArray_slow() const { return false; }
public:
virtual bool oop_is_instanceClassLoader() const { return false; }
virtual bool oop_is_instanceMirror() const { return false; }
virtual bool oop_is_instanceRef() const { return false; }

View File

@ -109,12 +109,13 @@ class oopDesc {
int size_given_klass(Klass* klass);
// type test operations (inlined in oop.inline.h)
bool is_instance() const;
bool is_instanceMirror() const;
bool is_instanceRef() const;
bool is_array() const;
bool is_objArray() const;
bool is_typeArray() const;
bool is_instance() const;
bool is_instanceMirror() const;
bool is_instanceClassLoader() const;
bool is_instanceRef() const;
bool is_array() const;
bool is_objArray() const;
bool is_typeArray() const;
private:
// field addresses in oop

View File

@ -147,12 +147,13 @@ inline void oopDesc::init_mark() { set_mark(markOopDesc::proto
inline bool oopDesc::is_a(Klass* k) const { return klass()->is_subtype_of(k); }
inline bool oopDesc::is_instance() const { return klass()->oop_is_instance(); }
inline bool oopDesc::is_instanceMirror() const { return klass()->oop_is_instanceMirror(); }
inline bool oopDesc::is_instanceRef() const { return klass()->oop_is_instanceRef(); }
inline bool oopDesc::is_array() const { return klass()->oop_is_array(); }
inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); }
inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); }
inline bool oopDesc::is_instance() const { return klass()->oop_is_instance(); }
inline bool oopDesc::is_instanceClassLoader() const { return klass()->oop_is_instanceClassLoader(); }
inline bool oopDesc::is_instanceMirror() const { return klass()->oop_is_instanceMirror(); }
inline bool oopDesc::is_instanceRef() const { return klass()->oop_is_instanceRef(); }
inline bool oopDesc::is_array() const { return klass()->oop_is_array(); }
inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); }
inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); }
inline void* oopDesc::field_base(int offset) const { return (void*)&((char*)this)[offset]; }

View File

@ -3877,6 +3877,7 @@ void TestMetaspaceAux_test();
void TestMetachunk_test();
void TestVirtualSpaceNode_test();
void TestNewSize_test();
void TestKlass_test();
#if INCLUDE_ALL_GCS
void TestOldFreeSpaceCalculation_test();
void TestG1BiasedArray_test();
@ -3900,6 +3901,7 @@ void execute_internal_vm_tests() {
run_unit_test(AltHashing::test_alt_hash());
run_unit_test(test_loggc_filename());
run_unit_test(TestNewSize_test());
run_unit_test(TestKlass_test());
#if INCLUDE_VM_STRUCTS
run_unit_test(VMStructs::test());
#endif