about summary refs log tree commit diff stats
path: root/src/dynarec/dynarec_native_pass.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-03-10 20:45:21 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-03-10 20:45:26 +0100
commita5a7d9382ec09c89779ae66f3af2ca2255ea3003 (patch)
tree6e1e55079aee2a6190766cf3d533662c44f0f48e /src/dynarec/dynarec_native_pass.c
parentbc770d908af3c310e2e0cd9e1fdc7ca6e0e80fb3 (diff)
downloadbox64-a5a7d9382ec09c89779ae66f3af2ca2255ea3003.tar.gz
box64-a5a7d9382ec09c89779ae66f3af2ca2255ea3003.zip
[DYNAREC] Limit temporary memory allocation on FillBlock64
Diffstat (limited to 'src/dynarec/dynarec_native_pass.c')
-rw-r--r--src/dynarec/dynarec_native_pass.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dynarec/dynarec_native_pass.c b/src/dynarec/dynarec_native_pass.c
index 471e2c98..8c609da1 100644
--- a/src/dynarec/dynarec_native_pass.c
+++ b/src/dynarec/dynarec_native_pass.c
@@ -71,7 +71,7 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int
         // This test is here to prevent things like TABLE64 to be out of range
         // native_size is not exact at this point, but it should be larger, not smaller, and not by a huge margin anyway
         // so it's good enough to avoid overflow in relative to PC data fectching
-        if(dyn->native_size >= MAXBLOCK_SIZE) {
+        if((dyn->native_size >= MAXBLOCK_SIZE) || (ninst >= MAX_INSTS)) {
             need_epilog = 1;
             break;
         }
@@ -98,8 +98,11 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int
                 }
             }
             reset_n = -1;
-        } else if(ninst && (dyn->insts[ninst].pred_sz>1 || (dyn->insts[ninst].pred_sz==1 && dyn->insts[ninst].pred[0]!=ninst-1)))
+        } 
+        #if STEP > 0
+        else if(ninst && (dyn->insts[ninst].pred_sz>1 || (dyn->insts[ninst].pred_sz==1 && dyn->insts[ninst].pred[0]!=ninst-1)))
             dyn->last_ip = 0;   // reset IP if some jump are coming here
+        #endif
         fpu_propagate_stack(dyn, ninst);
         NEW_INST;
         #if STEP == 0