Skip to content

Commit

Permalink
Remove common-case opt. Need add_decode_info for new encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav92003 committed Dec 19, 2024
1 parent 8dc950c commit 160e052
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
17 changes: 6 additions & 11 deletions clients/drcachesim/tools/invariant_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,21 +782,16 @@ invariant_checker_t::parallel_shard_memref(void *shard_data, const memref_t &mem
if (shard->error_ != "")
return false;
}
shard->error_ = shard->decode_cache_->add_decode_info(memref.instr);
if (shard->error_ != "") {
return false;
}
// The decode_info returned here will never be nullptr since we
// return early if the prior add_decode_info returned an error.
per_shard_t::decoding_info_t *decode_info =
shard->decode_cache_->get_decode_info(
reinterpret_cast<app_pc>(memref.instr.addr));
if (decode_info == nullptr) {
shard->error_ = shard->decode_cache_->add_decode_info(memref.instr);
if (shard->error_ != "") {
return false;
}
// The decode_info returned here will never be nullptr since we
// return early if the prior add_decode_info returned an error.
decode_info = shard->decode_cache_->get_decode_info(
reinterpret_cast<app_pc>(memref.instr.addr));
}
cur_instr_info.decoding = *decode_info;

#ifdef X86
if (cur_instr_info.decoding.opcode_ == OP_sti)
shard->instrs_since_sti = 0;
Expand Down
18 changes: 7 additions & 11 deletions clients/drcachesim/tools/opcode_mix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,14 @@ opcode_mix_t::parallel_shard_memref(void *shard_data, const memref_t &memref)
}

++shard->instr_count;

app_pc trace_pc = reinterpret_cast<app_pc>(memref.instr.addr);
opcode_data_t *opcode_data = shard->decode_cache->get_decode_info(trace_pc);
if (opcode_data == nullptr) {
shard->error = shard->decode_cache->add_decode_info(memref.instr);
if (shard->error != "") {
return false;
}
// The opcode_data returned here will never be nullptr since we
// return early if the prior add_decode_info returned an error.
opcode_data = shard->decode_cache->get_decode_info(trace_pc);
shard->error = shard->decode_cache->add_decode_info(memref.instr);
if (shard->error != "") {
return false;
}
// The opcode_data returned here will never be nullptr since we
// return early if the prior add_decode_info returned an error.
opcode_data_t *opcode_data =
shard->decode_cache->get_decode_info(reinterpret_cast<app_pc>(memref.instr.addr));
++shard->opcode_counts[opcode_data->opcode_];
++shard->category_counts[opcode_data->category_];
return true;
Expand Down

0 comments on commit 160e052

Please sign in to comment.