< prev index next >

src/hotspot/share/aot/aotCodeHeap.cpp

Print this page
rev 54936 : [mq]: 8221734-v3


  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 "memory/universe.hpp"
  39 #include "oops/compressedOops.hpp"
  40 #include "oops/method.inline.hpp"

  41 #include "runtime/handles.inline.hpp"
  42 #include "runtime/os.hpp"
  43 #include "runtime/safepointVerifiers.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/vmOperations.hpp"
  46 #include "utilities/sizes.hpp"
  47 
  48 bool AOTLib::_narrow_oop_shift_initialized = false;
  49 int  AOTLib::_narrow_oop_shift = 0;
  50 int  AOTLib::_narrow_klass_shift = 0;
  51 
  52 address AOTLib::load_symbol(const char *name) {
  53   address symbol = (address) os::dll_lookup(_dl_handle, name);
  54   if (symbol == NULL) {
  55     tty->print_cr("Shared file %s error: missing %s", _name, name);
  56     vm_exit(1);
  57   }
  58   return symbol;
  59 }
  60 


 716   }
 717 }
 718 
 719 void AOTCodeHeap::sweep_dependent_methods(int* indexes, int methods_cnt) {
 720   int marked = 0;
 721   for (int i = 0; i < methods_cnt; ++i) {
 722     int code_id = indexes[i];
 723     // Invalidate aot code.
 724     if (Atomic::cmpxchg(invalid, &_code_to_aot[code_id]._state, not_set) != not_set) {
 725       if (_code_to_aot[code_id]._state == in_use) {
 726         AOTCompiledMethod* aot = _code_to_aot[code_id]._aot;
 727         assert(aot != NULL, "aot should be set");
 728         if (!aot->is_runtime_stub()) { // Something is wrong - should not invalidate stubs.
 729           aot->mark_for_deoptimization(false);
 730           marked++;
 731         }
 732       }
 733     }
 734   }
 735   if (marked > 0) {
 736     VM_Deoptimize op;
 737     VMThread::execute(&op);
 738   }
 739 }
 740 
 741 void AOTCodeHeap::sweep_dependent_methods(AOTKlassData* klass_data) {
 742   // Make dependent methods non_entrant forever.
 743   int methods_offset = klass_data->_dependent_methods_offset;
 744   if (methods_offset >= 0) {
 745     address methods_cnt_adr = _dependencies + methods_offset;
 746     int methods_cnt = *(int*)methods_cnt_adr;
 747     int* indexes = (int*)(methods_cnt_adr + 4);
 748     sweep_dependent_methods(indexes, methods_cnt);
 749   }
 750 }
 751 
 752 void AOTCodeHeap::sweep_dependent_methods(InstanceKlass* ik) {
 753   AOTKlassData* klass_data = find_klass(ik);
 754   vmassert(klass_data != NULL, "dependency data missing");
 755   sweep_dependent_methods(klass_data);
 756 }
 757 




  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 "memory/universe.hpp"
  39 #include "oops/compressedOops.hpp"
  40 #include "oops/method.inline.hpp"
  41 #include "runtime/deoptimization.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/os.hpp"
  44 #include "runtime/safepointVerifiers.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 #include "runtime/vmOperations.hpp"
  47 #include "utilities/sizes.hpp"
  48 
  49 bool AOTLib::_narrow_oop_shift_initialized = false;
  50 int  AOTLib::_narrow_oop_shift = 0;
  51 int  AOTLib::_narrow_klass_shift = 0;
  52 
  53 address AOTLib::load_symbol(const char *name) {
  54   address symbol = (address) os::dll_lookup(_dl_handle, name);
  55   if (symbol == NULL) {
  56     tty->print_cr("Shared file %s error: missing %s", _name, name);
  57     vm_exit(1);
  58   }
  59   return symbol;
  60 }
  61 


 717   }
 718 }
 719 
 720 void AOTCodeHeap::sweep_dependent_methods(int* indexes, int methods_cnt) {
 721   int marked = 0;
 722   for (int i = 0; i < methods_cnt; ++i) {
 723     int code_id = indexes[i];
 724     // Invalidate aot code.
 725     if (Atomic::cmpxchg(invalid, &_code_to_aot[code_id]._state, not_set) != not_set) {
 726       if (_code_to_aot[code_id]._state == in_use) {
 727         AOTCompiledMethod* aot = _code_to_aot[code_id]._aot;
 728         assert(aot != NULL, "aot should be set");
 729         if (!aot->is_runtime_stub()) { // Something is wrong - should not invalidate stubs.
 730           aot->mark_for_deoptimization(false);
 731           marked++;
 732         }
 733       }
 734     }
 735   }
 736   if (marked > 0) {
 737     Deoptimization::deoptimize_all_marked();

 738   }
 739 }
 740 
 741 void AOTCodeHeap::sweep_dependent_methods(AOTKlassData* klass_data) {
 742   // Make dependent methods non_entrant forever.
 743   int methods_offset = klass_data->_dependent_methods_offset;
 744   if (methods_offset >= 0) {
 745     address methods_cnt_adr = _dependencies + methods_offset;
 746     int methods_cnt = *(int*)methods_cnt_adr;
 747     int* indexes = (int*)(methods_cnt_adr + 4);
 748     sweep_dependent_methods(indexes, methods_cnt);
 749   }
 750 }
 751 
 752 void AOTCodeHeap::sweep_dependent_methods(InstanceKlass* ik) {
 753   AOTKlassData* klass_data = find_klass(ik);
 754   vmassert(klass_data != NULL, "dependency data missing");
 755   sweep_dependent_methods(klass_data);
 756 }
 757 


< prev index next >