6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoaderData.inline.hpp"
27 #include "classfile/dictionary.hpp"
28 #include "classfile/javaClasses.inline.hpp"
29 #include "classfile/loaderConstraints.hpp"
30 #include "classfile/placeholders.hpp"
31 #include "classfile/resolutionErrors.hpp"
32 #include "classfile/stringTable.hpp"
33 #include "classfile/systemDictionary.hpp"
34 #include "classfile/vmSymbols.hpp"
35 #include "code/codeCache.hpp"
36 #include "compiler/compileBroker.hpp"
37 #include "gc/shared/gcLocker.hpp"
38 #include "interpreter/bytecodeStream.hpp"
39 #include "interpreter/interpreter.hpp"
40 #include "memory/filemap.hpp"
41 #include "memory/oopFactory.hpp"
42 #include "oops/instanceKlass.hpp"
43 #include "oops/instanceRefKlass.hpp"
44 #include "oops/klass.inline.hpp"
45 #include "oops/methodData.hpp"
1691 // Assumes classes in the SystemDictionary are only unloaded at a safepoint
1692 // Note: anonymous classes are not in the SD.
1693 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive,
1694 bool clean_previous_versions) {
1695 // First, mark for unload all ClassLoaderData referencing a dead class loader.
1696 bool unloading_occurred = ClassLoaderDataGraph::do_unloading(is_alive,
1697 clean_previous_versions);
1698 if (unloading_occurred) {
1699 dictionary()->do_unloading();
1700 constraints()->purge_loader_constraints();
1701 resolution_errors()->purge_resolution_errors();
1702 }
1703 // Oops referenced by the system dictionary may get unreachable independently
1704 // of the class loader (eg. cached protection domain oops). So we need to
1705 // explicitly unlink them here instead of in Dictionary::do_unloading.
1706 dictionary()->unlink(is_alive);
1707 #ifdef ASSERT
1708 VerifySDReachableAndLiveClosure cl(is_alive);
1709 dictionary()->oops_do(&cl);
1710 #endif
1711 return unloading_occurred;
1712 }
1713
1714 void SystemDictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) {
1715 strong->do_oop(&_java_system_loader);
1716 strong->do_oop(&_system_loader_lock_obj);
1717 CDS_ONLY(SystemDictionaryShared::roots_oops_do(strong);)
1718
1719 // Adjust dictionary
1720 dictionary()->roots_oops_do(strong, weak);
1721
1722 // Visit extra methods
1723 invoke_method_table()->oops_do(strong);
1724 }
1725
1726 void SystemDictionary::oops_do(OopClosure* f) {
1727 f->do_oop(&_java_system_loader);
1728 f->do_oop(&_system_loader_lock_obj);
1729 CDS_ONLY(SystemDictionaryShared::oops_do(f);)
1730
1731 // Adjust dictionary
1732 dictionary()->oops_do(f);
1733
1734 // Visit extra methods
1735 invoke_method_table()->oops_do(f);
1736 }
1737
1738 // Extended Class redefinition support.
1739 // If one of these classes is replaced, we need to replace it in these places.
1740 // KlassClosure::do_klass should take the address of a class but we can
1741 // change that later.
1742 void SystemDictionary::preloaded_classes_do(KlassClosure* f) {
1743 for (int k = (int)FIRST_WKID; k < (int)WKID_LIMIT; k++) {
1744 f->do_klass(_well_known_klasses[k]);
1745 }
1746
1747 {
1748 for (int i = 0; i < T_VOID+1; i++) {
1749 if (_box_klasses[i] != NULL) {
1750 assert(i >= T_BOOLEAN, "checking");
1751 f->do_klass(_box_klasses[i]);
1752 }
1753 }
1754 }
1755
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/backtrace.hpp"
27 #include "classfile/classLoaderData.inline.hpp"
28 #include "classfile/dictionary.hpp"
29 #include "classfile/javaClasses.inline.hpp"
30 #include "classfile/loaderConstraints.hpp"
31 #include "classfile/placeholders.hpp"
32 #include "classfile/resolutionErrors.hpp"
33 #include "classfile/stringTable.hpp"
34 #include "classfile/systemDictionary.hpp"
35 #include "classfile/vmSymbols.hpp"
36 #include "code/codeCache.hpp"
37 #include "compiler/compileBroker.hpp"
38 #include "gc/shared/gcLocker.hpp"
39 #include "interpreter/bytecodeStream.hpp"
40 #include "interpreter/interpreter.hpp"
41 #include "memory/filemap.hpp"
42 #include "memory/oopFactory.hpp"
43 #include "oops/instanceKlass.hpp"
44 #include "oops/instanceRefKlass.hpp"
45 #include "oops/klass.inline.hpp"
46 #include "oops/methodData.hpp"
1692 // Assumes classes in the SystemDictionary are only unloaded at a safepoint
1693 // Note: anonymous classes are not in the SD.
1694 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive,
1695 bool clean_previous_versions) {
1696 // First, mark for unload all ClassLoaderData referencing a dead class loader.
1697 bool unloading_occurred = ClassLoaderDataGraph::do_unloading(is_alive,
1698 clean_previous_versions);
1699 if (unloading_occurred) {
1700 dictionary()->do_unloading();
1701 constraints()->purge_loader_constraints();
1702 resolution_errors()->purge_resolution_errors();
1703 }
1704 // Oops referenced by the system dictionary may get unreachable independently
1705 // of the class loader (eg. cached protection domain oops). So we need to
1706 // explicitly unlink them here instead of in Dictionary::do_unloading.
1707 dictionary()->unlink(is_alive);
1708 #ifdef ASSERT
1709 VerifySDReachableAndLiveClosure cl(is_alive);
1710 dictionary()->oops_do(&cl);
1711 #endif
1712
1713 // Unload deallocated backtraces
1714 BacktraceList::unlink(is_alive);
1715 return unloading_occurred;
1716 }
1717
1718 void SystemDictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) {
1719 strong->do_oop(&_java_system_loader);
1720 strong->do_oop(&_system_loader_lock_obj);
1721 CDS_ONLY(SystemDictionaryShared::roots_oops_do(strong);)
1722
1723 // Adjust dictionary
1724 dictionary()->roots_oops_do(strong, weak);
1725
1726 // Visit extra methods
1727 invoke_method_table()->oops_do(strong);
1728
1729 // BacktraceList are weak roots
1730 if (weak != NULL) {
1731 BacktraceList::oops_do(weak);
1732 }
1733 }
1734
1735 void SystemDictionary::oops_do(OopClosure* f) {
1736 f->do_oop(&_java_system_loader);
1737 f->do_oop(&_system_loader_lock_obj);
1738 CDS_ONLY(SystemDictionaryShared::oops_do(f);)
1739
1740 // Adjust dictionary
1741 dictionary()->oops_do(f);
1742
1743 // Visit extra methods
1744 invoke_method_table()->oops_do(f);
1745
1746 // BacktraceList are weak roots
1747 BacktraceList::oops_do(f);
1748 }
1749
1750 // Extended Class redefinition support.
1751 // If one of these classes is replaced, we need to replace it in these places.
1752 // KlassClosure::do_klass should take the address of a class but we can
1753 // change that later.
1754 void SystemDictionary::preloaded_classes_do(KlassClosure* f) {
1755 for (int k = (int)FIRST_WKID; k < (int)WKID_LIMIT; k++) {
1756 f->do_klass(_well_known_klasses[k]);
1757 }
1758
1759 {
1760 for (int i = 0; i < T_VOID+1; i++) {
1761 if (_box_klasses[i] != NULL) {
1762 assert(i >= T_BOOLEAN, "checking");
1763 f->do_klass(_box_klasses[i]);
1764 }
1765 }
1766 }
1767
|