backend_x64/block_of_code: Reset labels when ClearCache() is called

This commit is contained in:
MerryMage 2016-08-25 02:59:42 +01:00
parent e32812cd00
commit d04b9eaa81
2 changed files with 43 additions and 39 deletions

View file

@ -21,6 +21,8 @@ BlockOfCode::BlockOfCode() : Xbyak::CodeGenerator(128 * 1024 * 1024) {
}
void BlockOfCode::ClearCache(bool poison_memory) {
consts.~Consts();
new (&consts) Consts();
reset();
GenConstants();
GenRunCode();
@ -42,49 +44,49 @@ void BlockOfCode::ReturnFromRunCode(bool MXCSR_switch) {
void BlockOfCode::GenConstants() {
align();
L(const_FloatNegativeZero32);
L(consts.FloatNegativeZero32);
dd(0x80000000u);
align();
L(const_FloatNaN32);
L(consts.FloatNaN32);
dd(0x7fc00000u);
align();
L(const_FloatNonSignMask32);
L(consts.FloatNonSignMask32);
dq(0x7fffffffu);
align();
L(const_FloatNegativeZero64);
L(consts.FloatNegativeZero64);
dq(0x8000000000000000u);
align();
L(const_FloatNaN64);
L(consts.FloatNaN64);
dq(0x7ff8000000000000u);
align();
L(const_FloatNonSignMask64);
L(consts.FloatNonSignMask64);
dq(0x7fffffffffffffffu);
align();
L(const_FloatPenultimatePositiveDenormal64);
L(consts.FloatPenultimatePositiveDenormal64);
dq(0x000ffffffffffffeu);
align();
L(const_FloatMinS32);
L(consts.FloatMinS32);
dq(0xc1e0000000000000u); // -2147483648 as a double
align();
L(const_FloatMaxS32);
L(consts.FloatMaxS32);
dq(0x41dfffffffc00000u); // 2147483647 as a double
align();
L(const_FloatPositiveZero32);
L(const_FloatPositiveZero64);
L(const_FloatMinU32);
L(consts.FloatPositiveZero32);
L(consts.FloatPositiveZero64);
L(consts.FloatMinU32);
dq(0x0000000000000000u); // 0 as a double
align();
L(const_FloatMaxU32);
L(consts.FloatMaxU32);
dq(0x41efffffffe00000u); // 4294967295 as a double
align();

View file

@ -36,43 +36,43 @@ public:
void CallFunction(const void* fn);
Xbyak::Address MFloatPositiveZero32() {
return xword[rip + const_FloatPositiveZero32];
return xword[rip + consts.FloatPositiveZero32];
}
Xbyak::Address MFloatNegativeZero32() {
return xword[rip + const_FloatNegativeZero32];
return xword[rip + consts.FloatNegativeZero32];
}
Xbyak::Address MFloatNaN32() {
return xword[rip + const_FloatNaN32];
return xword[rip + consts.FloatNaN32];
}
Xbyak::Address MFloatNonSignMask32() {
return xword[rip + const_FloatNonSignMask32];
return xword[rip + consts.FloatNonSignMask32];
}
Xbyak::Address MFloatPositiveZero64() {
return xword[rip + const_FloatPositiveZero64];
return xword[rip + consts.FloatPositiveZero64];
}
Xbyak::Address MFloatNegativeZero64() {
return xword[rip + const_FloatNegativeZero64];
return xword[rip + consts.FloatNegativeZero64];
}
Xbyak::Address MFloatNaN64() {
return xword[rip + const_FloatNaN64];
return xword[rip + consts.FloatNaN64];
}
Xbyak::Address MFloatNonSignMask64() {
return xword[rip + const_FloatNonSignMask64];
return xword[rip + consts.FloatNonSignMask64];
}
Xbyak::Address MFloatPenultimatePositiveDenormal64() {
return xword[rip + const_FloatPenultimatePositiveDenormal64];
return xword[rip + consts.FloatPenultimatePositiveDenormal64];
}
Xbyak::Address MFloatMinS32() {
return xword[rip + const_FloatMinS32];
return xword[rip + consts.FloatMinS32];
}
Xbyak::Address MFloatMaxS32() {
return xword[rip + const_FloatMaxS32];
return xword[rip + consts.FloatMaxS32];
}
Xbyak::Address MFloatMinU32() {
return xword[rip + const_FloatMinU32];
return xword[rip + consts.FloatMinU32];
}
Xbyak::Address MFloatMaxU32() {
return xword[rip + const_FloatMaxU32];
return xword[rip + consts.FloatMaxU32];
}
const void* GetReturnFromRunCodeAddress() const {
@ -104,19 +104,21 @@ public:
#endif
private:
Xbyak::Label const_FloatPositiveZero32;
Xbyak::Label const_FloatNegativeZero32;
Xbyak::Label const_FloatNaN32;
Xbyak::Label const_FloatNonSignMask32;
Xbyak::Label const_FloatPositiveZero64;
Xbyak::Label const_FloatNegativeZero64;
Xbyak::Label const_FloatNaN64;
Xbyak::Label const_FloatNonSignMask64;
Xbyak::Label const_FloatPenultimatePositiveDenormal64;
Xbyak::Label const_FloatMinS32;
Xbyak::Label const_FloatMaxS32;
Xbyak::Label const_FloatMinU32;
Xbyak::Label const_FloatMaxU32;
struct Consts {
Xbyak::Label FloatPositiveZero32;
Xbyak::Label FloatNegativeZero32;
Xbyak::Label FloatNaN32;
Xbyak::Label FloatNonSignMask32;
Xbyak::Label FloatPositiveZero64;
Xbyak::Label FloatNegativeZero64;
Xbyak::Label FloatNaN64;
Xbyak::Label FloatNonSignMask64;
Xbyak::Label FloatPenultimatePositiveDenormal64;
Xbyak::Label FloatMinS32;
Xbyak::Label FloatMaxS32;
Xbyak::Label FloatMinU32;
Xbyak::Label FloatMaxU32;
} consts;
void GenConstants();
using RunCodeFuncType = void(*)(JitState*, CodePtr);