ruby-changes:51341
From: normal <ko1@a...>
Date: Sat, 2 Jun 2018 06:23:28 +0900 (JST)
Subject: [ruby-changes:51341] normal:r63546 (trunk): gc.c: reduce size slightly by making MEMOP_TYPE_MALLOC zero
normal 2018-06-02 06:23:20 +0900 (Sat, 02 Jun 2018) New Revision: 63546 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63546 Log: gc.c: reduce size slightly by making MEMOP_TYPE_MALLOC zero Most (if not all) architectures have instructions for comparing against zero, allowing compilers to generate more compact code. Other MEMOP_TYPE_* enum values are not compared in hot paths, but MEMOP_TYPE_MALLOC is checked in objspace_malloc_increase text data bss dec hex filename 84088 264 3664 88016 157d0 gc-before.o 83784 264 3664 87712 156a0 gc.o Modified files: trunk/gc.c Index: gc.c =================================================================== --- gc.c (revision 63545) +++ gc.c (revision 63546) @@ -7785,9 +7785,9 @@ objspace_malloc_size(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L7785 } enum memop_type { - MEMOP_TYPE_MALLOC = 1, - MEMOP_TYPE_FREE = 2, - MEMOP_TYPE_REALLOC = 3 + MEMOP_TYPE_MALLOC = 0, + MEMOP_TYPE_FREE, + MEMOP_TYPE_REALLOC }; static inline void -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/