aboutsummaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
authorS.H <gamelinks007@gmail.com>2022-08-29 14:42:19 +0900
committerGitHub <noreply@github.com>2022-08-29 14:42:19 +0900
commit78748a5de2146d00696698340d745bba3ec66496 (patch)
treeac27f495e43ddb74308b96475183c682767593da /vm.c
parent7bdb999d0f28c7bb9d7a35ca775e405674527e5f (diff)
downloadruby-78748a5de2146d00696698340d745bba3ec66496.tar.gz
Introduce `usage_analysis_clear`
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/vm.c b/vm.c
index 8cab8b9b57..15b6fa3a57 100644
--- a/vm.c
+++ b/vm.c
@@ -4296,51 +4296,48 @@ usage_analysis_register_running(VALUE self)
return RBOOL(ruby_vm_collect_usage_func_register != 0);
}
+static VALUE
+usage_analysis_clear(VALUE self, ID usage_hash)
+{
+ VALUE uh;
+ uh = rb_const_get(self, usage_hash);
+ rb_hash_clear(uh);
+
+ return Qtrue;
+}
+
+
/* :nodoc: */
static VALUE
usage_analysis_insn_clear(VALUE self)
{
- ID usage_hash;
- ID bigram_hash;
- VALUE uh;
- VALUE bh;
-
- CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN");
- CONST_ID(bigram_hash, "USAGE_ANALYSIS_INSN_BIGRAM");
- uh = rb_const_get(rb_cRubyVM, usage_hash);
- bh = rb_const_get(rb_cRubyVM, bigram_hash);
- rb_hash_clear(uh);
- rb_hash_clear(bh);
+ ID usage_hash;
+ ID bigram_hash;
- return Qtrue;
+ CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN");
+ CONST_ID(bigram_hash, "USAGE_ANALYSIS_INSN_BIGRAM");
+ usage_analysis_clear(rb_cRubyVM, usage_hash);
+ return usage_analysis_clear(rb_cRubyVM, bigram_hash);
}
/* :nodoc: */
static VALUE
usage_analysis_operand_clear(VALUE self)
{
- ID usage_hash;
- VALUE uh;
-
- CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN");
- uh = rb_const_get(rb_cRubyVM, usage_hash);
- rb_hash_clear(uh);
+ ID usage_hash;
- return Qtrue;
+ CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN");
+ return usage_analysis_clear(self, usage_hash);
}
/* :nodoc: */
static VALUE
usage_analysis_register_clear(VALUE self)
{
- ID usage_hash;
- VALUE uh;
+ ID usage_hash;
- CONST_ID(usage_hash, "USAGE_ANALYSIS_REGS");
- uh = rb_const_get(rb_cRubyVM, usage_hash);
- rb_hash_clear(uh);
-
- return Qtrue;
+ CONST_ID(usage_hash, "USAGE_ANALYSIS_REGS");
+ return usage_analysis_clear(self, usage_hash);
}
#else