aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 03:46:46 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 03:46:46 +0000
commit6925c9c6f5e435fc88e683d7b9df475dd46c28ce (patch)
treea9c1c737ae7f45f8db587888debf990b2ef12613 /vm_insnhelper.h
parent63130b2348440c731d20f9488f922d53abe16b6e (diff)
downloadruby-6925c9c6f5e435fc88e683d7b9df475dd46c28ce.tar.gz
move canary-related statements into macros
This is mostly cosmetic. Should generate a slightly readable vm.inc output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index e65e889898..b5f35df2bd 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -201,6 +201,27 @@ enum vm_regan_acttype {
/**********************************************************/
+/* deal with stack canary */
+/**********************************************************/
+
+#if VM_CHECK_MODE > 0
+#define DECLARE_CANARY bool leaf; VALUE *canary
+#define SETUP_CANARY() \
+ if ((leaf = INSN_ATTR(leaf))) { \
+ canary = GET_SP(); \
+ SET_SV(vm_stack_canary); \
+ }
+#define CHECK_CANARY() \
+ if (leaf && (*canary != vm_stack_canary)) { \
+ vm_canary_is_found_dead(INSN_ATTR(bin), *canary); \
+ }
+#else
+#define DECLARE_CANARY /* void */
+#define SETUP_CANARY() /* void */
+#define CHECK_CANARY() /* void */
+#endif
+
+/**********************************************************/
/* others */
/**********************************************************/