From ac5d6faea8e8d142df798572b0522f8a185c8fb6 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 14 Dec 2021 19:47:42 -0500 Subject: YJIT: Fix unexpected truncation when outputing VALUE Previously, YJIT incorrectly discarded the upper 32 bits of the object pointer when writing out VALUEs to setup default keyword arguments. In addition to incorrectly truncating, the output pointers were not properly tracked for handling GC compaction moving the referenced objects. YJIT previously attempted to encode a mov instruction with a memory destination and a 64 bit immediate when there is no such encoding possible in the ISA. Add an assert to mitigate not being able to catch this at build time. --- bootstraptest/test_yjit.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 2ac37df0a2..0b2b78ca4a 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -1,3 +1,18 @@ +assert_equal '18374962167983112447', %q{ + # regression test for incorrectly discarding 32 bits of a pointer when it + # comes to default values. + def large_literal_default(n: 0xff00_fabcafe0_00ff) + n + end + + def call_graph_root + large_literal_default + end + + call_graph_root + call_graph_root +} + assert_normal_exit %q{ # regression test for a leak caught by an asert on --yjit-call-threshold=2 Foo = 1 -- cgit v1.2.3