Skip to content

Commit

Permalink
Only check lowest bit for _Bool type (#412)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
XrXr authored and k0kubun committed Aug 25, 2022
1 parent 5adf20d commit 4a8a126
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/yjit-new-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ jobs:
- run: make -j rdoc

# Run John's YJIT instruction tests, and make sure we can load the test-all runner
- run: make -j test-all TESTS='test/ruby/test_assignment test/ruby/test_call test/ruby/test_method test/ruby/test_proc test/ruby/test_module test/ruby/test_yjit' RUN_OPTS="--yjit-call-threshold=1"
- run: make -j test-all TESTS='test/ruby/test_assignment test/ruby/test_call test/ruby/test_method test/ruby/test_proc test/ruby/test_module test/ruby/test_class test/ruby/test_yjit' RUN_OPTS="--yjit-call-threshold=1"

# TODO: check that we can we run all of test-all successfully
5 changes: 3 additions & 2 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 4a8a126

Please sign in to comment.