提交 5207e1f3 编写于 作者: C coleenp

8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on

Summary: Remove search in system dictionary and hacks, replace with verifying in CLD::_klasses list.
Reviewed-by: dcubed, acorn
上级 f3b81cd6
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -520,6 +520,13 @@ void ClassLoaderData::verify() {
}
}
bool ClassLoaderData::contains_klass(Klass* klass) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
if (k == klass) return true;
}
return false;
}
// GC root of class loader data created.
ClassLoaderData* ClassLoaderDataGraph::_head = NULL;
......
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -260,6 +260,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
jobject add_handle(Handle h);
void add_class(Klass* k);
void remove_class(Klass* k);
bool contains_klass(Klass* k);
void record_dependency(Klass* to, TRAPS);
void init_dependencies(TRAPS);
......
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -707,7 +707,7 @@ void Dictionary::verify() {
loader_data->class_loader() == NULL ||
loader_data->class_loader()->is_instance(),
"checking type of class_loader");
e->verify(/*check_dictionary*/false);
e->verify();
probe->verify_protection_domain_set();
element_count++;
}
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -2650,23 +2650,6 @@ void SystemDictionary::verify() {
constraints()->verify(dictionary(), placeholders());
}
void SystemDictionary::verify_obj_klass_present(Symbol* class_name,
ClassLoaderData* loader_data) {
GCMutexLocker mu(SystemDictionary_lock);
Symbol* name;
Klass* probe = find_class(class_name, loader_data);
if (probe == NULL) {
probe = SystemDictionary::find_shared_class(class_name);
if (probe == NULL) {
name = find_placeholder(class_name, loader_data);
}
}
guarantee(probe != NULL || name != NULL,
"Loaded klasses should be in SystemDictionary");
}
// utility function for class load event
void SystemDictionary::post_class_load_event(const Ticks& start_time,
instanceKlassHandle k,
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -375,10 +375,6 @@ public:
static bool is_internal_format(Symbol* class_name);
#endif
// Verify class is in dictionary
static void verify_obj_klass_present(Symbol* class_name,
ClassLoaderData* loader_data);
// Initialization
static void initialize(TRAPS);
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -214,8 +214,8 @@ void ArrayKlass::oop_print_on(oop obj, outputStream* st) {
// Verification
void ArrayKlass::verify_on(outputStream* st, bool check_dictionary) {
Klass::verify_on(st, check_dictionary);
void ArrayKlass::verify_on(outputStream* st) {
Klass::verify_on(st);
if (component_mirror() != NULL) {
guarantee(component_mirror()->klass() != NULL, "should have a class");
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -146,7 +146,7 @@ class ArrayKlass: public Klass {
void oop_print_on(oop obj, outputStream* st);
// Verification
void verify_on(outputStream* st, bool check_dictionary);
void verify_on(outputStream* st);
void oop_verify_on(oop obj, outputStream* st);
};
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -3180,7 +3180,7 @@ class VerifyFieldClosure: public OopClosure {
virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
};
void InstanceKlass::verify_on(outputStream* st, bool check_dictionary) {
void InstanceKlass::verify_on(outputStream* st) {
#ifndef PRODUCT
// Avoid redundant verifies, this really should be in product.
if (_verify_count == Universe::verify_count()) return;
......@@ -3188,14 +3188,11 @@ void InstanceKlass::verify_on(outputStream* st, bool check_dictionary) {
#endif
// Verify Klass
Klass::verify_on(st, check_dictionary);
Klass::verify_on(st);
// Verify that klass is present in SystemDictionary if not already
// verifying the SystemDictionary.
if (is_loaded() && !is_anonymous() && check_dictionary) {
Symbol* h_name = name();
SystemDictionary::verify_obj_klass_present(h_name, class_loader_data());
}
// Verify that klass is present in ClassLoaderData
guarantee(class_loader_data()->contains_klass(this),
"this class isn't found in class loader data");
// Verify vtables
if (is_linked()) {
......
......@@ -1087,7 +1087,7 @@ public:
const char* internal_name() const;
// Verification
void verify_on(outputStream* st, bool check_dictionary);
void verify_on(outputStream* st);
void oop_verify_on(oop obj, outputStream* st);
};
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -638,7 +638,7 @@ void Klass::collect_statistics(KlassSizeStats *sz) const {
// Verification
void Klass::verify_on(outputStream* st, bool check_dictionary) {
void Klass::verify_on(outputStream* st) {
// This can be expensive, but it is worth checking that this klass is actually
// in the CLD graph but not in production.
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -695,8 +695,8 @@ class Klass : public Metadata {
virtual const char* internal_name() const = 0;
// Verification
virtual void verify_on(outputStream* st, bool check_dictionary);
void verify(bool check_dictionary = true) { verify_on(tty, check_dictionary); }
virtual void verify_on(outputStream* st);
void verify() { verify_on(tty); }
#ifndef PRODUCT
bool verify_vtable_index(int index);
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -674,8 +674,8 @@ const char* ObjArrayKlass::internal_name() const {
// Verification
void ObjArrayKlass::verify_on(outputStream* st, bool check_dictionary) {
ArrayKlass::verify_on(st, check_dictionary);
void ObjArrayKlass::verify_on(outputStream* st) {
ArrayKlass::verify_on(st);
guarantee(element_klass()->is_klass(), "should be klass");
guarantee(bottom_klass()->is_klass(), "should be klass");
Klass* bk = bottom_klass();
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -151,7 +151,7 @@ class ObjArrayKlass : public ArrayKlass {
const char* internal_name() const;
// Verification
void verify_on(outputStream* st, bool check_dictionary);
void verify_on(outputStream* st);
void oop_verify_on(oop obj, outputStream* st);
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册