insns.def: s/handles_frame/handles_sp/
because it's more suitable to describe the current behavior now. tool/ruby_vm/models/bare_instructions.rb: ditto. tool/ruby_vm/views/_insn_entry.erb: ditto. tool/ruby_vm/views/_mjit_compile_insn_body.erb: ditto. tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
218aa03c0f
commit
a763bc3c6b
16
insns.def
16
insns.def
@ -43,7 +43,7 @@
|
|||||||
* sp_inc: Used to dynamically calculate sp increase in
|
* sp_inc: Used to dynamically calculate sp increase in
|
||||||
`insn_stack_increase`.
|
`insn_stack_increase`.
|
||||||
|
|
||||||
* handles_frame: If it is true, VM deals with sp in the insn.
|
* handles_sp: If it is true, VM deals with sp in the insn.
|
||||||
|
|
||||||
- Attributes can access operands, but not stack (push/pop) variables.
|
- Attributes can access operands, but not stack (push/pop) variables.
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ defineclass
|
|||||||
(ID id, ISEQ class_iseq, rb_num_t flags)
|
(ID id, ISEQ class_iseq, rb_num_t flags)
|
||||||
(VALUE cbase, VALUE super)
|
(VALUE cbase, VALUE super)
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
{
|
{
|
||||||
VALUE klass = vm_find_or_create_class_by_id(id, flags, cbase, super);
|
VALUE klass = vm_find_or_create_class_by_id(id, flags, cbase, super);
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ send
|
|||||||
(CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
|
(CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
|
||||||
(...)
|
(...)
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
// attr rb_snum_t sp_inc = - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
|
// attr rb_snum_t sp_inc = - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
|
||||||
{
|
{
|
||||||
struct rb_calling_info calling;
|
struct rb_calling_info calling;
|
||||||
@ -768,7 +768,7 @@ opt_send_without_block
|
|||||||
(CALL_INFO ci, CALL_CACHE cc)
|
(CALL_INFO ci, CALL_CACHE cc)
|
||||||
(...)
|
(...)
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
// attr rb_snum_t sp_inc = -ci->orig_argc;
|
// attr rb_snum_t sp_inc = -ci->orig_argc;
|
||||||
{
|
{
|
||||||
struct rb_calling_info calling;
|
struct rb_calling_info calling;
|
||||||
@ -783,7 +783,7 @@ invokesuper
|
|||||||
(CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
|
(CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
|
||||||
(...)
|
(...)
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
// attr rb_snum_t sp_inc = - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
|
// attr rb_snum_t sp_inc = - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
|
||||||
{
|
{
|
||||||
struct rb_calling_info calling;
|
struct rb_calling_info calling;
|
||||||
@ -801,7 +801,7 @@ invokeblock
|
|||||||
(CALL_INFO ci)
|
(CALL_INFO ci)
|
||||||
(...)
|
(...)
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
// attr rb_snum_t sp_inc = 1 - ci->orig_argc;
|
// attr rb_snum_t sp_inc = 1 - ci->orig_argc;
|
||||||
{
|
{
|
||||||
struct rb_calling_info calling;
|
struct rb_calling_info calling;
|
||||||
@ -828,7 +828,7 @@ leave
|
|||||||
()
|
()
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
(VALUE val)
|
(VALUE val)
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
{
|
{
|
||||||
if (OPT_CHECKED_RUN) {
|
if (OPT_CHECKED_RUN) {
|
||||||
const VALUE *const bp = vm_base_ptr(reg_cfp);
|
const VALUE *const bp = vm_base_ptr(reg_cfp);
|
||||||
@ -1376,7 +1376,7 @@ opt_call_c_function
|
|||||||
(rb_insn_func_t funcptr)
|
(rb_insn_func_t funcptr)
|
||||||
()
|
()
|
||||||
()
|
()
|
||||||
// attr bool handles_frame = true;
|
// attr bool handles_sp = true;
|
||||||
{
|
{
|
||||||
reg_cfp = (funcptr)(ec, reg_cfp);
|
reg_cfp = (funcptr)(ec, reg_cfp);
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ class RubyVM::BareInstructions
|
|||||||
}.join
|
}.join
|
||||||
end
|
end
|
||||||
|
|
||||||
def handles_frame?
|
def handles_sp?
|
||||||
/\b(false|0)\b/ !~ @attrs['handles_frame'].expr.expr
|
/\b(false|0)\b/ !~ @attrs['handles_sp'].expr.expr
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
@ -129,7 +129,7 @@ class RubyVM::BareInstructions
|
|||||||
generate_attribute 'rb_num_t', 'retn', rets.size
|
generate_attribute 'rb_num_t', 'retn', rets.size
|
||||||
generate_attribute 'rb_num_t', 'width', width
|
generate_attribute 'rb_num_t', 'width', width
|
||||||
generate_attribute 'rb_snum_t', 'sp_inc', rets.size - pops.size
|
generate_attribute 'rb_snum_t', 'sp_inc', rets.size - pops.size
|
||||||
generate_attribute 'bool', 'handles_frame', false
|
generate_attribute 'bool', 'handles_sp', false
|
||||||
end
|
end
|
||||||
|
|
||||||
def typesplit a
|
def typesplit a
|
||||||
|
@ -30,7 +30,7 @@ INSN_ENTRY(<%= insn.name %>)
|
|||||||
% end
|
% end
|
||||||
DEBUG_ENTER_INSN(INSN_ATTR(name));
|
DEBUG_ENTER_INSN(INSN_ATTR(name));
|
||||||
ADD_PC(INSN_ATTR(width));
|
ADD_PC(INSN_ATTR(width));
|
||||||
% if insn.handles_frame?
|
% if insn.handles_sp?
|
||||||
POPN(INSN_ATTR(popn));
|
POPN(INSN_ATTR(popn));
|
||||||
% end
|
% end
|
||||||
COLLECT_USAGE_INSN(INSN_ATTR(bin));
|
COLLECT_USAGE_INSN(INSN_ATTR(bin));
|
||||||
@ -39,7 +39,7 @@ INSN_ENTRY(<%= insn.name %>)
|
|||||||
% end
|
% end
|
||||||
<%= render_c_expr insn.expr -%>
|
<%= render_c_expr insn.expr -%>
|
||||||
CHECK_VM_STACK_OVERFLOW_FOR_INSN(VM_REG_CFP, INSN_ATTR(retn));
|
CHECK_VM_STACK_OVERFLOW_FOR_INSN(VM_REG_CFP, INSN_ATTR(retn));
|
||||||
% if insn.handles_frame?
|
% if insn.handles_sp?
|
||||||
% insn.rets.reverse_each do |ret|
|
% insn.rets.reverse_each do |ret|
|
||||||
PUSH(<%= insn.cast_to_VALUE ret %>);
|
PUSH(<%= insn.cast_to_VALUE ret %>);
|
||||||
% end
|
% end
|
||||||
|
@ -75,13 +75,13 @@
|
|||||||
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
||||||
fprintf(f, " goto cancel;\n");
|
fprintf(f, " goto cancel;\n");
|
||||||
% else
|
% else
|
||||||
% if insn.handles_frame?
|
% if insn.handles_sp?
|
||||||
% # If insn.handles_frame? is true, cfp->sp might be changed inside insns (like vm_caller_setup_arg_block)
|
% # If insn.handles_sp? is true, cfp->sp might be changed inside insns (like vm_caller_setup_arg_block)
|
||||||
% # and thus we need to use cfp->sp, even when local_stack_p is TRUE. When insn.handles_frame? is true,
|
% # and thus we need to use cfp->sp, even when local_stack_p is TRUE. When insn.handles_sp? is true,
|
||||||
% # cfp->sp should be available too because _mjit_compile_pc_and_sp.erb sets it.
|
% # cfp->sp should be available too because _mjit_compile_pc_and_sp.erb sets it.
|
||||||
fprintf(f, <%= to_cstr.call(line) %>);
|
fprintf(f, <%= to_cstr.call(line) %>);
|
||||||
% else
|
% else
|
||||||
% # If local_stack_p is TRUE and insn.handles_frame? is false, stack values are only available in local variables
|
% # If local_stack_p is TRUE and insn.handles_sp? is false, stack values are only available in local variables
|
||||||
% # for stack. So we need to replace those macros if local_stack_p is TRUE here.
|
% # for stack. So we need to replace those macros if local_stack_p is TRUE here.
|
||||||
% case line
|
% case line
|
||||||
% when /\bGET_SP\(\)/
|
% when /\bGET_SP\(\)/
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
%
|
%
|
||||||
% # JIT: move sp to use or preserve stack variables
|
% # JIT: move sp to use or preserve stack variables
|
||||||
if (status->local_stack_p) {
|
if (status->local_stack_p) {
|
||||||
% # sp motion is optimized away for `handles_frame? #=> false` case.
|
% # sp motion is optimized away for `handles_sp? #=> false` case.
|
||||||
% # Thus sp should be set properly before `goto cancel`.
|
% # Thus sp should be set properly before `goto cancel`.
|
||||||
% if insn.handles_frame?
|
% if insn.handles_sp?
|
||||||
% # JIT-only behavior (pushing JIT's local variables to VM's stack):
|
% # JIT-only behavior (pushing JIT's local variables to VM's stack):
|
||||||
{
|
{
|
||||||
rb_snum_t i, push_size;
|
rb_snum_t i, push_size;
|
||||||
@ -28,7 +28,7 @@
|
|||||||
% end
|
% end
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
% if insn.handles_frame?
|
% if insn.handles_sp?
|
||||||
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */
|
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */
|
||||||
% else
|
% else
|
||||||
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user