From c9de012b07426435b8bd3bb29082fbceddf403a3 Mon Sep 17 00:00:00 2001 From: Pavel Date: Tue, 29 Mar 2022 12:03:02 +0400 Subject: Support arguments of width 128, 256 and 512 bits for external calls --- lib/Core/Executor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Core/Executor.cpp') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 42405982..6fad8830 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -3810,11 +3810,13 @@ void Executor::callExternalFunction(ExecutionState &state, } // normal external function handling path - // allocate 128 bits for each argument (+return value) to support fp80's; + // allocate 512 bits for each argument (+return value) to support + // fp80's and SIMD vectors as parameters for external calls; // we could iterate through all the arguments first and determine the exact // size we need, but this is faster, and the memory usage isn't significant. - uint64_t *args = (uint64_t*) alloca(2*sizeof(*args) * (arguments.size() + 1)); - memset(args, 0, 2 * sizeof(*args) * (arguments.size() + 1)); + size_t allocatedBytes = Expr::MaxWidth / 8 * (arguments.size() + 1); + uint64_t *args = (uint64_t*) alloca(allocatedBytes); + memset(args, 0, allocatedBytes); unsigned wordIndex = 2; for (std::vector >::iterator ai = arguments.begin(), ae = arguments.end(); ai!=ae; ++ai) { -- cgit 1.4.1