From ad0c69ea2965e4bd2cec6fd5b18cc397166dd797 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Mon, 2 Nov 2015 09:20:23 -0500 Subject: [PATCH] Make these definitions safe again. As of this moment, the performance win on new-metrics.rkt for using the unsafe version is about 1% (avg over 10 runs), which isn't enough to make it worth the segfaults. I believe that changes to the JIT since 2012 (when the unsafe ops were added) have sped up struct access. --- typed-racket-lib/typed-racket/rep/rep-utils.rkt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typed-racket-lib/typed-racket/rep/rep-utils.rkt b/typed-racket-lib/typed-racket/rep/rep-utils.rkt index b51b2921..b3fb2e46 100644 --- a/typed-racket-lib/typed-racket/rep/rep-utils.rkt +++ b/typed-racket-lib/typed-racket/rep/rep-utils.rkt @@ -362,8 +362,8 @@ [PathElem def-pathelem #:PathElem pathelem-case print-pathelem pathelem-name-ht pathelem-rec-id]) ;; NOTE: change these if the definitions above change, or everything will segfault -(define-syntax-rule (unsafe-Rep-seq v) (unsafe-struct*-ref v 0)) -(define-syntax-rule (unsafe-Type-key v) (unsafe-struct*-ref v 4)) +(define-syntax-rule (unsafe-Rep-seq v) (Rep-seq v)) +(define-syntax-rule (unsafe-Type-key v) (Type-key v)) (provide unsafe-Rep-seq unsafe-Type-key) (define (Rep-values rep)