Skip to content

Commit 05db546

Browse files
committed
Eliminate redundant register swapping in JIT
In the current register allocation of JIT, we save the host registers before using to keep the consistency of the content between the vm and the host register, even it had not been changed by any other operation after loaded from the stack. This generates lots of redundant `store` related instructions on the host and reduces the performance of vm. In this patch, we introduce the `dirty` flag to record the status of the host register. Once the content of the host register is changed by an operation, the flag is set to 1. The register swapping will only be invoked when the register is dirty in next allocation. The performance improvement after this patch is shown below: * x86-64 | Metric | Original | Improved | SpeedUp | |-----------+----------+----------+---------| | dhrystone | 0.623 s | 0.463 s | +25.6% | | miniz | 3.437 s | 2.837 s | +17.5% | | primes | 4.435 s | 3.205 s | +27.7% | | sha512 | 3.212 s | 3.024 s | +5.9% | | aes | 1.708 s | 1.545 s | +9.5% | | qsort | 5.236 s | 5.219 s | +0.3% | * aarch64 | Metric | Original | Improved | SpeedUp | |-----------+----------+----------+---------| | dhrystone | 1.003 s | 0.897 s | +10.6% | | miniz | 4.312 s | 4.107 s | +4.8% | | primes | 9.605 s | 8.879 s | +7.6% | | sha512 | 5.902 s | 5.796 s | +1.8% | | aes | 2.932 s | 2.891 s | +1.4% | | qsort | 6.123 s | 5.988 s | +2.2% | Close #330
1 parent 928d8e7 commit 05db546

File tree

3 files changed

+233
-118
lines changed

3 files changed

+233
-118
lines changed

0 commit comments

Comments
 (0)