git subrepo pull (merge) deps/lightrec

subrepo:
  subdir:   "deps/lightrec"
  merged:   "41210465"
upstream:
  origin:   "https://github.com/pcercuei/lightrec.git"
  branch:   "master"
  commit:   "25b6423b"
git-subrepo:
  version:  "0.4.1"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "a04d8c2"
This commit is contained in:
Zachary Cook 2020-05-12 10:18:14 -04:00
parent 034f3cd340
commit 88b399bddd
3 changed files with 24 additions and 12 deletions

View File

@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/pcercuei/lightrec.git
branch = master
commit = 126845d7b8bbdbec353076edb1fcd4bb10c2a2eb
commit = 25b6423b7a8e532404ac90dffb174e2f673748f6
parent = 9f797430963d9cf0fcef7d963466f9cac7026de2
method = merge
cmdver = 0.4.1

View File

@ -218,6 +218,8 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch)
branch_taken = is_branch_taken(reg_cache, op_next);
pr_debug("Target of impossible branch is a branch, "
"%staken.\n", branch_taken ? "" : "not ");
inter->cycles += lightrec_cycles_of_opcode(op_next);
old_rs = reg_cache[op_next.r.rs];
} else {
new_op.c = op_next;
new_op.flags = 0;
@ -248,16 +250,24 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch)
new_rt = reg_cache[op->r.rt];
/* Execute delay slot opcode */
if (branch_at_addr)
ds_next_pc = int_branch(&inter2, pc, op_next, branch_taken);
else
ds_next_pc = (*int_standard[inter2.op->i.op])(&inter2);
ds_next_pc = (*int_standard[inter2.op->i.op])(&inter2);
if (branch_at_addr) {
if (op_next.i.op == OP_SPECIAL)
/* TODO: Handle JALR setting $ra */
ds_next_pc = old_rs;
else if (op_next.i.op == OP_J || op_next.i.op == OP_JAL)
/* TODO: Handle JAL setting $ra */
ds_next_pc = (pc & 0xf0000000) | (op_next.j.imm << 2);
else
ds_next_pc = pc + 4 + ((s16)op_next.i.imm << 2);
}
if (branch_at_addr && !branch_taken) {
/* If the branch at the target of the branch opcode is not
* taken, we jump to its delay slot */
next_pc = pc + sizeof(u32);
} else if (!branch && branch_in_ds) {
} else if (branch_at_addr || (!branch && branch_in_ds)) {
next_pc = ds_next_pc;
}

View File

@ -76,19 +76,21 @@ static void * lightrec_recompiler_thd(void *d)
pthread_mutex_lock(&rec->mutex);
for (;;) {
do {
do {
pthread_cond_wait(&rec->cond, &rec->mutex);
if (rec->stop) {
pthread_mutex_unlock(&rec->mutex);
return NULL;
}
if (rec->stop)
goto out_unlock;
} while (slist_empty(&rec->slist));
lightrec_compile_list(rec);
}
} while (!rec->stop);
out_unlock:
pthread_mutex_unlock(&rec->mutex);
return NULL;
}
struct recompiler *lightrec_recompiler_init(struct lightrec_state *state)