зеркало из https://github.com/github/ruby.git
RJIT: Implement setclassvariable
This commit is contained in:
Родитель
8510f33cc1
Коммит
71bcab4519
|
@ -18,7 +18,7 @@ module RubyVM::RJIT
|
|||
asm.incr_counter(:rjit_insns_count)
|
||||
asm.comment("Insn: #{insn.name}")
|
||||
|
||||
# 82/102
|
||||
# 83/102
|
||||
case insn.name
|
||||
when :nop then nop(jit, ctx, asm)
|
||||
when :getlocal then getlocal(jit, ctx, asm)
|
||||
|
@ -31,7 +31,7 @@ module RubyVM::RJIT
|
|||
when :getinstancevariable then getinstancevariable(jit, ctx, asm)
|
||||
when :setinstancevariable then setinstancevariable(jit, ctx, asm)
|
||||
when :getclassvariable then getclassvariable(jit, ctx, asm)
|
||||
# setclassvariable
|
||||
when :setclassvariable then setclassvariable(jit, ctx, asm)
|
||||
when :opt_getconstant_path then opt_getconstant_path(jit, ctx, asm)
|
||||
when :getconstant then getconstant(jit, ctx, asm)
|
||||
# setconstant
|
||||
|
@ -556,7 +556,22 @@ module RubyVM::RJIT
|
|||
KeepCompiling
|
||||
end
|
||||
|
||||
# setclassvariable
|
||||
# @param jit [RubyVM::RJIT::JITState]
|
||||
# @param ctx [RubyVM::RJIT::Context]
|
||||
# @param asm [RubyVM::RJIT::Assembler]
|
||||
def setclassvariable(jit, ctx, asm)
|
||||
# rb_vm_setclassvariable can raise exceptions.
|
||||
jit_prepare_routine_call(jit, ctx, asm)
|
||||
|
||||
asm.mov(C_ARGS[0], [CFP, C.rb_control_frame_t.offsetof(:iseq)])
|
||||
asm.mov(C_ARGS[1], CFP)
|
||||
asm.mov(C_ARGS[2], jit.operand(0))
|
||||
asm.mov(C_ARGS[3], ctx.stack_pop(1))
|
||||
asm.mov(C_ARGS[4], jit.operand(1))
|
||||
asm.call(C.rb_vm_setclassvariable)
|
||||
|
||||
KeepCompiling
|
||||
end
|
||||
|
||||
# @param jit [RubyVM::RJIT::JITState]
|
||||
# @param ctx [RubyVM::RJIT::Context]
|
||||
|
@ -1251,6 +1266,9 @@ module RubyVM::RJIT
|
|||
|
||||
# checkmatch
|
||||
|
||||
# @param jit [RubyVM::RJIT::JITState]
|
||||
# @param ctx [RubyVM::RJIT::Context]
|
||||
# @param asm [RubyVM::RJIT::Assembler]
|
||||
def checkkeyword(jit, ctx, asm)
|
||||
# When a keyword is unspecified past index 32, a hash will be used
|
||||
# instead. This can only happen in iseqs taking more than 32 keywords.
|
||||
|
|
1
rjit_c.c
1
rjit_c.c
|
@ -496,6 +496,7 @@ extern rb_event_flag_t rb_rjit_global_events;
|
|||
extern void rb_vm_setinstancevariable(const rb_iseq_t *iseq, VALUE obj, ID id, VALUE val, IVC ic);
|
||||
extern VALUE rb_vm_throw(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t throw_state, VALUE throwobj);
|
||||
extern VALUE rb_reg_new_ary(VALUE ary, int opt);
|
||||
extern void rb_vm_setclassvariable(const rb_iseq_t *iseq, const rb_control_frame_t *cfp, ID id, VALUE val, ICVARC ic);
|
||||
|
||||
#include "rjit_c.rbinc"
|
||||
|
||||
|
|
|
@ -625,6 +625,10 @@ module RubyVM::RJIT # :nodoc: all
|
|||
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_opt_newarray_min) }
|
||||
end
|
||||
|
||||
def C.rb_vm_setclassvariable
|
||||
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_setclassvariable) }
|
||||
end
|
||||
|
||||
def C.rb_vm_setinstancevariable
|
||||
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_setinstancevariable) }
|
||||
end
|
||||
|
|
|
@ -542,6 +542,7 @@ generator = BindingGenerator.new(
|
|||
rb_reg_new_ary
|
||||
rb_ary_clear
|
||||
rb_str_intern
|
||||
rb_vm_setclassvariable
|
||||
],
|
||||
types: %w[
|
||||
CALL_DATA
|
||||
|
|
Загрузка…
Ссылка в новой задаче