From 6925c9c6f5e435fc88e683d7b9df475dd46c28ce Mon Sep 17 00:00:00 2001 From: shyouhei Date: Thu, 13 Sep 2018 03:46:46 +0000 Subject: 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 --- vm_insnhelper.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'vm_insnhelper.h') diff --git a/vm_insnhelper.h b/vm_insnhelper.h index e65e889898..b5f35df2bd 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -200,6 +200,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 */ /**********************************************************/ -- cgit v1.2.3