Skip to content

Commit

Permalink
Introduce a tier-1 JIT compiler based on aarch64 architecture
Browse files Browse the repository at this point in the history
We follow the template and API of X64 to implement A64 tier-1 JIT
compiler.

* Perfromance
| Metric   | rv32emu-T1C | qemu  |
|----------+-------------+-------|
|aes	   |        0.034|  0.045|
|puzzle	   |       0.0115| 0.0169|
|pi        |        0.035|  0.032|
|dhrystone |	    1.914|  2.005|
|Nqeueens  |	     3.87|  2.898|
|qsort-O2  |	    7.819| 11.614|
|miniz-O2  |	    7.604|  3.803|
|primes-O2 |	   10.551|  5.986|
|sha512-O2 |	    6.497|  2.853|
|stream	   |        52.25| 45.776|

As demonstrated in the memory usage analysis below, the tier-1 JIT
compiler utilizes less memory than QEMU across all benchmarks.

* Memory usage
| Metric   | rv32emu-T1C |   qemu  |
|----------+-------------+---------|
|aes	   |      183,212|1,265,962|
|puzzle	   |      145,239|  891,357|
|pi        |      144,739|  872,525|
|dhrystone |	  146,282|  853,256|
|Nqeueens  |	  146,696|  854,174|
|qsort-O2  |	  146,907|  856,721|
|miniz-O2  |	  157,475|  999,897|
|primes-O2 |	  142,356|  851,661|
|sha512-O2 |	  145,369|  901,136|
|stream	   |      157,975|  955,809|

Related: sysprog21#238
  • Loading branch information
qwe661234 committed Dec 22, 2023
1 parent c32861a commit daa7750
Show file tree
Hide file tree
Showing 9 changed files with 1,888 additions and 1,296 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,17 @@ endif
ENABLE_JIT ?= 0
$(call set-feature, JIT)
ifeq ($(call has, JIT), 1)
OBJS_EXT += jit_x64.o
OBJS_EXT += jit.o
ifneq ($(processor), x86_64)
$(error JIT mode only supports for x64 target currently.)
ifneq ($(processor), aarch64)
$(error JIT mode only supports for x64 and arm64 target currently.)
endif
endif

src/rv32_jit_template.c:
$(Q)tools/gen-jit-template.py $(CFLAGS) > $@

$(OUT)/jit_x64.o: src/jit_x64.c src/rv32_jit_template.c
$(OUT)/jit.o: src/jit.c src/rv32_jit_template.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF $@.d $<
endif
Expand Down
2 changes: 1 addition & 1 deletion src/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern struct target_ops gdbstub_ops;

#if RV32_HAS(JIT)
#include "cache.h"
#include "jit_x64.h"
#include "jit.h"
#endif

/* Shortcuts for comparing each field of specified RISC-V instruction */
Expand Down
Loading

0 comments on commit daa7750

Please sign in to comment.