Skip to content

Commit

Permalink
Use ordered map for commit log
Browse files Browse the repository at this point in the history
In general, unordered maps should not be used for iteration, only for
lookups.

In this case, using an ordered map guarantees that the order in which
writes are logged is consistent for a given instruction.

Resolves #1499
  • Loading branch information
aswaterman committed Aug 9, 2024
1 parent 91793ed commit 8b05d84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion riscv/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct insn_desc_t
};

// regnum, data
typedef std::unordered_map<reg_t, freg_t> commit_log_reg_t;
typedef std::map<reg_t, freg_t> commit_log_reg_t;

// addr, value, size
typedef std::vector<std::tuple<reg_t, uint64_t, uint8_t>> commit_log_mem_t;
Expand Down

0 comments on commit 8b05d84

Please sign in to comment.