[前][次][番号順一覧][スレッド一覧]

ruby-changes:69196

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:23:20 +0900 (JST)
Subject: [ruby-changes:69196] fc13ff14a2 (master): Add comments to getspecial

https://git.ruby-lang.org/ruby.git/commit/?id=fc13ff14a2

From fc13ff14a2a78173dd4a1e93c8f4e3665a4e8555 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Fri, 10 Sep 2021 14:01:49 -0700
Subject: Add comments to getspecial

---
 yjit_codegen.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index e6f955f210..049c72b6ba 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -3810,6 +3810,9 @@ gen_toregexp(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L3810
 static codegen_status_t
 gen_getspecial(jitstate_t *jit, ctx_t *ctx)
 {
+    // This takes two arguments, key and type
+    // key is only used when type == 0
+    // A non-zero type determines which type of backref to fetch
     rb_num_t key = jit_get_arg(jit, 0);
     rb_num_t type = jit_get_arg(jit, 1);
 
@@ -3817,6 +3820,8 @@ gen_getspecial(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L3820
         // not yet implemented
         return YJIT_CANT_COMPILE;
     } else if (type & 0x01) {
+        // Fetch a "special" backref based on a char encoded by shifting by 1
+
         // Can raise if matchdata uninitialized
         jit_prepare_routine_call(jit, ctx, REG0);
 
@@ -3851,6 +3856,8 @@ gen_getspecial(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L3856
 
         return YJIT_KEEP_COMPILING;
     } else {
+        // Fetch the N-th match from the last backref based on type shifted by 1
+
         // Can raise if matchdata uninitialized
         jit_prepare_routine_call(jit, ctx, REG0);
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]