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 #include "precompiled.hpp"
25
26 #include "aot/aotCodeHeap.hpp"
27 #include "aot/aotLoader.hpp"
28 #include "ci/ciUtilities.inline.hpp"
29 #include "classfile/javaAssertions.hpp"
30 #include "gc/shared/cardTable.hpp"
31 #include "gc/shared/cardTableBarrierSet.hpp"
32 #include "gc/shared/gcConfig.hpp"
33 #include "gc/g1/heapRegion.hpp"
34 #include "interpreter/abstractInterpreter.hpp"
35 #include "jvmci/compilerRuntime.hpp"
36 #include "jvmci/jvmciRuntime.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "oops/method.inline.hpp"
39 #include "runtime/handles.inline.hpp"
40 #include "runtime/os.hpp"
41 #include "runtime/safepointVerifiers.hpp"
42 #include "runtime/sharedRuntime.hpp"
43 #include "runtime/vmOperations.hpp"
44 #include "utilities/sizes.hpp"
45
46 bool AOTLib::_narrow_oop_shift_initialized = false;
47 int AOTLib::_narrow_oop_shift = 0;
48 int AOTLib::_narrow_klass_shift = 0;
49
50 address AOTLib::load_symbol(const char *name) {
51 address symbol = (address) os::dll_lookup(_dl_handle, name);
52 if (symbol == NULL) {
53 tty->print_cr("Shared file %s error: missing %s", _name, name);
54 vm_exit(1);
55 }
56 return symbol;
57 }
58
714 }
715 }
716
717 void AOTCodeHeap::sweep_dependent_methods(int* indexes, int methods_cnt) {
718 int marked = 0;
719 for (int i = 0; i < methods_cnt; ++i) {
720 int code_id = indexes[i];
721 // Invalidate aot code.
722 if (Atomic::cmpxchg(invalid, &_code_to_aot[code_id]._state, not_set) != not_set) {
723 if (_code_to_aot[code_id]._state == in_use) {
724 AOTCompiledMethod* aot = _code_to_aot[code_id]._aot;
725 assert(aot != NULL, "aot should be set");
726 if (!aot->is_runtime_stub()) { // Something is wrong - should not invalidate stubs.
727 aot->mark_for_deoptimization(false);
728 marked++;
729 }
730 }
731 }
732 }
733 if (marked > 0) {
734 VM_Deoptimize op;
735 VMThread::execute(&op);
736 }
737 }
738
739 void AOTCodeHeap::sweep_dependent_methods(AOTKlassData* klass_data) {
740 // Make dependent methods non_entrant forever.
741 int methods_offset = klass_data->_dependent_methods_offset;
742 if (methods_offset >= 0) {
743 address methods_cnt_adr = _dependencies + methods_offset;
744 int methods_cnt = *(int*)methods_cnt_adr;
745 int* indexes = (int*)(methods_cnt_adr + 4);
746 sweep_dependent_methods(indexes, methods_cnt);
747 }
748 }
749
750 void AOTCodeHeap::sweep_dependent_methods(InstanceKlass* ik) {
751 AOTKlassData* klass_data = find_klass(ik);
752 vmassert(klass_data != NULL, "dependency data missing");
753 sweep_dependent_methods(klass_data);
754 }
755
|
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 #include "precompiled.hpp"
25
26 #include "aot/aotCodeHeap.hpp"
27 #include "aot/aotLoader.hpp"
28 #include "ci/ciUtilities.inline.hpp"
29 #include "classfile/javaAssertions.hpp"
30 #include "gc/shared/cardTable.hpp"
31 #include "gc/shared/cardTableBarrierSet.hpp"
32 #include "gc/shared/gcConfig.hpp"
33 #include "gc/g1/heapRegion.hpp"
34 #include "interpreter/abstractInterpreter.hpp"
35 #include "jvmci/compilerRuntime.hpp"
36 #include "jvmci/jvmciRuntime.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "oops/method.inline.hpp"
39 #include "runtime/deoptimization.hpp"
40 #include "runtime/handles.inline.hpp"
41 #include "runtime/os.hpp"
42 #include "runtime/safepointVerifiers.hpp"
43 #include "runtime/sharedRuntime.hpp"
44 #include "runtime/vmOperations.hpp"
45 #include "utilities/sizes.hpp"
46
47 bool AOTLib::_narrow_oop_shift_initialized = false;
48 int AOTLib::_narrow_oop_shift = 0;
49 int AOTLib::_narrow_klass_shift = 0;
50
51 address AOTLib::load_symbol(const char *name) {
52 address symbol = (address) os::dll_lookup(_dl_handle, name);
53 if (symbol == NULL) {
54 tty->print_cr("Shared file %s error: missing %s", _name, name);
55 vm_exit(1);
56 }
57 return symbol;
58 }
59
715 }
716 }
717
718 void AOTCodeHeap::sweep_dependent_methods(int* indexes, int methods_cnt) {
719 int marked = 0;
720 for (int i = 0; i < methods_cnt; ++i) {
721 int code_id = indexes[i];
722 // Invalidate aot code.
723 if (Atomic::cmpxchg(invalid, &_code_to_aot[code_id]._state, not_set) != not_set) {
724 if (_code_to_aot[code_id]._state == in_use) {
725 AOTCompiledMethod* aot = _code_to_aot[code_id]._aot;
726 assert(aot != NULL, "aot should be set");
727 if (!aot->is_runtime_stub()) { // Something is wrong - should not invalidate stubs.
728 aot->mark_for_deoptimization(false);
729 marked++;
730 }
731 }
732 }
733 }
734 if (marked > 0) {
735 Deoptimization::deoptimize_all_marked();
736 }
737 }
738
739 void AOTCodeHeap::sweep_dependent_methods(AOTKlassData* klass_data) {
740 // Make dependent methods non_entrant forever.
741 int methods_offset = klass_data->_dependent_methods_offset;
742 if (methods_offset >= 0) {
743 address methods_cnt_adr = _dependencies + methods_offset;
744 int methods_cnt = *(int*)methods_cnt_adr;
745 int* indexes = (int*)(methods_cnt_adr + 4);
746 sweep_dependent_methods(indexes, methods_cnt);
747 }
748 }
749
750 void AOTCodeHeap::sweep_dependent_methods(InstanceKlass* ik) {
751 AOTKlassData* klass_data = find_klass(ik);
752 vmassert(klass_data != NULL, "dependency data missing");
753 sweep_dependent_methods(klass_data);
754 }
755
|