ruby-changes:73303
From: Alan <ko1@a...>
Date: Tue, 30 Aug 2022 01:09:59 +0900 (JST)
Subject: [ruby-changes:73303] c70d1471c1 (master): Only check lowest bit for _Bool type (https://github.com/Shopify/ruby/pull/412)
https://git.ruby-lang.org/ruby.git/commit/?id=c70d1471c1 From c70d1471c1723f26ca54699f056887fe200c973e Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Wed, 17 Aug 2022 15:42:39 -0400 Subject: Only check lowest bit for _Bool type (https://github.com/Shopify/ruby/pull/412) * Only check lowest bit for _Bool type The `test AL, AL` got lost during porting and we were generating `test RAX, RAX` instead. The upper bits of a `_Bool` return type is unspecified and we were failing `TestClass#test_singleton_class_should_has_own_namespace` due to interpreterting the return value incorrectly. * Enable test_class for test-all on x86_64 --- yjit/src/codegen.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 2e202ce2d0..1399a92f14 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -5526,8 +5526,9 @@ fn gen_opt_getinlinecache( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5526 vec![inline_cache, Opnd::mem(64, CFP, RUBY_OFFSET_CFP_EP)] ); - // Check the result. _Bool is one byte in SysV. - asm.test(ret_val, ret_val); + // Check the result. SysV only specifies one byte for _Bool return values, + // so it's important we only check one bit to ignore the higher bits in the register. + asm.test(ret_val, 1.into()); asm.jz(counted_exit!(ocb, side_exit, opt_getinlinecache_miss).into()); let inline_cache = asm.load(Opnd::const_ptr(ic as *const u8)); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/