From 0a1b43247133d1cfe8dd507017f3bdc63e6f96da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 1 Oct 2020 14:14:05 +0200 Subject: [PATCH] Drop call arguments _after_ the call --- lib/fizzy/execute.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/fizzy/execute.cpp b/lib/fizzy/execute.cpp index e540cf777..4b985fdf7 100644 --- a/lib/fizzy/execute.cpp +++ b/lib/fizzy/execute.cpp @@ -58,16 +58,14 @@ inline bool invoke_function( { assert(stack.size() >= num_args); span call_args{stack.rend() - num_args, num_args}; - stack.drop(num_args); const auto ret = func(instance, call_args, depth + 1); - // Bubble up traps if (ret.trapped) - return false; + return false; // Bubble up traps - // Push back the result + stack.drop(num_args); if (ret.has_value) - stack.push(ret.value); + stack.push(ret.value); // Push back the result return true; }