From 9c5adc68216301e8d9a068ac87ae85ef73b6b2b7 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Sun, 18 Jun 2023 20:31:11 +0900 Subject: [PATCH] make the check interval adjustment work for more situations call adjust_check_interval before calling check_interrupt so that it works for the recently added `toywasm --timeout`. (at least when user_intr_delay > 0.) --- lib/exec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/exec.c b/lib/exec.c index 4ec24b98..94ed0f5d 100644 --- a/lib/exec.c +++ b/lib/exec.c @@ -1074,13 +1074,6 @@ exec_expr_continue(struct exec_context *ctx) } n--; if (__predict_false(n == 0)) { - ret = check_interrupt(ctx); - if (ret != 0) { - if (IS_RESTARTABLE(ret)) { - STAT_INC(ctx->stats.exec_loop_restart); - } - return ret; - } struct timespec now; ret = timespec_now(CLOCK_MONOTONIC, &now); if (ret != 0) { @@ -1091,6 +1084,13 @@ exec_expr_continue(struct exec_context *ctx) } last = now; has_last = true; + ret = check_interrupt(ctx); + if (ret != 0) { + if (IS_RESTARTABLE(ret)) { + STAT_INC(ctx->stats.exec_loop_restart); + } + return ret; + } n = ctx->check_interval; assert(n > 0); }