object.h: separate frozen flag to the independent bit-field

So that other flag operation do not break frozen flag.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-01-07 07:42:20 +09:00
parent a234c66c97
commit 21003746df
5 changed files with 13 additions and 12 deletions
+6 -5
View File
@@ -12,7 +12,8 @@
struct RBasic *gcnext; \
enum mrb_vtype tt:8; \
unsigned int gccolor:3; \
uint32_t flags:21
unsigned int frozen:1; \
uint32_t flags:20
#define MRB_FLAG_TEST(obj, flag) ((obj)->flags & (flag))
@@ -21,10 +22,10 @@ struct RBasic {
};
#define mrb_basic_ptr(v) ((struct RBasic*)(mrb_ptr(v)))
#define MRB_FL_OBJ_IS_FROZEN (1 << 20)
#define MRB_FROZEN_P(o) ((o)->flags & MRB_FL_OBJ_IS_FROZEN)
#define MRB_SET_FROZEN_FLAG(o) ((o)->flags |= MRB_FL_OBJ_IS_FROZEN)
#define MRB_UNSET_FROZEN_FLAG(o) ((o)->flags &= ~MRB_FL_OBJ_IS_FROZEN)
#define MRB_OBJ_IS_FROZEN 1
#define MRB_FROZEN_P(o) ((o)->frozen)
#define MRB_SET_FROZEN_FLAG(o) ((o)->frozen = 1)
#define MRB_UNSET_FROZEN_FLAG(o) ((o)->frozen = 0)
#define mrb_frozen_p(o) MRB_FROZEN_P(o)
struct RObject {