summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-01-08 08:20:36 +0900
committerKoichi Sasada <ko1@atdot.net>2020-02-22 09:58:59 +0900
commitf2286925f08406bc857f7b03ad6779a5d61443ae (patch)
tree62d056c0a8c253f17fccd4a506ddb6cbf1f7bed5 /tool
parenta1eb1fabef1bca0696449cd358d93f5a644d5914 (diff)
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of (mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and mid+argc+flags only requires 64bits. So this patch packed rb_call_info to VALUE (1 word) on such cases. If we can not represent it in VALUE, then use imemo_callinfo which contains conventional callinfo (rb_callinfo, renamed from rb_call_info). iseq->body->ci_kw_size is removed because all of callinfo is VALUE size (packed ci or a pointer to imemo_callinfo). To access ci information, we need to use these functions: vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci). struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg. rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc() is temporary removed because cd->ci should be marked.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2888
Diffstat (limited to 'tool')
-rw-r--r--tool/mk_call_iseq_optimized.rb9
-rw-r--r--tool/ruby_vm/views/_mjit_compile_insn.erb2
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb10
-rw-r--r--tool/ruby_vm/views/_sp_inc_helpers.erb8
4 files changed, 14 insertions, 15 deletions
diff --git a/tool/mk_call_iseq_optimized.rb b/tool/mk_call_iseq_optimized.rb
index eba44531c2..9d4caf3465 100644
--- a/tool/mk_call_iseq_optimized.rb
+++ b/tool/mk_call_iseq_optimized.rb
@@ -39,9 +39,9 @@ static const vm_call_handler vm_call_iseq_handlers[][#{L.to_a.size}] = {
};
static inline vm_call_handler
-vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size)
+vm_call_iseq_setup_func(const struct rb_callinfo *ci, const int param_size, const int local_size)
{
- if (UNLIKELY(ci->flag & VM_CALL_TAILCALL)) {
+ if (UNLIKELY(vm_ci_flag(ci) & VM_CALL_TAILCALL)) {
return &vm_call_iseq_setup_tailcall_0start;
}
else if (0) { /* to disable optimize */
@@ -59,11 +59,10 @@ vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, con
#else
-
static inline vm_call_handler
-vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size)
+vm_call_iseq_setup_func(const struct rb_callinfo *ci, const int param_size, const int local_size)
{
- if (UNLIKELY(ci->flag & VM_CALL_TAILCALL)) {
+ if (UNLIKELY(vm_ci_flag(ci) & VM_CALL_TAILCALL)) {
return &vm_call_iseq_setup_tailcall_0start;
}
else {
diff --git a/tool/ruby_vm/views/_mjit_compile_insn.erb b/tool/ruby_vm/views/_mjit_compile_insn.erb
index 8f45121615..fe545e691d 100644
--- a/tool/ruby_vm/views/_mjit_compile_insn.erb
+++ b/tool/ruby_vm/views/_mjit_compile_insn.erb
@@ -35,7 +35,7 @@
% when 'ID'
comment_id(f, (ID)operands[<%= i %>]);
% when 'CALL_DATA'
- comment_id(f, ((CALL_DATA)operands[<%= i %>])->ci.mid);
+ comment_id(f, vm_ci_mid(((CALL_DATA)operands[<%= i %>])->ci));
% when 'VALUE'
if (SYMBOL_P((VALUE)operands[<%= i %>])) comment_id(f, SYM2ID((VALUE)operands[<%= i %>]));
% end
diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb
index ec8eec5589..af39512f73 100644
--- a/tool/ruby_vm/views/_mjit_compile_send.erb
+++ b/tool/ruby_vm/views/_mjit_compile_send.erb
@@ -18,13 +18,13 @@
%
if (!status->compile_info->disable_send_cache && has_valid_method_type(cc_copy)) {
const rb_iseq_t *iseq;
- const CALL_INFO ci = &cd->ci;
- unsigned int argc = ci->orig_argc; // this `argc` variable is for calculating a value's position on stack considering `blockarg`.
+ const CALL_INFO ci = cd->ci;
+ unsigned int argc = vm_ci_argc(ci); // this `argc` variable is for calculating a value's position on stack considering `blockarg`.
% if insn.name == 'send'
- argc += ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0); // simulate `vm_caller_setup_arg_block`'s `--reg_cfp->sp`
+ argc += ((vm_ci_flag(ci) & VM_CALL_ARGS_BLOCKARG) ? 1 : 0); // simulate `vm_caller_setup_arg_block`'s `--reg_cfp->sp`
% end
- if (!(ci->flag & VM_CALL_TAILCALL) // inlining non-tailcall path
+ if (!(vm_ci_flag(ci) & VM_CALL_TAILCALL) // inlining non-tailcall path
&& cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && fastpath_applied_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def))) { // CC_SET_FASTPATH in vm_callee_setup_arg
int param_size = iseq->body->param.size;
@@ -63,7 +63,7 @@
% else
fprintf(f, " calling.block_handler = VM_BLOCK_HANDLER_NONE;\n");
% end
- fprintf(f, " calling.argc = %d;\n", ci->orig_argc);
+ fprintf(f, " calling.argc = %d;\n", vm_ci_argc(ci));
fprintf(f, " calling.recv = stack[%d];\n", b->stack_size - 1 - argc);
% # JIT: Special CALL_METHOD. Bypass cc_copy->call and inline vm_call_iseq_setup_normal for vm_call_iseq_setup_func FASTPATH.
diff --git a/tool/ruby_vm/views/_sp_inc_helpers.erb b/tool/ruby_vm/views/_sp_inc_helpers.erb
index f4cf50b8c8..d0b0bd79ef 100644
--- a/tool/ruby_vm/views/_sp_inc_helpers.erb
+++ b/tool/ruby_vm/views/_sp_inc_helpers.erb
@@ -9,7 +9,7 @@
#line <%= __LINE__ + 1 %> <%=cstr __FILE__ %>
static rb_snum_t
-sp_inc_of_sendish(const struct rb_call_info *ci)
+sp_inc_of_sendish(const struct rb_callinfo *ci)
{
/* Send-ish instructions will:
*
@@ -18,8 +18,8 @@ sp_inc_of_sendish(const struct rb_call_info *ci)
* 3. Pop receiver.
* 4. Push return value.
*/
- const int argb = (ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0;
- const int argc = ci->orig_argc;
+ const int argb = (vm_ci_flag(ci) & VM_CALL_ARGS_BLOCKARG) ? 1 : 0;
+ const int argc = vm_ci_argc(ci);
const int recv = 1;
const int retn = 1;
@@ -28,7 +28,7 @@ sp_inc_of_sendish(const struct rb_call_info *ci)
}
static rb_snum_t
-sp_inc_of_invokeblock(const struct rb_call_info *ci)
+sp_inc_of_invokeblock(const struct rb_callinfo *ci)
{
/* sp_inc of invokeblock is almost identical to that of sendish
* instructions, except that it does not pop receiver. */