From d1a61e5ab51d02016c945b23f4c978b787e4b346 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 19 Nov 2020 16:56:28 -0700 Subject: [PATCH] Chez Scheme: mark `fx{+,-,*}/wraparound` as safe on good args Allow cptypes to convert a `fx{+,-,*}/wraparound` call to unsafe if it proves that the arguments are fixnums (unlike, say, `fx+`, where the possibility of overflow remains). --- racket/src/ChezScheme/s/primdata.ss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/racket/src/ChezScheme/s/primdata.ss b/racket/src/ChezScheme/s/primdata.ss index bd75d41bd3..c9a6d015cb 100644 --- a/racket/src/ChezScheme/s/primdata.ss +++ b/racket/src/ChezScheme/s/primdata.ss @@ -1365,11 +1365,11 @@ (ftype-pointer-null? [sig [(ftype-pointer) -> (boolean)]] [flags pure mifoldable discard]) (ftype-pointer->sexpr [sig [(ftype-pointer) -> (ptr)]] [flags]) (fx* [sig [(fixnum ...) -> (fixnum)]] [flags arith-op partial-folder]) ; not restricted to 2 arguments - (fx*/wraparound [sig [(fixnum fixnum) -> (fixnum)]] [flags arith-op partial-folder]) + (fx*/wraparound [sig [(fixnum fixnum) -> (fixnum)]] [flags arith-op partial-folder safeongoodargs]) (fx+ [sig [(fixnum ...) -> (fixnum)]] [flags arith-op partial-folder]) ; not restricted to 2 arguments - (fx+/wraparound [sig [(fixnum fixnum) -> (fixnum)]] [flags arith-op partial-folder]) + (fx+/wraparound [sig [(fixnum fixnum) -> (fixnum)]] [flags arith-op partial-folder safeongoodargs]) (fx- [sig [(fixnum fixnum ...) -> (fixnum)]] [flags arith-op partial-folder]) ; not restricted to 1 or 2 arguments - (fx-/wraparound [sig [(fixnum fixnum) -> (fixnum)]] [flags arith-op partial-folder]) + (fx-/wraparound [sig [(fixnum fixnum) -> (fixnum)]] [flags arith-op partial-folder safeongoodargs]) (fx/ [sig [(fixnum fixnum ...) -> (fixnum)]] [flags arith-op partial-folder]) ; not restricted to 1 or 2 arguments (fx1+ [sig [(fixnum) -> (fixnum)]] [flags arith-op cp02]) (fx1- [sig [(fixnum) -> (fixnum)]] [flags arith-op cp02])