[ARM64_DYNAREC] Added weakbarrier=2 to disable last write barriers (#2049)

This commit is contained in:
Yang Liu 2024-11-20 04:22:55 +08:00 committed by GitHub
parent 81e4e26dc5
commit fa432bb9d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 17 deletions

View File

@ -177,6 +177,7 @@ Enable/Disable simulation of Strong Memory model
Use weak memory barriers to reduce the performance impact by STRONGMEM Use weak memory barriers to reduce the performance impact by STRONGMEM
* 0 : Use regular safe barrier (Default.) * 0 : Use regular safe barrier (Default.)
* 1 : Use weak barriers to have more performance boost * 1 : Use weak barriers to have more performance boost
* 2 : Disable the last write barriers to have even more performance boost
#### BOX64_DYNAREC_X87DOUBLE * #### BOX64_DYNAREC_X87DOUBLE *
Force the use of Double for x87 emulation Force the use of Double for x87 emulation

View File

@ -306,6 +306,7 @@ Use weak memory barriers to reduce the performance impact by STRONGMEM
* 0 : Use regular safe barrier (Default.) * 0 : Use regular safe barrier (Default.)
* 1 : Use weak barriers to have more performance boost * 1 : Use weak barriers to have more performance boost
* 2 : Disable the last write barriers to have even more performance boost
=item B<BOX64_DYNAREC_X87DOUBLE>=I<0|1> =item B<BOX64_DYNAREC_X87DOUBLE>=I<0|1>

View File

@ -789,7 +789,7 @@ void LoadLogEnv()
p = getenv("BOX64_DYNAREC_WEAKBARRIER"); p = getenv("BOX64_DYNAREC_WEAKBARRIER");
if (p) { if (p) {
if (strlen(p) == 1) { if (strlen(p) == 1) {
if (p[0] >= '0' && p[0] <= '1') if (p[0] >= '0' && p[0] <= '2')
box64_dynarec_weakbarrier = p[0] - '0'; box64_dynarec_weakbarrier = p[0] - '0';
} }
if (box64_dynarec_weakbarrier) if (box64_dynarec_weakbarrier)

View File

@ -161,21 +161,21 @@
} while (0) } while (0)
// An opcode will write memory, this will be put before the STORE instruction automatically. // An opcode will write memory, this will be put before the STORE instruction automatically.
#define WILLWRITE() \ #define WILLWRITE() \
do { \ do { \
if (box64_dynarec_strongmem >= dyn->insts[ninst].will_write && dyn->smwrite == 0) { \ if (box64_dynarec_strongmem >= dyn->insts[ninst].will_write && dyn->smwrite == 0) { \
/* Will write but never written, this is the start of a SEQ, put a barrier. */ \ /* Will write but never written, this is the start of a SEQ, put a barrier. */ \
if (box64_dynarec_weakbarrier) \ if (box64_dynarec_weakbarrier) \
DMB_ISHST(); \ DMB_ISHST(); \
else \ else \
DMB_ISH(); \ DMB_ISH(); \
} else if (box64_dynarec_strongmem >= STRONGMEM_LAST_WRITE && dyn->insts[ninst].last_write) { \ } else if (box64_dynarec_strongmem >= STRONGMEM_LAST_WRITE && box64_dynarec_weakbarrier <= 1 && dyn->insts[ninst].last_write) { \
/* Last write, put a barrier */ \ /* Last write, put a barrier */ \
if (box64_dynarec_weakbarrier) \ if (box64_dynarec_weakbarrier) \
DMB_ISHST(); \ DMB_ISHST(); \
else \ else \
DMB_ISH(); \ DMB_ISH(); \
} \ } \
} while (0) } while (0)
// Similar to WILLWRITE, but checks lock. // Similar to WILLWRITE, but checks lock.

View File

@ -156,7 +156,7 @@ ENTRYINT(BOX64_DYNAREC_LOG, box64_dynarec_log, 0, 3, 2) \
ENTRYINT(BOX64_DYNAREC_BIGBLOCK, box64_dynarec_bigblock, 0, 3, 2) \ ENTRYINT(BOX64_DYNAREC_BIGBLOCK, box64_dynarec_bigblock, 0, 3, 2) \
ENTRYSTRING_(BOX64_DYNAREC_FORWARD, box64_dynarec_forward) \ ENTRYSTRING_(BOX64_DYNAREC_FORWARD, box64_dynarec_forward) \
ENTRYINT(BOX64_DYNAREC_STRONGMEM, box64_dynarec_strongmem, 0, 4, 3) \ ENTRYINT(BOX64_DYNAREC_STRONGMEM, box64_dynarec_strongmem, 0, 4, 3) \
ENTRYBOOL(BOX64_DYNAREC_WEAKBARRIER, box64_dynarec_weakbarrier) \ ENTRYINT(BOX64_DYNAREC_WEAKBARRIER, box64_dynarec_weakbarrier, 0, 2, 2) \
ENTRYBOOL(BOX64_DYNAREC_X87DOUBLE, box64_dynarec_x87double) \ ENTRYBOOL(BOX64_DYNAREC_X87DOUBLE, box64_dynarec_x87double) \
ENTRYBOOL(BOX64_DYNAREC_DIV0, box64_dynarec_div0) \ ENTRYBOOL(BOX64_DYNAREC_DIV0, box64_dynarec_div0) \
ENTRYBOOL(BOX64_DYNAREC_FASTNAN, box64_dynarec_fastnan) \ ENTRYBOOL(BOX64_DYNAREC_FASTNAN, box64_dynarec_fastnan) \