Skip to content

Commit

Permalink
SPU: improve analyser (v5)
Browse files Browse the repository at this point in the history
Fix jumptable analysis
  • Loading branch information
Nekotekina committed Jul 5, 2018
1 parent 712632d commit afd5af0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rpcs3/Emu/Cell/SPURecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void spu_cache::initialize()
}

// SPU cache file (version + block size type)
const std::string loc = _main->cache + u8"spu-§" + fmt::to_lower(g_cfg.core.spu_block_size.to_string()) + "-v4.dat";
const std::string loc = _main->cache + "spu-" + fmt::to_lower(g_cfg.core.spu_block_size.to_string()) + "-v5.dat";

auto cache = std::make_shared<spu_cache>(loc);

Expand Down Expand Up @@ -556,7 +556,7 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
add_block(pos + 4);
}
}
else if (type == spu_itype::BI && !op.d && !op.e)
else if (type == spu_itype::BI && g_cfg.core.spu_block_size != spu_block_size_type::safe && !op.d && !op.e && !sync)
{
// Analyse jump table (TODO)
std::basic_string<u32> jt_abs;
Expand Down Expand Up @@ -590,6 +590,8 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
if (std::max(jt_abs.size(), jt_rel.size()) * 4 + start <= i)
{
// Neither type of jump table completes
jt_abs.clear();
jt_rel.clear();
break;
}
}
Expand Down Expand Up @@ -619,6 +621,8 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
{
jt_abs.clear();
}

verify(HERE), jt_abs.size() != jt_rel.size();
}

if (jt_abs.size() >= jt_rel.size())
Expand Down Expand Up @@ -685,6 +689,10 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
LOG_WARNING(SPU, "[0x%x] No patterns detected (hbr=0x%x:0x%x)", pos, hbr_loc, hbr_tg);
}
}
else if (type == spu_itype::BI && sync)
{
LOG_NOTICE(SPU, "[0x%x] At 0x%x: ignoring indirect branch (SYNC)", result[0], pos);
}

if (type == spu_itype::BI || sl)
{
Expand Down

0 comments on commit afd5af0

Please sign in to comment.