From f473d69dc74412a2e8b36efc0863667f470beb26 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Tue, 15 Jan 2013 15:37:48 +0900 Subject: [PATCH] add setSize --- readme.md | 3 ++- readme.txt | 3 ++- xbyak/xbyak.h | 7 ++++++- xbyak/xbyak_mnemonic.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 0f1ebb2..395b4b5 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ -Xbyak 3.74 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++ +Xbyak 3.75 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++ ============= Abstract @@ -223,6 +223,7 @@ http://opensource.org/licenses/BSD-3-Clause History ------------- +* 2013/Jan/15 ver 3.75 add setSize() to modify generated code * 2013/Jan/12 ver 3.74 add CodeGenerator::reset() ; add Allocator::useProtect() * 2013/Jan/06 ver 3.73 use unordered_map if possible * 2012/Dec/04 ver 3.72 eax, ebx, ... are member variables of CodeGenerator(revert), Xbyak::util::eax, ... are static const. diff --git a/readme.txt b/readme.txt index 30ffd46..9924ee0 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ - C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak version 3.74 + C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak version 3.75 ----------------------------------------------------------------------------- ◎概要 @@ -244,6 +244,7 @@ sample/{echo,hello}.bfは http://www.kmonos.net/alang/etc/brainfuck.php から ----------------------------------------------------------------------------- ◎履歴 +2013/01/15 ver 3.75 生成されたコードを修正するためにsetSize()を追加 2013/01/12 ver 3.74 CodeGenerator::reset()とAllocator::useProtect()を追加 2013/01/06 ver 3.73 可能ならunordered_mapを使う 2012/12/04 ver 3.72 eaxなどをCodeGeneratorのメンバ変数に戻す. Xbyak::util::eaxはstatic const変数 diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 59ef2f7..c48da06 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -72,7 +72,7 @@ namespace Xbyak { enum { DEFAULT_MAX_CODE_SIZE = 4096, - VERSION = 0x3740 /* 0xABCD = A.BC(D) */ + VERSION = 0x3750 /* 0xABCD = A.BC(D) */ }; #ifndef MIE_INTEGER_TYPE_DEFINED @@ -587,6 +587,11 @@ public: template const F getCurr() const { return CastTo(&top_[size_]); } size_t getSize() const { return size_; } + void setSize(size_t size) + { + if (size >= maxSize_) throw ERR_OFFSET_IS_TOO_BIG; + size_ = size; + } void dump() const { const uint8 *p = getCode(); diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index 6ec3fe2..9bcb79c 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -1,4 +1,4 @@ -const char *getVersionString() const { return "3.74"; } +const char *getVersionString() const { return "3.75"; } 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 packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); }