From 5fd2c00f63cab7c28af724de9eefa5c90fe692c3 Mon Sep 17 00:00:00 2001 From: Sylvain Henry <sylvain@haskus.fr> Date: Fri, 26 Jan 2024 11:10:48 +0100 Subject: [PATCH] Perf: replace stack checks with assertions in casting primops There are RESERVED_STACK_WORDS free words (currently 21) on the stack, so omit the checks. Suggested by Cheng Shao. --- rts/PrimOps.cmm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 0c1043f9e822..07e47065101c 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -2968,7 +2968,7 @@ stg_castWord64ToDoublezh(I64 w) D_ d; P_ ptr; - STK_CHK_GEN_N (DOUBLE_SIZE_WDS); + ASSERT(RESERVED_STACK_WORDS >= DOUBLE_SIZE_WDS); reserve DOUBLE_SIZE_WDS = ptr { I64[ptr] = w; @@ -2983,7 +2983,7 @@ stg_castDoubleToWord64zh(D_ d) I64 w; P_ ptr; - STK_CHK_GEN_N (DOUBLE_SIZE_WDS); + ASSERT(RESERVED_STACK_WORDS >= DOUBLE_SIZE_WDS); reserve DOUBLE_SIZE_WDS = ptr { D_[ptr] = d; @@ -2998,7 +2998,7 @@ stg_castWord32ToFloatzh(W_ w) F_ f; P_ ptr; - STK_CHK_GEN_N (1); + ASSERT(RESERVED_STACK_WORDS >= 1); reserve 1 = ptr { I32[ptr] = %lobits32(w); @@ -3013,7 +3013,7 @@ stg_castFloatToWord32zh(F_ f) W_ w; P_ ptr; - STK_CHK_GEN_N (1); + ASSERT(RESERVED_STACK_WORDS >= 1); reserve 1 = ptr { F_[ptr] = f; -- GitLab