summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-06-30 10:38:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2022-07-07 11:56:25 -0700
commit3cf2c2e4a111f621c3c23029a55edebf00bbe1b0 (patch)
treed1de5c5d95fe2cc921594825a5d4c91158fd1100 /iseq.c
parent621e5c568af8881c58eb3c271e01fba5fe76a6a3 (diff)
downloadruby-3cf2c2e4a111f621c3c23029a55edebf00bbe1b0.tar.gz
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.
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/iseq.c b/iseq.c
index fee2627525..36f625d1bb 100644
--- a/iseq.c
+++ b/iseq.c
@@ -273,52 +273,56 @@ 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;
- // IVC and ICVARC entries
- for (unsigned int i = 0; i < body->ivc_size; i++, is_entries++) {
- IVC ivc = (IVC)is_entries;
- if (ivc->entry) {
- if (RB_TYPE_P(ivc->entry->class_value, T_NONE)) {
- rb_bug("!! %u", ivc->entry->index);
- }
+ if (body->is_entries) {
+ // IVC and ICVARC entries
+ for (unsigned int i = 0; i < body->ivc_size; i++, is_entries++) {
+ IVC ivc = (IVC)is_entries;
+ if (ivc->entry) {
+ if (RB_TYPE_P(ivc->entry->class_value, T_NONE)) {
+ rb_bug("!! %u", ivc->entry->index);
+ }
- VALUE nv = func(data, ivc->entry->class_value);
- if (ivc->entry->class_value != nv) {
- ivc->entry->class_value = nv;
+ VALUE nv = func(data, ivc->entry->class_value);
+ if (ivc->entry->class_value != nv) {
+ ivc->entry->class_value = nv;
+ }
}
}
- }
- // ISE entries
- for (unsigned int i = 0; i < body->ise_size; i++, is_entries++) {
- union iseq_inline_storage_entry *const is = (union iseq_inline_storage_entry *)is_entries;
- if (is->once.value) {
- VALUE nv = func(data, is->once.value);
- if (is->once.value != nv) {
- is->once.value = nv;
+ // ISE entries
+ for (unsigned int i = 0; i < body->ise_size; i++, is_entries++) {
+ union iseq_inline_storage_entry *const is = (union iseq_inline_storage_entry *)is_entries;
+ if (is->once.value) {
+ VALUE nv = func(data, is->once.value);
+ if (is->once.value != nv) {
+ is->once.value = nv;
+ }
}
}
- }
- // IC Entries
- for (unsigned int i = 0; i < body->ic_size; i++, is_entries++) {
- IC ic = (IC)is_entries;
- if (ic->entry) {
- VALUE nv = func(data, (VALUE)ic->entry);
- if ((VALUE)ic->entry != nv) {
- ic->entry = (void *)nv;
+ // IC Entries
+ for (unsigned int i = 0; i < body->ic_size; i++, is_entries++) {
+ IC ic = (IC)is_entries;
+ if (ic->entry) {
+ VALUE nv = func(data, (VALUE)ic->entry);
+ if ((VALUE)ic->entry != nv) {
+ ic->entry = (void *)nv;
+ }
}
}
}
// Embedded VALUEs
- if (ISEQ_MBITS_BUFLEN(size) == 1) {
- iseq_scan_bits(0, body->mark_bits.single, code, func, data);
- }
- else {
- if (body->mark_bits.list) {
- for (unsigned int i = 0; i < ISEQ_MBITS_BUFLEN(size); i++) {
- iseq_bits_t bits = body->mark_bits.list[i];
- iseq_scan_bits(i, bits, code, func, data);
+ if (body->mark_bits.list) {
+ if (ISEQ_MBITS_BUFLEN(size) == 1) {
+ iseq_scan_bits(0, body->mark_bits.single, code, func, data);
+ }
+ else {
+ if (body->mark_bits.list) {
+ for (unsigned int i = 0; i < ISEQ_MBITS_BUFLEN(size); i++) {
+ iseq_bits_t bits = body->mark_bits.list[i];
+ iseq_scan_bits(i, bits, code, func, data);
+ }
}
}
}
@@ -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);
}
}
- if (FL_TEST((VALUE)iseq, ISEQ_MARKABLE_ISEQ)) {
- VALUE *original_iseq = ISEQ_ORIGINAL_ISEQ(iseq);
- rb_iseq_each_value(iseq, update_each_insn_value, (void *)original_iseq);
- }
+ VALUE *original_iseq = ISEQ_ORIGINAL_ISEQ(iseq);
+ rb_iseq_each_value(iseq, update_each_insn_value, (void *)original_iseq);
if (body->param.flags.has_kw && ISEQ_COMPILE_DATA(iseq) == NULL) {
int i, j;
@@ -448,9 +450,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
if (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.pc2branchindex);