1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

decouple internal.h headers

Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
This commit is contained in:
卜部昌平 2019-12-04 17:16:30 +09:00
parent 33e9601938
commit 5e22f873ed
Notes: git 2019-12-26 20:45:55 +09:00
113 changed files with 1363 additions and 725 deletions

23
array.c
View file

@ -10,14 +10,25 @@
Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "ruby/st.h"
#include "probes.h"
#include "id.h"
#include "debug_counter.h"
#include "transient_heap.h"
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/compar.h"
#include "internal/enum.h"
#include "internal/gc.h"
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/rational.h"
#include "internal/vm.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "transient_heap.h"
#if !ARRAY_DEBUG
# define NDEBUG

10
ast.c
View file

@ -1,11 +1,15 @@
/* indent-tabs-mode: nil */
#include "internal.h"
#include "internal/parse.h"
#include "internal/symbol.h"
#include "internal/warnings.h"
#include "iseq.h"
#include "node.h"
#include "ruby.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
#include "node.h"
#include "vm_core.h"
#include "iseq.h"
#include "builtin.h"
static VALUE rb_mAST;

View file

@ -9,27 +9,40 @@
**********************************************************************/
#include "internal.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "id.h"
#include "ruby/config.h"
#include <ctype.h>
#include <float.h>
#include <math.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
# include <strings.h>
#endif
#include <math.h>
#include <float.h>
#include <ctype.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
# include <ieeefp.h>
#endif
#include "ruby_assert.h"
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
#define USE_GMP
#include <gmp.h>
# define USE_GMP
# include <gmp.h>
#endif
#include "id.h"
#include "internal.h"
#include "internal/bignum.h"
#include "internal/complex.h"
#include "internal/gc.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/sanitizers.h"
#include "internal/util.h"
#include "internal/variable.h"
#include "internal/warnings.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
#ifndef RUBY_INTEGER_UNIFICATION

18
class.c
View file

@ -23,13 +23,21 @@
* \{
*/
#include "internal.h"
#include "ruby/st.h"
#include "constant.h"
#include "vm_core.h"
#include "id_table.h"
#include "ruby/config.h"
#include <ctype.h>
#include "constant.h"
#include "id_table.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/hash.h"
#include "internal/object.h"
#include "internal/variable.h"
#include "ruby/st.h"
#include "vm_core.h"
#define id_attached id__attached__
void

View file

@ -9,9 +9,12 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "id.h"
#include "internal.h"
#include "internal/compar.h"
#include "internal/error.h"
#include "internal/vm.h"
#include "ruby/ruby.h"
VALUE rb_mComparable;

View file

@ -9,26 +9,40 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "ruby/util.h"
#include "internal.h"
#include "encindex.h"
#include "ruby/config.h"
#include <math.h>
#include "vm_core.h"
#include "vm_debug.h"
#include "builtin.h"
#include "iseq.h"
#include "insns.inc"
#include "insns_info.inc"
#include "id_table.h"
#include "gc.h"
#ifdef HAVE_DLADDR
# include <dlfcn.h>
#endif
#include "encindex.h"
#include "gc.h"
#include "id_table.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/compile.h"
#include "internal/complex.h"
#include "internal/debug.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/re.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "iseq.h"
#include "ruby/re.h"
#include "ruby/util.h"
#include "vm_core.h"
#include "vm_debug.h"
#include "builtin.h"
#include "insns.inc"
#include "insns_info.inc"
#undef RUBY_UNTYPED_DATA_WARNING
#define RUBY_UNTYPED_DATA_WARNING 0

View file

@ -6,15 +6,25 @@
*/
#include "ruby/config.h"
#if defined _MSC_VER
/* Microsoft Visual C does not define M_PI and others by default */
# define _USE_MATH_DEFINES 1
#endif
#include <ctype.h>
#include <math.h>
#include "internal.h"
#include "id.h"
#define NDEBUG
#include "id.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/complex.h"
#include "internal/error.h"
#include "internal/math.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/rational.h"
#include "ruby_assert.h"
#define ZERO INT2FIX(0)
@ -1700,8 +1710,6 @@ numeric_to_c(VALUE self)
return rb_complex_new1(self);
}
#include <ctype.h>
inline static int
issign(int c)
{

View file

@ -10,6 +10,8 @@
**********************************************************************/
#ifndef CONSTANT_H
#define CONSTANT_H
#include "ruby/ruby.h"
#include "id_table.h"
typedef enum {
CONST_DEPRECATED = 0x100,

20
cont.c
View file

@ -9,19 +9,25 @@
**********************************************************************/
#include "internal.h"
#include "vm_core.h"
#include "gc.h"
#include "eval_intern.h"
#include "mjit.h"
#include COROUTINE_H
#include "ruby/config.h"
#ifndef _WIN32
#include <unistd.h>
#include <sys/mman.h>
#endif
#include COROUTINE_H
#include "eval_intern.h"
#include "gc.h"
#include "internal.h"
#include "internal/cont.h"
#include "internal/mjit.h"
#include "internal/proc.h"
#include "internal/warnings.h"
#include "mjit.h"
#include "vm_core.h"
static const int DEBUG = 0;
#define RB_PAGE_SIZE (pagesize)

View file

@ -8,6 +8,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __attribute__((noreturn)) void

View file

@ -8,6 +8,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __attribute__((noreturn)) void

View file

@ -8,6 +8,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __attribute__((noreturn)) void

View file

@ -1,6 +1,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __attribute__((noreturn)) void

View file

@ -8,6 +8,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __declspec(noreturn) void __fastcall

View file

@ -8,6 +8,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __declspec(noreturn) void

View file

@ -8,6 +8,8 @@
#pragma once
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define COROUTINE __attribute__((noreturn, fastcall)) void

17
debug.c
View file

@ -9,15 +9,22 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "ruby/config.h"
#include <stdio.h>
#include "eval_intern.h"
#include "id.h"
#include "internal/debug.h"
#include "internal/signal.h"
#include "internal/util.h"
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/ruby.h"
#include "ruby/util.h"
#include "vm_debug.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "symbol.h"
#include "id.h"
#include "vm_core.h"
#include "vm_debug.h"
/* This is the only place struct RIMemo is actually used */
struct RIMemo {

80
dir.c
View file

@ -11,12 +11,10 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/thread.h"
#include "internal.h"
#include "id.h"
#include "encindex.h"
#include "ruby/config.h"
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -36,12 +34,10 @@
# define USE_OPENDIR_AT 0
# endif
#endif
#if USE_OPENDIR_AT
# include <fcntl.h>
#endif
#ifndef AT_FDCWD
# define AT_FDCWD -1
#endif
#undef HAVE_DIRENT_NAMLEN
#if defined HAVE_DIRENT_H && !defined _WIN32
@ -68,8 +64,6 @@
# endif
#endif
#include <errno.h>
#ifndef HAVE_STDLIB_H
char *getenv();
#endif
@ -78,28 +72,6 @@ char *getenv();
char *strchr(char*,char);
#endif
#include <ctype.h>
#include "ruby/util.h"
#define vm_initialized rb_cThread
/* define system APIs */
#ifdef _WIN32
#undef chdir
#define chdir(p) rb_w32_uchdir(p)
#undef mkdir
#define mkdir(p, m) rb_w32_umkdir((p), (m))
#undef rmdir
#define rmdir(p) rb_w32_urmdir(p)
#undef opendir
#define opendir(p) rb_w32_uopendir(p)
#define ruby_getcwd() rb_w32_ugetcwd(NULL, 0)
#define IS_WIN32 1
#else
#define IS_WIN32 0
#endif
#ifdef HAVE_SYS_ATTR_H
#include <sys/attr.h>
#endif
@ -123,15 +95,51 @@ char *strchr(char*,char);
#ifdef __APPLE__
# define NORMALIZE_UTF8PATH 1
# include <sys/param.h>
# include <sys/mount.h>
# include <sys/vnode.h>
#else
# define NORMALIZE_UTF8PATH 0
#endif
#if NORMALIZE_UTF8PATH
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/vnode.h>
#include "encindex.h"
#include "id.h"
#include "internal.h"
#include "internal/dir.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/gc.h"
#include "internal/io.h"
#include "internal/vm.h"
#include "ruby/encoding.h"
#include "ruby/ruby.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#ifndef AT_FDCWD
# define AT_FDCWD -1
#endif
#define vm_initialized rb_cThread
/* define system APIs */
#ifdef _WIN32
# undef chdir
# define chdir(p) rb_w32_uchdir(p)
# undef mkdir
# define mkdir(p, m) rb_w32_umkdir((p), (m))
# undef rmdir
# define rmdir(p) rb_w32_urmdir(p)
# undef opendir
# define opendir(p) rb_w32_uopendir(p)
# define ruby_getcwd() rb_w32_ugetcwd(NULL, 0)
# define IS_WIN32 1
#else
# define IS_WIN32 0
#endif
#if NORMALIZE_UTF8PATH
# if defined HAVE_FGETATTRLIST || !defined HAVE_GETATTRLIST
# define need_normalization(dirp, path) need_normalization(dirp)
# else

2
dln.c
View file

@ -1244,6 +1244,8 @@ rb_w32_check_imported(HMODULE ext, HMODULE mine)
#endif
#ifdef USE_DLN_DLOPEN
# include "internal/stdbool.h"
# include "internal/warnings.h"
COMPILER_WARNING_PUSH
#if defined(__clang__) || GCC_VERSION_SINCE(4, 2, 0)
COMPILER_WARNING_IGNORED(-Wpedantic)

1
dln.h
View file

@ -11,6 +11,7 @@
#ifndef DLN_H
#define DLN_H
#include "ruby/defines.h" /* for RUBY_SYMBOL_EXPORT_BEGIN */
#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES

View file

@ -9,7 +9,7 @@
**********************************************************************/
#include "internal.h"
#include "internal/encoding.h"
#define ENC_REPLICATE(name, orig) rb_encdb_replicate((name), (orig))
#define ENC_ALIAS(name, orig) rb_encdb_alias((name), (orig))

View file

@ -11,6 +11,7 @@
#ifndef RUBY_ENCINDEX_H
#define RUBY_ENCINDEX_H 1
#include "ruby/encoding.h" /* rb_ascii8bit_encindex etc. */
#if defined(__cplusplus)
extern "C" {
#if 0

View file

@ -9,14 +9,24 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "internal.h"
#include "encindex.h"
#include "regenc.h"
#include <ctype.h>
#include "ruby/util.h"
#include "ruby/config.h"
#include <ctype.h>
#include "encindex.h"
#include "internal.h"
#include "internal/enc.h"
#include "internal/encoding.h"
#include "internal/inits.h"
#include "internal/load.h"
#include "internal/object.h"
#include "internal/string.h"
#include "internal/vm.h"
#include "regenc.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#ifndef ENC_DEBUG
#define ENC_DEBUG 0
#endif

16
enum.c
View file

@ -9,14 +9,20 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "internal.h"
#include "ruby/util.h"
#include "id.h"
#include "internal.h"
#include "internal/compar.h"
#include "internal/enum.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/rational.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#include "symbol.h"
#include <assert.h>
VALUE rb_mEnumerable;
static ID id_next;

View file

@ -12,14 +12,22 @@
************************************************/
#include "ruby/ruby.h"
#include "internal.h"
#include "id.h"
#include "ruby/config.h"
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#include "id.h"
#include "internal.h"
#include "internal/enumerator.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/numeric.h"
#include "internal/range.h"
#include "ruby/ruby.h"
/*
* Document-class: Enumerator
*

37
error.c
View file

@ -9,27 +9,40 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "internal.h"
#include "ruby_assert.h"
#include "vm_core.h"
#include "builtin.h"
#include "ruby/config.h"
#include <stdio.h>
#include <stdarg.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#if defined __APPLE__
# include <AvailabilityMacros.h>
#endif
#include "internal.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/io.h"
#include "internal/load.h"
#include "internal/object.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "ruby_assert.h"
#include "vm_core.h"
#include "builtin.h"
/*!
* \defgroup exception Exception handlings
* \{

30
eval.c
View file

@ -11,19 +11,31 @@
**********************************************************************/
#include "internal.h"
#include "eval_intern.h"
#include "iseq.h"
#include "gc.h"
#include "ruby/vm.h"
#include "vm_core.h"
#include "mjit.h"
#include "probes.h"
#include "probes_helper.h"
#include "ruby/config.h"
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
#include "eval_intern.h"
#include "gc.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/hash.h"
#include "internal/inits.h"
#include "internal/io.h"
#include "internal/mjit.h"
#include "internal/object.h"
#include "internal/variable.h"
#include "iseq.h"
#include "mjit.h"
#include "probes.h"
#include "probes_helper.h"
#include "ruby/vm.h"
#include "vm_core.h"
NORETURN(void rb_raise_jump(VALUE, VALUE));
void rb_ec_clear_current_thread_trace_func(const rb_execution_context_t *ec);

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/bignum.h"
static VALUE
big(VALUE x)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/bignum.h"
static VALUE
bug_big_zero(VALUE self, VALUE length)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/bignum.h"
static VALUE
big(VALUE x)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/bignum.h"
static VALUE
rb_integer_pack_raw_m(VALUE val, VALUE buf, VALUE numwords_arg, VALUE wordsize_arg, VALUE nails, VALUE flags)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/bignum.h"
static VALUE
big(VALUE x)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/bignum.h"
static VALUE
str2big_poweroftwo(VALUE str, VALUE vbase, VALUE badcheck)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/numeric.h"
static VALUE
int_bignum_p(VALUE self)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/rational.h"
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
static VALUE

View file

@ -1,5 +1,5 @@
#include "ruby.h"
#include "internal.h"
#include "internal/string.h"
static VALUE
bug_str_capacity(VALUE klass, VALUE str)

View file

@ -1,5 +1,6 @@
#include "ruby/encoding.h"
#include "internal.h"
#include "internal/error.h"
#include "ruby/encoding.h"
static VALUE
bug_str_cstr_term(VALUE str)

View file

@ -1,4 +1,4 @@
#include "internal.h"
#include "internal/file.h"
#ifdef __APPLE__
static VALUE

View file

@ -1,6 +1,5 @@
#include "ruby.h"
#include "internal/time.h"
void ruby_reset_leap_second_info(void);
static VALUE
bug_time_s_reset_leap_second_info(VALUE klass)
{

View file

@ -8,9 +8,11 @@
************************************************/
#include "gc.h"
#include "internal/hash.h"
#include "internal/thread.h"
#include "ruby.h"
#include "vm_core.h"
#include "gc.h"
static int current_mode;
static VALUE me2counter = Qnil;

View file

@ -12,12 +12,16 @@
**********************************************************************/
#include <ruby/io.h>
#include "internal.h"
#include <ruby/st.h>
#include <ruby/re.h>
#include "node.h"
#include "gc.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/compilers.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "node.h"
#include "ruby/io.h"
#include "ruby/re.h"
#include "ruby/st.h"
#include "symbol.h"
/*

View file

@ -12,13 +12,15 @@
**********************************************************************/
#include "ruby/io.h"
#include "internal.h"
#include "ruby/debug.h"
#include "gc.h"
#include "internal.h"
#include "internal/hash.h"
#include "internal/string.h"
#include "node.h"
#include "vm_core.h"
#include "objspace.h"
#include "ruby/debug.h"
#include "ruby/io.h"
#include "vm_core.h"
static VALUE sym_output, sym_stdout, sym_string, sym_file;
static VALUE sym_full;

View file

@ -1,45 +1,51 @@
#include "ruby/config.h"
#include "ruby/config.h"
#ifdef RUBY_EXTCONF_H
#include RUBY_EXTCONF_H
# include RUBY_EXTCONF_H
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <fcntl.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
# include <pwd.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
# include <sys/ioctl.h>
#endif
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
# include <libutil.h>
#endif
#ifdef HAVE_UTIL_H
#include <util.h>
# include <util.h>
#endif
#ifdef HAVE_PTY_H
#include <pty.h>
# include <pty.h>
#endif
#if defined(HAVE_SYS_PARAM_H)
/* for __FreeBSD_version */
/* for __FreeBSD_version */
# include <sys/param.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
# include <sys/wait.h>
#else
#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
# define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
#endif
#include <ctype.h>
#include "ruby/io.h"
#include "internal.h"
#include "ruby/util.h"
#include <signal.h>
#ifdef HAVE_SYS_STROPTS_H
#include <sys/stropts.h>
#endif
@ -48,6 +54,12 @@
#include <unistd.h>
#endif
#include "internal.h"
#include "internal/process.h"
#include "internal/signal.h"
#include "ruby/io.h"
#include "ruby/util.h"
#define DEVICELEN 16
#ifndef HAVE_SETEUID

View file

@ -1,12 +1,12 @@
#ifndef RUBY_SOCKET_H
#define RUBY_SOCKET_H 1
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "internal.h"
#include "ruby/config.h"
#include RUBY_EXTCONF_H
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -56,12 +56,11 @@
#ifdef HAVE_NETPACKET_PACKET_H
# include <netpacket/packet.h>
#endif
#ifdef HAVE_NET_ETHERNET_H
# include <net/ethernet.h>
#endif
#include <errno.h>
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
@ -87,12 +86,15 @@
# endif
# include <ifaddrs.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
@ -100,16 +102,40 @@
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifdef HAVE_SYS_UCRED_H
# include <sys/ucred.h>
#endif
#ifdef HAVE_UCRED_H
# include <ucred.h>
#endif
#ifdef HAVE_NET_IF_DL_H
# include <net/if_dl.h>
#endif
#ifdef SOCKS5
# include <socks.h>
#endif
#ifndef HAVE_GETADDRINFO
# include "addrinfo.h"
#endif
#include "internal.h"
#include "internal/array.h"
#include "internal/error.h"
#include "internal/gc.h"
#include "internal/io.h"
#include "internal/thread.h"
#include "internal/vm.h"
#include "ruby/io.h"
#include "ruby/ruby.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "sockport.h"
#ifndef HAVE_TYPE_SOCKLEN_T
typedef int socklen_t;
#endif
@ -143,11 +169,6 @@ unsigned int if_nametoindex(const char *);
*/
#define pseudo_AF_FTIP pseudo_AF_RTIP
#ifndef HAVE_GETADDRINFO
# include "addrinfo.h"
#endif
#include "sockport.h"
#ifndef NI_MAXHOST
# define NI_MAXHOST 1025
@ -255,9 +276,7 @@ extern VALUE rb_eSocket;
#ifdef SOCKS
extern VALUE rb_cSOCKSSocket;
# ifdef SOCKS5
# include <socks.h>
# else
# ifndef SOCKS5
void SOCKSinit();
int Rconnect();
# endif

131
file.c
View file

@ -11,14 +11,22 @@
**********************************************************************/
#include "ruby/config.h"
#ifdef _WIN32
#include "missing/file.h"
# include "missing/file.h"
# include "ruby.h"
#endif
#include <ctype.h>
#include <time.h>
#ifdef __CYGWIN__
#include <windows.h>
#include <sys/cygwin.h>
#include <wchar.h>
# include <windows.h>
# include <sys/cygwin.h>
# include <wchar.h>
#endif
#ifdef __APPLE__
# if !(defined(__has_feature) && defined(__has_attribute))
/* Maybe a bug in SDK of Xcode 10.2.1 */
@ -28,21 +36,13 @@
# define API_AVAILABLE(...)
# define API_DEPRECATED(...)
# endif
#include <CoreFoundation/CFString.h>
# include <CoreFoundation/CFString.h>
#endif
#include "id.h"
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/util.h"
#include "ruby/thread.h"
#include "internal.h"
#include "dln.h"
#include "encindex.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
@ -60,77 +60,73 @@ int flock(int, int);
# define MAXPATHLEN 1024
#endif
#include <ctype.h>
#include <time.h>
#ifdef HAVE_UTIME_H
#include <utime.h>
# include <utime.h>
#elif defined HAVE_SYS_UTIME_H
#include <sys/utime.h>
# include <sys/utime.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
# include <pwd.h>
#endif
#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
# include <sys/sysmacros.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
# include <sys/mkdev.h>
#endif
#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
# include <fcntl.h>
#endif
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
# include <sys/time.h>
#endif
#if !defined HAVE_LSTAT && !defined lstat
#define lstat stat
# define lstat stat
#endif
/* define system APIs */
#ifdef _WIN32
#include "win32/file.h"
#define STAT(p, s) rb_w32_ustati128((p), (s))
#undef lstat
#define lstat(p, s) rb_w32_ulstati128((p), (s))
#undef access
#define access(p, m) rb_w32_uaccess((p), (m))
#undef truncate
#define truncate(p, n) rb_w32_utruncate((p), (n))
#undef chmod
#define chmod(p, m) rb_w32_uchmod((p), (m))
#undef chown
#define chown(p, o, g) rb_w32_uchown((p), (o), (g))
#undef lchown
#define lchown(p, o, g) rb_w32_ulchown((p), (o), (g))
#undef utimensat
#define utimensat(s, p, t, f) rb_w32_uutimensat((s), (p), (t), (f))
#undef link
#define link(f, t) rb_w32_ulink((f), (t))
#undef unlink
#define unlink(p) rb_w32_uunlink(p)
#undef rename
#define rename(f, t) rb_w32_urename((f), (t))
#undef symlink
#define symlink(s, l) rb_w32_usymlink((s), (l))
# include "win32/file.h"
# define STAT(p, s) rb_w32_ustati128((p), (s))
# undef lstat
# define lstat(p, s) rb_w32_ulstati128((p), (s))
# undef access
# define access(p, m) rb_w32_uaccess((p), (m))
# undef truncate
# define truncate(p, n) rb_w32_utruncate((p), (n))
# undef chmod
# define chmod(p, m) rb_w32_uchmod((p), (m))
# undef chown
# define chown(p, o, g) rb_w32_uchown((p), (o), (g))
# undef lchown
# define lchown(p, o, g) rb_w32_ulchown((p), (o), (g))
# undef utimensat
# define utimensat(s, p, t, f) rb_w32_uutimensat((s), (p), (t), (f))
# undef link
# define link(f, t) rb_w32_ulink((f), (t))
# undef unlink
# define unlink(p) rb_w32_uunlink(p)
# undef rename
# define rename(f, t) rb_w32_urename((f), (t))
# undef symlink
# define symlink(s, l) rb_w32_usymlink((s), (l))
#ifdef HAVE_REALPATH
# ifdef HAVE_REALPATH
/* Don't use native realpath(3) on Windows, as the check for
absolute paths does not work for drive letters. */
#undef HAVE_REALPATH
#endif
# undef HAVE_REALPATH
# endif
#else
#define STAT(p, s) stat((p), (s))
# define STAT(p, s) stat((p), (s))
#endif
#if defined _WIN32 || defined __APPLE__
@ -143,7 +139,7 @@ int flock(int, int);
/* utime may fail if time is out-of-range for the FS [ruby-dev:38277] */
#if defined DOSISH || defined __CYGWIN__
# define UTIME_EINVAL
# define UTIME_EINVAL
#endif
/* Solaris 10 realpath(3) doesn't support File.realpath */
@ -152,10 +148,29 @@ int flock(int, int);
#endif
#ifdef HAVE_REALPATH
#include <limits.h>
#include <stdlib.h>
# include <limits.h>
# include <stdlib.h>
#endif
#include "dln.h"
#include "encindex.h"
#include "id.h"
#include "internal.h"
#include "internal/compilers.h"
#include "internal/dir.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/io.h"
#include "internal/load.h"
#include "internal/object.h"
#include "internal/process.h"
#include "internal/thread.h"
#include "internal/vm.h"
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
VALUE rb_cFile;
VALUE rb_mFileTest;
VALUE rb_cStat;

107
gc.c
View file

@ -14,43 +14,25 @@
#define rb_data_object_alloc rb_data_object_alloc
#define rb_data_typed_object_alloc rb_data_typed_object_alloc
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/st.h"
#include "ruby/re.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby/debug.h"
#include "internal.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "builtin.h"
#include "gc.h"
#include "constant.h"
#include "ruby_atomic.h"
#include "probes.h"
#include "id_table.h"
#include "symbol.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include "ruby_assert.h"
#include "debug_counter.h"
#include "transient_heap.h"
#include "mjit.h"
#include "ruby/config.h"
#ifdef _WIN32
# include "ruby/ruby.h"
#endif
#undef rb_data_object_wrap
#include <setjmp.h>
#include <stdarg.h>
#include <stdio.h>
#ifndef HAVE_MALLOC_USABLE_SIZE
# ifdef _WIN32
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) _msize(a)
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) _msize(a)
# elif defined HAVE_MALLOC_SIZE
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) malloc_size(a)
# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) malloc_size(a)
# endif
#endif
#ifdef HAVE_MALLOC_USABLE_SIZE
# ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
# include RUBY_ALTERNATIVE_MALLOC_HEADER
@ -64,27 +46,72 @@
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
# include <sys/resource.h>
#endif
#if defined _WIN32 || defined __CYGWIN__
#include <windows.h>
# include <windows.h>
#elif defined(HAVE_POSIX_MEMALIGN)
#elif defined(HAVE_MEMALIGN)
#include <malloc.h>
# include <malloc.h>
#endif
#include <sys/types.h>
#if defined(_MSC_VER) && defined(_WIN64)
# include <intrin.h>
# pragma intrinsic(_umul128)
#endif
#include "constant.h"
#include "debug_counter.h"
#include "eval_intern.h"
#include "gc.h"
#include "id_table.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/complex.h"
#include "internal/cont.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/gc.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/io.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/rational.h"
#include "internal/sanitizers.h"
#include "internal/struct.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "internal/warnings.h"
#include "mjit.h"
#include "probes.h"
#include "regint.h"
#include "ruby/debug.h"
#include "ruby/io.h"
#include "ruby/re.h"
#include "ruby/st.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#include "ruby_atomic.h"
#include "symbol.h"
#include "transient_heap.h"
#include "vm_core.h"
#include "builtin.h"
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
#if defined(_MSC_VER) && defined(_WIN64)
#include <intrin.h>
#pragma intrinsic(_umul128)
#endif
#undef rb_data_object_wrap
/* Expecting this struct to be eliminated by function inlinings */
struct optional {
@ -3807,8 +3834,6 @@ rb_obj_id(VALUE obj)
return rb_find_object_id(obj, cached_object_id);
}
#include "regint.h"
static size_t
obj_memsize_of(VALUE obj, int use_all_types)
{

2
gc.h
View file

@ -1,6 +1,6 @@
#ifndef RUBY_GC_H
#define RUBY_GC_H 1
#include "ruby/ruby.h"
#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))

33
hash.c
View file

@ -11,17 +11,10 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "internal.h"
#include "ruby/config.h"
#include <errno.h>
#include "probes.h"
#include "id.h"
#include "symbol.h"
#include "debug_counter.h"
#include "transient_heap.h"
#include "ruby_assert.h"
#ifdef __APPLE__
# ifdef HAVE_CRT_EXTERNS_H
# include <crt_externs.h>
@ -30,6 +23,26 @@
# endif
#endif
#include "debug_counter.h"
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/bignum.h"
#include "internal/class.h"
#include "internal/cont.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/symbol.h"
#include "internal/vm.h"
#include "probes.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#include "symbol.h"
#include "transient_heap.h"
#ifndef HASH_DEBUG
#define HASH_DEBUG 0
#endif

View file

@ -1,5 +1,7 @@
#ifndef RUBY_ID_TABLE_H
#define RUBY_ID_TABLE_H 1
#include "ruby/config.h"
#include <stddef.h>
#include "ruby/ruby.h"
struct rb_id_table;

View file

@ -9,7 +9,8 @@
**********************************************************************/
#include "internal.h"
#include "internal/inits.h"
#include "ruby.h"
#include "builtin.h"
#include "prelude.rbinc"

View file

@ -18,17 +18,9 @@
# error not for C++
#endif
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "internal/stdbool.h"
#include "internal/bits.h"
#define LIKELY(x) RB_LIKELY(x)
#define UNLIKELY(x) RB_UNLIKELY(x)
#include "internal/compilers.h"
#include "internal/sanitizers.h"
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
#define roomof(x, y) (((x) + (y) - 1) / (y))
#define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
@ -36,54 +28,50 @@
/* Prevent compiler from reordering access */
#define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
#include "internal/serial.h"
#include "internal/static_assert.h"
#include "internal/time.h"
#include "internal/fixnum.h"
#include "internal/bignum.h"
#include "internal/rational.h"
#include "internal/numeric.h"
#include "internal/complex.h"
#include "internal/hash.h"
#include "internal/missing.h"
#include "internal/struct.h"
#include "internal/class.h"
#include "internal/imemo.h"
#include "internal/compar.h"
#include "internal/variable.h"
#include "internal/array.h"
#include "internal/debug.h"
#include "internal/compile.h"
#include "internal/cont.h"
#include "internal/dir.h"
#include "internal/encoding.h"
#include "internal/enum.h"
#include "internal/eval.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/gc.h"
#include "internal/io.h"
#include "internal/load.h"
#include "internal/loadpath.h"
#include "internal/math.h"
#include "internal/mjit.h"
#include "internal/object.h"
#include "internal/parse.h"
#include "internal/proc.h"
#include "internal/process.h"
#include "internal/range.h"
#include "internal/re.h"
#include "internal/signal.h"
#include "internal/string.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/transcode.h"
#include "internal/enc.h"
#include "internal/util.h"
#include "internal/vm.h"
#include "internal/enumerator.h"
#include "internal/random.h"
#include "internal/inits.h"
#include "internal/warnings.h"
#include "ruby/ruby.h"
/* Folowing macros were formerlly defined in this header but moved to somewhere
* else. In order to detect them we undef here. */
/* internal/error.h */
#undef Check_Type
/* internal/class.h */
#undef RClass
#undef RCLASS_SUPER
/* internal/gc.h */
#undef NEWOBJ_OF
#undef RB_NEWOBJ_OF
#undef RB_OBJ_WRITE
/* internal/hash.h */
#undef RHASH_IFNONE
#undef RHASH_SIZE
/* internal/struct.h */
#undef RSTRUCT_LEN
#undef RSTRUCT_PTR
#undef RSTRUCT_SET
#undef RSTRUCT_GET
/* Also, we keep the following macros here. They are expected to be
* overridden in each headers. */
/* internal/array.h */
#define rb_ary_new_from_args(...) rb_nonexistent_symbol(__VA_ARGS__)
/* internal/io.h */
#define rb_io_fptr_finalize(...) rb_nonexistent_symbol(__VA_ARGS__)
/* internal/string.h */
#define rb_fstring_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
/* internal/symbol.h */
#define rb_sym_intern_ascii_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
/* internal/vm.h */
#define rb_funcallv(...) rb_nonexistent_symbol(__VA_ARGS__)
#define rb_method_basic_definition_p(...) rb_nonexistent_symbol(__VA_ARGS__)
#endif /* RUBY_INTERNAL_H */

View file

@ -9,7 +9,6 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
#include "ruby/config.h"
#include <stddef.h> /* for size_t */
#include "internal/static_assert.h" /* for STATIC_ASSERT */
@ -87,6 +86,7 @@ RARY_TRANSIENT_UNSET(VALUE ary)
#endif
}
#undef rb_ary_new_from_args
#if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
#define rb_ary_new_from_args(n, ...) \
__extension__ ({ \

View file

@ -16,8 +16,13 @@
#include "ruby/intern.h" /* for rb_alloc_func_t */
#include "ruby/ruby.h" /* for struct RBasic */
#undef RClass /* See also include/ruby/backward.h */
#undef RCLASS_SUPER
#ifdef RClass
# undef RClass /* See also include/ruby/backward.h */
#endif
#ifdef RCLASS_SUPER
# undef RCLASS_SUPER
#endif
struct rb_deprecated_classext_struct {
char conflict[sizeof(VALUE) * 3];

View file

@ -9,7 +9,6 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
#include "ruby/defines.h" /* for GCC_VERSION_SINCE */
#ifdef _MSC_VER

View file

@ -17,7 +17,16 @@
#include "ruby/intern.h" /* for rb_exc_raise */
#include "ruby/ruby.h" /* for enum ruby_value_type */
#undef Check_Type /* in ruby/ruby.h */
#ifdef Check_Type
# undef Check_Type /* in ruby/ruby.h */
#endif
#ifdef rb_raise_static
# undef rb_raise_static
# undef rb_sys_fail_path
# undef rb_syserr_fail_path
#endif
#define rb_raise_static(e, m) \
rb_raise_cstr_i((e), rb_str_new_static((m), rb_strlen_lit(m)))
#ifdef RUBY_FUNCTION_NAME_STRING

View file

@ -18,9 +18,11 @@
struct rb_execution_context_struct; /* in vm_core.h */
#undef NEWOBJ_OF
#undef RB_NEWOBJ_OF
#undef RB_OBJ_WRITE
#ifdef NEWOBJ_OF
# undef NEWOBJ_OF
# undef RB_NEWOBJ_OF
# undef RB_OBJ_WRITE
#endif
/* optimized version of NEWOBJ() */
#define RB_NEWOBJ_OF(var, T, c, f) \

View file

@ -55,8 +55,14 @@ struct RHash {
};
#define RHASH(obj) (R_CAST(RHash)(obj))
#undef RHASH_IFNONE
#undef RHASH_SIZE
#ifdef RHASH_IFNONE
# undef RHASH_IFNONE
#endif
#ifdef RHASH_SIZE
# undef RHASH_SIZE
#endif
/* hash.c */
void rb_hash_st_table_set(VALUE hash, st_table *st);

View file

@ -19,6 +19,9 @@ VALUE rb_io_flush_raw(VALUE, int);
size_t rb_io_memsize(const rb_io_t *);
int rb_stderr_tty_p(void);
void rb_io_fptr_finalize_internal(void *ptr);
#ifdef rb_io_fptr_finalize
# undef rb_io_fptr_finalize
#endif
#define rb_io_fptr_finalize rb_io_fptr_finalize_internal
RUBY_SYMBOL_EXPORT_BEGIN

View file

@ -10,11 +10,6 @@
* file COPYING are met. Consult the file for details.
*/
#include "ruby/ruby.h" /* for VALUE */
#ifndef USE_SYMBOL_GC
# define USE_SYMBOL_GC 1
#endif
struct rb_iseq_struct; /* in vm_core.h */
/* parse.y */

View file

@ -19,6 +19,10 @@
#define STR_NOEMBED FL_USER1
#define STR_SHARED FL_USER2 /* = ELTS_SHARED */
#ifdef rb_fstring_cstr
# undef rb_fstring_cstr
#endif
/* string.c */
VALUE rb_fstring(VALUE);
VALUE rb_fstring_cstr(const char *str);

View file

@ -12,6 +12,7 @@
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "internal/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for struct RBasic */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
enum {
RSTRUCT_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
@ -32,10 +33,22 @@ struct RStruct {
};
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
#undef RSTRUCT_LEN
#undef RSTRUCT_PTR
#undef RSTRUCT_SET
#undef RSTRUCT_GET
#ifdef RSTRUCT_LEN
# undef RSTRUCT_LEN
#endif
#ifdef RSTRUCT_PTR
# undef RSTRUCT_PTR
#endif
#ifdef RSTRUCT_SET
# undef RSTRUCT_SET
#endif
#ifdef RSTRUCT_GET
# undef RSTRUCT_GET
#endif
/* struct.c */
VALUE rb_struct_init_copy(VALUE copy, VALUE s);

View file

@ -13,6 +13,10 @@
#include "ruby/encoding.h" /* for rb_encoding */
#include "internal/compilers.h" /* for __has_builtin */
#ifdef rb_sym_intern_ascii_cstr
# undef rb_sym_intern_ascii_cstr
#endif
/* symbol.c */
VALUE rb_to_symbol_type(VALUE obj);
VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);

View file

@ -9,7 +9,6 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
#include "ruby/config.h"
#include <stddef.h> /* for size_t */
#include "constant.h" /* for rb_const_entry_t */

View file

@ -15,6 +15,14 @@
#include "ruby/ruby.h" /* for ID */
#include "ruby/st.h" /* for st_table */
#ifdef rb_funcallv
# undef rb_funcallv
#endif
#ifdef rb_method_basic_definition_p
# undef rb_method_basic_definition_p
#endif
/* I have several reasons to choose 64 here:
*
* - A cache line must be a power-of-two size.

61
io.c
View file

@ -11,38 +11,31 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "internal.h"
#include "dln.h"
#include "encindex.h"
#include "id.h"
#include "ruby/config.h"
#ifdef _WIN32
# include "ruby/ruby.h"
# include "ruby/io.h"
#endif
#include <ctype.h>
#include <errno.h>
#include "ruby_atomic.h"
#include "ccan/list/list.h"
#include <stddef.h>
/* non-Linux poll may not work on all FDs */
#if defined(HAVE_POLL)
# if defined(__linux__)
# define USE_POLL 1
# endif
# if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000
# define USE_POLL 1
# endif
# if defined(__linux__)
# define USE_POLL 1
# endif
# if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000
# define USE_POLL 1
# endif
#endif
#ifndef USE_POLL
# define USE_POLL 0
# define USE_POLL 0
#endif
#if !USE_POLL
# include "vm_core.h"
#endif
#include "builtin.h"
#undef free
#define free(x) xfree(x)
@ -119,7 +112,31 @@
# include <copyfile.h>
#endif
#include "dln.h"
#include "encindex.h"
#include "id.h"
#include "internal.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/inits.h"
#include "internal/io.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/process.h"
#include "internal/stdbool.h"
#include "ccan/list/list.h"
#include "internal/thread.h"
#include "internal/transcode.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby_atomic.h"
#if !USE_POLL
# include "vm_core.h"
#endif
#include "builtin.h"
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)

30
iseq.c
View file

@ -9,25 +9,37 @@
**********************************************************************/
#include "internal.h"
#include "ruby/util.h"
#include "eval_intern.h"
#define RUBY_VM_INSNS_INFO 1
/* #define RUBY_MARK_FREE_DEBUG 1 */
#include "ruby/config.h"
#ifdef HAVE_DLADDR
# include <dlfcn.h>
#endif
#define RUBY_VM_INSNS_INFO 1
/* #define RUBY_MARK_FREE_DEBUG 1 */
#include "eval_intern.h"
#include "gc.h"
#include "vm_core.h"
#include "iseq.h"
#include "id_table.h"
#include "builtin.h"
#include "internal.h"
#include "internal/bits.h"
#include "internal/compile.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/hash.h"
#include "internal/parse.h"
#include "internal/sanitizers.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "iseq.h"
#include "mjit.h"
#include "ruby/util.h"
#include "vm_core.h"
#include "builtin.h"
#include "insns.inc"
#include "insns_info.inc"
#include "mjit.h"
VALUE rb_cISeq;
static VALUE iseqw_new(const rb_iseq_t *iseq);

2
iseq.h
View file

@ -11,6 +11,8 @@
#ifndef RUBY_ISEQ_H
#define RUBY_ISEQ_H 1
#include "internal/gc.h"
#include "vm_core.h"
RUBY_EXTERN const int ruby_api_version[];
#define ISEQ_MAJOR_VERSION ((unsigned int)ruby_api_version[0])

15
load.c
View file

@ -2,13 +2,20 @@
* load methods from eval.c
*/
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
#include "dln.h"
#include "eval_intern.h"
#include "probes.h"
#include "internal.h"
#include "internal/dir.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/load.h"
#include "internal/parse.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "iseq.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
static VALUE ruby_dln_librefs;

View file

@ -9,13 +9,7 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "internal.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "encindex.h"
#include "id_table.h"
#include "ruby/config.h"
#include <math.h>
#ifdef HAVE_FLOAT_H
@ -25,6 +19,23 @@
#include <ieeefp.h>
#endif
#include "encindex.h"
#include "id_table.h"
#include "internal.h"
#include "internal/bignum.h"
#include "internal/class.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/object.h"
#include "internal/struct.h"
#include "internal/util.h"
#include "internal/vm.h"
#include "ruby/io.h"
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
#define BITSPERSHORT (2*CHAR_BIT)
#define SHORTMASK ((1<<BITSPERSHORT)-1)
#define SHORTDN(x) RSHIFT((x),BITSPERSHORT)

13
math.c
View file

@ -9,13 +9,22 @@
**********************************************************************/
#include "ruby/config.h"
#ifdef _MSC_VER
# define _USE_MATH_DEFINES 1
#endif
#include "internal.h"
#include <errno.h>
#include <float.h>
#include <math.h>
#include <errno.h>
#include "internal.h"
#include "internal/bignum.h"
#include "internal/complex.h"
#include "internal/math.h"
#include "internal/object.h"
#include "internal/vm.h"
#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun) && \
!defined(signbit)

View file

@ -12,6 +12,9 @@
#define RUBY_METHOD_H 1
#include "internal.h"
#include "internal/imemo.h"
#include "internal/compilers.h"
#include "internal/static_assert.h"
#ifndef END_OF_ENUMERATION
# if defined(__GNUC__) &&! defined(__STRICT_ANSI__)

View file

@ -1,6 +1,7 @@
#include "internal.h"
#include "vm_core.h"
#include "internal/array.h"
#include "iseq.h"
#include "vm_core.h"
#include "builtin.h"
#include "miniprelude.c"

12
mjit.c
View file

@ -11,14 +11,20 @@
// To share variables privately, include mjit_worker.c instead of linking.
#include "internal.h"
#include "ruby/config.h"
#if USE_MJIT
#include "mjit_worker.c"
#include "constant.h"
#include "id_table.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/file.h"
#include "internal/hash.h"
#include "internal/mjit.h"
#include "internal/warnings.h"
#include "mjit_worker.c"
// Copy ISeq's states so that race condition does not happen on compilation.
static void

7
mjit.h
View file

@ -9,11 +9,14 @@
#ifndef RUBY_MJIT_H
#define RUBY_MJIT_H 1
#include "ruby.h"
#include "debug_counter.h"
#include "ruby/config.h"
#if USE_MJIT
#include "debug_counter.h"
#include "ruby.h"
#include "vm_core.h"
// Special address values of a function generated from the
// corresponding iseq by MJIT:
enum rb_mjit_iseq_func {

View file

@ -10,17 +10,22 @@
// call Ruby methods (C functions that may call rb_funcall) or trigger
// GC (using ZALLOC, xmalloc, xfree, etc.) in this file.
#include "internal.h"
#include "ruby/config.h"
#if USE_MJIT
#include "internal.h"
#include "internal/compile.h"
#include "internal/hash.h"
#include "internal/variable.h"
#include "mjit.h"
#include "vm_core.h"
#include "vm_exec.h"
#include "mjit.h"
#include "vm_insnhelper.h"
#include "builtin.h"
#include "insns.inc"
#include "insns_info.inc"
#include "vm_insnhelper.h"
// Macros to check if a position is already compiled using compile_status.stack_size_for_pos
#define NOT_COMPILED_STACK_SIZE -1

3
node.c
View file

@ -9,6 +9,9 @@
**********************************************************************/
#include "internal.h"
#include "internal/hash.h"
#include "internal/variable.h"
#include "ruby/ruby.h"
#include "vm_core.h"

View file

@ -9,10 +9,8 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
#include "id.h"
#include "ruby/config.h"
#include <assert.h>
#include <ctype.h>
#include <math.h>
@ -26,6 +24,22 @@
#include <ieeefp.h>
#endif
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/compilers.h"
#include "internal/complex.h"
#include "internal/enumerator.h"
#include "internal/gc.h"
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/rational.h"
#include "internal/util.h"
#include "internal/variable.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
/* use IEEE 64bit values if not defined */
#ifndef FLT_RADIX
#define FLT_RADIX 2

View file

@ -11,18 +11,31 @@
**********************************************************************/
#include "ruby/config.h"
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include "constant.h"
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/class.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/inits.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/struct.h"
#include "internal/symbol.h"
#include "internal/variable.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "internal.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include "constant.h"
#include "id.h"
#include "probes.h"
/*!
* \defgroup object Core objects and their operations

14
pack.c
View file

@ -9,12 +9,20 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "internal.h"
#include <sys/types.h>
#include "ruby/config.h"
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <sys/types.h>
#include "internal.h"
#include "internal/bits.h"
#include "internal/string.h"
#include "internal/symbol.h"
#include "internal/util.h"
#include "internal/variable.h"
#include "builtin.h"
/*

38
parse.y
View file

@ -20,18 +20,37 @@
#define YYLTYPE rb_code_location_t
#define YYLTYPE_IS_DECLARED 1
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/encoding.h"
#include "ruby/config.h"
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include "internal.h"
#include "internal/compile.h"
#include "internal/complex.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/io.h"
#include "internal/numeric.h"
#include "internal/parse.h"
#include "internal/rational.h"
#include "internal/re.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/util.h"
#include "internal/variable.h"
#include "node.h"
#include "parse.h"
#include "symbol.h"
#include "regenc.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include "probes.h"
#include "regenc.h"
#include "ruby/encoding.h"
#include "ruby/regex.h"
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "symbol.h"
#ifndef WARN_PAST_SCOPE
# define WARN_PAST_SCOPE 0
@ -5531,9 +5550,6 @@ ripper_dispatch_delayed_token(struct parser_params *p, enum yytokentype t)
#define has_delayed_token(p) (!NIL_P(p->delayed.token))
#endif /* RIPPER */
#include "ruby/regex.h"
#include "ruby/util.h"
static inline int
is_identchar(const char *ptr, const char *MAYBE_UNUSED(ptr_end), rb_encoding *enc)
{

9
proc.c
View file

@ -10,10 +10,15 @@
**********************************************************************/
#include "eval_intern.h"
#include "internal.h"
#include "gc.h"
#include "vm_core.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/error.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/symbol.h"
#include "iseq.h"
#include "vm_core.h"
/* Proc.new with no block will raise an exception in the future
* versions */

View file

@ -12,82 +12,106 @@
**********************************************************************/
#include "ruby/config.h"
#include "ruby/io.h"
#include "internal.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "vm_core.h"
#include "hrtime.h"
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_PROCESS_H
#include <process.h>
# include <stdlib.h>
#endif
#include <time.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_PROCESS_H
# include <process.h>
#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
# define EXIT_SUCCESS 0
#endif
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
# define EXIT_FAILURE 1
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#ifdef HAVE_VFORK_H
# include <vfork.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
#include "ruby/st.h"
#include <sys/stat.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
# include <sys/times.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
# include <pwd.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
# include <grp.h>
# ifdef __CYGWIN__
int initgroups(const char *, rb_gid_t);
# endif
#endif
#ifdef HAVE_SYS_ID_H
#include <sys/id.h>
# include <sys/id.h>
#endif
#ifdef __APPLE__
# include <mach/mach_time.h>
#endif
#include "dln.h"
#include "hrtime.h"
#include "internal.h"
#include "internal/bits.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/hash.h"
#include "internal/mjit.h"
#include "internal/object.h"
#include "internal/process.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "internal/warnings.h"
#include "ruby/io.h"
#include "ruby/st.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "vm_core.h"
/* define system APIs */
#ifdef _WIN32
#undef open
@ -317,8 +341,6 @@ close_unless_reserved(int fd)
/*#define DEBUG_REDIRECT*/
#if defined(DEBUG_REDIRECT)
#include <stdarg.h>
static void
ttyprintf(const char *fmt, ...)
{
@ -1572,8 +1594,6 @@ after_fork_ruby(void)
}
#endif
#include "dln.h"
#if defined(HAVE_WORKING_FORK)
/* try_with_sh and exec_with_sh should be async-signal-safe. Actually it is.*/

View file

@ -9,41 +9,59 @@
**********************************************************************/
#include "internal.h"
#include "ruby/config.h"
#include <errno.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <math.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
# include <fcntl.h>
#endif
#include <math.h>
#include <errno.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
# include <sys/time.h>
#endif
#ifdef HAVE_SYSCALL_H
#include <syscall.h>
# include <syscall.h>
#elif defined HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
# include <sys/syscall.h>
#endif
#ifdef _WIN32
#include <windows.h>
#include <wincrypt.h>
# include <winsock2.h>
# include <windows.h>
# include <wincrypt.h>
#endif
#include "ruby_atomic.h"
#ifdef __OpenBSD__
/* to define OpenBSD for version check */
#include <sys/param.h>
# include <sys/param.h>
#endif
#if defined HAVE_GETRANDOM
# include <sys/random.h>
#elif defined __linux__ && defined __NR_getrandom
# include <linux/random.h>
#endif
#include "internal.h"
#include "internal/compilers.h"
#include "internal/error.h"
#include "internal/numeric.h"
#include "internal/random.h"
#include "internal/sanitizers.h"
#include "ruby_atomic.h"
typedef int int_must_be_32bit_at_least[sizeof(int) * CHAR_BIT < 32 ? -1 : 1];
#include "missing/mt19937.c"
@ -320,11 +338,7 @@ fill_random_bytes_urandom(void *seed, size_t size)
# define fill_random_bytes_urandom(seed, size) -1
#endif
#if defined HAVE_GETRANDOM
# include <sys/random.h>
#elif defined __linux__ && defined __NR_getrandom
# include <linux/random.h>
#if ! defined HAVE_GETRANDOM && defined __linux__ && defined __NR_getrandom
# ifndef GRND_NONBLOCK
# define GRND_NONBLOCK 0x0001 /* not defined in musl libc */
# endif

16
range.c
View file

@ -9,14 +9,24 @@
**********************************************************************/
#include "internal.h"
#include "id.h"
#include "ruby/config.h"
#include <assert.h>
#include <math.h>
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#include <math.h>
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/compar.h"
#include "internal/enum.h"
#include "internal/enumerator.h"
#include "internal/error.h"
#include "internal/numeric.h"
#include "internal/range.h"
VALUE rb_cRange;
static ID id_beg, id_end, id_excl;

View file

@ -5,23 +5,32 @@
which is written in ruby.
*/
#include "internal.h"
#include "id.h"
#include <math.h>
#include "ruby/config.h"
#include <ctype.h>
#include <float.h>
#include <math.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#define NDEBUG
#include "ruby_assert.h"
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
#define USE_GMP
#include <gmp.h>
#endif
#define NDEBUG
#include "id.h"
#include "internal.h"
#include "internal/complex.h"
#include "internal/error.h"
#include "internal/gc.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/rational.h"
#include "ruby_assert.h"
#define ZERO INT2FIX(0)
#define ONE INT2FIX(1)
#define TWO INT2FIX(2)
@ -2299,8 +2308,6 @@ float_rationalize(int argc, VALUE *argv, VALUE self)
}
}
#include <ctype.h>
inline static int
issign(int c)
{

15
re.c
View file

@ -9,13 +9,20 @@
**********************************************************************/
#include "ruby/config.h"
#include <ctype.h>
#include "encindex.h"
#include "internal.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/re.h"
#include "regint.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "ruby/util.h"
#include "internal.h"
#include "regint.h"
#include "encindex.h"
#include <ctype.h>
VALUE rb_eRegexpError;

55
ruby.c
View file

@ -11,38 +11,57 @@
**********************************************************************/
#ifdef __CYGWIN__
#include <windows.h>
#include <sys/cygwin.h>
#endif
#include "ruby/encoding.h"
#include "ruby/thread.h"
#include "ruby/version.h"
#include "internal.h"
#include "eval_intern.h"
#include "dln.h"
#include "ruby/config.h"
#include <ctype.h>
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#ifdef __CYGWIN__
# include <windows.h>
# include <sys/cygwin.h>
#endif
#ifdef __hpux
#include <sys/pstat.h>
# include <sys/pstat.h>
#endif
#if defined(LOAD_RELATIVE) && defined(HAVE_DLADDR)
#include <dlfcn.h>
# include <dlfcn.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
# include <fcntl.h>
#elif defined(HAVE_SYS_FCNTL_H)
#include <sys/fcntl.h>
# include <sys/fcntl.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#include "dln.h"
#include "eval_intern.h"
#include "internal.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/inits.h"
#include "internal/io.h"
#include "internal/load.h"
#include "internal/loadpath.h"
#include "internal/missing.h"
#include "internal/object.h"
#include "internal/parse.h"
#include "mjit.h"
#include "ruby/encoding.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby/version.h"
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
@ -50,10 +69,6 @@
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
#endif
#include "ruby/util.h"
#include "mjit.h"
void Init_ruby_description(void);
#ifndef HAVE_STDLIB_H

View file

@ -11,36 +11,39 @@
**********************************************************************/
#include "internal.h"
#include "vm_core.h"
#include "ruby/config.h"
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include "ruby_atomic.h"
#include "eval_intern.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_UCONTEXT_H
#include <ucontext.h>
# include <sys/uio.h>
#endif
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
# ifndef VALGRIND_MAKE_MEM_DEFINED
# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
# endif
# ifndef VALGRIND_MAKE_MEM_UNDEFINED
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
# endif
#else
# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
#ifdef HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
#if HAVE_PTHREAD_H
# include <pthread.h>
#endif
#include "debug_counter.h"
#include "eval_intern.h"
#include "internal.h"
#include "internal/eval.h"
#include "internal/sanitizers.h"
#include "internal/signal.h"
#include "internal/string.h"
#include "internal/thread.h"
#include "ruby_atomic.h"
#include "vm_core.h"
#ifdef NEED_RUBY_ATOMIC_OPS
rb_atomic_t
ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val)
@ -395,7 +398,6 @@ interrupt_init(int argc, VALUE *argv, VALUE self)
return rb_call_super(2, args);
}
#include "debug_counter.h"
void rb_malloc_info_show_results(void); /* gc.c */
void
@ -728,10 +730,6 @@ rb_signal_buff_size(void)
return signal_buff.size;
}
#if HAVE_PTHREAD_H
#include <pthread.h>
#endif
static void
rb_disable_interrupt(void)
{

View file

@ -11,17 +11,27 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "internal.h"
#include "id.h"
#include "ruby/config.h"
#include <math.h>
#include <stdarg.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
# include <ieeefp.h>
#endif
#include "id.h"
#include "internal.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/sanitizers.h"
#include "internal/symbol.h"
#include "internal/util.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
static char *fmt_setup(char*,size_t,int,int,int,int);

3
st.c
View file

@ -105,6 +105,9 @@
#include "st.h"
#else
#include "internal.h"
#include "internal/bits.h"
#include "internal/hash.h"
#include "internal/sanitizers.h"
#endif
#include <stdio.h>

View file

@ -47,10 +47,7 @@
* January 1996
*/
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "timev.h"
#include "internal.h"
#include "ruby/config.h"
#ifndef GAWK
#include <stdio.h>
@ -68,6 +65,14 @@
#endif
#include <math.h>
#include "internal.h"
#include "internal/string.h"
#include "internal/util.h"
#include "internal/vm.h"
#include "ruby/encoding.h"
#include "ruby/ruby.h"
#include "timev.h"
/* defaults: season to taste */
#define SYSV_EXT 1 /* stuff in System V ascftime routine */
#define SUNOS_EXT 1 /* stuff in SunOS strftime routine */

View file

@ -11,37 +11,52 @@
**********************************************************************/
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "internal.h"
#include "encindex.h"
#include "probes.h"
#include "gc.h"
#include "ruby_assert.h"
#include "id.h"
#include "debug_counter.h"
#include "ruby/util.h"
#define BEG(no) (regs->beg[(no)])
#define END(no) (regs->end[(no)])
#include "ruby/config.h"
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#if defined HAVE_CRYPT_R
# if defined HAVE_CRYPT_H
# include <crypt.h>
# include <crypt.h>
# endif
#elif !defined HAVE_CRYPT
# include "missing/crypt.h"
# define HAVE_CRYPT_R 1
#endif
#include "debug_counter.h"
#include "encindex.h"
#include "gc.h"
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/compar.h"
#include "internal/compilers.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/gc.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/re.h"
#include "internal/sanitizers.h"
#include "internal/string.h"
#include "internal/transcode.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#define BEG(no) (regs->beg[(no)])
#define END(no) (regs->end[(no)])
#undef rb_str_new
#undef rb_usascii_str_new
#undef rb_utf8_str_new

View file

@ -9,10 +9,17 @@
**********************************************************************/
#include "internal.h"
#include "vm_core.h"
#include "id.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/struct.h"
#include "internal/symbol.h"
#include "transient_heap.h"
#include "vm_core.h"
/* only for struct[:field] access */
enum {

View file

@ -9,13 +9,22 @@
**********************************************************************/
#include "gc.h"
#include "internal.h"
#include "internal/error.h"
#include "internal/gc.h"
#include "internal/hash.h"
#include "internal/object.h"
#include "internal/symbol.h"
#include "internal/vm.h"
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "internal.h"
#include "symbol.h"
#include "gc.h"
#include "probes.h"
#ifndef USE_SYMBOL_GC
# define USE_SYMBOL_GC 1
#endif
#ifndef SYMBOL_DEBUG
# define SYMBOL_DEBUG 0
#endif

View file

@ -13,6 +13,7 @@
#define RUBY_SYMBOL_H 1
#include "id.h"
#include "ruby/encoding.h"
#define DYNAMIC_ID_P(id) (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)
#define STATIC_ID2SYM(id) (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)

View file

@ -87,10 +87,11 @@ Prelude.new(output, ARGV, vpath).instance_eval do
sources: <%= @preludes.map {|n,*| prelude_base(n)}.join(', ') %><%=%>
*/
%unless @preludes.empty?
#include "ruby/ruby.h"
#include "internal.h"
#include "vm_core.h"
#include "internal/warnings.h"
#include "iseq.h"
#include "ruby/ruby.h"
#include "vm_core.h"
% preludes = @preludes.values.sort
% preludes.each {|i, prelude, lines, sub|

View file

@ -64,24 +64,35 @@
/* for model 2 */
#include "ruby/config.h"
#include "ruby/io.h"
#include "eval_intern.h"
#include "timev.h"
#include "ruby/thread.h"
#include "ruby/thread_native.h"
#include "ruby/debug.h"
#include "gc.h"
#include "internal.h"
#include "iseq.h"
#include "vm_core.h"
#include "mjit.h"
#include "hrtime.h"
#ifdef __linux__
// Normally, gcc(1) translates calls to alloca() with inlined code. This is not done when either the -ansi, -std=c89, -std=c99, or the -std=c11 option is given and the header <alloca.h> is not included.
#include <alloca.h>
# include <alloca.h>
#endif
#include "eval_intern.h"
#include "gc.h"
#include "hrtime.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/io.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/signal.h"
#include "internal/thread.h"
#include "internal/time.h"
#include "internal/warnings.h"
#include "iseq.h"
#include "mjit.h"
#include "ruby/debug.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/thread_native.h"
#include "timev.h"
#include "vm_core.h"
#ifndef USE_NATIVE_THREAD_PRIORITY
#define USE_NATIVE_THREAD_PRIORITY 0
#define RUBY_THREAD_PRIORITY_MAX 3

32
time.c
View file

@ -11,29 +11,37 @@
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "ruby/encoding.h"
#include "internal.h"
#include <sys/types.h>
#include <time.h>
#include "ruby/config.h"
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <float.h>
#include <math.h>
#include <time.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
# include <strings.h>
#endif
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
# include <sys/time.h>
#endif
#include "timev.h"
#include "id.h"
#include "internal.h"
#include "internal/array.h"
#include "internal/compar.h"
#include "internal/numeric.h"
#include "internal/rational.h"
#include "internal/string.h"
#include "internal/time.h"
#include "internal/variable.h"
#include "ruby/encoding.h"
#include "timev.h"
static ID id_submicro, id_nano_num, id_nano_den, id_offset, id_zone;
static ID id_nanosecond, id_microsecond, id_millisecond, id_nsec, id_usec;

View file

@ -1,5 +1,6 @@
#ifndef RUBY_TIMEV_H
#define RUBY_TIMEV_H
#include "ruby/ruby.h"
#if 0
struct vtm {/* dummy for TAGS */};

View file

@ -127,13 +127,18 @@ def mk_builtin_header file
f.puts "// auto-generated file"
f.puts "// by #{__FILE__}"
f.puts "// with #{file}"
f.puts '#include "internal/compilers.h" /* for MAYBE_UNUSED */'
f.puts '#include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */'
f.puts '#include "ruby/ruby.h" /* for VALUE */'
f.puts '#include "builtin.h" /* for RB_BUILTIN_FUNCTION */'
f.puts 'struct rb_execution_context_struct; /* in vm_core.h */'
f.puts
lineno = 6
lineno = 11
line_file = file.gsub('\\', '/')
inlines.each{|cfunc_name, (body_lineno, text, params, func_name)|
if String === cfunc_name
f.puts "static VALUE #{cfunc_name}(rb_execution_context_t *ec, const VALUE self) {"
f.puts "static VALUE #{cfunc_name}(struct rb_execution_context_struct *ec, const VALUE self) {"
lineno += 1
params.reverse_each.with_index{|param, i|

Some files were not shown because too many files have changed in this diff Show more