diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2022-08-17 15:42:39 -0400 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-29 09:09:41 -0700 |
commit | c70d1471c1723f26ca54699f056887fe200c973e (patch) | |
tree | 94de2106a72298d574140c29447a855b24577c93 /yjit | |
parent | d57a9f61a065418ef99fcbbb65eca4f34f33f1c8 (diff) |
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
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6289
Diffstat (limited to 'yjit')
-rw-r--r-- | yjit/src/codegen.rs | 5 |
1 files 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( 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)); |