diff --git a/sample/calc.cpp b/sample/calc.cpp index 4f05eee..1e4d424 100644 --- a/sample/calc.cpp +++ b/sample/calc.cpp @@ -37,8 +37,12 @@ private: size_t constTblPos_; int regIdx_; Map varMap_; // map var name to index - const Xbyak::Reg32e& valTbl_; - const Xbyak::Reg32e& tbl_; + const Xbyak::MemOperand& valTbl_; +#ifdef XBYAK32 + const Xbyak::Reg32& tbl_; +#else + const Xbyak::Reg64& tbl_; +#endif public: /* @param y [out] the value of f(var) @@ -80,7 +84,7 @@ public: if (constTblPos_ >= MAX_CONST_NUM) throw; constTbl_[constTblPos_] = n; if (regIdx_ == 7) throw; - movsd(Xbyak::Xmm(++regIdx_), ptr[tbl_ + constTblPos_ * sizeof(double)]); + movsd(Xbyak::Xmm(++regIdx_), ptr[tbl_ + constTblPos_ * (int)sizeof(double)]); constTblPos_++; } // use eax diff --git a/sample/calc2.cpp b/sample/calc2.cpp index 600ade2..7d556c5 100644 --- a/sample/calc2.cpp +++ b/sample/calc2.cpp @@ -1,6 +1,5 @@ /* @author herumi - @date $Date: 2010/11/17 11:58:06 $ tiny calculator 2 This program generates a function to calc the value of @@ -106,9 +105,13 @@ private: size_t constTblPos_; int regIdx_; #ifdef XBYAK32 - const Xbyak::Reg32e& varTbl_; + const Xbyak::MemOperand& varTbl_; +#endif +#ifdef XBYAK32 + const Xbyak::Reg32& tbl_; +#else + const Xbyak::Reg64& tbl_; #endif - const Xbyak::Reg32e& tbl_; public: /* double jit(double x); @@ -116,7 +119,7 @@ public: 64bit: x [rcx](win), xmm0(gcc), return xmm0 */ Jit() - : negConst_(0x8000000000000000ULL) + : negConst_(Xbyak::uint64(1) << 63) , constTblPos_(0) , regIdx_(-1) #ifdef XBYAK32 @@ -290,7 +293,7 @@ int main(int argc, char *argv[]) return 1; } parserJit.code_.complete(); - double (*jit)(double) = (double (*)(double))parserJit.code_.getCode(); + double (*jit)(double) = parserJit.code_.getCode(); Test("VM ", vm); Test("JIT", jit); diff --git a/sample/memfunc.cpp b/sample/memfunc.cpp index f4d9dfd..eeedaa9 100644 --- a/sample/memfunc.cpp +++ b/sample/memfunc.cpp @@ -9,6 +9,10 @@ struct A { int func(int a, int b, int c, int d, int e) const { return x_ + y_ + a + b + c + d + e; } }; +#ifdef _MSC_VER + #pragma warning(disable : 4510 4512 4610) +#endif + struct Code : public Xbyak::CodeGenerator { Code() { @@ -25,7 +29,11 @@ struct Code : public Xbyak::CodeGenerator { #endif #endif const struct { - const Reg32e& self; +#ifdef XBYAK32 + const Reg32& self; +#else + const Reg64& self; +#endif const Operand& a; const Operand& b; const Operand& c;