aboutsummaryrefslogtreecommitdiffstats
path: root/vm_exec.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-11 16:07:21 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-11 16:07:21 +0000
commitcc7b9c5450ff80c15b34d6ec9240aa284c6198c1 (patch)
tree74ae943e92a1b443b91fb3d7ffbb8818cd9b8b19 /vm_exec.h
parent4bbfdbe5c459365821ae6ac7b68b64d0a424df4d (diff)
downloadruby-cc7b9c5450ff80c15b34d6ec9240aa284c6198c1.tar.gz
vm_exec.h: introduce macros for abstarction.
* vm_exec.h: declare two macros * START_OF_ORIGINAL_INSN() * DISPATCH_ORIGINAL_INSN() instead of inserting label and goto lines. For OPT_CALL_THREADED_CODE, first macro is empty and second macro is simply call the original insn function. * tool/instruction.rb: use above macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_exec.h')
-rw-r--r--vm_exec.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/vm_exec.h b/vm_exec.h
index 3bfdd569d1..29120975ce 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -66,6 +66,9 @@ error !
#define NEXT_INSN() return reg_cfp;
+#define START_OF_ORIGINAL_INSN(x) /* ignore */
+#define DISPATCH_ORIGINAL_INSN(x) return LABEL(x)(ec, reg_cfp);
+
/************************************************/
#elif OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
/* threaded code with gcc */
@@ -95,10 +98,8 @@ error !
#else
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
/* do nothing */
-
#endif
-
/**********************************/
#if OPT_DIRECT_THREADED_CODE
@@ -134,6 +135,9 @@ error !
#define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)
+#define START_OF_ORIGINAL_INSN(x) start_of_##x:
+#define DISPATCH_ORIGINAL_INSN(x) goto start_of_##x;
+
/************************************************/
#else /* no threaded code */
/* most common method */
@@ -145,7 +149,6 @@ case BIN(insn):
DEBUG_END_INSN(); \
break;
-
#define INSN_DISPATCH() \
while (1) { \
switch (GET_CURRENT_INSN()) {
@@ -159,6 +162,9 @@ default: \
#define NEXT_INSN() goto first
+#define START_OF_ORIGINAL_INSN(x) start_of_##x:
+#define DISPATCH_ORIGINAL_INSN(x) goto start_of_##x;
+
#endif
#define VM_SP_CNT(ec, sp) ((sp) - (ec)->vm_stack)