fix JIT bug

The bug happens with n-ary uses of arithmetic operations that
have constant arguments but couldn't be constant-folded ---
maybe due to a divide-by-zero.
This commit is contained in:
Matthew Flatt 2012-03-10 08:17:41 -07:00
parent 5c051f3ec9
commit 34314c1e7a
2 changed files with 9 additions and 3 deletions

View File

@ -1924,6 +1924,11 @@
(lambda ()
(set! a 'v)))))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check compilation of an n-ary `/' that isn't
;; constant folded due to a divide-by-zero:
(err/rt-test (call/cc (lambda (k) (/ 1 2 0))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1903,9 +1903,10 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app,
__START_SHORT_JUMPS__(c < 100);
if (trigger_arg > c) {
/* we don't expect this to happen, since constant-folding would
have collapsed it */
if (trigger_arg >= c) {
/* we don't expect this to happen, since constant-folding normally
would have collapsed it --- but a division by zero, for example,
might block constant folding */
trigger_arg = 0;
}