From 082a395dfdd3fbd4d5af1567466f5b060baf6bae Mon Sep 17 00:00:00 2001 From: kobalicek Date: Sat, 28 Oct 2017 23:14:07 +0200 Subject: [PATCH] Fixed a bug in Compiler when used with CodeInfo that doesn't specify any alignment --- src/asmjit/base/codecompiler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/asmjit/base/codecompiler.cpp b/src/asmjit/base/codecompiler.cpp index 78b4bd7..582e94a 100644 --- a/src/asmjit/base/codecompiler.cpp +++ b/src/asmjit/base/codecompiler.cpp @@ -129,9 +129,9 @@ CCFunc* CodeCompiler::newFunc(const FuncSignature& sign) noexcept { return nullptr; } - // Override the natural stack alignment of the calling convention to what's - // specified by CodeInfo. - func->_funcDetail._callConv.setNaturalStackAlignment(_codeInfo.getStackAlignment()); + // If the CodeInfo guarantees higher alignment honor it. + if (_codeInfo.getStackAlignment() > func->_funcDetail._callConv.getNaturalStackAlignment()) + func->_funcDetail._callConv.setNaturalStackAlignment(_codeInfo.getStackAlignment()); // Allocate space for function arguments. func->_args = nullptr;