From a80714aeee5717ba36114604c07df0043292949e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 28 Feb 2019 09:43:06 -0700 Subject: [PATCH] fix JIT-inlined `unsafe-fl<`, etc., for > 2 args and CGC Some parts of the implementation used for comparison were omitted when allocation operations are not supported (but comparisons don't allocate). This problem was unconvered by running the "jitinline.rktl" tests with RacketCGC. --- racket/src/racket/src/jitarith.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/racket/src/racket/src/jitarith.c b/racket/src/racket/src/jitarith.c index a6689abd9f..b0b329e94b 100644 --- a/racket/src/racket/src/jitarith.c +++ b/racket/src/racket/src/jitarith.c @@ -2173,7 +2173,7 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app, Branch_Info_Addr nary_addrs[3]; GC_CAN_IGNORE jit_insn *refslow, *reffx, *refdone; GC_CAN_IGNORE jit_insn *reffalse = NULL, *refdone3 = NULL; -#ifdef INLINE_FP_OPS +#ifdef INLINE_FP_COMP int args_unboxed; GC_CAN_IGNORE jit_insn *reffl, *refdone2; int use_fl = !unsafe_fx; @@ -2189,6 +2189,18 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app, mzSET_USE_FL(use_fl = 0); } +#ifdef INLINE_FP_COMP +# ifndef INLINE_FP_OPS + if ((arith == ARITH_ADD) + || (arith == ARITH_SUB) + || (arith == ARITH_MUL) + || (arith == ARITH_DIV)) { + /* assert: unsafe_fl < 1 */ + use_fl = 0; + } +# endif +#endif + c = app->num_args; if (!c) { /* Constant folding would normally prevent us from getting here, but just in case */ @@ -2265,7 +2277,7 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app, } else reffx = NULL; -#ifdef INLINE_FP_OPS +#ifdef INLINE_FP_COMP if (use_fl && (unsafe_fl < 1)) { /* First argument a flonum? */ jit_ldxi_s(JIT_R0, JIT_R0, &((Scheme_Object *)0x0)->type); @@ -2331,7 +2343,7 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app, reffalse = NULL; } -#ifdef INLINE_FP_OPS +#ifdef INLINE_FP_COMP if (use_fl) { /* Flonum branch: */ if (unsafe_fl < 1) { @@ -2414,7 +2426,7 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app, } } -#ifdef INLINE_FP_OPS +#ifdef INLINE_FP_COMP if (use_fl && use_fx) { mz_patch_ucbranch(refdone2); }