MJIT Support for getblockparamproxy
This commit is contained in:
parent
043e3d2cdc
commit
d30d404bc4
@ -18,7 +18,6 @@ class TestJIT < Test::Unit::TestCase
|
|||||||
# trace_* insns are not compiled for now...
|
# trace_* insns are not compiled for now...
|
||||||
TEST_PENDING_INSNS = RubyVM::INSTRUCTION_NAMES.select { |n| n.start_with?('trace_') }.map(&:to_sym) + [
|
TEST_PENDING_INSNS = RubyVM::INSTRUCTION_NAMES.select { |n| n.start_with?('trace_') }.map(&:to_sym) + [
|
||||||
# not supported yet
|
# not supported yet
|
||||||
:getblockparamproxy,
|
|
||||||
:defineclass,
|
:defineclass,
|
||||||
:opt_call_c_function,
|
:opt_call_c_function,
|
||||||
|
|
||||||
@ -94,7 +93,18 @@ class TestJIT < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_compile_insn_getblockparamproxy
|
def test_compile_insn_getblockparamproxy
|
||||||
skip "support this in mjit_compile"
|
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '4', success_count: 3, insns: %i[getblockparamproxy])
|
||||||
|
begin;
|
||||||
|
def bar(&b)
|
||||||
|
b.call
|
||||||
|
end
|
||||||
|
|
||||||
|
def foo(&b)
|
||||||
|
bar(&b) * bar(&b)
|
||||||
|
end
|
||||||
|
|
||||||
|
print foo { 2 }
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_compile_insn_getspecial
|
def test_compile_insn_getspecial
|
||||||
|
@ -81,6 +81,9 @@
|
|||||||
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
||||||
fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_opt_insn);\n");
|
fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_opt_insn);\n");
|
||||||
fprintf(f, " goto cancel;\n");
|
fprintf(f, " goto cancel;\n");
|
||||||
|
% when /\A(?<prefix>.+\b)INSN_LABEL\((?<name>[^)]+)\)(?<suffix>.+)\z/m
|
||||||
|
% prefix, name, suffix = Regexp.last_match[:prefix], Regexp.last_match[:name], Regexp.last_match[:suffix]
|
||||||
|
fprintf(f, " <%= prefix.gsub(/\t/, ' ' * 8) %>INSN_LABEL(<%= name %>_%d)<%= suffix.sub(/\n/, '\n') %>", pos);
|
||||||
% else
|
% else
|
||||||
% if insn.handles_sp?
|
% if insn.handles_sp?
|
||||||
% # If insn.handles_sp? 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)
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
} -%>
|
} -%>
|
||||||
%
|
%
|
||||||
% unsupported_insns = [
|
% unsupported_insns = [
|
||||||
% 'getblockparamproxy', # TODO: support this
|
|
||||||
% 'defineclass', # low priority
|
% 'defineclass', # low priority
|
||||||
% 'opt_call_c_function', # low priority
|
% 'opt_call_c_function', # low priority
|
||||||
% ]
|
% ]
|
||||||
|
3
vm.c
3
vm.c
@ -323,8 +323,6 @@ extern VALUE rb_vm_invoke_bmethod(rb_execution_context_t *ec, rb_proc_t *proc, V
|
|||||||
const rb_callable_method_entry_t *me);
|
const rb_callable_method_entry_t *me);
|
||||||
static VALUE vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, VALUE block_handler);
|
static VALUE vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, VALUE block_handler);
|
||||||
|
|
||||||
static VALUE rb_block_param_proxy;
|
|
||||||
|
|
||||||
#include "mjit.h"
|
#include "mjit.h"
|
||||||
#include "vm_insnhelper.h"
|
#include "vm_insnhelper.h"
|
||||||
#include "vm_exec.h"
|
#include "vm_exec.h"
|
||||||
@ -352,6 +350,7 @@ rb_next_class_serial(void)
|
|||||||
VALUE rb_cRubyVM;
|
VALUE rb_cRubyVM;
|
||||||
VALUE rb_cThread;
|
VALUE rb_cThread;
|
||||||
VALUE rb_mRubyVMFrozenCore;
|
VALUE rb_mRubyVMFrozenCore;
|
||||||
|
VALUE rb_block_param_proxy;
|
||||||
|
|
||||||
#define ruby_vm_redefined_flag GET_VM()->redefined_flag
|
#define ruby_vm_redefined_flag GET_VM()->redefined_flag
|
||||||
VALUE ruby_vm_const_missing_count = 0;
|
VALUE ruby_vm_const_missing_count = 0;
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
RUBY_SYMBOL_EXPORT_BEGIN
|
RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
|
|
||||||
|
RUBY_EXTERN VALUE rb_block_param_proxy;
|
||||||
|
|
||||||
RUBY_EXTERN VALUE ruby_vm_const_missing_count;
|
RUBY_EXTERN VALUE ruby_vm_const_missing_count;
|
||||||
RUBY_EXTERN rb_serial_t ruby_vm_global_method_state;
|
RUBY_EXTERN rb_serial_t ruby_vm_global_method_state;
|
||||||
RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
|
RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user