mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Interpreter_Tables: Ensure all instructions fit within m_allInstruction at compile-time
This commit is contained in:
parent
6c61021eb1
commit
06488477a9
@ -4,7 +4,6 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||
#include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
|
||||
@ -358,6 +357,15 @@ static std::array<GekkoOPTemplate, 10> table63_2 =
|
||||
|
||||
namespace InterpreterTables
|
||||
{
|
||||
constexpr size_t TotalInstructionFunctionCount()
|
||||
{
|
||||
return primarytable.size() + table4_2.size() + table4_3.size() + table4.size() + table31.size() +
|
||||
table19.size() + table59.size() + table63.size() + table63_2.size();
|
||||
}
|
||||
|
||||
static_assert(TotalInstructionFunctionCount() < m_allInstructions.size(),
|
||||
"m_allInstructions is too small");
|
||||
|
||||
void InitTables()
|
||||
{
|
||||
// once initialized, tables are read-only
|
||||
@ -484,11 +492,6 @@ void InitTables()
|
||||
for (auto& tpl : table63_2)
|
||||
m_allInstructions[m_numInstructions++] = &tpl.opinfo;
|
||||
|
||||
if (m_numInstructions >= 512)
|
||||
{
|
||||
PanicAlert("m_allInstructions underdimensioned");
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user