mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 12:07:44 +00:00
LibX86: Don't build_opcode_table_if_needed() every instruction decode
Instead, just do this once at startup. :^)
This commit is contained in:
parent
2f81c20002
commit
7ea36f5ed0
2 changed files with 1 additions and 10 deletions
|
@ -257,12 +257,8 @@ static void build_0f_slash(u8 op, u8 slash, const char* mnemonic, InstructionFor
|
||||||
build_slash(s_0f_table32, op, slash, mnemonic, format, impl, lock_prefix_allowed);
|
build_slash(s_0f_table32, op, slash, mnemonic, format, impl, lock_prefix_allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instruction::build_opcode_tables_if_needed()
|
[[gnu::constructor]] static void build_opcode_tables()
|
||||||
{
|
{
|
||||||
static bool has_built_tables = false;
|
|
||||||
if (has_built_tables)
|
|
||||||
return;
|
|
||||||
|
|
||||||
build(0x00, "ADD", OP_RM8_reg8, &Interpreter::ADD_RM8_reg8, LockPrefixAllowed);
|
build(0x00, "ADD", OP_RM8_reg8, &Interpreter::ADD_RM8_reg8, LockPrefixAllowed);
|
||||||
build(0x01, "ADD", OP_RM16_reg16, &Interpreter::ADD_RM16_reg16, OP_RM32_reg32, &Interpreter::ADD_RM32_reg32, LockPrefixAllowed);
|
build(0x01, "ADD", OP_RM16_reg16, &Interpreter::ADD_RM16_reg16, OP_RM32_reg32, &Interpreter::ADD_RM32_reg32, LockPrefixAllowed);
|
||||||
build(0x02, "ADD", OP_reg8_RM8, &Interpreter::ADD_reg8_RM8, LockPrefixAllowed);
|
build(0x02, "ADD", OP_reg8_RM8, &Interpreter::ADD_reg8_RM8, LockPrefixAllowed);
|
||||||
|
@ -706,8 +702,6 @@ void Instruction::build_opcode_tables_if_needed()
|
||||||
build_0f(0xFD, "PADDW", OP_mm1_mm2m64, &Interpreter::PADDW_mm1_mm2m64);
|
build_0f(0xFD, "PADDW", OP_mm1_mm2m64, &Interpreter::PADDW_mm1_mm2m64);
|
||||||
build_0f(0xFE, "PADDD", OP_mm1_mm2m64, &Interpreter::PADDD_mm1_mm2m64);
|
build_0f(0xFE, "PADDD", OP_mm1_mm2m64, &Interpreter::PADDD_mm1_mm2m64);
|
||||||
build_0f(0xFF, "UD0", OP, &Interpreter::UD0);
|
build_0f(0xFF, "UD0", OP, &Interpreter::UD0);
|
||||||
|
|
||||||
has_built_tables = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* register_name(RegisterIndex8);
|
static const char* register_name(RegisterIndex8);
|
||||||
|
|
|
@ -505,8 +505,6 @@ public:
|
||||||
private:
|
private:
|
||||||
Instruction(InstructionStream&, bool o32, bool a32);
|
Instruction(InstructionStream&, bool o32, bool a32);
|
||||||
|
|
||||||
static void build_opcode_tables_if_needed();
|
|
||||||
|
|
||||||
String to_string_internal(u32 origin, const SymbolProvider*, bool x32) const;
|
String to_string_internal(u32 origin, const SymbolProvider*, bool x32) const;
|
||||||
|
|
||||||
const char* reg8_name() const;
|
const char* reg8_name() const;
|
||||||
|
@ -788,7 +786,6 @@ ALWAYS_INLINE u32 MemoryOrRegisterReference::read32(CPU& cpu, const Instruction&
|
||||||
|
|
||||||
ALWAYS_INLINE Instruction Instruction::from_stream(InstructionStream& stream, bool o32, bool a32)
|
ALWAYS_INLINE Instruction Instruction::from_stream(InstructionStream& stream, bool o32, bool a32)
|
||||||
{
|
{
|
||||||
build_opcode_tables_if_needed();
|
|
||||||
return Instruction(stream, o32, a32);
|
return Instruction(stream, o32, a32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue