summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-31 15:58:50 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-31 16:04:16 +0900
commitb1aecef87364631b0001dd2aafc432931e19a98f (patch)
tree7132db2022addc42126a1992c312eb7566dd2df6 /iseq.c
parentea42423908ed055f9039b1dce6e9a232a3b2dd90 (diff)
Use UNALIGNED_MEMBER_PTR
* internal.h (UNALIGNED_MEMBER_ACCESS, UNALIGNED_MEMBER_PTR): moved from eval_intern.h. * compile.c iseq.c, vm.c: use UNALIGNED_MEMBER_PTR for `entries` in `struct iseq_catch_table`. * vm_eval.c, vm_insnhelper.c: use UNALIGNED_MEMBER_PTR for `body` in `rb_method_definition_t`.
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/iseq.c b/iseq.c
index 916715e23f..fa4e72d2cd 100644
--- a/iseq.c
+++ b/iseq.c
@@ -256,7 +256,7 @@ rb_iseq_update_references(rb_iseq_t *iseq)
unsigned int i;
for(i = 0; i < table->size; i++) {
struct iseq_catch_table_entry *entry;
- entry = &table->entries[i];
+ entry = UNALIGNED_MEMBER_PTR(table, entries[i]);
if (entry->iseq) {
entry->iseq = (rb_iseq_t *)rb_gc_location((VALUE)entry->iseq);
}
@@ -315,7 +315,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
unsigned int i;
for(i = 0; i < table->size; i++) {
const struct iseq_catch_table_entry *entry;
- entry = &table->entries[i];
+ entry = UNALIGNED_MEMBER_PTR(table, entries[i]);
if (entry->iseq) {
rb_gc_mark_no_pin((VALUE)entry->iseq);
}
@@ -2138,7 +2138,8 @@ rb_iseq_disasm_recursive(const rb_iseq_t *iseq, VALUE indent)
rb_str_cat_cstr(indent, "| ");
indent_str = RSTRING_PTR(indent);
for (i = 0; i < body->catch_table->size; i++) {
- const struct iseq_catch_table_entry *entry = &body->catch_table->entries[i];
+ const struct iseq_catch_table_entry *entry =
+ UNALIGNED_MEMBER_PTR(body->catch_table, entries[i]);
rb_str_cat(str, indent_str, indent_len);
rb_str_catf(str,
"| catch type: %-6s st: %04d ed: %04d sp: %04d cont: %04d\n",
@@ -2272,7 +2273,8 @@ iseq_iterate_children(const rb_iseq_t *iseq, void (*iter_func)(const rb_iseq_t *
if (body->catch_table) {
for (i = 0; i < body->catch_table->size; i++) {
- const struct iseq_catch_table_entry *entry = &body->catch_table->entries[i];
+ const struct iseq_catch_table_entry *entry =
+ UNALIGNED_MEMBER_PTR(body->catch_table, entries[i]);
child = entry->iseq;
if (child) {
if (rb_hash_aref(all_children, (VALUE)child) == Qnil) {
@@ -2782,7 +2784,8 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
/* exception */
if (iseq_body->catch_table) for (i=0; i<iseq_body->catch_table->size; i++) {
VALUE ary = rb_ary_new();
- const struct iseq_catch_table_entry *entry = &iseq_body->catch_table->entries[i];
+ const struct iseq_catch_table_entry *entry =
+ UNALIGNED_MEMBER_PTR(iseq_body->catch_table, entries[i]);
rb_ary_push(ary, exception_type2symbol(entry->type));
if (entry->iseq) {
rb_ary_push(ary, iseq_data_to_ary(rb_iseq_check(entry->iseq)));