From 7efff338315d5e04d09c63c0135fae7bf0294080 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 9 Aug 2018 18:21:16 -0600 Subject: [PATCH] JIT: tweak to avoid register reload on some branches --- racket/src/racket/src/jit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/racket/src/racket/src/jit.c b/racket/src/racket/src/jit.c index 51db280391..196de999a2 100644 --- a/racket/src/racket/src/jit.c +++ b/racket/src/racket/src/jit.c @@ -1153,12 +1153,15 @@ static int finish_branch_with_true(mz_jit_state *jitter, Branch_Info *for_branch static int finish_branch_with_false(mz_jit_state *jitter, Branch_Info *for_branch) { GC_CAN_IGNORE jit_insn *ref; + int reg_valid; scheme_prepare_branch_jump(jitter, for_branch); CHECK_LIMIT(); __START_SHORT_JUMPS__(for_branch->branch_short); + reg_valid = mz_CURRENT_REG_STATUS_VALID(); ref = jit_jmpi(jit_forward()); + mz_SET_REG_STATUS_VALID(reg_valid); add_branch(for_branch, ref, BRANCH_ADDR_FALSE, BRANCH_ADDR_UCBRANCH); __END_SHORT_JUMPS__(for_branch->branch_short); @@ -1170,8 +1173,12 @@ void scheme_branch_for_true(mz_jit_state *jitter, Branch_Info *for_branch) { if (for_branch->true_needs_jump) { GC_CAN_IGNORE jit_insn *ref; + int reg_valid; + reg_valid = mz_CURRENT_REG_STATUS_VALID(); ref = jit_jmpi(jit_forward()); + mz_SET_REG_STATUS_VALID(reg_valid); + add_branch(for_branch, ref, BRANCH_ADDR_TRUE, BRANCH_ADDR_UCBRANCH); } } @@ -1179,13 +1186,17 @@ void scheme_branch_for_true(mz_jit_state *jitter, Branch_Info *for_branch) static int finish_branch(mz_jit_state *jitter, int target, Branch_Info *for_branch) { GC_CAN_IGNORE jit_insn *ref; + int reg_valid; scheme_prepare_branch_jump(jitter, for_branch); CHECK_LIMIT(); __START_SHORT_JUMPS__(for_branch->branch_short); + reg_valid = mz_CURRENT_REG_STATUS_VALID(); ref = jit_beqi_p(jit_forward(), target, scheme_false); + mz_SET_REG_STATUS_VALID(reg_valid); + add_branch(for_branch, ref, BRANCH_ADDR_FALSE, BRANCH_ADDR_BRANCH); scheme_branch_for_true(jitter, for_branch);