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

Closes PR 12688
This commit is contained in:
Matthew Flatt 2012-04-08 17:16:11 -06:00
parent f968ca3db6
commit 104e70bf65
2 changed files with 16 additions and 0 deletions

View File

@ -1930,6 +1930,21 @@
(err/rt-test (call/cc (lambda (k) (/ 1 2 0)))) (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) (report-errs)

View File

@ -2424,6 +2424,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
|| IS_NAMED_PRIM(rator, "list-tail")) { || IS_NAMED_PRIM(rator, "list-tail")) {
generate_two_args(app->rand1, app->rand2, jitter, 1, 2); generate_two_args(app->rand1, app->rand2, jitter, 1, 2);
mz_rs_sync();
if (IS_NAMED_PRIM(rator, "list-ref")) if (IS_NAMED_PRIM(rator, "list-ref"))
(void)jit_calli(sjc.list_ref_code); (void)jit_calli(sjc.list_ref_code);
else else