cs: avoid abuse of vector-ref for struct-ref
Use `$object-ref`, instead. Otherwise, cptypes can detect the abuse of `#3%vector-ref` and make unwanted transformations.
This commit is contained in:
parent
d8125082a2
commit
5a638073eb
|
@ -242,6 +242,7 @@ future2-demo: $(BUILDDIR)rumble.$(CSO)
|
|||
|
||||
RUMBLE_SRCS = rumble/define.ss \
|
||||
rumble/virtual-register.ss \
|
||||
rumble/layout.ss \
|
||||
rumble/check.ss \
|
||||
rumble/syntax-rule.ss \
|
||||
rumble/letrec.ss \
|
||||
|
|
|
@ -706,6 +706,7 @@
|
|||
|
||||
(include "rumble/define.ss")
|
||||
(include "rumble/virtual-register.ss")
|
||||
(include "rumble/layout.ss")
|
||||
(include "rumble/begin0.ss")
|
||||
(include "rumble/letrec.ss")
|
||||
(include "rumble/syntax-rule.ss")
|
||||
|
|
|
@ -128,11 +128,6 @@
|
|||
|
||||
;; ----------------------------------------
|
||||
|
||||
;; HACK: hardwired numbers that depend on the tagging regime
|
||||
;; and other representation details
|
||||
(define bytevector-content-offset 9)
|
||||
(define vector-content-offset (if (> (fixnum-width) 32) 9 5))
|
||||
|
||||
(define (object->addr v) ; call with GC disabled
|
||||
(#%$object-address v 0))
|
||||
|
||||
|
|
5
racket/src/cs/rumble/layout.ss
Normal file
5
racket/src/cs/rumble/layout.ss
Normal file
|
@ -0,0 +1,5 @@
|
|||
;; HACK: hardwired numbers that depend on the tagging regime
|
||||
;; and other representation details
|
||||
(define bytevector-content-offset 9)
|
||||
(define vector-content-offset (if (> (fixnum-width) 32) 9 5))
|
||||
(define record-content-offset vector-content-offset)
|
|
@ -974,9 +974,9 @@
|
|||
(putprop (record-type-uid rtd) 'guards new-guards))))))
|
||||
|
||||
(define (unsafe-struct*-ref s i)
|
||||
(#3%vector-ref s i))
|
||||
(#%$object-ref 'scheme-object s (fx+ record-content-offset (fx* i (foreign-sizeof 'void*)))))
|
||||
(define (unsafe-struct*-set! s i v)
|
||||
(#3%vector-set! s i v))
|
||||
(#%$object-set! 'scheme-object s (fx+ record-content-offset (fx* i (foreign-sizeof 'void*))) v))
|
||||
(define (unsafe-struct? v r)
|
||||
(#3%record? v r))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user