callbacks: Member functions should be const
This commit is contained in:
parent
9f2f08db8d
commit
bfd3e30c75
2 changed files with 10 additions and 10 deletions
|
@ -9,23 +9,23 @@
|
||||||
|
|
||||||
namespace Dynarmic::BackendX64 {
|
namespace Dynarmic::BackendX64 {
|
||||||
|
|
||||||
void SimpleCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) {
|
void SimpleCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) const {
|
||||||
l({code.ABI_PARAM1, code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
l({code.ABI_PARAM1, code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
||||||
code.CallFunction(fn);
|
code.CallFunction(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) {
|
void SimpleCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) const {
|
||||||
l(code.ABI_PARAM1, {code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
l(code.ABI_PARAM1, {code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
||||||
code.CallFunction(fn);
|
code.CallFunction(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArgCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) {
|
void ArgCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) const {
|
||||||
l({code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
l({code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
||||||
code.mov(code.ABI_PARAM1, arg);
|
code.mov(code.ABI_PARAM1, arg);
|
||||||
code.CallFunction(fn);
|
code.CallFunction(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArgCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) {
|
void ArgCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) const {
|
||||||
#if defined(WIN32) && !defined(__MINGW64__)
|
#if defined(WIN32) && !defined(__MINGW64__)
|
||||||
l(code.ABI_PARAM2, {code.ABI_PARAM3, code.ABI_PARAM4});
|
l(code.ABI_PARAM2, {code.ABI_PARAM3, code.ABI_PARAM4});
|
||||||
code.mov(code.ABI_PARAM1, arg);
|
code.mov(code.ABI_PARAM1, arg);
|
||||||
|
|
|
@ -23,8 +23,8 @@ class Callback {
|
||||||
public:
|
public:
|
||||||
virtual ~Callback() = default;
|
virtual ~Callback() = default;
|
||||||
|
|
||||||
virtual void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) = 0;
|
virtual void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) const = 0;
|
||||||
virtual void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) = 0;
|
virtual void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SimpleCallback final : public Callback {
|
class SimpleCallback final : public Callback {
|
||||||
|
@ -34,8 +34,8 @@ public:
|
||||||
|
|
||||||
~SimpleCallback() override = default;
|
~SimpleCallback() override = default;
|
||||||
|
|
||||||
void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) override;
|
void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) const override;
|
||||||
void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) override;
|
void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void (*fn)();
|
void (*fn)();
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
~ArgCallback() override = default;
|
~ArgCallback() override = default;
|
||||||
|
|
||||||
void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) override;
|
void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) const override;
|
||||||
void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) override;
|
void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void (*fn)();
|
void (*fn)();
|
||||||
|
|
Loading…
Reference in a new issue