From ea02b93bb95a42439631606269659dffc1981883 Mon Sep 17 00:00:00 2001 From: "Eileen M. Uchitelle" Date: Thu, 18 Nov 2021 16:17:40 -0500 Subject: Refactor setclassvariable (#5143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We only need the cref when we have a cache miss so don't look it up until we need it. This likely speeds up class variable writes in the interpreter but also simplifies the jit code. Before ``` Warming up -------------------------------------- write a cvar 192.280k i/100ms Calculating ------------------------------------- write a cvar 1.915M (± 3.5%) i/s - 9.614M in 5.026694s ``` After ``` Warming up -------------------------------------- write a cvar 216.308k i/100ms Calculating ------------------------------------- write a cvar 2.140M (± 3.1%) i/s - 10.815M in 5.058079s ``` Followup to ruby/ruby#5137 --- insns.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'insns.def') diff --git a/insns.def b/insns.def index 018e3112ba..371361512f 100644 --- a/insns.def +++ b/insns.def @@ -250,7 +250,7 @@ setclassvariable // attr bool leaf = false; /* has rb_warning() */ { vm_ensure_not_refinement_module(GET_SELF()); - vm_setclassvariable(GET_ISEQ(), vm_get_cref(GET_EP()), GET_CFP(), id, val, (ICVARC)ic); + vm_setclassvariable(GET_ISEQ(), GET_CFP(), id, val, (ICVARC)ic); } /* Get constant variable id. If klass is Qnil and allow_nil is Qtrue, constants -- cgit v1.2.3