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:
parent
77a978fb10
commit
b82d6e2204
|
@ -7,8 +7,7 @@
|
||||||
"built-in-symbol.rkt"
|
"built-in-symbol.rkt"
|
||||||
"reserved-symbol.rkt"
|
"reserved-symbol.rkt"
|
||||||
"namespace-scope.rkt"
|
"namespace-scope.rkt"
|
||||||
"serialize.rkt"
|
"serialize.rkt")
|
||||||
"vector-ref.rkt")
|
|
||||||
|
|
||||||
(provide (struct-out header)
|
(provide (struct-out header)
|
||||||
make-header
|
make-header
|
||||||
|
@ -106,26 +105,26 @@
|
||||||
(make-vector ,(syntax-literals-count sl) #f))
|
(make-vector ,(syntax-literals-count sl) #f))
|
||||||
(define-values (,get-syntax-literal!-id)
|
(define-values (,get-syntax-literal!-id)
|
||||||
(lambda (pos)
|
(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
|
(if ready-stx
|
||||||
ready-stx
|
ready-stx
|
||||||
(begin
|
(begin
|
||||||
,@(if skip-deserialize?
|
,@(if skip-deserialize?
|
||||||
null
|
null
|
||||||
`((if (,unsafe-vector-ref-id ,deserialized-syntax-vector-id 0)
|
`((if (unsafe-vector*-ref ,deserialized-syntax-vector-id 0)
|
||||||
(void)
|
(void)
|
||||||
(,deserialize-syntax-id ,bulk-binding-registry-id))))
|
(,deserialize-syntax-id ,bulk-binding-registry-id))))
|
||||||
(let-values ([(stx)
|
(let-values ([(stx)
|
||||||
(syntax-module-path-index-shift
|
(syntax-module-path-index-shift
|
||||||
(syntax-shift-phase-level
|
(syntax-shift-phase-level
|
||||||
(,unsafe-vector-ref-id ,deserialized-syntax-vector-id pos)
|
(unsafe-vector*-ref ,deserialized-syntax-vector-id pos)
|
||||||
,phase-shift-id)
|
,phase-shift-id)
|
||||||
,(add-module-path-index! mpis self)
|
,(add-module-path-index! mpis self)
|
||||||
,self-id
|
,self-id
|
||||||
,inspector-id)])
|
,inspector-id)])
|
||||||
(begin
|
(begin
|
||||||
(vector-cas! ,syntax-literals-id pos #f stx)
|
(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
|
;; Generate on-demand deserialization (shared across instances); the
|
||||||
;; result defines `deserialize-syntax-id`
|
;; result defines `deserialize-syntax-id`
|
||||||
|
@ -189,7 +188,7 @@
|
||||||
(cdr ns+stxss)))))]))
|
(cdr ns+stxss)))))]))
|
||||||
|
|
||||||
(define (generate-eager-syntax-literal-lookup pos)
|
(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
|
;; Genereate a vector for a set of syntax objects; the result is a
|
||||||
;; vector like the one generated in expression from by
|
;; vector like the one generated in expression from by
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
"module-use.rkt"
|
"module-use.rkt"
|
||||||
"../host/linklet.rkt"
|
"../host/linklet.rkt"
|
||||||
"built-in-symbol.rkt"
|
"built-in-symbol.rkt"
|
||||||
"reserved-symbol.rkt"
|
"reserved-symbol.rkt")
|
||||||
"vector-ref.rkt")
|
|
||||||
|
|
||||||
;; Serializaiton is mostly for syntax object and module path indexes.
|
;; Serializaiton is mostly for syntax object and module path indexes.
|
||||||
;;
|
;;
|
||||||
|
@ -96,7 +95,7 @@
|
||||||
(define pos
|
(define pos
|
||||||
(add-module-path-index!/pos mpis mpi))
|
(add-module-path-index!/pos mpis mpi))
|
||||||
(and pos
|
(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)
|
(define (add-module-path-index!/pos mpis mpi)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -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]))
|
|
|
@ -17432,9 +17432,6 @@ static const char *startup_source =
|
||||||
"(define-values(top-level-require!-id)(make-built-in-symbol! 'top-level-require!))"
|
"(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(mpi-vector-id)(make-built-in-symbol! 'mpi-vector))"
|
||||||
"(define-values"
|
"(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"
|
"(struct:module-path-index-table"
|
||||||
" module-path-index-table1.1"
|
" module-path-index-table1.1"
|
||||||
" module-path-index-table?"
|
" module-path-index-table?"
|
||||||
|
@ -17469,7 +17466,7 @@ static const char *startup_source =
|
||||||
"(lambda(mpis_0 mpi_21)"
|
"(lambda(mpis_0 mpi_21)"
|
||||||
"(begin"
|
"(begin"
|
||||||
"(let-values(((pos_13)(add-module-path-index!/pos mpis_0 mpi_21)))"
|
"(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"
|
"(define-values"
|
||||||
"(add-module-path-index!/pos)"
|
"(add-module-path-index!/pos)"
|
||||||
"(lambda(mpis_1 mpi_23)"
|
"(lambda(mpis_1 mpi_23)"
|
||||||
|
@ -26595,7 +26592,7 @@ static const char *startup_source =
|
||||||
" '(pos)"
|
" '(pos)"
|
||||||
"(list"
|
"(list"
|
||||||
" 'let-values"
|
" '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"
|
"(list"
|
||||||
" 'if"
|
" 'if"
|
||||||
" 'ready-stx"
|
" 'ready-stx"
|
||||||
|
@ -26608,7 +26605,7 @@ static const char *startup_source =
|
||||||
"(list"
|
"(list"
|
||||||
"(list"
|
"(list"
|
||||||
" 'if"
|
" 'if"
|
||||||
"(list* unsafe-vector-ref-id deserialized-syntax-vector-id '(0))"
|
"(list* 'unsafe-vector*-ref deserialized-syntax-vector-id '(0))"
|
||||||
" '(void)"
|
" '(void)"
|
||||||
"(list deserialize-syntax-id bulk-binding-registry-id))))"
|
"(list deserialize-syntax-id bulk-binding-registry-id))))"
|
||||||
"(list"
|
"(list"
|
||||||
|
@ -26621,7 +26618,7 @@ static const char *startup_source =
|
||||||
" 'syntax-module-path-index-shift"
|
" 'syntax-module-path-index-shift"
|
||||||
"(list"
|
"(list"
|
||||||
" 'syntax-shift-phase-level"
|
" '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)"
|
" phase-shift-id)"
|
||||||
"(add-module-path-index! mpis_12 self_14)"
|
"(add-module-path-index! mpis_12 self_14)"
|
||||||
" self-id"
|
" self-id"
|
||||||
|
@ -26629,7 +26626,7 @@ static const char *startup_source =
|
||||||
"(list"
|
"(list"
|
||||||
" 'begin"
|
" 'begin"
|
||||||
"(list* 'vector-cas! syntax-literals-id '(pos #f stx))"
|
"(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"
|
"(define-values"
|
||||||
"(generate-lazy-syntax-literals-data!)"
|
"(generate-lazy-syntax-literals-data!)"
|
||||||
"(lambda(sl_4 mpis_13)"
|
"(lambda(sl_4 mpis_13)"
|
||||||
|
@ -26696,7 +26693,7 @@ static const char *startup_source =
|
||||||
" '((cdr ns+stxss)))))))))))"
|
" '((cdr ns+stxss)))))))))))"
|
||||||
"(define-values"
|
"(define-values"
|
||||||
"(generate-eager-syntax-literal-lookup)"
|
"(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"
|
"(define-values"
|
||||||
"(syntax-literals-as-vector)"
|
"(syntax-literals-as-vector)"
|
||||||
"(lambda(sl_6)(begin(list->vector(reverse$1(syntax-literals-stxes sl_6))))))"
|
"(lambda(sl_6)(begin(list->vector(reverse$1(syntax-literals-stxes sl_6))))))"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user