Project

General

Profile

« Previous | Next » 

Revision ae750799

Added by ko1 (Koichi Sasada) almost 5 years ago

Use FL_TEST_RAW() to check flags.

FL_TEST() uses FL_ABLE() which test data types. However,
in array.c we don't need to check it (all of them should be
T_ARRAY), so I changed from FL_TEST() to FL_TEST_RAW() which
does not check FL_ABLE(). Instead of FL_ABLE(), add assertion
to check given object is a T_ARRAY object.

For example, rb_ary_free() becomes slim:

with FL_TEST():
0000000000006a30 <rb_ary_free>:
6a30: 40 f6 c7 07 test $0x7,%dil
6a34: 48 8b 07 mov (%rdi),%rax
6a37: 75 09 jne 6a42 <rb_ary_free+0x12>
6a39: 48 f7 c7 f7 ff ff ff test $0xfffffffffffffff7,%rdi
6a40: 75 1e jne 6a60 <rb_ary_free+0x30>
6a42: a9 00 00 00 02 test $0x2000000,%eax
6a47: 74 07 je 6a50 <rb_ary_free+0x20>
6a49: f3 c3 repz retq
6a4b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
6a50: 48 8b 7f 20 mov 0x20(%rdi),%rdi
6a54: e9 00 00 00 00 jmpq 6a59 <rb_ary_free+0x29>
6a59: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
6a60: 89 c2 mov %eax,%edx
6a62: 83 e2 1f and $0x1f,%edx
6a65: 83 fa 1b cmp $0x1b,%edx
6a68: 74 d8 je 6a42 <rb_ary_free+0x12>
6a6a: f6 c4 60 test $0x60,%ah
6a6d: 74 d3 je 6a42 <rb_ary_free+0x12>
6a6f: eb d8 jmp 6a49 <rb_ary_free+0x19>```

with FL_TEST_RAW():
0000000000006a30 <rb_ary_free>:
6a30: 48 f7 07 00 60 00 02 testq $0x2006000,(%rdi)
6a37: 74 07 je 6a40 <rb_ary_free+0x10>
6a39: f3 c3 repz retq
6a3b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
6a40: 48 8b 7f 20 mov 0x20(%rdi),%rdi
6a44: e9 00 00 00 00 jmpq 6a49 <rb_ary_free+0x19>