Skip to content

Commit 3ebb25d

Browse files
committed
Remove predicted block
Because we already have block chaining, there is no need for predicted block.
1 parent 71053f1 commit 3ebb25d

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

src/emulate.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ static block_t *block_alloc(riscv_t *rv)
301301
block_t *block = mpool_alloc(rv->block_mp);
302302
assert(block);
303303
block->n_insn = 0;
304-
block->predict = NULL;
305304
#if RV32_HAS(JIT)
306305
block->translatable = true;
307306
block->hot = false;
@@ -990,13 +989,6 @@ static block_t *block_find_or_translate(riscv_t *rv)
990989
mpool_free(rv->block_mp, delete_target);
991990
}
992991
#endif
993-
/* update the block prediction.
994-
* When translating a new block, the block predictor may benefit,
995-
* but updating it after finding a particular block may penalize
996-
* significantly.
997-
*/
998-
if (prev)
999-
prev->predict = next;
1000992
}
1001993

1002994
return next;
@@ -1016,15 +1008,10 @@ void rv_step(riscv_t *rv, int32_t cycles)
10161008
/* loop until hitting the cycle target */
10171009
while (rv->csr_cycle < cycles_target && !rv->halt) {
10181010
block_t *block;
1019-
/* try to predict the next block */
1020-
if (prev && prev->predict && prev->predict->pc_start == rv->PC) {
1021-
block = prev->predict;
1022-
} else {
1023-
/* lookup the next block in block map or translate a new block,
1024-
* and move onto the next block.
1025-
*/
1026-
block = block_find_or_translate(rv);
1027-
}
1011+
/* lookup the next block in block map or translate a new block,
1012+
* and move onto the next block.
1013+
*/
1014+
block = block_find_or_translate(rv);
10281015

10291016
/* by now, a block should be available */
10301017
assert(block);

src/riscv_private.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ enum {
5959
typedef struct block {
6060
uint32_t n_insn; /**< number of instructions encompased */
6161
uint32_t pc_start, pc_end; /**< address range of the basic block */
62-
struct block *predict; /**< block prediction */
6362

6463
rv_insn_t *ir_head, *ir_tail; /**< the first and last ir for this block */
6564
bool backward;

0 commit comments

Comments
 (0)