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.
This commit is contained in:
Matthew Flatt 2014-05-30 07:49:27 +01:00
parent c0ec9702e8
commit 9b1a2e7b37
3 changed files with 11 additions and 20 deletions

View File

@ -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();

View File

@ -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

View File

@ -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);