1 /*
2 * Copyright (c) 2003, 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 *
3749 //
3750 // If the can_redefine_classes capability is obtained in the onload
3751 // phase then the compiler has recorded all dependencies from startup.
3752 // In that case we need only deoptimize and throw away all compiled code
3753 // that depends on the class.
3754 //
3755 // If can_redefine_classes is obtained sometime after the onload
3756 // phase then the dependency information may be incomplete. In that case
3757 // the first call to RedefineClasses causes all compiled code to be
3758 // thrown away. As can_redefine_classes has been obtained then
3759 // all future compilations will record dependencies so second and
3760 // subsequent calls to RedefineClasses need only throw away code
3761 // that depends on the class.
3762 //
3763 void VM_RedefineClasses::flush_dependent_code(instanceKlassHandle k_h, TRAPS) {
3764 assert_locked_or_safepoint(Compile_lock);
3765
3766 // All dependencies have been recorded from startup or this is a second or
3767 // subsequent use of RedefineClasses
3768 if (JvmtiExport::all_dependencies_are_recorded()) {
3769 Universe::flush_evol_dependents_on(k_h);
3770 } else {
3771 CodeCache::mark_all_nmethods_for_deoptimization();
3772
3773 ResourceMark rm(THREAD);
3774 DeoptimizationMarker dm;
3775
3776 // Deoptimize all activations depending on marked nmethods
3777 Deoptimization::deoptimize_dependents();
3778
3779 // Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
3780 CodeCache::make_marked_nmethods_not_entrant();
3781
3782 // From now on we know that the dependency information is complete
3783 JvmtiExport::set_all_dependencies_are_recorded(true);
3784 }
3785 }
3786
3787 void VM_RedefineClasses::compute_added_deleted_matching_methods() {
3788 Method* old_method;
3789 Method* new_method;
|
1 /*
2 * Copyright (c) 2003, 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 *
3749 //
3750 // If the can_redefine_classes capability is obtained in the onload
3751 // phase then the compiler has recorded all dependencies from startup.
3752 // In that case we need only deoptimize and throw away all compiled code
3753 // that depends on the class.
3754 //
3755 // If can_redefine_classes is obtained sometime after the onload
3756 // phase then the dependency information may be incomplete. In that case
3757 // the first call to RedefineClasses causes all compiled code to be
3758 // thrown away. As can_redefine_classes has been obtained then
3759 // all future compilations will record dependencies so second and
3760 // subsequent calls to RedefineClasses need only throw away code
3761 // that depends on the class.
3762 //
3763 void VM_RedefineClasses::flush_dependent_code(instanceKlassHandle k_h, TRAPS) {
3764 assert_locked_or_safepoint(Compile_lock);
3765
3766 // All dependencies have been recorded from startup or this is a second or
3767 // subsequent use of RedefineClasses
3768 if (JvmtiExport::all_dependencies_are_recorded()) {
3769 CodeCache::flush_evol_dependents_on(k_h);
3770 } else {
3771 CodeCache::mark_all_nmethods_for_deoptimization();
3772
3773 ResourceMark rm(THREAD);
3774 DeoptimizationMarker dm;
3775
3776 // Deoptimize all activations depending on marked nmethods
3777 Deoptimization::deoptimize_dependents();
3778
3779 // Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
3780 CodeCache::make_marked_nmethods_not_entrant();
3781
3782 // From now on we know that the dependency information is complete
3783 JvmtiExport::set_all_dependencies_are_recorded(true);
3784 }
3785 }
3786
3787 void VM_RedefineClasses::compute_added_deleted_matching_methods() {
3788 Method* old_method;
3789 Method* new_method;
|