summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2021-09-10 14:01:49 -0700
committerAlan Wu <[email protected]>2021-10-20 18:19:40 -0400
commitfc13ff14a2a78173dd4a1e93c8f4e3665a4e8555 (patch)
treef223eec6231318a643b3367b383b498d07497955
parentbf8557f48719434261f9cf4051582868dca95363 (diff)
Add comments to getspecial
-rw-r--r--yjit_codegen.c7
1 files changed, 7 insertions, 0 deletions
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)
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)
// 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)
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);