diff options
author | Peter Zhu <[email protected]> | 2022-03-23 15:19:48 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2022-03-24 10:03:51 -0400 |
commit | 5f10bd634fb6ae8f74a4ea730176233b0ca96954 (patch) | |
tree | 170c1c81ea63184290c9e021cc45bffbfc3f4f41 /iseq.h | |
parent | 04591e1be7618f64bd3bed8c53c0fcde5fcbddb8 (diff) |
Add ISEQ_BODY macro
Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using
this macro will make it easier for us to change the allocation strategy
of rb_iseq_constant_body when using Variable Width Allocation.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5698
Diffstat (limited to 'iseq.h')
-rw-r--r-- | iseq.h | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -28,35 +28,35 @@ typedef struct rb_iseq_struct rb_iseq_t; extern const ID rb_iseq_shared_exc_local_tbl[]; -#define ISEQ_COVERAGE(iseq) iseq->body->variable.coverage -#define ISEQ_COVERAGE_SET(iseq, cov) RB_OBJ_WRITE(iseq, &iseq->body->variable.coverage, cov) +#define ISEQ_COVERAGE(iseq) ISEQ_BODY(iseq)->variable.coverage +#define ISEQ_COVERAGE_SET(iseq, cov) RB_OBJ_WRITE(iseq, &ISEQ_BODY(iseq)->variable.coverage, cov) #define ISEQ_LINE_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_LINES) #define ISEQ_BRANCH_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_BRANCHES) -#define ISEQ_PC2BRANCHINDEX(iseq) iseq->body->variable.pc2branchindex -#define ISEQ_PC2BRANCHINDEX_SET(iseq, h) RB_OBJ_WRITE(iseq, &iseq->body->variable.pc2branchindex, h) +#define ISEQ_PC2BRANCHINDEX(iseq) ISEQ_BODY(iseq)->variable.pc2branchindex +#define ISEQ_PC2BRANCHINDEX_SET(iseq, h) RB_OBJ_WRITE(iseq, &ISEQ_BODY(iseq)->variable.pc2branchindex, h) -#define ISEQ_FLIP_CNT(iseq) (iseq)->body->variable.flip_count +#define ISEQ_FLIP_CNT(iseq) ISEQ_BODY(iseq)->variable.flip_count static inline rb_snum_t ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq) { - rb_snum_t cnt = iseq->body->variable.flip_count; - iseq->body->variable.flip_count += 1; + rb_snum_t cnt = ISEQ_BODY(iseq)->variable.flip_count; + ISEQ_BODY(iseq)->variable.flip_count += 1; return cnt; } static inline VALUE * ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq) { - return iseq->body->variable.original_iseq; + return ISEQ_BODY(iseq)->variable.original_iseq; } static inline void ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq) { - void *ptr = iseq->body->variable.original_iseq; - iseq->body->variable.original_iseq = NULL; + void *ptr = ISEQ_BODY(iseq)->variable.original_iseq; + ISEQ_BODY(iseq)->variable.original_iseq = NULL; if (ptr) { ruby_xfree(ptr); } @@ -65,7 +65,7 @@ ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq) static inline VALUE * ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size) { - return iseq->body->variable.original_iseq = + return ISEQ_BODY(iseq)->variable.original_iseq = ALLOC_N(VALUE, size); } |