@@ -1001,6 +1001,33 @@ Commit::commit()
10011001 std::list<ThreadID>::iterator end = activeThreads->end ();
10021002
10031003 int num_squashing_threads = 0 ;
1004+ auto hasYoungerInflight = [&](ThreadID tid, InstSeqNum squashed_seq,
1005+ bool include_squash_inst) {
1006+ const InstSeqNum cutoff =
1007+ include_squash_inst ? squashed_seq - 1 : squashed_seq;
1008+
1009+ if (cutoff <= youngestSeqNum[tid]) {
1010+ return true ;
1011+ }
1012+
1013+ for (const auto &inst : fixedbuffer[tid]) {
1014+ if (inst && !inst->isSquashed () && inst->seqNum > cutoff) {
1015+ return true ;
1016+ }
1017+ }
1018+
1019+ for (int i = 0 ; i < fromRename->size ; ++i) {
1020+ const auto &inst = fromRename->insts [i];
1021+ if (!inst || inst->threadNumber != tid || inst->isSquashed ()) {
1022+ continue ;
1023+ }
1024+ if (inst->seqNum > cutoff) {
1025+ return true ;
1026+ }
1027+ }
1028+
1029+ return false ;
1030+ };
10041031
10051032 while (threads != end) {
10061033 ThreadID tid = *threads++;
@@ -1030,11 +1057,14 @@ Commit::commit()
10301057 // Squashed sequence number must be older than youngest valid
10311058 // instruction in the ROB. This prevents squashes from younger
10321059 // instructions overriding squashes from older instructions.
1060+ const bool has_younger_inflight =
1061+ hasYoungerInflight (tid, fromIEW->squashedSeqNum [tid],
1062+ fromIEW->includeSquashInst [tid]);
10331063 DPRINTF (Commit, " fromIEW->squash %d, commitStatus %d, fromIEW->squashedSeqNum %d, youngestSeqNum %d\n " ,
10341064 fromIEW->squash [tid], commitStatus[tid], fromIEW->squashedSeqNum [tid], youngestSeqNum[tid]);
10351065 if (fromIEW->squash [tid] &&
10361066 commitStatus[tid] != TrapPending &&
1037- fromIEW-> squashedSeqNum [tid] <= youngestSeqNum[tid] ) {
1067+ has_younger_inflight ) {
10381068
10391069 if (fromIEW->mispredictInst [tid]) {
10401070 DPRINTF (Commit,
@@ -1212,9 +1242,9 @@ Commit::commitInsts()
12121242 continue ;
12131243 }
12141244
1215- while (num_committed < commit_width &&
1216- num_committed_per_thread[commit_thread] <
1217- commit_width_per_thread[commit_thread]) {
1245+ while (num_committed < commit_width &&
1246+ num_committed_per_thread[commit_thread] <
1247+ commit_width_per_thread[commit_thread]) {
12181248 // hardware transactionally memory
12191249 // If executing within a transaction,
12201250 // need to handle interrupts specially
@@ -1453,6 +1483,11 @@ Commit::commitInsts()
14531483
14541484 }
14551485
1486+ if (head_inst->isReadBarrier () ||
1487+ head_inst->isWriteBarrier ()) {
1488+ cpu->armSyncVisibleStoreReplay (tid);
1489+ }
1490+
14561491 if (cpu->difftestEnabled ()) {
14571492 diffInst (tid, head_inst);
14581493 }
@@ -1651,7 +1686,7 @@ Commit::commitHead(const DynInstPtr &head_inst, unsigned inst_num)
16511686 // race with the TLB invalidation.
16521687 if ((head_inst->isMemRef () || head_inst->isReturn () ||
16531688 head_inst->isReadBarrier () || head_inst->isWriteBarrier ()) &&
1654- (inst_num > 0 || !iewStage->flushStores (tid))) {
1689+ (inst_num > 0 || !iewStage->flushStores (tid, head_inst-> seqNum ))) {
16551690 DPRINTF (Commit,
16561691 " [tid:%i] [sn:%llu] "
16571692 " Waiting for all stores to writeback.\n " ,
@@ -1705,7 +1740,7 @@ Commit::commitHead(const DynInstPtr &head_inst, unsigned inst_num)
17051740
17061741 if (inst_fault != NoFault) {
17071742 traceLogInstFault (head_inst, inst_fault);
1708- if (!iewStage->flushStores (tid) || inst_num > 0 ) {
1743+ if (!iewStage->flushStores (tid, head_inst-> seqNum ) || inst_num > 0 ) {
17091744 DPRINTF (Commit,
17101745 " [tid:%i] [sn:%llu] "
17111746 " Stores outstanding, fault must wait.\n " ,
0 commit comments