don't JIT-inline `values' in a single-value position

This commit is contained in:
Matthew Flatt 2010-12-28 17:47:03 -07:00
parent 84a4f3f006
commit 3b032893c1
2 changed files with 9 additions and 0 deletions

View File

@ -1348,6 +1348,11 @@
(test-values (list (void)) (lambda () (for-each (lambda (x) (values 1 2)) '(1 2))))
(err/rt-test (map (lambda (x) (values 1 2)) '(1 2)) arity?)
;; Make sure `values' isn't JIT-inlined in a single-value position:
(err/rt-test ((if (zero? (random 1)) (lambda () (+ (values) 3)) #f)) arity?)
(err/rt-test ((if (zero? (random 1)) (lambda () (+ (values 1 2) 3)) #f)) arity?)
(err/rt-test ((if (zero? (random 1)) (lambda () (+ (values 1 2 4) 3)) #f)) arity?)
(test #t andmap add1 null)
(test #t andmap < null null)
(test #f ormap add1 null)

View File

@ -8737,6 +8737,8 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
} else if (IS_NAMED_PRIM(rator, "values")) {
Scheme_Object *args[3];
if (!multi_ok) return 0;
args[0] = rator;
args[1] = app->rand1;
args[2] = app->rand2;
@ -9214,6 +9216,8 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
} else if (IS_NAMED_PRIM(rator, "values")) {
int c = app->num_args;
if (!multi_ok) return 0;
if (c) {
generate_app(app, NULL, c, jitter, 0, 0, 2);
CHECK_LIMIT();