From 9b1a2e7b3744bcdcd7a928b37eb89150bad49025 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 30 May 2014 07:49:27 +0100 Subject: [PATCH] JIT: minor comparison repairs Fix some comparisions that are written as pointer comparisons when they're actually integer comparisons. Also, remove an unnecessarily slow variant of pointer compairson for x86_64. --- racket/src/racket/src/jit.c | 2 +- racket/src/racket/src/jit.h | 9 --------- racket/src/racket/src/jitinline.c | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/racket/src/racket/src/jit.c b/racket/src/racket/src/jit.c index bd8f5fa434..59ce9bf3ef 100644 --- a/racket/src/racket/src/jit.c +++ b/racket/src/racket/src/jit.c @@ -3360,7 +3360,7 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data) /* check whether argv == runstack: */ ref = jit_bner_p(jit_forward(), JIT_RUNSTACK, JIT_R2); /* check whether we have at least one rest arg: */ - ref3 = jit_bgti_p(jit_forward(), JIT_R1, cnt); + ref3 = jit_bgti_i(jit_forward(), JIT_R1, cnt); /* yes and no: make room for the scheme_null */ jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1)); CHECK_RUNSTACK_OVERFLOW(); diff --git a/racket/src/racket/src/jit.h b/racket/src/racket/src/jit.h index 78eb4063f7..51d0bae8c5 100644 --- a/racket/src/racket/src/jit.h +++ b/racket/src/racket/src/jit.h @@ -1045,15 +1045,6 @@ static jit_insn *fp_tmpr; # define __END_TINY_JUMPS_IF_COMPACT__(cond) __END_TINY_JUMPS__(cond) #endif -/* mz_b..i_p supports 64-bit constants on x86_64: */ -#ifdef MZ_USE_JIT_X86_64 -# define mz_beqi_p(a, v, i) ((void)jit_patchable_movi_p(JIT_REXTMP, i), jit_beqr_p(a, v, JIT_REXTMP)) -# define mz_bnei_p(a, v, i) ((void)jit_patchable_movi_p(JIT_REXTMP, i), jit_bner_p(a, v, JIT_REXTMP)) -#else -# define mz_beqi_p(a, v, i) jit_beqi_p(a, v, i) -# define mz_bnei_p(a, v, i) jit_bnei_p(a, v, i) -#endif - #ifdef jit_leai_l # define jit_fixnum_l(JIT_Rdest, JIT_Rsrc) jit_leai_l(JIT_Rdest, JIT_Rsrc, 1, 1) #else diff --git a/racket/src/racket/src/jitinline.c b/racket/src/racket/src/jitinline.c index e5bd06adb2..414d16e92c 100644 --- a/racket/src/racket/src/jitinline.c +++ b/racket/src/racket/src/jitinline.c @@ -238,11 +238,11 @@ static int generate_inlined_constant_test(mz_jit_state *jitter, Scheme_App2_Rec } if (cnst2) { - ref2 = mz_beqi_p(jit_forward(), JIT_R0, cnst); - ref = mz_bnei_p(jit_forward(), JIT_R0, cnst2); + ref2 = jit_beqi_p(jit_forward(), JIT_R0, cnst); + ref = jit_bnei_p(jit_forward(), JIT_R0, cnst2); mz_patch_branch(ref2); } else { - ref = mz_bnei_p(jit_forward(), JIT_R0, cnst); + ref = jit_bnei_p(jit_forward(), JIT_R0, cnst); } if (for_branch) { @@ -317,11 +317,11 @@ static int generate_inlined_type_test(mz_jit_state *jitter, Scheme_App2_Rec *app __END_INNER_TINY__(branch_short); } if (lo_ty == hi_ty) { - ref3 = jit_bnei_p(jit_forward(), JIT_R1, lo_ty); + ref3 = jit_bnei_i(jit_forward(), JIT_R1, lo_ty); ref4 = NULL; } else { - ref3 = jit_blti_p(jit_forward(), JIT_R1, lo_ty); - ref4 = jit_bgti_p(jit_forward(), JIT_R1, hi_ty); + ref3 = jit_blti_i(jit_forward(), JIT_R1, lo_ty); + ref4 = jit_bgti_i(jit_forward(), JIT_R1, hi_ty); } if (can_chaperone < 0) { /* Make sure it's not a impersonator */ @@ -1095,8 +1095,8 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in ref1 = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1); jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); - ref3 = jit_beqi_p(jit_forward(), JIT_R1, scheme_null_type); - ref4 = jit_bnei_p(jit_forward(), JIT_R1, scheme_pair_type); + ref3 = jit_beqi_i(jit_forward(), JIT_R1, scheme_null_type); + ref4 = jit_bnei_i(jit_forward(), JIT_R1, scheme_pair_type); CHECK_LIMIT(); /* We have a pair. Optimistically check for PAIR_IS_LIST: */ @@ -2458,7 +2458,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i didn't disturb R0: */ if (for_branch) mz_SET_R0_STATUS_VALID(reg_status); } else { - ref = mz_bnei_p(jit_forward(), JIT_R0, a1); + ref = jit_bnei_p(jit_forward(), JIT_R0, a1); /* In case true is a fall-through, note that the test didn't disturb R0 or R1: */ if (for_branch) mz_SET_REG_STATUS_VALID(reg_status); @@ -2532,7 +2532,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i CHECK_LIMIT(); } - ref_f = jit_beqi_p(jit_forward(), JIT_R0, 0); + ref_f = jit_beqi_i(jit_forward(), JIT_R0, 0); if (for_branch) { scheme_add_branch_false(for_branch, ref_f);