From 1a557d97cf13f7f1ddf465a32e0fde6b77ad40ed Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Thu, 6 Feb 2025 19:47:59 +0900 Subject: [PATCH 1/4] revert changing behavior of StackFrame::close() --- xbyak/xbyak_util.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index c0c9bc7..6f06665 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h @@ -966,7 +966,7 @@ public: make epilog manually @param callRet [in] call ret() if true */ - void makeEpilog(bool callRet = true) + void close(bool callRet = true) { using namespace Xbyak; const Reg64& _rsp = code_->rsp; @@ -978,16 +978,9 @@ public: if (callRet) code_->ret(); } - // close() is automatically called in a destructor. - // It is not called if close() is explicitly called before. - void close(bool callRet = true) - { - if (!makeEpilog_) return; - makeEpilog(callRet); - makeEpilog_ = false; - } ~StackFrame() { + if (!makeEpilog_) return; close(); } private: From 52e793eab22679d40cbf4a21209d65b30185a02d Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Thu, 6 Feb 2025 19:52:59 +0900 Subject: [PATCH 2/4] Test StackFrame::close() to match the previous specification --- test/sf_test.cpp | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/test/sf_test.cpp b/test/sf_test.cpp index 509fb93..477724d 100644 --- a/test/sf_test.cpp +++ b/test/sf_test.cpp @@ -402,35 +402,18 @@ struct CloseCode : Xbyak::CodeGenerator { case 1: { - StackFrame sf(this, 0); + StackFrame sf(this, 0, 0, 0, false); sf.close(); // Explicitly call close(). setProtectModeRE(); // Ensure that no writes occur in destructor by setting read-exec - sf.close(); } break; case 2: { - StackFrame sf(this, 0); - sf.close(); - sf.close(); // The second call is ignored. - } - break; - - case 3: - { - StackFrame sf(this, 0); - sf.makeEpilog(); // Explicitly call makeEpilog. - // close() is automatically called. - } - break; - - case 4: - { - StackFrame sf(this, 0); - sf.makeEpilog(); // Explicitly call makeEpilog. - sf.makeEpilog(); // The second call is also valid. - // close() is automatically called. + StackFrame sf(this, 0, 0, 0, false); + sf.close(); // Explicitly call close(). + sf.close(); // Explicitly call close(). + setProtectModeRE(); // Ensure that no writes occur in destructor by setting read-exec } break; default: @@ -442,7 +425,7 @@ struct CloseCode : Xbyak::CodeGenerator { CYBOZU_TEST_AUTO(close) { const size_t expectedTbl[] = { - 1, 1, 1, 2, 3, + 1, 1, 2, }; for (size_t i = 0; i < sizeof(expectedTbl)/sizeof(expectedTbl[0]); i++) { CloseCode c(i); From 2648121049129064fdd7e3cc5bc9193259d76de2 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Thu, 6 Feb 2025 20:46:49 +0900 Subject: [PATCH 3/4] main catches exception --- test/nm_frame.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/nm_frame.cpp b/test/nm_frame.cpp index ffdcc97..0641025 100644 --- a/test/nm_frame.cpp +++ b/test/nm_frame.cpp @@ -32,6 +32,7 @@ public: }; int main() + try { // the size of Operand exceeds 32 bit. CYBOZU_TEST_EQUAL(sizeof(Xbyak::Operand), 8u); @@ -39,4 +40,7 @@ int main() s.gen(); ErrorSample es; es.gen(); +} catch (std::exception& e) { + fprintf(stderr, "ERR=%s\n", e.what()); + return 1; } From cbede2aadbd9769c5693c66c36278072848cc404 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Fri, 7 Feb 2025 08:24:22 +0900 Subject: [PATCH 4/4] v7.23.1 --- CMakeLists.txt | 2 +- doc/changelog.md | 1 + meson.build | 2 +- readme.md | 2 +- readme.txt | 5 +++-- xbyak/xbyak.h | 2 +- xbyak/xbyak_mnemonic.h | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0c6ad1..3b89cc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -project(xbyak LANGUAGES CXX VERSION 7.23) +project(xbyak LANGUAGES CXX VERSION 7.23.1) file(GLOB headers xbyak/*.h) diff --git a/doc/changelog.md b/doc/changelog.md index fea144b..6c5ab38 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -1,5 +1,6 @@ # History +* 2025/Feb/07 ver 7.23.1 revert the behavior of StackFrame::close(). * 2025/Feb/03 ver 7.23 stricter checking of register size, improve handling of 16-bit immediates, change spec of StackFrame::close(), fix push/pop to support APX. * 2024/Nov/11 ver 7.22 add Reg::cvt{128,256,512}(). tested by xed 2024.11.04 * 2024/Oct/31 ver 7.21 Enhance XMM register validation in SSE instructions diff --git a/meson.build b/meson.build index b553fc7..ca95f6f 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,7 @@ project( 'xbyak', 'cpp', - version: '7.23', + version: '7.23.1', license: 'BSD-3-Clause', default_options: 'b_ndebug=if-release' ) diff --git a/readme.md b/readme.md index 7c61eb5..4d93c79 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ -# Xbyak 7.23 [![Badge Build]][Build Status] +# Xbyak 7.23.1 [![Badge Build]][Build Status] *A JIT assembler for x86/x64 architectures supporting advanced instruction sets up to AVX10.2* diff --git a/readme.txt b/readme.txt index dbf334b..dbb4780 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ - C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.23 + C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.23.1 ----------------------------------------------------------------------------- ◎概要 @@ -404,7 +404,8 @@ sample/{echo,hello}.bfは http://www.kmonos.net/alang/etc/brainfuck.php から ----------------------------------------------------------------------------- ◎履歴 -2025/02/23 ver 7.23 レジスタサイズのチェック厳密化・16ビット側値の範囲改善・StackFrame::close()の仕様変更。push/pop with APX修正。 +2025/02/07 ver 7.23.1 StackFrame::close()の挙動を元に戻す +2025/02/07 ver 7.23 レジスタサイズのチェック厳密化・16ビット側値の範囲改善・StackFrame::close()の仕様変更。push/pop with APX修正。 2024/11/11 ver 7.22 Reg::cvt{128,256,512}(). xed 2024.11.04でテスト 2024/10/31 ver 7.21 SSE命令のXMMレジスタのチェックを厳密化 2024/10/17 ver 7.20.1 AVX10.2 rev 2.0仕様書の変更に追従 diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index d3bd09a..97e7205 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -155,7 +155,7 @@ namespace Xbyak { enum { DEFAULT_MAX_CODE_SIZE = 4096, - VERSION = 0x7230 /* 0xABCD = A.BC(.D) */ + VERSION = 0x7231 /* 0xABCD = A.BC(.D) */ }; #ifndef MIE_INTEGER_TYPE_DEFINED diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index 880ce33..08f337c 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -1,4 +1,4 @@ -const char *getVersionString() const { return "7.23"; } +const char *getVersionString() const { return "7.23.1"; } void aadd(const Address& addr, const Reg32e ®) { opMR(addr, reg, T_0F38, 0x0FC, T_APX); } void aand(const Address& addr, const Reg32e ®) { opMR(addr, reg, T_0F38|T_66, 0x0FC, T_APX|T_66); } void adc(const Operand& op, uint32_t imm) { opOI(op, imm, 0x10, 2); }