From: Eric Wong Date: 2017-07-13T08:10:09+00:00 Subject: [ruby-core:82027] Re: [Ruby trunk Feature#13715] [PATCH] avoid garbage from Symbol#to_s in interpolation ko1@atdot.net wrote: > > VALUE rb_vm_call0_body(rb_thread_t *th, struct rb_calling_info *calling, > > You don't need to expose `vm_call0_body()` because ` vm_eval.c` and ` vm_insnhelper.c` are included in `vm.c`. Ah, thanks. I just added a prototype for vm_call0_body. > ``` > if (RB_TYPE_P(recv, T_SYMBOL)) { > vm_search_method(ci, cc, recv); > ``` > > It seems we can use `vm_method_cfunc_is()`. Right, I expanded the function in my original patch it since I wanted to make it obvious that cc is populated regardless of function match. I am using a comment instead, now. > ``` > calling.block_handler = VM_BLOCK_HANDLER_NONE; > calling.argc = 0; > calling.recv = recv; > val = rb_vm_call0_body(th, &calling, ci, cc, 0); > return RB_TYPE_P(val, T_STRING) ? val : rb_any_to_s(recv); > ``` > > How about to call `rb_obj_as_string()` directly? I understand that you want to reuse method search results, but code will be simplified. I think the >10% improvement for non-symbol dstr benchmarks is worth the complexity, especially since we populate cc for vm_method_cfunc_is anyways. > Or make new function to call method with given ci, cc? I'm not sure what you mean, vm_call0_body is insufficient? Anyways, v2 patch here: https://80x24.org/spew/20170713075445.25252-1-e@80x24.org/raw Unsubscribe: