зеркало из https://github.com/github/ruby.git
RJIT: Implement getglobal
This commit is contained in:
Родитель
9f8e914943
Коммит
81e19b7d99
|
@ -18,7 +18,7 @@ module RubyVM::RJIT
|
||||||
asm.incr_counter(:rjit_insns_count)
|
asm.incr_counter(:rjit_insns_count)
|
||||||
asm.comment("Insn: #{insn.name}")
|
asm.comment("Insn: #{insn.name}")
|
||||||
|
|
||||||
# 78/102
|
# 79/102
|
||||||
case insn.name
|
case insn.name
|
||||||
when :nop then nop(jit, ctx, asm)
|
when :nop then nop(jit, ctx, asm)
|
||||||
when :getlocal then getlocal(jit, ctx, asm)
|
when :getlocal then getlocal(jit, ctx, asm)
|
||||||
|
@ -35,7 +35,7 @@ module RubyVM::RJIT
|
||||||
when :opt_getconstant_path then opt_getconstant_path(jit, ctx, asm)
|
when :opt_getconstant_path then opt_getconstant_path(jit, ctx, asm)
|
||||||
when :getconstant then getconstant(jit, ctx, asm)
|
when :getconstant then getconstant(jit, ctx, asm)
|
||||||
# setconstant
|
# setconstant
|
||||||
# getglobal
|
when :getglobal then getglobal(jit, ctx, asm)
|
||||||
# setglobal
|
# setglobal
|
||||||
when :putnil then putnil(jit, ctx, asm)
|
when :putnil then putnil(jit, ctx, asm)
|
||||||
when :putself then putself(jit, ctx, asm)
|
when :putself then putself(jit, ctx, asm)
|
||||||
|
@ -649,7 +649,25 @@ module RubyVM::RJIT
|
||||||
end
|
end
|
||||||
|
|
||||||
# setconstant
|
# setconstant
|
||||||
# getglobal
|
|
||||||
|
# @param jit [RubyVM::RJIT::JITState]
|
||||||
|
# @param ctx [RubyVM::RJIT::Context]
|
||||||
|
# @param asm [RubyVM::RJIT::Assembler]
|
||||||
|
def getglobal(jit, ctx, asm)
|
||||||
|
gid = jit.operand(0)
|
||||||
|
|
||||||
|
# Save the PC and SP because we might make a Ruby call for warning
|
||||||
|
jit_prepare_routine_call(jit, ctx, asm)
|
||||||
|
|
||||||
|
asm.mov(C_ARGS[0], gid)
|
||||||
|
asm.call(C.rb_gvar_get)
|
||||||
|
|
||||||
|
top = ctx.stack_push
|
||||||
|
asm.mov(top, C_RET)
|
||||||
|
|
||||||
|
KeepCompiling
|
||||||
|
end
|
||||||
|
|
||||||
# setglobal
|
# setglobal
|
||||||
|
|
||||||
# @param jit [RubyVM::RJIT::JITState]
|
# @param jit [RubyVM::RJIT::JITState]
|
||||||
|
|
|
@ -505,6 +505,10 @@ module RubyVM::RJIT # :nodoc: all
|
||||||
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_get_symbol_id) }
|
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_get_symbol_id) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def C.rb_gvar_get
|
||||||
|
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_gvar_get) }
|
||||||
|
end
|
||||||
|
|
||||||
def C.rb_hash_aref
|
def C.rb_hash_aref
|
||||||
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_aref) }
|
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_aref) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -536,6 +536,7 @@ generator = BindingGenerator.new(
|
||||||
rb_reg_match_post
|
rb_reg_match_post
|
||||||
rb_reg_match_last
|
rb_reg_match_last
|
||||||
rb_reg_nth_match
|
rb_reg_nth_match
|
||||||
|
rb_gvar_get
|
||||||
],
|
],
|
||||||
types: %w[
|
types: %w[
|
||||||
CALL_DATA
|
CALL_DATA
|
||||||
|
|
Загрузка…
Ссылка в новой задаче