diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-08-02 23:25:38 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-08-02 23:25:38 +0900 |
commit | 086ffe72c711179c30a773027e0b4113e908d399 (patch) | |
tree | 1ed14b8037dfe0f60d858ec5a1fa019bd1e592dc /vm_insnhelper.c | |
parent | e9e17cbc051e894dfd27eda5feca2939f65552db (diff) | |
download | ruby-086ffe72c711179c30a773027e0b4113e908d399.tar.gz |
Revert "Revert "Add a specialized instruction for `.nil?` calls""
This reverts commit a0980f2446c0db735b8ffeb37e241370c458a626.
Retry for macOS Mojave.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 57f6d91e88..1875d35de1 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -4228,6 +4228,26 @@ vm_opt_empty_p(VALUE recv) } } +VALUE rb_false(VALUE obj); + +static VALUE +vm_opt_nil_p(CALL_INFO ci, CALL_CACHE cc, VALUE recv) +{ + if (recv == Qnil) { + if (BASIC_OP_UNREDEFINED_P(BOP_NIL_P, NIL_REDEFINED_OP_FLAG)) { + return Qtrue; + } else { + return Qundef; + } + } else { + if (vm_method_cfunc_is(ci, cc, recv, rb_false)) { + return Qfalse; + } else { + return Qundef; + } + } +} + static VALUE fix_succ(VALUE x) { |