345 return; |
345 return; |
346 } |
346 } |
347 AOTCompiledMethod *aot = new AOTCompiledMethod(code, mh(), meta, metadata_table, metadata_size, state_adr, this, name, code_id, _aot_id); |
347 AOTCompiledMethod *aot = new AOTCompiledMethod(code, mh(), meta, metadata_table, metadata_size, state_adr, this, name, code_id, _aot_id); |
348 assert(_code_to_aot[code_id]._aot == NULL, "should be not initialized"); |
348 assert(_code_to_aot[code_id]._aot == NULL, "should be not initialized"); |
349 _code_to_aot[code_id]._aot = aot; // Should set this first |
349 _code_to_aot[code_id]._aot = aot; // Should set this first |
350 if (Atomic::cmpxchg(in_use, &_code_to_aot[code_id]._state, not_set) != not_set) { |
350 if (Atomic::cmpxchg(&_code_to_aot[code_id]._state, not_set, in_use) != not_set) { |
351 _code_to_aot[code_id]._aot = NULL; // Clean |
351 _code_to_aot[code_id]._aot = NULL; // Clean |
352 } else { // success |
352 } else { // success |
353 // Publish method |
353 // Publish method |
354 #ifdef TIERED |
354 #ifdef TIERED |
355 mh->set_aot_code(aot); |
355 mh->set_aot_code(aot); |
408 full_name[len+4] = 0; |
408 full_name[len+4] = 0; |
409 guarantee(_code_to_aot[code_id]._state != invalid, "stub %s can't be invalidated", full_name); |
409 guarantee(_code_to_aot[code_id]._state != invalid, "stub %s can't be invalidated", full_name); |
410 AOTCompiledMethod* aot = new AOTCompiledMethod(entry, NULL, meta, metadata_table, metadata_size, state_adr, this, full_name, code_id, i); |
410 AOTCompiledMethod* aot = new AOTCompiledMethod(entry, NULL, meta, metadata_table, metadata_size, state_adr, this, full_name, code_id, i); |
411 assert(_code_to_aot[code_id]._aot == NULL, "should be not initialized"); |
411 assert(_code_to_aot[code_id]._aot == NULL, "should be not initialized"); |
412 _code_to_aot[code_id]._aot = aot; |
412 _code_to_aot[code_id]._aot = aot; |
413 if (Atomic::cmpxchg(in_use, &_code_to_aot[code_id]._state, not_set) != not_set) { |
413 if (Atomic::cmpxchg(&_code_to_aot[code_id]._state, not_set, in_use) != not_set) { |
414 fatal("stab '%s' code state is %d", full_name, _code_to_aot[code_id]._state); |
414 fatal("stab '%s' code state is %d", full_name, _code_to_aot[code_id]._state); |
415 } |
415 } |
416 // Adjust code buffer boundaries only for stubs because they are last in the buffer. |
416 // Adjust code buffer boundaries only for stubs because they are last in the buffer. |
417 adjust_boundaries(aot); |
417 adjust_boundaries(aot); |
418 if (PrintAOT && Verbose) { |
418 if (PrintAOT && Verbose) { |
719 void AOTCodeHeap::sweep_dependent_methods(int* indexes, int methods_cnt) { |
719 void AOTCodeHeap::sweep_dependent_methods(int* indexes, int methods_cnt) { |
720 int marked = 0; |
720 int marked = 0; |
721 for (int i = 0; i < methods_cnt; ++i) { |
721 for (int i = 0; i < methods_cnt; ++i) { |
722 int code_id = indexes[i]; |
722 int code_id = indexes[i]; |
723 // Invalidate aot code. |
723 // Invalidate aot code. |
724 if (Atomic::cmpxchg(invalid, &_code_to_aot[code_id]._state, not_set) != not_set) { |
724 if (Atomic::cmpxchg(&_code_to_aot[code_id]._state, not_set, invalid) != not_set) { |
725 if (_code_to_aot[code_id]._state == in_use) { |
725 if (_code_to_aot[code_id]._state == in_use) { |
726 AOTCompiledMethod* aot = _code_to_aot[code_id]._aot; |
726 AOTCompiledMethod* aot = _code_to_aot[code_id]._aot; |
727 assert(aot != NULL, "aot should be set"); |
727 assert(aot != NULL, "aot should be set"); |
728 if (!aot->is_runtime_stub()) { // Something is wrong - should not invalidate stubs. |
728 if (!aot->is_runtime_stub()) { // Something is wrong - should not invalidate stubs. |
729 aot->mark_for_deoptimization(false); |
729 aot->mark_for_deoptimization(false); |