summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-03-21 10:51:35 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-03-21 10:51:35 -0400
commit30e7561d1d21844bd6fc7a2ced12cd08cf3ea5ea (patch)
treef18eb73c250a44be082435e7ac84952c1e9fcb30
parentf67f0d72688679267c4040c5f6aa8c493067704a (diff)
downloadruby-30e7561d1d21844bd6fc7a2ced12cd08cf3ea5ea.tar.gz
Revert "YJIT: Rest and block_arg support (#7557)"
This reverts commit 5d0a1ffafa61da04dbda38a5cb5565bcb8032a78. This commit is causing sequel in yjit-bench to raise with this stack trace: ``` sequel-5.64.0/lib/sequel/dataset/sql.rb:266:in `literal': wrong argument type Array (expected Proc) (TypeError) from sequel-5.64.0/lib/sequel/database/misc.rb:269:in `literal' from sequel-5.64.0/lib/sequel/adapters/shared/sqlite.rb:314:in `column_definition_default_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:564:in `block in column_definition_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:564:in `each' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:564:in `column_definition_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:634:in `block in column_list_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:634:in `map' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:634:in `column_list_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:753:in `create_table_sql' from sequel-5.64.0/lib/sequel/adapters/shared/sqlite.rb:348:in `create_table_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:702:in `create_table_from_generator' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:203:in `create_table' from benchmarks/sequel/benchmark.rb:19:in `<main>' ```
-rw-r--r--bootstraptest/test_yjit.rb21
-rw-r--r--yjit/src/codegen.rs9
-rw-r--r--yjit/src/stats.rs3
3 files changed, 9 insertions, 24 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index f29f0ce876..8902cd6cde 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -3662,24 +3662,3 @@ assert_equal '[1, 2, 3]', %q{
end
send(:bar, 1, 2, 3)
}
-
-# Rest with block
-# Simplified code from railsbench
-assert_equal '[{"/a"=>"b", :as=>:c, :via=>:post}, [], nil]', %q{
- def match(path, *rest, &block)
- [path, rest, block]
- end
-
- def map_method(method, args, &block)
- options = args.last
- args.pop
- options[:via] = method
- match(*args, options, &block)
- end
-
- def post(*args, &block)
- map_method(:post, args, &block)
- end
-
- post "/a" => "b", as: :c
-}
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 6b840ee475..d0fd439264 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -5181,9 +5181,9 @@ fn move_rest_args_to_stack(array: Opnd, num_args: u32, ctx: &mut Context, asm: &
let array_len_opnd = get_array_len(asm, array);
- asm.comment("Side exit if length is less than required");
+ asm.comment("Side exit if length doesn't not equal remaining args");
asm.cmp(array_len_opnd, num_args.into());
- asm.jl(counted_exit!(ocb, side_exit, send_iseq_has_rest_and_splat_not_equal));
+ asm.jbe(counted_exit!(ocb, side_exit, send_splatarray_length_not_equal));
asm.comment("Push arguments from array");
@@ -5413,6 +5413,11 @@ fn gen_send_iseq(
return CantCompile;
}
+ if iseq_has_rest && unsafe { get_iseq_flags_has_block(iseq) } {
+ gen_counter_incr!(asm, send_iseq_has_rest_and_block);
+ return CantCompile;
+ }
+
if iseq_has_rest && unsafe { get_iseq_flags_has_kw(iseq) } {
gen_counter_incr!(asm, send_iseq_has_rest_and_kw);
return CantCompile;
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index b096e28e07..5f8f841ffc 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -253,10 +253,11 @@ make_counters! {
send_send_getter,
send_send_builtin,
send_iseq_has_rest_and_captured,
+ send_iseq_has_rest_and_splat_fewer,
send_iseq_has_rest_and_send,
+ send_iseq_has_rest_and_block,
send_iseq_has_rest_and_kw,
send_iseq_has_rest_and_optional,
- send_iseq_has_rest_and_splat_not_equal,
send_is_a_class_mismatch,
send_instance_of_class_mismatch,