expander: remove backend-specific vector handling

Backend-specific handling is no longer useful, since the rules have
changed for code inspectors, bytecode, and unsafe operations.
This commit is contained in:
Matthew Flatt 2018-03-19 08:01:50 -06:00
parent 77a978fb10
commit b82d6e2204
4 changed files with 14 additions and 33 deletions

View File

@ -7,8 +7,7 @@
"built-in-symbol.rkt"
"reserved-symbol.rkt"
"namespace-scope.rkt"
"serialize.rkt"
"vector-ref.rkt")
"serialize.rkt")
(provide (struct-out header)
make-header
@ -106,26 +105,26 @@
(make-vector ,(syntax-literals-count sl) #f))
(define-values (,get-syntax-literal!-id)
(lambda (pos)
(let-values ([(ready-stx) (,unsafe-vector-ref-id ,syntax-literals-id pos)])
(let-values ([(ready-stx) (unsafe-vector*-ref ,syntax-literals-id pos)])
(if ready-stx
ready-stx
(begin
,@(if skip-deserialize?
null
`((if (,unsafe-vector-ref-id ,deserialized-syntax-vector-id 0)
`((if (unsafe-vector*-ref ,deserialized-syntax-vector-id 0)
(void)
(,deserialize-syntax-id ,bulk-binding-registry-id))))
(let-values ([(stx)
(syntax-module-path-index-shift
(syntax-shift-phase-level
(,unsafe-vector-ref-id ,deserialized-syntax-vector-id pos)
(unsafe-vector*-ref ,deserialized-syntax-vector-id pos)
,phase-shift-id)
,(add-module-path-index! mpis self)
,self-id
,inspector-id)])
(begin
(vector-cas! ,syntax-literals-id pos #f stx)
(,unsafe-vector-ref-id ,syntax-literals-id pos))))))))))
(unsafe-vector*-ref ,syntax-literals-id pos))))))))))
;; Generate on-demand deserialization (shared across instances); the
;; result defines `deserialize-syntax-id`
@ -189,7 +188,7 @@
(cdr ns+stxss)))))]))
(define (generate-eager-syntax-literal-lookup pos)
`(,unsafe-vector-ref-id ,syntax-literals-id ,pos))
`(unsafe-vector*-ref ,syntax-literals-id ,pos))
;; Genereate a vector for a set of syntax objects; the result is a
;; vector like the one generated in expression from by

View File

@ -16,8 +16,7 @@
"module-use.rkt"
"../host/linklet.rkt"
"built-in-symbol.rkt"
"reserved-symbol.rkt"
"vector-ref.rkt")
"reserved-symbol.rkt")
;; Serializaiton is mostly for syntax object and module path indexes.
;;
@ -96,7 +95,7 @@
(define pos
(add-module-path-index!/pos mpis mpi))
(and pos
`(,unsafe-vector-ref-id ,mpi-vector-id ,pos)))
`(unsafe-vector*-ref ,mpi-vector-id ,pos)))
(define (add-module-path-index!/pos mpis mpi)
(cond

View File

@ -1,14 +0,0 @@
#lang racket/base
(provide unsafe-vector-ref-id)
(define unsafe-vector-ref-id
(cond
[(eq? (system-type 'vm) 'chez-scheme)
;; Using `unsafe-vector*-ref` is worthwhile,
;; because it saves significant compiler effort
'unsafe-vector*-ref]
[else
;; Using an unsafe operation doesn't work with
;; bytecode loading in no-unsafe-operation mode
'vector*-ref]))

View File

@ -17432,9 +17432,6 @@ static const char *startup_source =
"(define-values(top-level-require!-id)(make-built-in-symbol! 'top-level-require!))"
"(define-values(mpi-vector-id)(make-built-in-symbol! 'mpi-vector))"
"(define-values"
"(unsafe-vector-ref-id)"
"(if(eq?(system-type 'vm) 'chez-scheme)(let-values() 'unsafe-vector*-ref)(let-values() 'vector*-ref)))"
"(define-values"
"(struct:module-path-index-table"
" module-path-index-table1.1"
" module-path-index-table?"
@ -17469,7 +17466,7 @@ static const char *startup_source =
"(lambda(mpis_0 mpi_21)"
"(begin"
"(let-values(((pos_13)(add-module-path-index!/pos mpis_0 mpi_21)))"
"(if pos_13(list unsafe-vector-ref-id mpi-vector-id pos_13) #f)))))"
"(if pos_13(list 'unsafe-vector*-ref mpi-vector-id pos_13) #f)))))"
"(define-values"
"(add-module-path-index!/pos)"
"(lambda(mpis_1 mpi_23)"
@ -26595,7 +26592,7 @@ static const char *startup_source =
" '(pos)"
"(list"
" 'let-values"
"(list(list '(ready-stx)(list* unsafe-vector-ref-id syntax-literals-id '(pos))))"
"(list(list '(ready-stx)(list* 'unsafe-vector*-ref syntax-literals-id '(pos))))"
"(list"
" 'if"
" 'ready-stx"
@ -26608,7 +26605,7 @@ static const char *startup_source =
"(list"
"(list"
" 'if"
"(list* unsafe-vector-ref-id deserialized-syntax-vector-id '(0))"
"(list* 'unsafe-vector*-ref deserialized-syntax-vector-id '(0))"
" '(void)"
"(list deserialize-syntax-id bulk-binding-registry-id))))"
"(list"
@ -26621,7 +26618,7 @@ static const char *startup_source =
" 'syntax-module-path-index-shift"
"(list"
" 'syntax-shift-phase-level"
"(list* unsafe-vector-ref-id deserialized-syntax-vector-id '(pos))"
"(list* 'unsafe-vector*-ref deserialized-syntax-vector-id '(pos))"
" phase-shift-id)"
"(add-module-path-index! mpis_12 self_14)"
" self-id"
@ -26629,7 +26626,7 @@ static const char *startup_source =
"(list"
" 'begin"
"(list* 'vector-cas! syntax-literals-id '(pos #f stx))"
"(list* unsafe-vector-ref-id syntax-literals-id '(pos))))))))))))))))))))"
"(list* 'unsafe-vector*-ref syntax-literals-id '(pos))))))))))))))))))))"
"(define-values"
"(generate-lazy-syntax-literals-data!)"
"(lambda(sl_4 mpis_13)"
@ -26696,7 +26693,7 @@ static const char *startup_source =
" '((cdr ns+stxss)))))))))))"
"(define-values"
"(generate-eager-syntax-literal-lookup)"
"(lambda(pos_87)(begin(list unsafe-vector-ref-id syntax-literals-id pos_87))))"
"(lambda(pos_87)(begin(list 'unsafe-vector*-ref syntax-literals-id pos_87))))"
"(define-values"
"(syntax-literals-as-vector)"
"(lambda(sl_6)(begin(list->vector(reverse$1(syntax-literals-stxes sl_6))))))"