1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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.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 "compiler/compileBroker.hpp"
36 #include "interpreter/bytecodeStream.hpp"
37 #include "interpreter/interpreter.hpp"
38 #include "memory/filemap.hpp"
39 #include "memory/gcLocker.hpp"
40 #include "memory/oopFactory.hpp"
41 #include "oops/instanceKlass.hpp"
42 #include "oops/instanceRefKlass.hpp"
43 #include "oops/klass.inline.hpp"
44 #include "oops/methodData.hpp"
45 #include "oops/objArrayKlass.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "oops/oop.inline2.hpp"
48 #include "oops/typeArrayKlass.hpp"
49 #include "prims/jvmtiEnvBase.hpp"
50 #include "prims/methodHandles.hpp"
51 #include "runtime/arguments.hpp"
52 #include "runtime/biasedLocking.hpp"
53 #include "runtime/fieldType.hpp"
54 #include "runtime/handles.inline.hpp"
1610 }
1611
1612
1613 // ----------------------------------------------------------------------------
1614 // Update hierachy. This is done before the new klass has been added to the SystemDictionary. The Recompile_lock
1615 // is held, to ensure that the compiler is not using the class hierachy, and that deoptimization will kick in
1616 // before a new class is used.
1617
1618 void SystemDictionary::add_to_hierarchy(instanceKlassHandle k, TRAPS) {
1619 assert(k.not_null(), "just checking");
1620 assert_locked_or_safepoint(Compile_lock);
1621
1622 // Link into hierachy. Make sure the vtables are initialized before linking into
1623 k->append_to_sibling_list(); // add to superklass/sibling list
1624 k->process_interfaces(THREAD); // handle all "implements" declarations
1625 k->set_init_state(InstanceKlass::loaded);
1626 // Now flush all code that depended on old class hierarchy.
1627 // Note: must be done *after* linking k into the hierarchy (was bug 12/9/97)
1628 // Also, first reinitialize vtable because it may have gotten out of synch
1629 // while the new class wasn't connected to the class hierarchy.
1630 Universe::flush_dependents_on(k);
1631 }
1632
1633 // ----------------------------------------------------------------------------
1634 // GC support
1635
1636 // Following roots during mark-sweep is separated in two phases.
1637 //
1638 // The first phase follows preloaded classes and all other system
1639 // classes, since these will never get unloaded anyway.
1640 //
1641 // The second phase removes (unloads) unreachable classes from the
1642 // system dictionary and follows the remaining classes' contents.
1643
1644 void SystemDictionary::always_strong_oops_do(OopClosure* blk) {
1645 roots_oops_do(blk, NULL);
1646 }
1647
1648 void SystemDictionary::always_strong_classes_do(KlassClosure* closure) {
1649 // Follow all system classes and temporary placeholders in dictionary
1650 dictionary()->always_strong_classes_do(closure);
|
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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.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 "interpreter/bytecodeStream.hpp"
38 #include "interpreter/interpreter.hpp"
39 #include "memory/filemap.hpp"
40 #include "memory/gcLocker.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"
46 #include "oops/objArrayKlass.hpp"
47 #include "oops/oop.inline.hpp"
48 #include "oops/oop.inline2.hpp"
49 #include "oops/typeArrayKlass.hpp"
50 #include "prims/jvmtiEnvBase.hpp"
51 #include "prims/methodHandles.hpp"
52 #include "runtime/arguments.hpp"
53 #include "runtime/biasedLocking.hpp"
54 #include "runtime/fieldType.hpp"
55 #include "runtime/handles.inline.hpp"
1611 }
1612
1613
1614 // ----------------------------------------------------------------------------
1615 // Update hierachy. This is done before the new klass has been added to the SystemDictionary. The Recompile_lock
1616 // is held, to ensure that the compiler is not using the class hierachy, and that deoptimization will kick in
1617 // before a new class is used.
1618
1619 void SystemDictionary::add_to_hierarchy(instanceKlassHandle k, TRAPS) {
1620 assert(k.not_null(), "just checking");
1621 assert_locked_or_safepoint(Compile_lock);
1622
1623 // Link into hierachy. Make sure the vtables are initialized before linking into
1624 k->append_to_sibling_list(); // add to superklass/sibling list
1625 k->process_interfaces(THREAD); // handle all "implements" declarations
1626 k->set_init_state(InstanceKlass::loaded);
1627 // Now flush all code that depended on old class hierarchy.
1628 // Note: must be done *after* linking k into the hierarchy (was bug 12/9/97)
1629 // Also, first reinitialize vtable because it may have gotten out of synch
1630 // while the new class wasn't connected to the class hierarchy.
1631 CodeCache::flush_dependents_on(k);
1632 }
1633
1634 // ----------------------------------------------------------------------------
1635 // GC support
1636
1637 // Following roots during mark-sweep is separated in two phases.
1638 //
1639 // The first phase follows preloaded classes and all other system
1640 // classes, since these will never get unloaded anyway.
1641 //
1642 // The second phase removes (unloads) unreachable classes from the
1643 // system dictionary and follows the remaining classes' contents.
1644
1645 void SystemDictionary::always_strong_oops_do(OopClosure* blk) {
1646 roots_oops_do(blk, NULL);
1647 }
1648
1649 void SystemDictionary::always_strong_classes_do(KlassClosure* closure) {
1650 // Follow all system classes and temporary placeholders in dictionary
1651 dictionary()->always_strong_classes_do(closure);
|