JIT: fix handling of index argument to bytes-set!
When the second argument to `bytes-set!` is a reference to a module-level variable that is definitely defined but not a known constant, then an incorrect reordering was used that would cause the third argument value to get overwritten before the call. Closes #1601
This commit is contained in:
parent
b3223ad8d2
commit
a5e7972bde
|
@ -967,6 +967,20 @@
|
|||
(test '(#f =) apply-an-accessor (alpha 'a) x?)
|
||||
(test '(#f =) apply-an-accessor (beta 'b) x?))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Check case of an index that's a module-level variable that is definitely
|
||||
;; defined but not a known constant
|
||||
|
||||
(module assign-to-bytes-array-with-non-constant-offset racket/base
|
||||
(provide out)
|
||||
(define buf (make-bytes 4 7))
|
||||
(define offset (if (even? (random 1)) 2 2))
|
||||
(define f (lambda () (bytes-set! buf offset 9) (bytes-ref buf offset)))
|
||||
(set! f f)
|
||||
(define out (f)))
|
||||
|
||||
(test 9 dynamic-require ''assign-to-bytes-array-with-non-constant-offset 'out)
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -4432,7 +4432,7 @@ int scheme_generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
|
|||
|
||||
simple = (SCHEME_INTP(app->args[2])
|
||||
&& (SCHEME_INT_VAL(app->args[2]) >= 0));
|
||||
if (simple || scheme_can_delay_and_avoids_r1(app->args[2]))
|
||||
if (simple || scheme_can_delay_and_avoids_r1_r2(app->args[2]))
|
||||
can_delay_index = 1;
|
||||
else
|
||||
can_delay_index = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user