changing code to use more macros for the slot field access

This commit is contained in:
hyunghwan.chung
2018-12-12 15:05:18 +00:00
parent 8d10b4a5fa
commit 3d57095c4a
4 changed files with 54 additions and 26 deletions

View File

@ -500,6 +500,27 @@ struct moo_obj_word_t
#define MOO_OBJ_GET_WORD_SLOT(oop) (((moo_oop_word_t)(oop))->slot)
#define MOO_OBJ_GET_LIWORD_SLOT(oop) (((moo_oop_liword_t)(oop))->slot)
#define MOO_OBJ_GET_OOP_SLOT_PTR(oop,idx) (&(((moo_oop_oop_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_CHAR_SLOT_PTR(oop,idx) (&(((moo_oop_char_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_BYTE_SLOT_PTR(oop,idx) (&(((moo_oop_byte_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_HALFWORD_SLOT_PTR(oop,idx) (&(((moo_oop_halfword_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_WORD_SLOT_PTR(oop,idx) (&(((moo_oop_word_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_LIWORD_SLOT_PTR(oop,idx) (&(((moo_oop_liword_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_OOP_SLOT_VAL(oop,idx) ((((moo_oop_oop_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_CHAR_SLOT_VAL(oop,idx) ((((moo_oop_char_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_BYTE_SLOT_VAL(oop,idx) ((((moo_oop_byte_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_HALFWORD_SLOT_VAL(oop,idx) ((((moo_oop_halfword_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_WORD_SLOT_VAL(oop,idx) ((((moo_oop_word_t)(oop))->slot)[idx])
#define MOO_OBJ_GET_LIWORD_SLOT_VAL(oop,idx) ((((moo_oop_liword_t)(oop))->slot)[idx])
/*#define MOO_OBJ_SET_OOP_SLOT_VAL(oop,idx,val) ((((moo_oop_oop_t)(oop))->slot)[idx] = (val)) - I must use MOO_STORE_OOP() instead.*/
#define MOO_OBJ_SET_CHAR_SLOT_VAL(oop,idx,val) ((((moo_oop_char_t)(oop))->slot)[idx] = (val))
#define MOO_OBJ_SET_BYTE_SLOT_VAL(oop,idx,val) ((((moo_oop_byte_t)(oop))->slot)[idx] = (val))
#define MOO_OBJ_SET_HALFWORD_SLOT_VAL(oop,idx,val) ((((moo_oop_halfword_t)(oop))->slot)[idx] = (val))
#define MOO_OBJ_SET_WORD_SLOT_VAL(oop,idx,val) ((((moo_oop_word_t)(oop))->slot)[idx] = (val))
#define MOO_OBJ_SET_LIWORD_SLOT_VAL(oop,idx,val) ((((moo_oop_liword_t)(oop))->slot)[idx] = (val))
typedef struct moo_trailer_t moo_trailer_t;
struct moo_trailer_t
{