-
Notifications
You must be signed in to change notification settings - Fork 5.6k
ZJIT: Add compilation for checkkeyword #14764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I need to run stats to get before and after on |
555c631 to
4c2601c
Compare
tekknolagi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
|
It's adding a new instruction, so it's nice to have an HIR test that does checkkeyword. |
|
ooh, yep, agree ^ also a test for > 32 kw |
4c2601c to
d30424a
Compare
This comment has been minimized.
This comment has been minimized.
d64f96b to
0ffd944
Compare
bb65b21 to
cfb06f4
Compare
tekknolagi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
augh i had pending comments
Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
|
I think I've addressed all the concerns and we should be good to merge. |
<details>
<summary>Before</summary>
<br>
```
**ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (64.0% of total 3,683,424):
Kernel#is_a?: 427,127 (11.6%)
Hash#[]=: 426,276 (11.6%)
String#start_with?: 336,245 ( 9.1%)
ObjectSpace::WeakKeyMap#[]: 139,406 ( 3.8%)
Hash#fetch: 127,291 ( 3.5%)
String#hash: 79,259 ( 2.2%)
Process.clock_gettime: 74,658 ( 2.0%)
Array#any?: 74,441 ( 2.0%)
Integer#==: 71,067 ( 1.9%)
Kernel#dup: 68,058 ( 1.8%)
Hash#key?: 62,306 ( 1.7%)
Regexp#match?: 62,247 ( 1.7%)
SQLite3::Statement#step: 61,172 ( 1.7%)
SQLite3::Statement#done?: 61,172 ( 1.7%)
Kernel#Array: 55,015 ( 1.5%)
Integer#<=>: 49,127 ( 1.3%)
String.new: 48,363 ( 1.3%)
IO#read: 47,753 ( 1.3%)
Array#include?: 43,307 ( 1.2%)
Struct#initialize: 42,650 ( 1.2%)
Top-3 not optimized method types for send (100.0% of total 1,022,743):
iseq: 736,483 (72.0%)
cfunc: 286,174 (28.0%)
null: 86 ( 0.0%)
Top-6 not optimized method types for send_without_block (100.0% of total 189,556):
optimized_call: 115,966 (61.2%)
optimized_send: 36,767 (19.4%)
optimized_struct_aset: 33,788 (17.8%)
null: 2,521 ( 1.3%)
optimized_block_call: 510 ( 0.3%)
cfunc: 4 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 1,648,882):
invokesuper: 697,471 (42.3%)
invokeblock: 496,687 (30.1%)
sendforward: 221,094 (13.4%)
opt_eq: 147,620 ( 9.0%)
opt_minus: 40,865 ( 2.5%)
opt_plus: 22,912 ( 1.4%)
opt_send_without_block: 18,932 ( 1.1%)
opt_gt: 867 ( 0.1%)
opt_mult: 768 ( 0.0%)
opt_neq: 654 ( 0.0%)
opt_or: 508 ( 0.0%)
opt_lt: 359 ( 0.0%)
opt_ge: 145 ( 0.0%)
Top-13 send fallback reasons (100.0% of total 8,308,826):
send_without_block_polymorphic: 3,174,975 (38.2%)
not_optimized_instruction: 1,648,882 (19.8%)
fancy_call_feature: 1,072,807 (12.9%)
send_not_optimized_method_type: 1,022,743 (12.3%)
send_no_profiles: 599,715 ( 7.2%)
send_without_block_no_profiles: 486,108 ( 5.9%)
send_without_block_not_optimized_optimized_method_type: 187,031 ( 2.3%)
send_polymorphic: 101,834 ( 1.2%)
obj_to_string_not_string: 7,610 ( 0.1%)
send_without_block_not_optimized_method_type: 2,525 ( 0.0%)
send_without_block_direct_too_many_args: 2,369 ( 0.0%)
send_without_block_cfunc_array_variadic: 2,190 ( 0.0%)
ccall_with_frame_too_many_args: 37 ( 0.0%)
Top-8 popular unsupported argument-parameter features (100.0% of total 1,209,121):
param_opt: 583,595 (48.3%)
param_forwardable: 178,162 (14.7%)
param_block: 162,689 (13.5%)
param_kw: 150,575 (12.5%)
param_rest: 90,091 ( 7.5%)
param_kwrest: 33,791 ( 2.8%)
caller_splat: 10,214 ( 0.8%)
caller_kw_splat: 4 ( 0.0%)
Top-7 unhandled YARV insns (100.0% of total 128,032):
checkkeyword: 88,698 (69.3%)
invokesuperforward: 22,296 (17.4%)
getblockparam: 16,292 (12.7%)
getconstant: 336 ( 0.3%)
checkmatch: 290 ( 0.2%)
setblockparam: 101 ( 0.1%)
once: 19 ( 0.0%)
Top-1 compile error reasons (100.0% of total 21,283):
exception_handler: 21,283 (100.0%)
Top-18 side exit reasons (100.0% of total 2,335,562):
guard_type_failure: 677,930 (29.0%)
guard_shape_failure: 410,183 (17.6%)
unhandled_kwarg: 235,100 (10.1%)
patchpoint_stable_constant_names: 206,172 ( 8.8%)
block_param_proxy_not_iseq_or_ifunc: 199,931 ( 8.6%)
patchpoint_no_singleton_class: 188,359 ( 8.1%)
unhandled_yarv_insn: 128,032 ( 5.5%)
unknown_newarray_send: 124,805 ( 5.3%)
patchpoint_method_redefined: 73,062 ( 3.1%)
unhandled_hir_insn: 56,688 ( 2.4%)
compile_error: 21,283 ( 0.9%)
block_param_proxy_modified: 11,647 ( 0.5%)
fixnum_mult_overflow: 954 ( 0.0%)
patchpoint_no_ep_escape: 813 ( 0.0%)
guard_bit_equals_failure: 316 ( 0.0%)
obj_to_string_fallback: 230 ( 0.0%)
interrupt: 35 ( 0.0%)
guard_type_not_failure: 22 ( 0.0%)
send_count: 26,775,579
dynamic_send_count: 8,308,826 (31.0%)
optimized_send_count: 18,466,753 (69.0%)
iseq_optimized_send_count: 7,611,729 (28.4%)
inline_cfunc_optimized_send_count: 5,935,290 (22.2%)
inline_iseq_optimized_send_count: 657,555 ( 2.5%)
non_variadic_cfunc_optimized_send_count: 3,169,054 (11.8%)
variadic_cfunc_optimized_send_count: 1,093,125 ( 4.1%)
dynamic_getivar_count: 2,793,635
dynamic_setivar_count: 3,040,844
compiled_iseq_count: 4,496
failed_iseq_count: 0
compile_time: 915ms
profile_time: 6ms
gc_time: 6ms
invalidation_time: 20ms
vm_write_pc_count: 26,857,114
vm_write_sp_count: 25,770,558
vm_write_locals_count: 25,770,558
vm_write_stack_count: 25,770,558
vm_write_to_parent_iseq_local_count: 106,036
vm_read_from_parent_iseq_local_count: 3,213,992
guard_type_count: 27,683,170
guard_type_exit_ratio: 2.4%
code_region_bytes: 32,178,176
side_exit_count: 2,335,562
total_insn_count: 170,714,077
vm_insn_count: 28,999,194
zjit_insn_count: 141,714,883
ratio_in_zjit: 83.0%
```
</details>
<details>
<summary>After</summary>
<br>
```
**ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (63.9% of total 3,686,703):
Kernel#is_a?: 427,123 (11.6%)
Hash#[]=: 426,276 (11.6%)
String#start_with?: 336,245 ( 9.1%)
ObjectSpace::WeakKeyMap#[]: 139,406 ( 3.8%)
Hash#fetch: 127,291 ( 3.5%)
String#hash: 79,259 ( 2.1%)
Process.clock_gettime: 74,658 ( 2.0%)
Array#any?: 74,441 ( 2.0%)
Integer#==: 71,067 ( 1.9%)
Kernel#dup: 68,058 ( 1.8%)
Regexp#match?: 62,336 ( 1.7%)
Hash#key?: 62,306 ( 1.7%)
SQLite3::Statement#step: 61,172 ( 1.7%)
SQLite3::Statement#done?: 61,172 ( 1.7%)
Kernel#Array: 55,048 ( 1.5%)
Integer#<=>: 49,127 ( 1.3%)
String.new: 48,363 ( 1.3%)
IO#read: 47,753 ( 1.3%)
Array#include?: 43,309 ( 1.2%)
Struct#initialize: 42,650 ( 1.2%)
Top-3 not optimized method types for send (100.0% of total 1,026,413):
iseq: 737,496 (71.9%)
cfunc: 288,831 (28.1%)
null: 86 ( 0.0%)
Top-6 not optimized method types for send_without_block (100.0% of total 189,556):
optimized_call: 115,966 (61.2%)
optimized_send: 36,767 (19.4%)
optimized_struct_aset: 33,788 (17.8%)
null: 2,521 ( 1.3%)
optimized_block_call: 510 ( 0.3%)
cfunc: 4 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 1,648,949):
invokesuper: 697,452 (42.3%)
invokeblock: 496,687 (30.1%)
sendforward: 221,094 (13.4%)
opt_eq: 147,620 ( 9.0%)
opt_minus: 40,863 ( 2.5%)
opt_plus: 22,912 ( 1.4%)
opt_send_without_block: 19,020 ( 1.2%)
opt_gt: 867 ( 0.1%)
opt_mult: 768 ( 0.0%)
opt_neq: 654 ( 0.0%)
opt_or: 508 ( 0.0%)
opt_lt: 359 ( 0.0%)
opt_ge: 145 ( 0.0%)
Top-13 send fallback reasons (100.0% of total 8,318,975):
send_without_block_polymorphic: 3,177,471 (38.2%)
not_optimized_instruction: 1,648,949 (19.8%)
fancy_call_feature: 1,075,143 (12.9%)
send_not_optimized_method_type: 1,026,413 (12.3%)
send_no_profiles: 599,748 ( 7.2%)
send_without_block_no_profiles: 486,190 ( 5.8%)
send_without_block_not_optimized_optimized_method_type: 187,031 ( 2.2%)
send_polymorphic: 102,497 ( 1.2%)
obj_to_string_not_string: 8,412 ( 0.1%)
send_without_block_not_optimized_method_type: 2,525 ( 0.0%)
send_without_block_direct_too_many_args: 2,369 ( 0.0%)
send_without_block_cfunc_array_variadic: 2,190 ( 0.0%)
ccall_with_frame_too_many_args: 37 ( 0.0%)
Top-8 popular unsupported argument-parameter features (100.0% of total 1,211,457):
param_opt: 584,073 (48.2%)
param_forwardable: 178,907 (14.8%)
param_block: 162,689 (13.4%)
param_kw: 151,688 (12.5%)
param_rest: 90,091 ( 7.4%)
param_kwrest: 33,791 ( 2.8%)
caller_splat: 10,214 ( 0.8%)
caller_kw_splat: 4 ( 0.0%)
Top-6 unhandled YARV insns (100.0% of total 39,334):
invokesuperforward: 22,296 (56.7%)
getblockparam: 16,292 (41.4%)
getconstant: 336 ( 0.9%)
checkmatch: 290 ( 0.7%)
setblockparam: 101 ( 0.3%)
once: 19 ( 0.0%)
Top-1 compile error reasons (100.0% of total 21,283):
exception_handler: 21,283 (100.0%)
Top-18 side exit reasons (100.0% of total 2,253,541):
guard_type_failure: 682,695 (30.3%)
guard_shape_failure: 410,183 (18.2%)
unhandled_kwarg: 236,780 (10.5%)
patchpoint_stable_constant_names: 206,310 ( 9.2%)
block_param_proxy_not_iseq_or_ifunc: 199,931 ( 8.9%)
patchpoint_no_singleton_class: 188,438 ( 8.4%)
unknown_newarray_send: 124,805 ( 5.5%)
patchpoint_method_redefined: 73,056 ( 3.2%)
unhandled_hir_insn: 56,686 ( 2.5%)
unhandled_yarv_insn: 39,334 ( 1.7%)
compile_error: 21,283 ( 0.9%)
block_param_proxy_modified: 11,647 ( 0.5%)
fixnum_mult_overflow: 954 ( 0.0%)
patchpoint_no_ep_escape: 813 ( 0.0%)
guard_bit_equals_failure: 316 ( 0.0%)
obj_to_string_fallback: 230 ( 0.0%)
interrupt: 58 ( 0.0%)
guard_type_not_failure: 22 ( 0.0%)
send_count: 27,032,751
dynamic_send_count: 8,318,975 (30.8%)
optimized_send_count: 18,713,776 (69.2%)
iseq_optimized_send_count: 7,809,698 (28.9%)
inline_cfunc_optimized_send_count: 5,980,083 (22.1%)
inline_iseq_optimized_send_count: 657,677 ( 2.4%)
non_variadic_cfunc_optimized_send_count: 3,170,381 (11.7%)
variadic_cfunc_optimized_send_count: 1,095,937 ( 4.1%)
dynamic_getivar_count: 2,793,987
dynamic_setivar_count: 3,350,905
compiled_iseq_count: 4,498
failed_iseq_count: 0
compile_time: 884ms
profile_time: 6ms
gc_time: 6ms
invalidation_time: 19ms
vm_write_pc_count: 27,417,915
vm_write_sp_count: 26,327,928
vm_write_locals_count: 26,327,928
vm_write_stack_count: 26,327,928
vm_write_to_parent_iseq_local_count: 106,036
vm_read_from_parent_iseq_local_count: 3,213,992
guard_type_count: 27,937,831
guard_type_exit_ratio: 2.4%
code_region_bytes: 32,571,392
side_exit_count: 2,253,541
total_insn_count: 170,630,429
vm_insn_count: 26,617,244
zjit_insn_count: 144,013,185
ratio_in_zjit: 84.4%
```
</details>
Before
After