ruby-changes:68649
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:11:42 +0900 (JST)
Subject: [ruby-changes:68649] e4c65ec49c (master): Refactor uJIT code into more files for readability
https://git.ruby-lang.org/ruby.git/commit/?id=e4c65ec49c From e4c65ec49c5e2cba537f2d9ee00888c5dfbcac34 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Tue, 8 Dec 2020 16:54:41 -0500 Subject: Refactor uJIT code into more files for readability --- .gitignore | 2 +- common.mk | 34 +- compile.c | 1 - mjit.h | 2 +- ruby.c | 2 +- template/Makefile.in | 2 +- tool/ruby_vm/views/ujit_examples.inc.erb | 24 - tool/ruby_vm/views/ujit_hooks.inc.erb | 24 + ujit.h | 50 ++ ujit_codegen.c | 895 +++++++++++++++++++++ ujit_codegen.h | 10 + ujit_compile.c | 1238 ------------------------------ ujit_compile.h | 30 - ujit_core.c | 68 ++ ujit_core.h | 50 ++ ujit_iface.c | 260 +++++++ ujit_iface.h | 27 + version.c | 4 +- vm_method.c | 2 +- win32/Makefile.sub | 2 +- 20 files changed, 1410 insertions(+), 1317 deletions(-) delete mode 100644 tool/ruby_vm/views/ujit_examples.inc.erb create mode 100644 tool/ruby_vm/views/ujit_hooks.inc.erb create mode 100644 ujit.h create mode 100644 ujit_codegen.c create mode 100644 ujit_codegen.h delete mode 100644 ujit_compile.c delete mode 100644 ujit_compile.h create mode 100644 ujit_core.c create mode 100644 ujit_core.h create mode 100644 ujit_iface.c create mode 100644 ujit_iface.h diff --git a/.gitignore b/.gitignore index 4c2a8ca452..4fa89e9dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -230,4 +230,4 @@ lcov*.info https://github.com/ruby/ruby/blob/trunk/.gitignore#L230 /include/ruby-*/*/rb_mjit_min_header-*.h # UJIT -/ujit_examples.h +/ujit_hooks.inc diff --git a/common.mk b/common.mk index 1f8f36d30f..67541abba4 100644 --- a/common.mk +++ b/common.mk @@ -152,7 +152,9 @@ COMMONOBJS = array.$(OBJEXT) \ https://github.com/ruby/ruby/blob/trunk/common.mk#L152 vm_trace.$(OBJEXT) \ ujit_asm.$(OBJEXT) \ ujit_utils.$(OBJEXT) \ - ujit_compile.$(OBJEXT) \ + ujit_core.$(OBJEXT) \ + ujit_codegen.$(OBJEXT) \ + ujit_iface.$(OBJEXT) \ $(COROUTINE_OBJ) \ $(DTRACE_OBJ) \ $(BUILTIN_ENCOBJS) \ @@ -1108,7 +1110,7 @@ incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}known_errors.inc \ https://github.com/ruby/ruby/blob/trunk/common.mk#L1110 insns: $(INSNS) -ujit_examples.inc: vm.$(OBJEXT) +ujit_hooks.inc: vm.$(OBJEXT) id.h: $(tooldir)/generic_erb.rb $(srcdir)/template/id.h.tmpl $(srcdir)/defs/id.def $(ECHO) generating $@ @@ -3096,7 +3098,7 @@ compile.$(OBJEXT): {$(VPATH)}st.h https://github.com/ruby/ruby/blob/trunk/common.mk#L3098 compile.$(OBJEXT): {$(VPATH)}subst.h compile.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h compile.$(OBJEXT): {$(VPATH)}thread_native.h -compile.$(OBJEXT): {$(VPATH)}ujit_compile.h +compile.$(OBJEXT): {$(VPATH)}ujit.h compile.$(OBJEXT): {$(VPATH)}util.h compile.$(OBJEXT): {$(VPATH)}vm_callinfo.h compile.$(OBJEXT): {$(VPATH)}vm_core.h @@ -3476,7 +3478,7 @@ cont.$(OBJEXT): {$(VPATH)}st.h https://github.com/ruby/ruby/blob/trunk/common.mk#L3478 cont.$(OBJEXT): {$(VPATH)}subst.h cont.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h cont.$(OBJEXT): {$(VPATH)}thread_native.h -cont.$(OBJEXT): {$(VPATH)}ujit_compile.h +cont.$(OBJEXT): {$(VPATH)}ujit.h cont.$(OBJEXT): {$(VPATH)}vm_core.h cont.$(OBJEXT): {$(VPATH)}vm_debug.h cont.$(OBJEXT): {$(VPATH)}vm_opts.h @@ -5567,7 +5569,7 @@ eval.$(OBJEXT): {$(VPATH)}st.h https://github.com/ruby/ruby/blob/trunk/common.mk#L5569 eval.$(OBJEXT): {$(VPATH)}subst.h eval.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h eval.$(OBJEXT): {$(VPATH)}thread_native.h -eval.$(OBJEXT): {$(VPATH)}ujit_compile.h +eval.$(OBJEXT): {$(VPATH)}ujit.h eval.$(OBJEXT): {$(VPATH)}vm.h eval.$(OBJEXT): {$(VPATH)}vm_core.h eval.$(OBJEXT): {$(VPATH)}vm_debug.h @@ -6016,7 +6018,7 @@ gc.$(OBJEXT): {$(VPATH)}thread.h https://github.com/ruby/ruby/blob/trunk/common.mk#L6018 gc.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h gc.$(OBJEXT): {$(VPATH)}thread_native.h gc.$(OBJEXT): {$(VPATH)}transient_heap.h -gc.$(OBJEXT): {$(VPATH)}ujit_compile.h +gc.$(OBJEXT): {$(VPATH)}ujit.h gc.$(OBJEXT): {$(VPATH)}util.h gc.$(OBJEXT): {$(VPATH)}vm_callinfo.h gc.$(OBJEXT): {$(VPATH)}vm_core.h @@ -7008,7 +7010,7 @@ iseq.$(OBJEXT): {$(VPATH)}subst.h https://github.com/ruby/ruby/blob/trunk/common.mk#L7010 iseq.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h iseq.$(OBJEXT): {$(VPATH)}thread_native.h iseq.$(OBJEXT): {$(VPATH)}ujit_asm.h -iseq.$(OBJEXT): {$(VPATH)}ujit_compile.h +iseq.$(OBJEXT): {$(VPATH)}ujit.h iseq.$(OBJEXT): {$(VPATH)}util.h iseq.$(OBJEXT): {$(VPATH)}vm_callinfo.h iseq.$(OBJEXT): {$(VPATH)}vm_core.h @@ -8706,7 +8708,7 @@ mjit.$(OBJEXT): {$(VPATH)}subst.h https://github.com/ruby/ruby/blob/trunk/common.mk#L8708 mjit.$(OBJEXT): {$(VPATH)}thread.h mjit.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h mjit.$(OBJEXT): {$(VPATH)}thread_native.h -mjit.$(OBJEXT): {$(VPATH)}ujit_compile.h +mjit.$(OBJEXT): {$(VPATH)}ujit.h mjit.$(OBJEXT): {$(VPATH)}util.h mjit.$(OBJEXT): {$(VPATH)}vm_callinfo.h mjit.$(OBJEXT): {$(VPATH)}vm_core.h @@ -8919,7 +8921,7 @@ mjit_compile.$(OBJEXT): {$(VPATH)}st.h https://github.com/ruby/ruby/blob/trunk/common.mk#L8921 mjit_compile.$(OBJEXT): {$(VPATH)}subst.h mjit_compile.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h mjit_compile.$(OBJEXT): {$(VPATH)}thread_native.h -mjit_compile.$(OBJEXT): {$(VPATH)}ujit_compile.h +mjit_compile.$(OBJEXT): {$(VPATH)}ujit.h mjit_compile.$(OBJEXT): {$(VPATH)}vm_callinfo.h mjit_compile.$(OBJEXT): {$(VPATH)}vm_core.h mjit_compile.$(OBJEXT): {$(VPATH)}vm_exec.h @@ -12508,7 +12510,7 @@ ruby.$(OBJEXT): {$(VPATH)}subst.h https://github.com/ruby/ruby/blob/trunk/common.mk#L12510 ruby.$(OBJEXT): {$(VPATH)}thread.h ruby.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h ruby.$(OBJEXT): {$(VPATH)}thread_native.h -ruby.$(OBJEXT): {$(VPATH)}ujit_compile.h +ruby.$(OBJEXT): {$(VPATH)}ujit.h ruby.$(OBJEXT): {$(VPATH)}util.h ruby.$(OBJEXT): {$(VPATH)}vm_core.h ruby.$(OBJEXT): {$(VPATH)}vm_opts.h @@ -14471,7 +14473,7 @@ thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h https://github.com/ruby/ruby/blob/trunk/common.mk#L14473 thread.$(OBJEXT): {$(VPATH)}thread_native.h thread.$(OBJEXT): {$(VPATH)}thread_sync.c thread.$(OBJEXT): {$(VPATH)}timev.h -thread.$(OBJEXT): {$(VPATH)}ujit_compile.h +thread.$(OBJEXT): {$(VPATH)}ujit.h thread.$(OBJEXT): {$(VPATH)}vm_core.h thread.$(OBJEXT): {$(VPATH)}vm_debug.h thread.$(OBJEXT): {$(VPATH)}vm_opts.h @@ -15236,8 +15238,8 @@ ujit_compile.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h https://github.com/ruby/ruby/blob/trunk/common.mk#L15238 ujit_compile.$(OBJEXT): {$(VPATH)}thread_native.h ujit_compile.$(OBJEXT): {$(VPATH)}ujit_asm.h ujit_compile.$(OBJEXT): {$(VPATH)}ujit_compile.c -ujit_compile.$(OBJEXT): {$(VPATH)}ujit_compile.h -ujit_compile.$(OBJEXT): {$(VPATH)}ujit_examples.inc +ujit_compile.$(OBJEXT): {$(VPATH)}ujit.h +ujit_compile.$(OBJEXT): {$(VPATH)}ujit_hooks.inc ujit_compile.$(OBJEXT): {$(VPATH)}ujit_utils.h ujit_compile.$(OBJEXT): {$(VPATH)}vm_callinfo.h ujit_compile.$(OBJEXT): {$(VPATH)}vm_core.h @@ -15810,7 +15812,7 @@ version.$(OBJEXT): {$(VPATH)}st.h https://github.com/ruby/ruby/blob/trunk/common.mk#L15812 version.$(OBJEXT): {$(VPATH)}subst.h version.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h version.$(OBJEXT): {$(VPATH)}thread_native.h -version.$(OBJEXT): {$(VPATH)}ujit_compile.h +version.$(OBJEXT): {$(VPATH)}ujit.h version.$(OBJEXT): {$(VPATH)}version.c version.$(OBJEXT): {$(VPATH)}vm_core.h version.$(OBJEXT): {$(VPATH)}vm_opts.h @@ -16043,7 +16045,7 @@ vm.$(OBJEXT): {$(VPATH)}st.h https://github.com/ruby/ruby/blob/trunk/common.mk#L16045 vm.$(OBJEXT): {$(VPATH)}subst.h vm.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h vm.$(OBJEXT): {$(VPATH)}thread_native.h -vm.$(OBJEXT): {$(VPATH)}ujit_compile.h +vm.$(OBJEXT): {$(VPATH)}ujit.h vm.$(OBJEXT): {$(VPATH)}variable.h vm.$(OBJEXT): {$(VPATH)}vm.c vm.$(OBJEXT): {$(VPATH)}vm.h @@ -16849,7 +16851,7 @@ vm_trace.$(OBJEXT): {$(VPATH)}subst.h https://github.com/ruby/ruby/blob/trunk/common.mk#L16851 vm_trace.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h vm_trace.$(OBJEXT): {$(VPATH)}thread_native.h vm_trace.$(OBJEXT): {$(VPATH)}trace_point.rbinc -vm_trace.$(OBJEXT): {$(VPATH)}ujit_compile.h +vm_trace.$(OBJEXT): {$(VPATH)}ujit.h vm_trace.$(OBJEXT): {$(VPATH)}vm_core.h vm_trace.$(OBJEXT): {$(VPATH)}vm_opts.h vm_trace.$(OBJEXT): {$(VPATH)}vm_trace.c diff --git a/compile.c b/compile.c index aedced7c8d..1e88dc242d 100644 --- a/compile.c +++ b/compile.c @@ -43,7 +43,6 @@ https://github.com/ruby/ruby/blob/trunk/compile.c#L43 #include "builtin.h" #include "insns.inc" #include "insns_info.inc" -#include "ujit_compile.h" #undef RUBY_UNTYPED_DATA_WARNING #define RUBY_UNTYPED_DATA_WARNING 0 diff --git a/mjit.h b/mjit.h index 51ba66921c..0264962da8 100644 --- a/mjit.h +++ b/mjit.h @@ -16,7 +16,7 @@ https://github.com/ruby/ruby/blob/trunk/mjit.h#L16 #include "debug_counter.h" #include "ruby.h" -#include "ujit_compile.h" +#include "ujit.h" // Special address values of a function generated from the // corresponding iseq by MJIT: diff --git a/ruby.c b/ruby.c index a2e3ae8058..e8a4d4735b 100644 --- a/ruby.c +++ b/ruby.c @@ -59,7 +59,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby.c#L59 #include "internal/process.h" #include "internal/variable.h" #include "mjit.h" -#include "ujit_compile.h" +#include "ujit.h" #include "ruby/encoding.h" #include "ruby/thread.h" #include "ruby/util.h" diff --git a/template/Makefile.in b/template/Makefile.in index 557c9922f2..c71681b4c4 100644 --- a/template/Makefile. (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/