Patch after reviewing

This commit is contained in:
Thonnat 2017-06-06 10:33:30 +02:00
parent 080cdb35d8
commit b86a069083
13 changed files with 18 additions and 21 deletions

View File

@ -41,7 +41,7 @@ __declspec(noinline, noreturn)
} \ } \
while (0) while (0)
#define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") #define UNREACHABLE() assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!""Unreachable code!"); })
#define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__) #define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__)
#ifdef _DEBUG #ifdef _DEBUG

View File

@ -89,7 +89,6 @@ const char* GetLogClassName(Class log_class) {
case Class::Count: case Class::Count:
default: default:
UNREACHABLE(); UNREACHABLE();
return {};
} }
} }
@ -107,7 +106,6 @@ const char* GetLevelName(Level log_level) {
case Level::Count: case Level::Count:
default: default:
UNREACHABLE(); UNREACHABLE();
return {};
} }
#undef LVL #undef LVL
} }

View File

@ -248,7 +248,7 @@ public:
z -= other.z; z -= other.z;
} }
template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type>
Vec3<decltype(-T{})> operator-() const { Vec3<decltype(-Q{})> operator-() const {
return MakeVec(-x, -y, -z); return MakeVec(-x, -y, -z);
} }
Vec3<decltype(T{} * T{})> operator*(const Vec3& other) const { Vec3<decltype(T{} * T{})> operator*(const Vec3& other) const {
@ -463,7 +463,7 @@ public:
w -= other.w; w -= other.w;
} }
template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type>
Vec4<decltype(-T{})> operator-() const { Vec4<decltype(-Q{})> operator-() const {
return MakeVec(-x, -y, -z, -w); return MakeVec(-x, -y, -z, -w);
} }
Vec4<decltype(T{} * T{})> operator*(const Vec4& other) const { Vec4<decltype(T{} * T{})> operator*(const Vec4& other) const {

View File

@ -125,7 +125,7 @@ public:
* Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time) * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
* @param ticks Number of ticks to advance the CPU core * @param ticks Number of ticks to advance the CPU core
*/ */
virtual void AddTicks(size_t ticks) = 0; virtual void AddTicks(u64 ticks) = 0;
/** /**
* Saves the current CPU context * Saves the current CPU context

View File

@ -124,7 +124,7 @@ void ARM_Dynarmic::SetCP15Register(CP15Register reg, u32 value) {
interpreter_state->CP15[reg] = value; interpreter_state->CP15[reg] = value;
} }
void ARM_Dynarmic::AddTicks(size_t ticks) { void ARM_Dynarmic::AddTicks(u64 ticks) {
down_count -= ticks; down_count -= ticks;
if (down_count < 0) { if (down_count < 0) {
CoreTiming::Advance(); CoreTiming::Advance();
@ -136,7 +136,7 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64));
void ARM_Dynarmic::ExecuteInstructions(int num_instructions) { void ARM_Dynarmic::ExecuteInstructions(int num_instructions) {
MICROPROFILE_SCOPE(ARM_Jit); MICROPROFILE_SCOPE(ARM_Jit);
size_t ticks_executed = jit->Run(static_cast<unsigned>(num_instructions)); u64 ticks_executed = jit->Run(static_cast<unsigned>(num_instructions));
AddTicks(ticks_executed); AddTicks(ticks_executed);
} }

View File

@ -27,7 +27,7 @@ public:
u32 GetCP15Register(CP15Register reg) override; u32 GetCP15Register(CP15Register reg) override;
void SetCP15Register(CP15Register reg, u32 value) override; void SetCP15Register(CP15Register reg, u32 value) override;
void AddTicks(size_t ticks) override; void AddTicks(u64 ticks) override;
void SaveContext(ThreadContext& ctx) override; void SaveContext(ThreadContext& ctx) override;
void LoadContext(const ThreadContext& ctx) override; void LoadContext(const ThreadContext& ctx) override;

View File

@ -759,7 +759,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins
ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size); ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size);
if (ret == ThumbDecodeStatus::BRANCH) { if (ret == ThumbDecodeStatus::BRANCH) {
int inst_index; int inst_index;
int table_length = static_cast<int>(arm_instruction_trans_len); size_t table_length = arm_instruction_trans_len;
u32 tinstr = GetThumbInstruction(inst, addr); u32 tinstr = GetThumbInstruction(inst, addr);
switch ((tinstr & 0xF800) >> 11) { switch ((tinstr & 0xF800) >> 11) {
@ -848,7 +848,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr)
ARM_INST_PTR inst_base = nullptr; ARM_INST_PTR inst_base = nullptr;
TransExtData ret = TransExtData::NON_BRANCH; TransExtData ret = TransExtData::NON_BRANCH;
int size = 0; // instruction size of basic block int size = 0; // instruction size of basic block
bb_start = static_cast<int>(trans_cache_buf_top); bb_start = trans_cache_buf_top;
u32 phys_addr = addr; u32 phys_addr = addr;
u32 pc_start = cpu->Reg[15]; u32 pc_start = cpu->Reg[15];

View File

@ -18,7 +18,7 @@ enum class TransExtData {
SINGLE_STEP = (1 << 8) SINGLE_STEP = (1 << 8)
}; };
#ifdef _WIN32 #ifdef _MSC_VER
#pragma warning( push ) #pragma warning( push )
#pragma warning( disable : 4200) #pragma warning( disable : 4200)
#endif // WIN #endif // WIN
@ -28,7 +28,7 @@ struct arm_inst {
TransExtData br; TransExtData br;
char component[0]; char component[0];
}; };
#ifdef _WIN32 #ifdef _MSC_VER
#pragma warning( pop ) #pragma warning( pop )
#endif // WIN #endif // WIN

View File

@ -90,8 +90,7 @@ std::u16string Path::AsU16Str() const {
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return {}; return {};
default: default:
LOG_ERROR(Service_FS, "Bad conversion type for LowPathType!"); UNREACHABLE();
return {};
} }
} }

View File

@ -83,8 +83,8 @@ union Header {
* @note While @p normal_params_size is equivalent to the number of normal parameters, * @note While @p normal_params_size is equivalent to the number of normal parameters,
* @p translate_params_size includes the size occupied by the translate parameters headers. * @p translate_params_size includes the size occupied by the translate parameters headers.
*/ */
inline u32 MakeHeader(u16 command_id, u32 normal_params_size, inline u32 MakeHeader(u16 command_id, unsigned int normal_params_size,
u32 translate_params_size) { unsigned int translate_params_size) {
Header header{}; Header header{};
header.command_id.Assign(command_id); header.command_id.Assign(command_id);
header.normal_params_size.Assign(normal_params_size); header.normal_params_size.Assign(normal_params_size);

View File

@ -522,7 +522,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) {
context.cpu_registers[1] = output; context.cpu_registers[1] = output;
} }
s64 Thread::GetWaitObjectIndex(WaitObject* object) const { size_t Thread::GetWaitObjectIndex(WaitObject* object) const {
ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything");
auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object);
return std::distance(match, wait_objects.rend()) - 1; return std::distance(match, wait_objects.rend()) - 1;

View File

@ -142,7 +142,7 @@ public:
* object in the list. * object in the list.
* @param object Object to query the index of. * @param object Object to query the index of.
*/ */
s64 GetWaitObjectIndex(WaitObject* object) const; size_t GetWaitObjectIndex(WaitObject* object) const;
/** /**
* Stops a thread, invalidating it from further use * Stops a thread, invalidating it from further use

View File

@ -259,7 +259,7 @@ struct FramebufferRegs {
default: default:
LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format); LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format);
UNIMPLEMENTED(); UNIMPLEMENTED();
return -1; return 0;
} }
} }
@ -274,7 +274,7 @@ struct FramebufferRegs {
default: default:
LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format); LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format);
UNIMPLEMENTED(); UNIMPLEMENTED();
return -1; return 0;
} }
} }