Skip to content

Commit

Permalink
Merge pull request sysprog21#476 from vacantron/develop
Browse files Browse the repository at this point in the history
Fix jit-cache without T2C enabled
  • Loading branch information
jserv authored Aug 20, 2024
2 parents 481794c + 01ed5da commit 14f6e2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1864,8 +1864,10 @@ static void code_cache_flush(struct jit_state *state, riscv_t *rv)
state->offset = state->org_size;
state->n_blocks = 0;
set_reset(&state->set);
jit_cache_clear(rv->jit_cache);
clear_cache_hot(rv->block_cache, (clear_func_t) clear_hot);
#if RV32_HAS(T2C)
jit_cache_clear(rv->jit_cache);
#endif
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ riscv_t *rv_create(riscv_user_t rv_attr)
mpool_create(sizeof(chain_entry_t) << BLOCK_IR_MAP_CAPACITY_BITS,
sizeof(chain_entry_t));
rv->jit_state = jit_state_init(CODE_CACHE_SIZE);
rv->jit_cache = jit_cache_init();
rv->block_cache = cache_create(BLOCK_MAP_CAPACITY_BITS);
assert(rv->block_cache);
#if RV32_HAS(T2C)
rv->quit = false;
rv->jit_cache = jit_cache_init();
/* prepare wait queue. */
pthread_mutex_init(&rv->wait_queue_lock, NULL);
INIT_LIST_HEAD(&rv->wait_queue);
Expand Down Expand Up @@ -389,10 +389,10 @@ void rv_delete(riscv_t *rv)
rv->quit = true;
pthread_join(t2c_thread, NULL);
pthread_mutex_destroy(&rv->wait_queue_lock);
jit_cache_exit(rv->jit_cache);
#endif
mpool_destroy(rv->chain_entry_mp);
jit_state_exit(rv->jit_state);
jit_cache_exit(rv->jit_cache);
cache_free(rv->block_cache);
#endif
free(rv);
Expand Down

0 comments on commit 14f6e2e

Please # to comment.