From c07f24cd18ab41117f6ec3b9a1246786e4d0d8bf Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 23 Jun 2020 09:14:59 +0900 Subject: Change flag names in preparation of `REnv` refactoring. --- include/mruby/proc.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/mruby/proc.h b/include/mruby/proc.h index a4ca25043..ef5357d5d 100644 --- a/include/mruby/proc.h +++ b/include/mruby/proc.h @@ -22,14 +22,19 @@ struct REnv { mrb_sym mid; }; -/* flags (21bits): 1(shared flag):10(cioff/bidx):10(stack_len) */ -#define MRB_ENV_SET_STACK_LEN(e,len) ((e)->flags = (((e)->flags & ~0x3ff)|((unsigned int)(len) & 0x3ff))) -#define MRB_ENV_STACK_LEN(e) ((mrb_int)((e)->flags & 0x3ff)) -#define MRB_ENV_STACK_UNSHARED (1<<20) -#define MRB_ENV_UNSHARE_STACK(e) ((e)->flags |= MRB_ENV_STACK_UNSHARED) -#define MRB_ENV_STACK_SHARED_P(e) (((e)->flags & MRB_ENV_STACK_UNSHARED) == 0) -#define MRB_ENV_BIDX(e) (((e)->flags >> 10) & 0x3ff) -#define MRB_ENV_SET_BIDX(e,idx) ((e)->flags = (((e)->flags & ~(0x3ff<<10))|((unsigned int)(idx) & 0x3ff)<<10)) +/* flags (21bits): 1(close):1(touched):1(heap):8(cioff/bidx):8(stack_len) */ +#define MRB_ENV_SET_LEN(e,len) ((e)->flags = (((e)->flags & ~0xff)|((unsigned int)(len) & 0xff))) +#define MRB_ENV_LEN(e) ((mrb_int)((e)->flags & 0xff)) +#define MRB_ENV_CLOSED (1<<20) +#define MRB_ENV_TOUCHED (1<<19) +#define MRB_ENV_HEAPED (1<<18) +#define MRB_ENV_CLOSE(e) ((e)->flags |= MRB_ENV_CLOSED) +#define MRB_ENV_TOUCH(e) ((e)->flags |= MRB_ENV_TOUCHED) +#define MRB_ENV_HEAP(e) ((e)->flags |= MRB_ENV_HEAPED) +#define MRB_ENV_HEAP_P(e) ((e)->flags & MRB_ENV_HEAPED) +#define MRB_ENV_ONSTACK_P(e) (((e)->flags & MRB_ENV_CLOSED) == 0) +#define MRB_ENV_BIDX(e) (((e)->flags >> 8) & 0xff) +#define MRB_ENV_SET_BIDX(e,idx) ((e)->flags = (((e)->flags & ~(0xff<<8))|((unsigned int)(idx) & 0xff)<<10)) void mrb_env_unshare(mrb_state*, struct REnv*); -- cgit v1.2.3