summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
99104c0)
subrepo:
subdir: "deps/lightrec"
merged: "
109d0a6ba3"
upstream:
origin: "https://github.com/pcercuei/lightrec.git"
branch: "master"
commit: "
109d0a6ba3"
git-subrepo:
version: "0.4.6"
origin: "https://github.com/ingydotnet/git-subrepo.git"
commit: "
110b9eb"
[subrepo]
remote = https://github.com/pcercuei/lightrec.git
branch = master
[subrepo]
remote = https://github.com/pcercuei/lightrec.git
branch = master
- commit = eb2d1a88ff22a5a71e27efffdbdb423bb9b91b4f
- parent = ab206b0c7fd5228d09d0b0cf3183405a6960ea55
+ commit = 109d0a6ba35d0279b9d0bf5bacafabc2d634af7b
+ parent = 99104c0456c7c923f40a474c1cbefb89a092b966
method = merge
cmdver = 0.4.6
method = merge
cmdver = 0.4.6
int lightrec_compile_block(struct lightrec_cstate *cstate,
struct block *block)
{
int lightrec_compile_block(struct lightrec_cstate *cstate,
struct block *block)
{
+ u32 was_dead[ARRAY_SIZE(cstate->targets) / 8];
struct lightrec_state *state = cstate->state;
struct lightrec_branch_target *target;
bool fully_tagged = false;
struct lightrec_state *state = cstate->state;
struct lightrec_branch_target *target;
bool fully_tagged = false;
/* Add compiled function to the LUT */
lut_write(state, lut_offset(block->pc), block->function);
/* Add compiled function to the LUT */
lut_write(state, lut_offset(block->pc), block->function);
- if (ENABLE_THREADED_COMPILER)
- lightrec_reaper_continue(state->reaper);
-
/* Detect old blocks that have been covered by the new one */
/* Detect old blocks that have been covered by the new one */
- for (i = 0; i < cstate->nb_targets; i++) {
+ for (i = 0; ENABLE_THREADED_COMPILER && i < cstate->nb_targets; i++) {
target = &cstate->targets[i];
if (!target->offset)
target = &cstate->targets[i];
if (!target->offset)
offset = block->pc + target->offset * sizeof(u32);
offset = block->pc + target->offset * sizeof(u32);
- /* Pause the reaper while we search for the block until we set
- * the BLOCK_IS_DEAD flag, otherwise the block may be removed
- * under our feet. */
- if (ENABLE_THREADED_COMPILER)
- lightrec_reaper_pause(state->reaper);
-
block2 = lightrec_find_block(state->block_cache, offset);
if (block2) {
/* No need to check if block2 is compilable - it must
block2 = lightrec_find_block(state->block_cache, offset);
if (block2) {
/* No need to check if block2 is compilable - it must
/* Set the "block dead" flag to prevent the dynarec from
* recompiling this block */
old_flags = block_set_flags(block2, BLOCK_IS_DEAD);
/* Set the "block dead" flag to prevent the dynarec from
* recompiling this block */
old_flags = block_set_flags(block2, BLOCK_IS_DEAD);
+
+ if (old_flags & BLOCK_IS_DEAD)
+ was_dead[i / 32] |= BIT(i % 32);
+ else
+ was_dead[i / 32] &= ~BIT(i % 32);
- if (ENABLE_THREADED_COMPILER) {
- lightrec_reaper_continue(state->reaper);
+ /* If block2 was pending for compilation, cancel it.
+ * If it's being compiled right now, wait until it finishes. */
+ if (block2)
+ lightrec_recompiler_remove(state->rec, block2);
+ }
- /* If block2 was pending for compilation, cancel it.
- * If it's being compiled right now, wait until it
- * finishes. */
- if (block2)
- lightrec_recompiler_remove(state->rec, block2);
- }
+ for (i = 0; i < cstate->nb_targets; i++) {
+ target = &cstate->targets[i];
+
+ if (!target->offset)
+ continue;
/* We know from now on that block2 (if present) isn't going to
* be compiled. We can override the LUT entry with our new
/* We know from now on that block2 (if present) isn't going to
* be compiled. We can override the LUT entry with our new
offset = lut_offset(block->pc) + target->offset;
lut_write(state, offset, jit_address(target->label));
offset = lut_offset(block->pc) + target->offset;
lut_write(state, offset, jit_address(target->label));
+ offset = block->pc + target->offset * sizeof(u32);
+ block2 = lightrec_find_block(state->block_cache, offset);
if (block2) {
pr_debug("Reap block 0x%08x as it's covered by block "
"0x%08x\n", block2->pc, block->pc);
if (block2) {
pr_debug("Reap block 0x%08x as it's covered by block "
"0x%08x\n", block2->pc, block->pc);
if (!ENABLE_THREADED_COMPILER) {
lightrec_unregister_block(state->block_cache, block2);
lightrec_free_block(state, block2);
if (!ENABLE_THREADED_COMPILER) {
lightrec_unregister_block(state->block_cache, block2);
lightrec_free_block(state, block2);
- } else if (!(old_flags & BLOCK_IS_DEAD)) {
+ } else if (!(was_dead[i / 32] & BIT(i % 32))) {
lightrec_reaper_add(state->reaper,
lightrec_reap_block,
block2);
lightrec_reaper_add(state->reaper,
lightrec_reap_block,
block2);
+ if (ENABLE_THREADED_COMPILER)
+ lightrec_reaper_continue(state->reaper);
+
if (ENABLE_DISASSEMBLER) {
pr_debug("Compiling block at PC: 0x%08x\n", block->pc);
jit_disassemble();
if (ENABLE_DISASSEMBLER) {
pr_debug("Compiling block at PC: 0x%08x\n", block->pc);
jit_disassemble();