From dc2a26582fa2ec0bace78f6fcdecd22873d685df Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 16 Sep 2024 18:19:55 -0700 Subject: [PATCH] FEXCore/OpcodeDispatcher: Fixes missing static on some tables This was causing egregious stack usage in these two functions --- .../Interface/Core/OpcodeDispatcher.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp index 5750b1a86f..681d4072e0 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp @@ -4950,18 +4950,18 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { constexpr uint16_t PF_38_66 = (1U << 0); constexpr uint16_t PF_38_F2 = (1U << 1); - constexpr std::tuple H0F38_SHA[] = { + constexpr static std::tuple H0F38_SHA[] = { {OPD(PF_38_NONE, 0xC8), 1, &OpDispatchBuilder::SHA1NEXTEOp}, {OPD(PF_38_NONE, 0xC9), 1, &OpDispatchBuilder::SHA1MSG1Op}, {OPD(PF_38_NONE, 0xCA), 1, &OpDispatchBuilder::SHA1MSG2Op}, {OPD(PF_38_NONE, 0xCB), 1, &OpDispatchBuilder::SHA256RNDS2Op}, {OPD(PF_38_NONE, 0xCC), 1, &OpDispatchBuilder::SHA256MSG1Op}, {OPD(PF_38_NONE, 0xCD), 1, &OpDispatchBuilder::SHA256MSG2Op}, }; - constexpr std::tuple H0F38_AES[] = { + constexpr static std::tuple H0F38_AES[] = { {OPD(PF_38_66, 0xDB), 1, &OpDispatchBuilder::AESImcOp}, {OPD(PF_38_66, 0xDC), 1, &OpDispatchBuilder::AESEncOp}, {OPD(PF_38_66, 0xDD), 1, &OpDispatchBuilder::AESEncLastOp}, {OPD(PF_38_66, 0xDE), 1, &OpDispatchBuilder::AESDecOp}, {OPD(PF_38_66, 0xDF), 1, &OpDispatchBuilder::AESDecLastOp}, }; - constexpr std::tuple H0F38_CRC[] = { + constexpr static std::tuple H0F38_CRC[] = { {OPD(PF_38_F2, 0xF0), 1, &OpDispatchBuilder::CRC32}, {OPD(PF_38_F2, 0xF1), 1, &OpDispatchBuilder::CRC32}, @@ -4973,10 +4973,10 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { #define OPD(REX, prefix, opcode) ((REX << 9) | (prefix << 8) | opcode) #define PF_3A_NONE 0 #define PF_3A_66 1 - constexpr std::tuple H0F3A_AES[] = { + constexpr static std::tuple H0F3A_AES[] = { {OPD(0, PF_3A_66, 0xDF), 1, &OpDispatchBuilder::AESKeyGenAssist}, }; - constexpr std::tuple H0F3A_PCLMUL[] = { + constexpr static std::tuple H0F3A_PCLMUL[] = { {OPD(0, PF_3A_66, 0x44), 1, &OpDispatchBuilder::PCLMULQDQOp}, }; @@ -4985,7 +4985,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { #undef OPD #define OPD(map_select, pp, opcode) (((map_select - 1) << 10) | (pp << 8) | (opcode)) - constexpr std::tuple VEX_PCLMUL[] = { + constexpr static std::tuple VEX_PCLMUL[] = { {OPD(3, 0b01, 0x44), 1, &OpDispatchBuilder::VPCLMULQDQOp}, }; #undef OPD @@ -4994,7 +4994,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { constexpr uint16_t PF_NONE = 0; constexpr uint16_t PF_66 = 2; - constexpr std::tuple SecondaryExtensionOp_RDRAND[] = { + constexpr static std::tuple SecondaryExtensionOp_RDRAND[] = { // GROUP 9 {OPD(FEXCore::X86Tables::TYPE_GROUP_9, PF_NONE, 6), 1, &OpDispatchBuilder::RDRANDOp}, {OPD(FEXCore::X86Tables::TYPE_GROUP_9, PF_NONE, 7), 1, &OpDispatchBuilder::RDRANDOp}, @@ -5004,7 +5004,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { }; #undef OPD - constexpr std::tuple SecondaryModRMExtensionOp_CLZero[] = { + constexpr static std::tuple SecondaryModRMExtensionOp_CLZero[] = { {((3 << 3) | 4), 1, &OpDispatchBuilder::CLZeroOp}, }; @@ -5470,7 +5470,7 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { // All OPDReg versions need it #define OPDReg(op, reg) ((1 << 15) | ((op - 0xD8) << 8) | (reg << 3)) #define OPD(op, modrmop) (((op - 0xD8) << 8) | modrmop) - constexpr std::tuple X87F64OpTable[] = { + constexpr static std::tuple X87F64OpTable[] = { {OPDReg(0xD8, 0) | 0x00, 8, &OpDispatchBuilder::Bind<&OpDispatchBuilder::FADDF64, 32, false, OpDispatchBuilder::OpResult::RES_ST0>}, {OPDReg(0xD8, 1) | 0x00, 8, &OpDispatchBuilder::Bind<&OpDispatchBuilder::FMULF64, 32, false, OpDispatchBuilder::OpResult::RES_ST0>}, @@ -5700,7 +5700,7 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {OPD(0xDF, 0xF0), 8, &OpDispatchBuilder::Bind<&OpDispatchBuilder::FCOMIF64, 80, false, OpDispatchBuilder::FCOMIFlags::FLAGS_RFLAGS, false>}, }; - constexpr std::tuple X87OpTable[] = { + constexpr static std::tuple X87OpTable[] = { {OPDReg(0xD8, 0) | 0x00, 8, &OpDispatchBuilder::Bind<&OpDispatchBuilder::FADD, 32, false, OpDispatchBuilder::OpResult::RES_ST0>}, {OPDReg(0xD8, 1) | 0x00, 8, &OpDispatchBuilder::Bind<&OpDispatchBuilder::FMUL, 32, false, OpDispatchBuilder::OpResult::RES_ST0>},