fix a JIT bug related to inlined structure constructors

Merge to v5.3.4
This commit is contained in:
Matthew Flatt 2013-04-23 20:05:41 -06:00
parent d123e09686
commit fd883dbf32
2 changed files with 13 additions and 1 deletions

View File

@ -3096,6 +3096,17 @@
(go '(foo-x (foo 1))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The JIT should check an inlined-constructor guess
;; to make sure that it's "simple" (e.g., no guards)
(let ([f #f])
(set! f (lambda (f x) (f x)))
(struct a (x))
(struct b (y) #:property prop:procedure 0)
(test 1 a-x (f a 1))
(test 2 (f b (lambda () 2))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -756,7 +756,8 @@ int scheme_generate_struct_alloc(mz_jit_state *jitter, int num_args,
mz_patch_branch(ref);
(void)mz_bnei_t(refslow, JIT_R0, scheme_prim_type, JIT_R2);
jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Primitive_Proc *)0x0)->pp.flags);
(void)jit_bmci_i(refslow, JIT_R2, SCHEME_PRIM_STRUCT_TYPE_SIMPLE_CONSTR);
jit_andi_i(JIT_R2, JIT_R2, SCHEME_PRIM_OTHER_TYPE_MASK);
(void)jit_bnei_i(refslow, JIT_R2, SCHEME_PRIM_STRUCT_TYPE_SIMPLE_CONSTR);
CHECK_LIMIT();
jit_ldxi_p(JIT_R2, JIT_R0, &(SCHEME_PRIM_CLOSURE_ELS(0x0)[0]));