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
This commit is contained in:
Alan Wu 2022-08-17 15:42:39 -04:00 committed by Takashi Kokubun
parent d57a9f61a0
commit c70d1471c1
Notes: git 2022-08-30 01:10:17 +09:00

View file

@ -5526,8 +5526,9 @@ fn gen_opt_getinlinecache(
vec![inline_cache, Opnd::mem(64, CFP, RUBY_OFFSET_CFP_EP)] vec![inline_cache, Opnd::mem(64, CFP, RUBY_OFFSET_CFP_EP)]
); );
// Check the result. _Bool is one byte in SysV. // Check the result. SysV only specifies one byte for _Bool return values,
asm.test(ret_val, ret_val); // 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()); asm.jz(counted_exit!(ocb, side_exit, opt_getinlinecache_miss).into());
let inline_cache = asm.load(Opnd::const_ptr(ic as *const u8)); let inline_cache = asm.load(Opnd::const_ptr(ic as *const u8));