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

ruby-changes:64739

From: Takashi <ko1@a...>
Date: Tue, 5 Jan 2021 03:45:43 +0900 (JST)
Subject: [ruby-changes:64739] 87c546b5fa (master): Avoid using inconsistent coding style

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

From 87c546b5fa97e6e226cce4daf417617a1143f642 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Mon, 4 Jan 2021 10:44:02 -0800
Subject: Avoid using inconsistent coding style

Other `_mjit_compile_*.erb` files don't use goto. These files'd better
be consistent for readability.

diff --git a/tool/ruby_vm/views/_mjit_compile_getinlinecache.erb b/tool/ruby_vm/views/_mjit_compile_getinlinecache.erb
index 1b636bc..637dea8 100644
--- a/tool/ruby_vm/views/_mjit_compile_getinlinecache.erb
+++ b/tool/ruby_vm/views/_mjit_compile_getinlinecache.erb
@@ -13,17 +13,10 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_getinlinecache.erb#L13
 
 % # compiler: Capture IC values, locking getinlinecache
     struct iseq_inline_constant_cache_entry *ice = ic->entry;
-    if (ice == NULL) {
-        goto getinlinecache_cancel;
-    }
-    rb_serial_t ic_serial = ice->ic_serial;
-    const rb_cref_t *ic_cref = ice->ic_cref;
-    VALUE ic_value = ice->value;
-
-    if (ic_serial && !status->compile_info->disable_const_cache) {
+    if (ice != NULL && ice->ic_serial && !status->compile_info->disable_const_cache) {
 %       # JIT: Inline everything in IC, and cancel the slow path
-        fprintf(f, "    if (vm_ic_hit_p((rb_serial_t)%"PRI_SERIALT_PREFIX"u, (const rb_cref_t *)0x%"PRIxVALUE", reg_cfp->ep)) {", ic_serial, (VALUE)ic_cref);
-        fprintf(f, "        stack[%d] = 0x%"PRIxVALUE";\n", b->stack_size, ic_value);
+        fprintf(f, "    if (vm_ic_hit_p((rb_serial_t)%"PRI_SERIALT_PREFIX"u, (const rb_cref_t *)0x%"PRIxVALUE", reg_cfp->ep)) {", ice->ic_serial, (VALUE)ice->ic_cref);
+        fprintf(f, "        stack[%d] = 0x%"PRIxVALUE";\n", b->stack_size, ice->value);
         fprintf(f, "        goto label_%d;\n", pos + insn_len(insn) + (int)dst);
         fprintf(f, "    }");
         fprintf(f, "    else {");
@@ -36,4 +29,3 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_getinlinecache.erb#L29
         b->stack_size += <%= insn.call_attribute('sp_inc') %>;
         break;
     }
-    getinlinecache_cancel:;
-- 
cgit v0.10.2


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

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