From 156fb72d7015b420c57b0bd230693f52d8d75b32 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 9 Dec 2019 15:22:48 +0900 Subject: vm_args.c (rb_warn_check): Use iseq_unique_id instead of its pointer (This is the second try of 036bc1da6c6c9b0fa9b7f5968d897a9554dd770e.) If iseq is GC'ed, the pointer of iseq may be reused, which may hide a deprecation warning of keyword argument change. http://ci.rvm.jp/results/trunk-test1@phosphorus-docker/2474221 ``` 1) Failure: TestKeywordArguments#test_explicit_super_kwsplat [/tmp/ruby/v2/src/trunk-test1/test/ruby/test_keyword.rb:549]: --- expected +++ actual @@ -1 +1 @@ -/The keyword argument is passed as the last hash parameter.* for `m'/m +"" ``` This change ad-hocly adds iseq_unique_id for each iseq, and use it instead of iseq pointer. This covers the case where caller is GC'ed. Still, the case where callee is GC'ed, is not covered. But anyway, it is very rare that iseq is GC'ed. Even when it occurs, it just hides some warnings. It's no big deal. --- iseq.h | 1 + 1 file changed, 1 insertion(+) (limited to 'iseq.h') diff --git a/iseq.h b/iseq.h index 3701c320be..25c62a384f 100644 --- a/iseq.h +++ b/iseq.h @@ -186,6 +186,7 @@ void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events); void rb_iseq_trace_set_all(rb_event_flag_t turnon_events); void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq); +struct rb_iseq_constant_body *rb_iseq_constant_body_alloc(void); VALUE rb_iseqw_new(const rb_iseq_t *iseq); const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw); -- cgit v1.2.1