mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Remove ISEQ_MARKABLE_ISEQ flag
We don't need this flag anymore. We have all the info we need via the bitmap and the is_entries list.
This commit is contained in:
parent
621e5c568a
commit
3cf2c2e4a1
Notes:
git
2022-07-08 03:56:46 +09:00
3 changed files with 41 additions and 53 deletions
11
compile.c
11
compile.c
|
@ -2241,7 +2241,6 @@ add_adjust_info(struct iseq_insn_info_entry *insns_info, unsigned int *positions
|
||||||
static int
|
static int
|
||||||
iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
||||||
{
|
{
|
||||||
VALUE iseqv = (VALUE)iseq;
|
|
||||||
struct iseq_insn_info_entry *insns_info;
|
struct iseq_insn_info_entry *insns_info;
|
||||||
struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
|
struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
|
||||||
unsigned int *positions;
|
unsigned int *positions;
|
||||||
|
@ -2396,7 +2395,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
||||||
generated_iseq[code_index + 1 + j] = map;
|
generated_iseq[code_index + 1 + j] = map;
|
||||||
ISEQ_MBITS_SET(mark_offset_bits, code_index + 1 + j);
|
ISEQ_MBITS_SET(mark_offset_bits, code_index + 1 + j);
|
||||||
RB_OBJ_WRITTEN(iseq, Qundef, map);
|
RB_OBJ_WRITTEN(iseq, Qundef, map);
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
needs_bitmap = true;
|
needs_bitmap = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2413,7 +2411,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
||||||
if (!SPECIAL_CONST_P(v)) {
|
if (!SPECIAL_CONST_P(v)) {
|
||||||
RB_OBJ_WRITTEN(iseq, Qundef, v);
|
RB_OBJ_WRITTEN(iseq, Qundef, v);
|
||||||
ISEQ_MBITS_SET(mark_offset_bits, code_index + 1 + j);
|
ISEQ_MBITS_SET(mark_offset_bits, code_index + 1 + j);
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
needs_bitmap = true;
|
needs_bitmap = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2433,7 +2430,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
||||||
ic_index, ISEQ_IS_SIZE(body));
|
ic_index, ISEQ_IS_SIZE(body));
|
||||||
}
|
}
|
||||||
generated_iseq[code_index + 1 + j] = (VALUE)ic;
|
generated_iseq[code_index + 1 + j] = (VALUE)ic;
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
|
|
||||||
if (insn == BIN(opt_getinlinecache) && type == TS_IC) {
|
if (insn == BIN(opt_getinlinecache) && type == TS_IC) {
|
||||||
// Store the instruction index for opt_getinlinecache on the IC for
|
// Store the instruction index for opt_getinlinecache on the IC for
|
||||||
|
@ -10338,14 +10334,12 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
|
||||||
if (NUM2UINT(op) >= ISEQ_BODY(iseq)->ise_size) {
|
if (NUM2UINT(op) >= ISEQ_BODY(iseq)->ise_size) {
|
||||||
ISEQ_BODY(iseq)->ise_size = NUM2INT(op) + 1;
|
ISEQ_BODY(iseq)->ise_size = NUM2INT(op) + 1;
|
||||||
}
|
}
|
||||||
FL_SET((VALUE)iseq, ISEQ_MARKABLE_ISEQ);
|
|
||||||
break;
|
break;
|
||||||
case TS_IC:
|
case TS_IC:
|
||||||
argv[j] = op;
|
argv[j] = op;
|
||||||
if (NUM2UINT(op) >= ISEQ_BODY(iseq)->ic_size) {
|
if (NUM2UINT(op) >= ISEQ_BODY(iseq)->ic_size) {
|
||||||
ISEQ_BODY(iseq)->ic_size = NUM2INT(op) + 1;
|
ISEQ_BODY(iseq)->ic_size = NUM2INT(op) + 1;
|
||||||
}
|
}
|
||||||
FL_SET((VALUE)iseq, ISEQ_MARKABLE_ISEQ);
|
|
||||||
break;
|
break;
|
||||||
case TS_IVC: /* inline ivar cache */
|
case TS_IVC: /* inline ivar cache */
|
||||||
case TS_ICVARC: /* inline cvar cache */
|
case TS_ICVARC: /* inline cvar cache */
|
||||||
|
@ -10353,7 +10347,6 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
|
||||||
if (NUM2UINT(op) >= ISEQ_BODY(iseq)->ivc_size) {
|
if (NUM2UINT(op) >= ISEQ_BODY(iseq)->ivc_size) {
|
||||||
ISEQ_BODY(iseq)->ivc_size = NUM2INT(op) + 1;
|
ISEQ_BODY(iseq)->ivc_size = NUM2INT(op) + 1;
|
||||||
}
|
}
|
||||||
FL_SET((VALUE)iseq, ISEQ_MARKABLE_ISEQ);
|
|
||||||
break;
|
break;
|
||||||
case TS_CALLDATA:
|
case TS_CALLDATA:
|
||||||
argv[j] = iseq_build_callinfo_from_hash(iseq, op);
|
argv[j] = iseq_build_callinfo_from_hash(iseq, op);
|
||||||
|
@ -11240,7 +11233,6 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
|
||||||
if (!SPECIAL_CONST_P(v)) {
|
if (!SPECIAL_CONST_P(v)) {
|
||||||
RB_OBJ_WRITTEN(iseqv, Qundef, v);
|
RB_OBJ_WRITTEN(iseqv, Qundef, v);
|
||||||
ISEQ_MBITS_SET(mark_offset_bits, code_index);
|
ISEQ_MBITS_SET(mark_offset_bits, code_index);
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
needs_bitmap = true;
|
needs_bitmap = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -11262,7 +11254,6 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
|
||||||
code[code_index] = v;
|
code[code_index] = v;
|
||||||
ISEQ_MBITS_SET(mark_offset_bits, code_index);
|
ISEQ_MBITS_SET(mark_offset_bits, code_index);
|
||||||
RB_OBJ_WRITTEN(iseqv, Qundef, v);
|
RB_OBJ_WRITTEN(iseqv, Qundef, v);
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
needs_bitmap = true;
|
needs_bitmap = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -11274,7 +11265,6 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
|
||||||
if (!SPECIAL_CONST_P(v)) {
|
if (!SPECIAL_CONST_P(v)) {
|
||||||
RB_OBJ_WRITTEN(iseqv, Qundef, v);
|
RB_OBJ_WRITTEN(iseqv, Qundef, v);
|
||||||
ISEQ_MBITS_SET(mark_offset_bits, code_index);
|
ISEQ_MBITS_SET(mark_offset_bits, code_index);
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
needs_bitmap = true;
|
needs_bitmap = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -11295,7 +11285,6 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
|
||||||
ic->ic_cache.get_insn_idx = insn_index;
|
ic->ic_cache.get_insn_idx = insn_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
|
|
||||||
break;
|
break;
|
||||||
case TS_CALLDATA:
|
case TS_CALLDATA:
|
||||||
{
|
{
|
||||||
|
|
8
iseq.c
8
iseq.c
|
@ -273,6 +273,7 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data)
|
||||||
|
|
||||||
union iseq_inline_storage_entry *is_entries = body->is_entries;
|
union iseq_inline_storage_entry *is_entries = body->is_entries;
|
||||||
|
|
||||||
|
if (body->is_entries) {
|
||||||
// IVC and ICVARC entries
|
// IVC and ICVARC entries
|
||||||
for (unsigned int i = 0; i < body->ivc_size; i++, is_entries++) {
|
for (unsigned int i = 0; i < body->ivc_size; i++, is_entries++) {
|
||||||
IVC ivc = (IVC)is_entries;
|
IVC ivc = (IVC)is_entries;
|
||||||
|
@ -309,8 +310,10 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Embedded VALUEs
|
// Embedded VALUEs
|
||||||
|
if (body->mark_bits.list) {
|
||||||
if (ISEQ_MBITS_BUFLEN(size) == 1) {
|
if (ISEQ_MBITS_BUFLEN(size) == 1) {
|
||||||
iseq_scan_bits(0, body->mark_bits.single, code, func, data);
|
iseq_scan_bits(0, body->mark_bits.single, code, func, data);
|
||||||
}
|
}
|
||||||
|
@ -323,6 +326,7 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Similar to rb_iseq_each_value, except that this walks through each
|
// Similar to rb_iseq_each_value, except that this walks through each
|
||||||
// instruction instead of the associated VALUEs. The provided iterator should
|
// instruction instead of the associated VALUEs. The provided iterator should
|
||||||
|
@ -393,10 +397,8 @@ rb_iseq_update_references(rb_iseq_t *iseq)
|
||||||
cds[i].cc = (struct rb_callcache *)rb_gc_location((VALUE)cds[i].cc);
|
cds[i].cc = (struct rb_callcache *)rb_gc_location((VALUE)cds[i].cc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FL_TEST((VALUE)iseq, ISEQ_MARKABLE_ISEQ)) {
|
|
||||||
VALUE *original_iseq = ISEQ_ORIGINAL_ISEQ(iseq);
|
VALUE *original_iseq = ISEQ_ORIGINAL_ISEQ(iseq);
|
||||||
rb_iseq_each_value(iseq, update_each_insn_value, (void *)original_iseq);
|
rb_iseq_each_value(iseq, update_each_insn_value, (void *)original_iseq);
|
||||||
}
|
|
||||||
|
|
||||||
if (body->param.flags.has_kw && ISEQ_COMPILE_DATA(iseq) == NULL) {
|
if (body->param.flags.has_kw && ISEQ_COMPILE_DATA(iseq) == NULL) {
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -448,9 +450,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
|
||||||
if (ISEQ_BODY(iseq)) {
|
if (ISEQ_BODY(iseq)) {
|
||||||
const struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
|
const struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq);
|
||||||
|
|
||||||
if (FL_TEST((VALUE)iseq, ISEQ_MARKABLE_ISEQ)) {
|
|
||||||
rb_iseq_each_value(iseq, each_insn_value, NULL);
|
rb_iseq_each_value(iseq, each_insn_value, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
rb_gc_mark_movable(body->variable.coverage);
|
rb_gc_mark_movable(body->variable.coverage);
|
||||||
rb_gc_mark_movable(body->variable.pc2branchindex);
|
rb_gc_mark_movable(body->variable.pc2branchindex);
|
||||||
|
|
1
iseq.h
1
iseq.h
|
@ -90,7 +90,6 @@ ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
|
||||||
#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
|
#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
|
||||||
#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
|
#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
|
||||||
#define ISEQ_TRANSLATED IMEMO_FL_USER3
|
#define ISEQ_TRANSLATED IMEMO_FL_USER3
|
||||||
#define ISEQ_MARKABLE_ISEQ IMEMO_FL_USER4
|
|
||||||
|
|
||||||
#define ISEQ_EXECUTABLE_P(iseq) (FL_TEST_RAW(((VALUE)iseq), ISEQ_NOT_LOADED_YET | ISEQ_USE_COMPILE_DATA) == 0)
|
#define ISEQ_EXECUTABLE_P(iseq) (FL_TEST_RAW(((VALUE)iseq), ISEQ_NOT_LOADED_YET | ISEQ_USE_COMPILE_DATA) == 0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue