* internal.h, vm_core.h: move LIKELY/UNLIKELY/UNINITIALIZED_VAR()

macros from vm_core.h to internal.h.
* string.c: remove dependency to "vm_core.h".
* common.mk: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2014-02-05 04:58:00 +00:00
Родитель 135bbdcdc7
Коммит 1ccaa4756a
5 изменённых файлов: 31 добавлений и 23 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Wed Feb 5 13:51:33 2014 Koichi Sasada <ko1@atdot.net>
* internal.h, vm_core.h: move LIKELY/UNLIKELY/UNINITIALIZED_VAR()
macros from vm_core.h to internal.h.
* string.c: remove dependency to "vm_core.h".
* common.mk: ditto.
Wed Feb 5 13:29:01 2014 Koichi Sasada <ko1@atdot.net>
* string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly

Просмотреть файл

@ -751,7 +751,7 @@ st.$(OBJEXT): {$(VPATH)}st.c $(RUBY_H_INCLUDES)
strftime.$(OBJEXT): {$(VPATH)}strftime.c $(RUBY_H_INCLUDES) \
{$(VPATH)}timev.h $(ENCODING_H_INCLUDES)
string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}node.h {$(VPATH)}ruby_atomic.h {$(VPATH)}vm_core.h {$(VPATH)}vm_debug.h {$(VPATH)}id.h {$(VPATH)}method.h {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}thread_native.h
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES)
struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \

Просмотреть файл

@ -19,6 +19,27 @@ extern "C" {
#endif
#endif
/* likely */
#if __GNUC__ >= 3
#define LIKELY(x) (__builtin_expect((x), 1))
#define UNLIKELY(x) (__builtin_expect((x), 0))
#else /* __GNUC__ >= 3 */
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif /* __GNUC__ >= 3 */
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(unused)
#define UNINITIALIZED_VAR(x) x __attribute__((unused))
#elif defined(__GNUC__) && __GNUC__ >= 3
#define UNINITIALIZED_VAR(x) x = x
#else
#define UNINITIALIZED_VAR(x) x
#endif
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
# ifndef VALGRIND_MAKE_MEM_DEFINED

Просмотреть файл

@ -14,7 +14,6 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
#include "vm_core.h"
#include "internal.h"
#include "probes.h"
#include <assert.h>

Просмотреть файл

@ -100,27 +100,6 @@
#endif /* OPT_STACK_CACHING */
#endif /* OPT_CALL_THREADED_CODE */
/* likely */
#if __GNUC__ >= 3
#define LIKELY(x) (__builtin_expect((x), 1))
#define UNLIKELY(x) (__builtin_expect((x), 0))
#else /* __GNUC__ >= 3 */
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif /* __GNUC__ >= 3 */
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(unused)
#define UNINITIALIZED_VAR(x) x __attribute__((unused))
#elif defined(__GNUC__) && __GNUC__ >= 3
#define UNINITIALIZED_VAR(x) x = x
#else
#define UNINITIALIZED_VAR(x) x
#endif
typedef unsigned long rb_num_t;
/* iseq data type */