about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-30 17:50:14 +0000
committerptitSeb <sebastien.chev@gmail.com>2023-03-30 17:50:14 +0000
commit260eeacbebe48f162cbbb53736a6a6f605877c19 (patch)
treeeca1643defdf8639e97040adfaf0008d2389799d /src
parent13b2aed9363548ac17fe2f7ff6852209b0c09cf5 (diff)
downloadbox64-260eeacbebe48f162cbbb53736a6a6f605877c19.tar.gz
box64-260eeacbebe48f162cbbb53736a6a6f605877c19.zip
[DYNAREC] Better handling of forward blocks with unused opcode in between
Diffstat (limited to 'src')
-rwxr-xr-xsrc/dynarec/dynarec_native_pass.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dynarec/dynarec_native_pass.c b/src/dynarec/dynarec_native_pass.c
index be9ebd7e..0c9ddfbc 100755
--- a/src/dynarec/dynarec_native_pass.c
+++ b/src/dynarec/dynarec_native_pass.c
@@ -147,8 +147,18 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr)
             ok = 1;
             // we use the 1st predecessor here
             int ii = ninst+1;
-            while(ii<dyn->size && !dyn->insts[ii].pred_sz) 
-                ++ii;
+            if(ii<dyn->size && !dyn->insts[ii].pred_sz) {
+                while(ii<dyn->size && (!dyn->insts[ii].pred_sz || (dyn->insts[ii].pred_sz==1 && dyn->insts[ii].pred[0]==ii-1))) {
+                    // may need to skip opcodes to advance
+                    ++ninst;
+                    NEW_INST;
+                    MESSAGE(LOG_DEBUG, "Skipping unused opcode\n");
+                    INST_NAME("Skipped opcode");
+                    INST_EPILOG;
+                    addr += dyn->insts[ii].x64.size;
+                    ++ii;
+                }
+            }
             if((dyn->insts[ii].x64.barrier&BARRIER_FULL)==BARRIER_FULL)
                 reset_n = -2;    // hack to say Barrier!
             else {