call supports variadic template if possible

This commit is contained in:
MITSUNARI Shigeo 2015-07-22 22:32:08 +09:00
parent df615b7581
commit 1e208fd202
5 changed files with 18 additions and 4 deletions

View file

@ -1,5 +1,5 @@
Xbyak 4.83 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++ Xbyak 4.84 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
============= =============
Abstract Abstract
@ -277,6 +277,7 @@ The header files under xbyak/ are independent of cybozulib.
History History
------------- -------------
* 2015/Jun/22 ver 4.84 call() support variadic template if available(thanks to randomstuff)
* 2015/Jun/16 ver 4.83 support movbe(thanks to benvanik) * 2015/Jun/16 ver 4.83 support movbe(thanks to benvanik)
* 2015/May/24 ver 4.82 support detection of F16C * 2015/May/24 ver 4.82 support detection of F16C
* 2015/Apr/25 ver 4.81 fix the condition to throw exception for setSize(thanks to whyisthisfieldhere) * 2015/Apr/25 ver 4.81 fix the condition to throw exception for setSize(thanks to whyisthisfieldhere)

View file

@ -1,5 +1,5 @@
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.83 C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.84
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
◎概要 ◎概要
@ -296,6 +296,7 @@ cybozulibは単体テストでのみ利用されていて、xbyak/ディレク
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
◎履歴 ◎履歴
2015/07/22 ver 4.84 call()がvariadic template対応
2015/05/24 ver 4.83 mobveサポート(thanks to benvanik) 2015/05/24 ver 4.83 mobveサポート(thanks to benvanik)
2015/05/24 ver 4.82 F16Cが使えるかどうかの判定追加 2015/05/24 ver 4.82 F16Cが使えるかどうかの判定追加
2015/04/25 ver 4.81 setSizeが例外を投げる条件を修正(thanks to whyisthisfieldhere) 2015/04/25 ver 4.81 setSizeが例外を投げる条件を修正(thanks to whyisthisfieldhere)

View file

@ -74,7 +74,11 @@ public:
#else #else
mov(eax, ptr [esp + 4]); mov(eax, ptr [esp + 4]);
push(eax); push(eax);
#ifdef XBYAK_VARIADIC_TEMPLATE
call(atoi);
#else
call(Xbyak::CastTo<void*>(atoi)); call(Xbyak::CastTo<void*>(atoi));
#endif
add(esp, 4); add(esp, 4);
#endif #endif
ret(); ret();

View file

@ -82,6 +82,10 @@
#endif #endif
#endif #endif
#if (__cplusplus >= 201103) || (_MSC_VER >= 1800)
#define XBYAK_VARIADIC_TEMPLATE
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4514) /* remove inline function */ #pragma warning(disable : 4514) /* remove inline function */
@ -96,7 +100,7 @@ namespace Xbyak {
enum { enum {
DEFAULT_MAX_CODE_SIZE = 4096, DEFAULT_MAX_CODE_SIZE = 4096,
VERSION = 0x4830 /* 0xABCD = A.BC(D) */ VERSION = 0x4840 /* 0xABCD = A.BC(D) */
}; };
#ifndef MIE_INTEGER_TYPE_DEFINED #ifndef MIE_INTEGER_TYPE_DEFINED
@ -1912,6 +1916,10 @@ public:
void call(const char *label) { call(std::string(label)); } void call(const char *label) { call(std::string(label)); }
void call(const Label& label) { opJmp(label, T_NEAR, 0, B11101000, 0); } void call(const Label& label) { opJmp(label, T_NEAR, 0, B11101000, 0); }
// call(function pointer) // call(function pointer)
#ifdef XBYAK_VARIADIC_TEMPLATE
template<class Ret, class... Params>
void call(Ret(*func)(Params...)) { call(CastTo<const void*>(func)); }
#endif
void call(const void *addr) { opJmpAbs(addr, T_NEAR, 0, B11101000); } void call(const void *addr) { opJmpAbs(addr, T_NEAR, 0, B11101000); }
// special case // special case
void movd(const Address& addr, const Mmx& mmx) void movd(const Address& addr, const Mmx& mmx)

View file

@ -1,4 +1,4 @@
const char *getVersionString() const { return "4.83"; } const char *getVersionString() const { return "4.84"; }
void packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); } void packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); }
void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); } void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); }
void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); } void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); }