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

ruby-changes:50283

From: nobu <ko1@a...>
Date: Wed, 14 Feb 2018 14:11:07 +0900 (JST)
Subject: [ruby-changes:50283] nobu:r62401 (trunk): mjit.h: compare as pointer

nobu	2018-02-14 14:11:02 +0900 (Wed, 14 Feb 2018)

  New Revision: 62401

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62401

  Log:
    mjit.h: compare as pointer
    
    * mjit.c (mjit_get_iseq_func), mjit.h (mjit_exec): do not compare
      a pointer as shorter type.  by loosing the precision, different
      values can result in "equal" wrongly.  enum type is an alias of
      `int`, and is often shorter than a pointer type nowadays.

  Modified files:
    trunk/mjit.c
    trunk/mjit.h
Index: mjit.c
===================================================================
--- mjit.c	(revision 62400)
+++ mjit.c	(revision 62401)
@@ -1123,7 +1123,7 @@ mjit_get_iseq_func(const struct rb_iseq_ https://github.com/ruby/ruby/blob/trunk/mjit.c#L1123
     struct timeval tv;
     tv.tv_sec = 0;
     tv.tv_usec = 1000;
-    while ((enum rb_mjit_iseq_func)body->jit_func == NOT_READY_JIT_ISEQ_FUNC) {
+    while (body->jit_func == (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC) {
         CRITICAL_SECTION_START(3, "in mjit_get_iseq_func for a client wakeup");
         rb_native_cond_broadcast(&mjit_worker_wakeup);
         CRITICAL_SECTION_FINISH(3, "in mjit_get_iseq_func for a client wakeup");
Index: mjit.h
===================================================================
--- mjit.h	(revision 62400)
+++ mjit.h	(revision 62401)
@@ -103,7 +103,7 @@ mjit_exec(rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/mjit.h#L103
 
     func = body->jit_func;
     if (UNLIKELY(mjit_opts.wait && mjit_opts.min_calls == total_calls && mjit_target_iseq_p(body)
-                 && (enum rb_mjit_iseq_func)func == NOT_ADDED_JIT_ISEQ_FUNC)) {
+                 && func == (mjit_func_t)NOT_ADDED_JIT_ISEQ_FUNC)) {
         mjit_add_iseq_to_process(iseq);
         func = mjit_get_iseq_func(body);
     }

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

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