summaryrefslogtreecommitdiff
path: root/yjit/bindgen/src
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-05-03 15:25:03 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2022-05-12 14:34:18 -0700
commitebaf56c013fa3c24bc680cd7482845b9ed30cda8 (patch)
tree7e85ccf3a758cd9a60c569942f9ee5d7cd6453a7 /yjit/bindgen/src
parent14ae97ded37f9474feccbfb345735b8240c2776c (diff)
YJIT: Implement getblockparam
This implements the getblockparam instruction. There are two cases we need to handle depending on whether or not VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM is set in the environment flag. When the modified flag is unset, we need to call rb_vm_bh_to_procval to get a proc from our passed block, save the proc in the environment, and set the modified flag. In the case that the modified flag is set we are able to just use the existing proc in the environment. One quirk of this is that we need to call jit_prepare_routine_call early and ensure we update PC and SP regardless of the branch taken, so that we have a consistent SP offset at the start of the next instruction. We considered using a chain guard to generate these two paths separately, but decided against it because it's very common to see both and the modified case is basically a subset of the instructions in the unmodified case. This includes tests for both getblockparam and getblockparamproxy which was previously missing a test.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5881
Diffstat (limited to 'yjit/bindgen/src')
-rw-r--r--yjit/bindgen/src/main.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/yjit/bindgen/src/main.rs b/yjit/bindgen/src/main.rs
index 33f81366c2..7049688e1f 100644
--- a/yjit/bindgen/src/main.rs
+++ b/yjit/bindgen/src/main.rs
@@ -210,6 +210,7 @@ fn main() {
.opaque_type("rb_execution_context_.*")
.blocklist_type("rb_control_frame_struct")
.opaque_type("rb_control_frame_struct")
+ .allowlist_function("rb_vm_bh_to_procval")
// From yjit.c
.allowlist_function("rb_iseq_(get|set)_yjit_payload")