summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-01 21:23:20 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-01 21:23:20 +0000
commit3eb12cb68849b1ac2b86b85b7f31a1d60410c15e (patch)
treedd121280ee31542cc092bc5cf6e0a16e22f13376
parentafbf10e8c699e43f1a4ad72733a51a545cea705b (diff)
downloadbundler-3eb12cb68849b1ac2b86b85b7f31a1d60410c15e.tar.gz
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--gc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gc.c b/gc.c
index 4ebae169ec..6636130abb 100644
--- a/gc.c
+++ b/gc.c
@@ -7785,9 +7785,9 @@ objspace_malloc_size(rb_objspace_t *objspace, void *ptr, size_t hint)
}
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