[DYNAREC] Added BIGBLOCK=3 level

This commit is contained in:
ptitSeb 2022-10-25 18:34:38 +02:00
parent 280bc969ce
commit 067dcbc0f7
3 changed files with 8 additions and 4 deletions

View File

@ -130,7 +130,8 @@ Forbid dynablock creation in the interval specified (helpfull for debugging beha
Enables/Disables Box64's Dynarec building BigBlock. Enables/Disables Box64's Dynarec building BigBlock.
* 0 : Don't try to build block as big as possible (can help program using lots of thread and a JIT, like C#/Unity) (Default when libmonobdwgc-2.0.so is loaded) * 0 : Don't try to build block as big as possible (can help program using lots of thread and a JIT, like C#/Unity) (Default when libmonobdwgc-2.0.so is loaded)
* 1 : Build Dynarec block as big as possible (Default.) * 1 : Build Dynarec block as big as possible (Default.)
* 2 : Build Dynarec block bigger (don't stop when block overlaps) * 2 : Build Dynarec block bigger (don't stop when block overlaps, but only for blocks in elf memory)
* 3 : Build Dynarec block bigger (don't stop when block overlaps, for all type of memory)
#### BOX64_DYNAREC_STRONGMEM #### BOX64_DYNAREC_STRONGMEM
Enable/Disable simulation of Strong Memory model Enable/Disable simulation of Strong Memory model

View File

@ -18,6 +18,7 @@
#include "dynablock.h" #include "dynablock.h"
#include "dynarec_native.h" #include "dynarec_native.h"
#include "custommem.h" #include "custommem.h"
#include "elfloader.h"
#include "dynarec_arch.h" #include "dynarec_arch.h"
#include "dynarec_helper.h" #include "dynarec_helper.h"
@ -43,6 +44,7 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr)
fpu_reset(dyn); fpu_reset(dyn);
int reset_n = -1; int reset_n = -1;
dyn->last_ip = (dyn->insts && dyn->insts[0].pred_sz)?0:ip; // RIP is always set at start of block unless there is a predecessor! dyn->last_ip = (dyn->insts && dyn->insts[0].pred_sz)?0:ip; // RIP is always set at start of block unless there is a predecessor!
int stopblock = 2+(FindElfAddress(my_context, addr)?0:1); // if block is in elf_memory, it can be extended with bligblocks==2, else it needs 3
// ok, go now // ok, go now
INIT; INIT;
while(ok) { while(ok) {
@ -217,7 +219,8 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr)
if(ok<0) {ok = 0; need_epilog=1;} if(ok<0) {ok = 0; need_epilog=1;}
++ninst; ++ninst;
#if STEP == 0 #if STEP == 0
if(ok && ((!isJumpTableDefault64((void*)addr) && (box64_dynarec_bigblock<2)) || (addr>=box64_nodynarec_start && addr<box64_nodynarec_end))) if(ok && (((box64_dynarec_bigblock<stopblock) && !isJumpTableDefault64((void*)addr))
|| (addr>=box64_nodynarec_start && addr<box64_nodynarec_end)))
#else #else
if(ok && (ninst==dyn->size)) if(ok && (ninst==dyn->size))
#endif #endif

View File

@ -421,13 +421,13 @@ void LoadLogEnv()
p = getenv("BOX64_DYNAREC_BIGBLOCK"); p = getenv("BOX64_DYNAREC_BIGBLOCK");
if(p) { if(p) {
if(strlen(p)==1) { if(strlen(p)==1) {
if(p[0]>='0' && p[0]<='2') if(p[0]>='0' && p[0]<='3')
box64_dynarec_bigblock = p[0]-'0'; box64_dynarec_bigblock = p[0]-'0';
} }
if(!box64_dynarec_bigblock) if(!box64_dynarec_bigblock)
printf_log(LOG_INFO, "Dynarec will not try to make big block\n"); printf_log(LOG_INFO, "Dynarec will not try to make big block\n");
else if (box64_dynarec_bigblock>1) else if (box64_dynarec_bigblock>1)
printf_log(LOG_INFO, "Dynarec will try to make bigger blocks\n"); printf_log(LOG_INFO, "Dynarec will try to make bigger blocks%s\n", (box64_dynarec_bigblock>2)?" even on non-elf memory":"");
} }
p = getenv("BOX64_DYNAREC_STRONGMEM"); p = getenv("BOX64_DYNAREC_STRONGMEM");