From 331fb4a2b3576ee364dc67f212b3c9c759fafdd8 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 21 Jul 2015 21:41:04 +0000 Subject: [PATCH] * vm_core.h: constify rb_call_info_t::kw_arg, rb_control_frame_t::iseq and rb_control_frame_t::block_iseq. * iseq.c (iseq_free): catch up this fix. * vm.c: ditto. * vm_dump.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ iseq.c | 4 ++-- vm.c | 4 ++-- vm_core.h | 6 +++--- vm_dump.c | 4 ++-- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c862a81d6b..8cc90b513b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Wed Jul 22 06:37:54 2015 Koichi Sasada + + * vm_core.h: constify rb_call_info_t::kw_arg, + rb_control_frame_t::iseq and rb_control_frame_t::block_iseq. + + * iseq.c (iseq_free): catch up this fix. + + * vm.c: ditto. + + * vm_dump.c: ditto. + Wed Jul 22 06:25:45 2015 Koichi Sasada * vm_core.h: constify rb_call_info_t::blockiseq and rb_block_::iseq. diff --git a/iseq.c b/iseq.c index 694b3dfe05..0161dea259 100644 --- a/iseq.c +++ b/iseq.c @@ -80,8 +80,8 @@ iseq_free(void *ptr) if (iseq->callinfo_entries) { for (i=0; icallinfo_size; i++) { /* TODO: revisit callinfo data structure */ - rb_call_info_kw_arg_t *kw_arg = iseq->callinfo_entries[i].kw_arg; - ruby_xfree(kw_arg); + const rb_call_info_kw_arg_t *kw_arg = iseq->callinfo_entries[i].kw_arg; + ruby_xfree((void *)kw_arg); } ruby_xfree(iseq->callinfo_entries); } diff --git a/vm.c b/vm.c index 41947a97a2..9aaf5f6180 100644 --- a/vm.c +++ b/vm.c @@ -1767,7 +1767,7 @@ rb_thread_current_status(const rb_thread_t *th) if (cfp->iseq != 0) { if (cfp->pc != 0) { - rb_iseq_t *iseq = cfp->iseq; + const rb_iseq_t *iseq = cfp->iseq; int line_no = rb_vm_get_sourceline(cfp); str = rb_sprintf("%"PRIsVALUE":%d:in `%"PRIsVALUE"'", iseq->location.path, line_no, iseq->location.label); @@ -2065,7 +2065,7 @@ rb_thread_mark(void *ptr) rb_gc_mark_values((long)(sp - p), p); while (cfp != limit_cfp) { - rb_iseq_t *iseq = cfp->iseq; + const rb_iseq_t *iseq = cfp->iseq; rb_gc_mark(cfp->proc); rb_gc_mark(cfp->self); if (iseq) { diff --git a/vm_core.h b/vm_core.h index daf801f21c..c0c119ac2a 100644 --- a/vm_core.h +++ b/vm_core.h @@ -202,7 +202,7 @@ typedef struct rb_call_info_struct { unsigned int flag; int orig_argc; const rb_iseq_t *blockiseq; - rb_call_info_kw_arg_t *kw_arg; + const rb_call_info_kw_arg_t *kw_arg; /* inline cache: keys */ rb_serial_t method_state; @@ -550,11 +550,11 @@ typedef struct rb_vm_struct { typedef struct rb_control_frame_struct { VALUE *pc; /* cfp[0] */ VALUE *sp; /* cfp[1] */ - rb_iseq_t *iseq; /* cfp[2] */ + const rb_iseq_t *iseq; /* cfp[2] */ VALUE flag; /* cfp[3] */ VALUE self; /* cfp[4] / block[0] */ VALUE *ep; /* cfp[5] / block[1] */ - rb_iseq_t *block_iseq; /* cfp[6] / block[2] */ + const rb_iseq_t *block_iseq;/* cfp[6] / block[2] */ VALUE proc; /* cfp[7] / block[3] */ #if VM_DEBUG_BP_CHECK diff --git a/vm_dump.c b/vm_dump.c index 599229b6ee..dc27dd4c4a 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -358,7 +358,7 @@ rb_vmdebug_thread_dump_regs(VALUE thval) void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp,VALUE *_pc) { - rb_iseq_t *iseq = cfp->iseq; + const rb_iseq_t *iseq = cfp->iseq; if (iseq != 0) { ptrdiff_t pc = _pc - iseq->iseq_encoded; @@ -372,7 +372,7 @@ rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp,VALUE *_pc) /* printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp)); */ if (pc >= 0) { - const VALUE *iseq_original = rb_iseq_original_iseq(iseq); + const VALUE *iseq_original = rb_iseq_original_iseq((rb_iseq_t *)iseq); rb_iseq_disasm_insn(0, iseq_original, (size_t)pc, iseq, 0); }