Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix JIT bug related to `list-ref' and `list-tail'

Closes PR 12688
  • Loading branch information...
commit 104e70bf659e9eb59fc3439ad229bf61fdde2a8b 1 parent f968ca3
@mflatt mflatt authored
Showing with 16 additions and 0 deletions.
  1. +15 −0 collects/tests/racket/optimize.rktl
  2. +1 −0  src/racket/src/jitinline.c
View
15 collects/tests/racket/optimize.rktl
@@ -1930,6 +1930,21 @@
(err/rt-test (call/cc (lambda (k) (/ 1 2 0))))
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Check slow path on `list-tail', where
+;; index is > 10000:
+
+(test 4.8
+ 'list-ref-test
+ (let loop ((line 0))
+ (let* ((numlist (build-list 20004 (lambda (x) 2.4)))
+ (n (length numlist)))
+ (let* ((mid (/ n 2))
+ (n1 (car numlist))
+ (n2 (list-ref numlist mid)))
+ (for-each values numlist)
+ (+ n1 n2)))))
+
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)
View
1  src/racket/src/jitinline.c
@@ -2424,6 +2424,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
|| IS_NAMED_PRIM(rator, "list-tail")) {
generate_two_args(app->rand1, app->rand2, jitter, 1, 2);
+ mz_rs_sync();
if (IS_NAMED_PRIM(rator, "list-ref"))
(void)jit_calli(sjc.list_ref_code);
else
Please sign in to comment.
Something went wrong with that request. Please try again.