about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-04-16 16:25:33 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-04-16 16:25:33 +0200
commitbd432a3a1502a6b1d26ea7ea1d19c9f38c795450 (patch)
treefd7472d3d6c0fd03404b730e0d443aa59dde5125 /src
parentb155850ad10e7c6198c18e90ba0522b81781aa98 (diff)
downloadbox64-bd432a3a1502a6b1d26ea7ea1d19c9f38c795450.tar.gz
box64-bd432a3a1502a6b1d26ea7ea1d19c9f38c795450.zip
[DYNAREC] Stop spamming about not enough Hotpage after a few message, also added some memory barrier on hotpage allocation, to stay safe on Arm
Diffstat (limited to 'src')
-rwxr-xr-xsrc/dynarec/dynablock.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/dynarec/dynablock.c b/src/dynarec/dynablock.c
index 6bc61bf3..20f3bd04 100755
--- a/src/dynarec/dynablock.c
+++ b/src/dynarec/dynablock.c
@@ -405,6 +405,7 @@ int IsInHotPage(uintptr_t addr) {
                 hotpage_size[i] = 0;
                 dynarec_log(LOG_DEBUG, "End of Hotpage %p\n", (void*)hotpage[i]);
             }
+            __sync_synchronize();
             return 1;
         }
     }
@@ -437,17 +438,20 @@ void AddHotPage(uintptr_t addr) {
             if(!hotpage_count[i])
                 ++hotpages;
             hotpage_count[i] = HOTPAGE_STEP;
+            __sync_synchronize();
             return;
         }
         if(addr==hotpage[i]+0x1000*(hotpage_size[i]+1)) {
             ++hotpage_size[i];
             hotpage_count[i] = HOTPAGE_STEP;
+            __sync_synchronize();
             return;
         }
         if(addr+0x1000==hotpage[i]) {
             ++hotpage_size[i];
             hotpage[i] = addr;
             hotpage_count[i] = HOTPAGE_STEP;
+            __sync_synchronize();
             return;
         }
     }
@@ -460,12 +464,19 @@ void AddHotPage(uintptr_t addr) {
             minidx = i;
         }
     if(hotpage_count[minidx]) {
-        dynarec_log(LOG_NONE, "Warning, not enough Hotpage, replacing %p(%p/%d) with %p\n", (void*)hotpage[minidx], (void*)(0x1000*(hotpage_size[minidx]+1)), hotpage_count[minidx], (void*)addr);
+        static int cnt = 0;
+        if(cnt<50) {
+            dynarec_log(LOG_NONE, "Warning, not enough Hotpage, replacing %p(%p/%d) with %p\n", (void*)hotpage[minidx], (void*)(0x1000*(hotpage_size[minidx]+1)), hotpage_count[minidx], (void*)addr);
+            ++cnt;
+            if(cnt==50)   // stop spamming console with message...
+                dynarec_log(LOG_NONE, "    will stop warning about not enough Hotpage now\n");
+        }
         hotpage_size[minidx] = 0;
     } else
         ++hotpages;
     hotpage[minidx] = addr;
     hotpage_count[minidx] = HOTPAGE_STEP;
+    __sync_synchronize();
 }
 
 dynablock_t* DBGetBlock(x64emu_t* emu, uintptr_t addr, int create, dynablock_t** current)