< prev index next >

src/hotspot/share/oops/methodData.cpp

Print this page




 879     }
 880     fatal("Adding to failed speculations list that appears to have been freed. Source: %s", st.as_string());
 881   }
 882 }
 883 
 884 bool FailedSpeculation::add_failed_speculation(nmethod* nm, FailedSpeculation** failed_speculations_address, address speculation, int speculation_len) {
 885   assert(failed_speculations_address != NULL, "must be");
 886   size_t fs_size = sizeof(FailedSpeculation) + speculation_len;
 887   FailedSpeculation* fs = new (fs_size) FailedSpeculation(speculation, speculation_len);
 888   if (fs == NULL) {
 889     // no memory -> ignore failed speculation
 890     return false;
 891   }
 892 
 893   guarantee(is_aligned(fs, sizeof(FailedSpeculation*)), "FailedSpeculation objects must be pointer aligned");
 894   guarantee_failed_speculations_alive(nm, failed_speculations_address);
 895 
 896   FailedSpeculation** cursor = failed_speculations_address;
 897   do {
 898     if (*cursor == NULL) {
 899       FailedSpeculation* old_fs = Atomic::cmpxchg(fs, cursor, (FailedSpeculation*) NULL);
 900       if (old_fs == NULL) {
 901         // Successfully appended fs to end of the list
 902         return true;
 903       }
 904       cursor = old_fs->next_adr();
 905     } else {
 906       cursor = (*cursor)->next_adr();
 907     }
 908   } while (true);
 909 }
 910 
 911 void FailedSpeculation::free_failed_speculations(FailedSpeculation** failed_speculations_address) {
 912   assert(failed_speculations_address != NULL, "must be");
 913   FailedSpeculation* fs = *failed_speculations_address;
 914   while (fs != NULL) {
 915     FailedSpeculation* next = fs->next();
 916     delete fs;
 917     fs = next;
 918   }
 919 




 879     }
 880     fatal("Adding to failed speculations list that appears to have been freed. Source: %s", st.as_string());
 881   }
 882 }
 883 
 884 bool FailedSpeculation::add_failed_speculation(nmethod* nm, FailedSpeculation** failed_speculations_address, address speculation, int speculation_len) {
 885   assert(failed_speculations_address != NULL, "must be");
 886   size_t fs_size = sizeof(FailedSpeculation) + speculation_len;
 887   FailedSpeculation* fs = new (fs_size) FailedSpeculation(speculation, speculation_len);
 888   if (fs == NULL) {
 889     // no memory -> ignore failed speculation
 890     return false;
 891   }
 892 
 893   guarantee(is_aligned(fs, sizeof(FailedSpeculation*)), "FailedSpeculation objects must be pointer aligned");
 894   guarantee_failed_speculations_alive(nm, failed_speculations_address);
 895 
 896   FailedSpeculation** cursor = failed_speculations_address;
 897   do {
 898     if (*cursor == NULL) {
 899       FailedSpeculation* old_fs = Atomic::cmpxchg(cursor, (FailedSpeculation*) NULL, fs);
 900       if (old_fs == NULL) {
 901         // Successfully appended fs to end of the list
 902         return true;
 903       }
 904       cursor = old_fs->next_adr();
 905     } else {
 906       cursor = (*cursor)->next_adr();
 907     }
 908   } while (true);
 909 }
 910 
 911 void FailedSpeculation::free_failed_speculations(FailedSpeculation** failed_speculations_address) {
 912   assert(failed_speculations_address != NULL, "must be");
 913   FailedSpeculation* fs = *failed_speculations_address;
 914   while (fs != NULL) {
 915     FailedSpeculation* next = fs->next();
 916     delete fs;
 917     fs = next;
 918   }
 919 


< prev index next >