зеркало из https://github.com/github/ruby.git
Implement alias
This commit is contained in:
Родитель
bd0d0d3b38
Коммит
26cb5d416f
|
@ -3149,8 +3149,7 @@ module RubyVM::MJIT
|
|||
asm.incr_counter(:send_bmethod)
|
||||
return CantCompile
|
||||
when C.VM_METHOD_TYPE_ALIAS
|
||||
asm.incr_counter(:send_alias)
|
||||
return CantCompile
|
||||
jit_call_alias(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:)
|
||||
when C.VM_METHOD_TYPE_OPTIMIZED
|
||||
jit_call_optimized(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:)
|
||||
when C.VM_METHOD_TYPE_UNDEF
|
||||
|
@ -3362,6 +3361,12 @@ module RubyVM::MJIT
|
|||
jit_getivar(jit, ctx, asm, comptime_recv, ivar_id, recv_opnd)
|
||||
end
|
||||
|
||||
# vm_call_alias
|
||||
def jit_call_alias(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:)
|
||||
cme = C.rb_aliased_callable_method_entry(cme)
|
||||
jit_call_method_each_type(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:)
|
||||
end
|
||||
|
||||
# vm_call_optimized
|
||||
# @param jit [RubyVM::MJIT::JITState]
|
||||
# @param ctx [RubyVM::MJIT::Context]
|
||||
|
|
|
@ -403,6 +403,15 @@ module RubyVM::MJIT # :nodoc: all
|
|||
}
|
||||
end
|
||||
|
||||
def rb_aliased_callable_method_entry(cme)
|
||||
_cme = cme.to_i
|
||||
cme_addr = Primitive.cstmt! %{
|
||||
extern const rb_callable_method_entry_t * rb_aliased_callable_method_entry(const rb_callable_method_entry_t *me);
|
||||
return SIZET2NUM((size_t)rb_aliased_callable_method_entry((const rb_callable_method_entry_t *)NUM2SIZET(_cme)));
|
||||
}
|
||||
rb_callable_method_entry_t.new(cme_addr)
|
||||
end
|
||||
|
||||
#========================================================================================
|
||||
#
|
||||
# Old stuff
|
||||
|
|
Загрузка…
Ссылка в новой задаче