debase-ruby_core_source 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/eval_intern.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/gc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/insns.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/insns_info.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-rc1 → ruby-2.2.0-p0}/internal.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-rc1 → ruby-2.2.0-p0}/iseq.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/method.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/node.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/opt_sc.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/parse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/regenc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/regint.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-2.2.0-p0/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-rc1 → ruby-2.2.0-p0}/version.h +4 -5
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/vm.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-rc1 → ruby-2.2.0-p0}/vm_core.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/vm_insnhelper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview1 → ruby-2.2.0-p0}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.2.0-preview2 → ruby-2.2.0-p0}/vmtc.inc +0 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +45 -133
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/constant.h +0 -37
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/encdb.h +0 -170
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/id.h +0 -198
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/insns.inc +0 -193
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/insns_info.inc +0 -745
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/internal.h +0 -1094
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/iseq.h +0 -157
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/known_errors.inc +0 -731
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/node.h +0 -544
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/opt_sc.inc +0 -726
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/optunifs.inc +0 -123
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/parse.h +0 -202
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/regint.h +0 -972
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/ruby_atomic.h +0 -170
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/symbol.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/transdb.h +0 -193
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/version.h +0 -53
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/vm.inc +0 -3317
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/vm_core.h +0 -1120
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview1/vmtc.inc +0 -104
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/addr2line.h +0 -21
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/ccan/build_assert/build_assert.h +0 -40
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/ccan/check_type/check_type.h +0 -63
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/ccan/container_of/container_of.h +0 -142
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/ccan/list/list.h +0 -635
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/ccan/str/str.h +0 -16
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/dln.h +0 -51
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/eval_intern.h +0 -275
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/gc.h +0 -107
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/internal.h +0 -1178
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/iseq.h +0 -157
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/method.h +0 -141
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/node_name.inc +0 -212
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/optinsn.inc +0 -83
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/probes_helper.h +0 -67
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/regenc.h +0 -234
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/regparse.h +0 -363
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/siphash.h +0 -48
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/thread_pthread.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/thread_win32.h +0 -36
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/timev.h +0 -42
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/transcode_data.h +0 -123
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/version.h +0 -53
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/vm_core.h +0 -1158
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/vm_debug.h +0 -37
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/vm_exec.h +0 -182
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/vm_insnhelper.h +0 -233
- data/lib/debase/ruby_core_source/ruby-2.2.0-preview2/vm_opts.h +0 -56
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/addr2line.h +0 -21
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/ccan/build_assert/build_assert.h +0 -40
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/ccan/check_type/check_type.h +0 -63
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/ccan/container_of/container_of.h +0 -142
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/ccan/list/list.h +0 -635
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/ccan/str/str.h +0 -16
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/constant.h +0 -43
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/dln.h +0 -51
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/eval_intern.h +0 -275
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/gc.h +0 -107
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/id.h +0 -210
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/insns.inc +0 -107
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/insns_info.inc +0 -752
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/known_errors.inc +0 -746
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/method.h +0 -141
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/node.h +0 -544
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/node_name.inc +0 -212
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/opt_sc.inc +0 -734
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/optinsn.inc +0 -83
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/optunifs.inc +0 -124
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/parse.h +0 -203
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/probes_helper.h +0 -67
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/regenc.h +0 -234
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/regint.h +0 -972
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/regparse.h +0 -363
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/ruby_atomic.h +0 -170
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/siphash.h +0 -48
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/symbol.h +0 -87
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/thread_pthread.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/thread_win32.h +0 -36
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/timev.h +0 -42
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/transcode_data.h +0 -123
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/vm.inc +0 -3353
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/vm_debug.h +0 -37
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/vm_exec.h +0 -182
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/vm_insnhelper.h +0 -233
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/vm_opts.h +0 -56
- data/lib/debase/ruby_core_source/ruby-2.2.0-rc1/vmtc.inc +0 -105
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#define RUBY_REVISION 48628
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#ifndef SIPHASH_H
|
|
2
|
-
#define SIPHASH_H 1
|
|
3
|
-
#include <stdlib.h>
|
|
4
|
-
#ifdef HAVE_STDINT_H
|
|
5
|
-
#include <stdint.h>
|
|
6
|
-
#endif
|
|
7
|
-
#ifdef HAVE_INTTYPES_H
|
|
8
|
-
#include <inttypes.h>
|
|
9
|
-
#endif
|
|
10
|
-
|
|
11
|
-
#ifndef HAVE_UINT64_T
|
|
12
|
-
typedef struct {
|
|
13
|
-
uint32_t u32[2];
|
|
14
|
-
} sip_uint64_t;
|
|
15
|
-
#define uint64_t sip_uint64_t
|
|
16
|
-
#else
|
|
17
|
-
typedef uint64_t sip_uint64_t;
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
typedef struct {
|
|
21
|
-
int c;
|
|
22
|
-
int d;
|
|
23
|
-
uint64_t v[4];
|
|
24
|
-
uint8_t buf[sizeof(uint64_t)];
|
|
25
|
-
uint8_t buflen;
|
|
26
|
-
uint8_t msglen_byte;
|
|
27
|
-
} sip_state;
|
|
28
|
-
|
|
29
|
-
typedef struct sip_interface_st sip_interface;
|
|
30
|
-
|
|
31
|
-
typedef struct {
|
|
32
|
-
sip_state state[1];
|
|
33
|
-
const sip_interface *methods;
|
|
34
|
-
} sip_hash;
|
|
35
|
-
|
|
36
|
-
sip_hash *sip_hash_new(const uint8_t key[16], int c, int d);
|
|
37
|
-
sip_hash *sip_hash_init(sip_hash *h, const uint8_t key[16], int c, int d);
|
|
38
|
-
int sip_hash_update(sip_hash *h, const uint8_t *data, size_t len);
|
|
39
|
-
int sip_hash_final(sip_hash *h, uint8_t **digest, size_t *len);
|
|
40
|
-
int sip_hash_final_integer(sip_hash *h, uint64_t *digest);
|
|
41
|
-
int sip_hash_digest(sip_hash *h, const uint8_t *data, size_t data_len, uint8_t **digest, size_t *digest_len);
|
|
42
|
-
int sip_hash_digest_integer(sip_hash *h, const uint8_t *data, size_t data_len, uint64_t *digest);
|
|
43
|
-
void sip_hash_free(sip_hash *h);
|
|
44
|
-
void sip_hash_dump(sip_hash *h);
|
|
45
|
-
|
|
46
|
-
uint64_t sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len);
|
|
47
|
-
|
|
48
|
-
#endif
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**********************************************************************
|
|
2
|
-
|
|
3
|
-
thread_pthread.h -
|
|
4
|
-
|
|
5
|
-
$Author: normal $
|
|
6
|
-
|
|
7
|
-
Copyright (C) 2004-2007 Koichi Sasada
|
|
8
|
-
|
|
9
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
#ifndef RUBY_THREAD_PTHREAD_H
|
|
12
|
-
#define RUBY_THREAD_PTHREAD_H
|
|
13
|
-
|
|
14
|
-
#ifdef HAVE_PTHREAD_NP_H
|
|
15
|
-
#include <pthread_np.h>
|
|
16
|
-
#endif
|
|
17
|
-
|
|
18
|
-
#define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
|
|
19
|
-
#define RB_NATIVETHREAD_COND_INIT { PTHREAD_COND_INITIALIZER, }
|
|
20
|
-
|
|
21
|
-
typedef struct rb_thread_cond_struct {
|
|
22
|
-
pthread_cond_t cond;
|
|
23
|
-
#ifdef HAVE_CLOCKID_T
|
|
24
|
-
clockid_t clockid;
|
|
25
|
-
#endif
|
|
26
|
-
} rb_nativethread_cond_t;
|
|
27
|
-
|
|
28
|
-
typedef struct native_thread_data_struct {
|
|
29
|
-
void *signal_thread_list;
|
|
30
|
-
rb_nativethread_cond_t sleep_cond;
|
|
31
|
-
} native_thread_data_t;
|
|
32
|
-
|
|
33
|
-
#undef except
|
|
34
|
-
#undef try
|
|
35
|
-
#undef leave
|
|
36
|
-
#undef finally
|
|
37
|
-
|
|
38
|
-
typedef struct rb_global_vm_lock_struct {
|
|
39
|
-
/* fast path */
|
|
40
|
-
unsigned long acquired;
|
|
41
|
-
rb_nativethread_lock_t lock;
|
|
42
|
-
|
|
43
|
-
/* slow path */
|
|
44
|
-
volatile unsigned long waiting;
|
|
45
|
-
rb_nativethread_cond_t cond;
|
|
46
|
-
|
|
47
|
-
/* yield */
|
|
48
|
-
rb_nativethread_cond_t switch_cond;
|
|
49
|
-
rb_nativethread_cond_t switch_wait_cond;
|
|
50
|
-
int need_yield;
|
|
51
|
-
int wait_yield;
|
|
52
|
-
} rb_global_vm_lock_t;
|
|
53
|
-
|
|
54
|
-
#endif /* RUBY_THREAD_PTHREAD_H */
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**********************************************************************
|
|
2
|
-
|
|
3
|
-
thread_win32.h -
|
|
4
|
-
|
|
5
|
-
$Author: ko1 $
|
|
6
|
-
|
|
7
|
-
Copyright (C) 2004-2007 Koichi Sasada
|
|
8
|
-
|
|
9
|
-
**********************************************************************/
|
|
10
|
-
|
|
11
|
-
/* interface */
|
|
12
|
-
#ifndef RUBY_THREAD_WIN32_H
|
|
13
|
-
#define RUBY_THREAD_WIN32_H
|
|
14
|
-
|
|
15
|
-
# ifdef __CYGWIN__
|
|
16
|
-
# undef _WIN32
|
|
17
|
-
# endif
|
|
18
|
-
|
|
19
|
-
WINBASEAPI BOOL WINAPI
|
|
20
|
-
TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
|
|
21
|
-
|
|
22
|
-
typedef struct rb_thread_cond_struct {
|
|
23
|
-
struct cond_event_entry *next;
|
|
24
|
-
struct cond_event_entry *prev;
|
|
25
|
-
} rb_nativethread_cond_t;
|
|
26
|
-
|
|
27
|
-
typedef struct native_thread_data_struct {
|
|
28
|
-
HANDLE interrupt_event;
|
|
29
|
-
} native_thread_data_t;
|
|
30
|
-
|
|
31
|
-
typedef struct rb_global_vm_lock_struct {
|
|
32
|
-
HANDLE lock;
|
|
33
|
-
} rb_global_vm_lock_t;
|
|
34
|
-
|
|
35
|
-
#endif /* RUBY_THREAD_WIN32_H */
|
|
36
|
-
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#ifndef RUBY_TIMEV_H
|
|
2
|
-
#define RUBY_TIMEV_H
|
|
3
|
-
|
|
4
|
-
PACKED_STRUCT_UNALIGNED(struct vtm {
|
|
5
|
-
VALUE year; /* 2000 for example. Integer. */
|
|
6
|
-
VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
|
|
7
|
-
VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
|
|
8
|
-
const char *zone; /* "JST", "EST", "EDT", etc. */
|
|
9
|
-
uint16_t yday:9; /* 1..366 */
|
|
10
|
-
uint8_t mon:4; /* 1..12 */
|
|
11
|
-
uint8_t mday:5; /* 1..31 */
|
|
12
|
-
uint8_t hour:5; /* 0..23 */
|
|
13
|
-
uint8_t min:6; /* 0..59 */
|
|
14
|
-
uint8_t sec:6; /* 0..60 */
|
|
15
|
-
uint8_t wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
|
|
16
|
-
uint8_t isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
#define TIME_SCALE 1000000000
|
|
20
|
-
|
|
21
|
-
#ifndef TYPEOF_TIMEVAL_TV_SEC
|
|
22
|
-
# define TYPEOF_TIMEVAL_TV_SEC time_t
|
|
23
|
-
#endif
|
|
24
|
-
#ifndef TYPEOF_TIMEVAL_TV_USEC
|
|
25
|
-
# if INT_MAX >= 1000000
|
|
26
|
-
# define TYPEOF_TIMEVAL_TV_USEC int
|
|
27
|
-
# else
|
|
28
|
-
# define TYPEOF_TIMEVAL_TV_USEC long
|
|
29
|
-
# endif
|
|
30
|
-
#endif
|
|
31
|
-
|
|
32
|
-
#if SIZEOF_TIME_T == SIZEOF_LONG
|
|
33
|
-
typedef unsigned long unsigned_time_t;
|
|
34
|
-
#elif SIZEOF_TIME_T == SIZEOF_INT
|
|
35
|
-
typedef unsigned int unsigned_time_t;
|
|
36
|
-
#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
|
37
|
-
typedef unsigned LONG_LONG unsigned_time_t;
|
|
38
|
-
#else
|
|
39
|
-
# error cannot find integer type which size is same as time_t.
|
|
40
|
-
#endif
|
|
41
|
-
|
|
42
|
-
#endif
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**********************************************************************
|
|
2
|
-
|
|
3
|
-
transcode_data.h -
|
|
4
|
-
|
|
5
|
-
$Author: nobu $
|
|
6
|
-
created at: Mon 10 Dec 2007 14:01:47 JST 2007
|
|
7
|
-
|
|
8
|
-
Copyright (C) 2007 Martin Duerst
|
|
9
|
-
|
|
10
|
-
**********************************************************************/
|
|
11
|
-
|
|
12
|
-
#include "ruby/ruby.h"
|
|
13
|
-
|
|
14
|
-
#ifndef RUBY_TRANSCODE_DATA_H
|
|
15
|
-
#define RUBY_TRANSCODE_DATA_H 1
|
|
16
|
-
|
|
17
|
-
RUBY_SYMBOL_EXPORT_BEGIN
|
|
18
|
-
|
|
19
|
-
#define WORDINDEX_SHIFT_BITS 2
|
|
20
|
-
#define WORDINDEX2INFO(widx) ((widx) << WORDINDEX_SHIFT_BITS)
|
|
21
|
-
#define INFO2WORDINDEX(info) ((info) >> WORDINDEX_SHIFT_BITS)
|
|
22
|
-
#define BYTE_LOOKUP_BASE(bl) ((bl)[0])
|
|
23
|
-
#define BYTE_LOOKUP_INFO(bl) ((bl)[1])
|
|
24
|
-
|
|
25
|
-
#define PType (unsigned int)
|
|
26
|
-
|
|
27
|
-
#define NOMAP (PType 0x01) /* direct map */
|
|
28
|
-
#define ONEbt (0x02) /* one byte payload */
|
|
29
|
-
#define TWObt (0x03) /* two bytes payload */
|
|
30
|
-
#define THREEbt (0x05) /* three bytes payload */
|
|
31
|
-
#define FOURbt (0x06) /* four bytes payload, UTF-8 only, macros start at getBT0 */
|
|
32
|
-
#define INVALID (PType 0x07) /* invalid byte sequence */
|
|
33
|
-
#define UNDEF (PType 0x09) /* legal but undefined */
|
|
34
|
-
#define ZERObt (PType 0x0A) /* zero bytes of payload, i.e. remove */
|
|
35
|
-
#define FUNii (PType 0x0B) /* function from info to info */
|
|
36
|
-
#define FUNsi (PType 0x0D) /* function from start to info */
|
|
37
|
-
#define FUNio (PType 0x0E) /* function from info to output */
|
|
38
|
-
#define FUNso (PType 0x0F) /* function from start to output */
|
|
39
|
-
#define STR1 (PType 0x11) /* string 4 <= len <= 259 bytes: 1byte length + content */
|
|
40
|
-
#define GB4bt (PType 0x12) /* GB18030 four bytes payload */
|
|
41
|
-
#define FUNsio (PType 0x13) /* function from start and info to output */
|
|
42
|
-
|
|
43
|
-
#define STR1_LENGTH(byte_addr) (unsigned int)(*(byte_addr) + 4)
|
|
44
|
-
#define STR1_BYTEINDEX(w) ((w) >> 6)
|
|
45
|
-
#define makeSTR1(bi) (((bi) << 6) | STR1)
|
|
46
|
-
#define makeSTR1LEN(len) ((len)-4)
|
|
47
|
-
|
|
48
|
-
#define o1(b1) (PType((((unsigned char)(b1))<<8)|ONEbt))
|
|
49
|
-
#define o2(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|TWObt))
|
|
50
|
-
#define o3(b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned int)(unsigned char)(b3))<<24)|THREEbt)&0xffffffffU))
|
|
51
|
-
#define o4(b0,b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned char)(b3))<<24)|((((unsigned char)(b0))&0x07)<<5)|FOURbt)&0xffffffffU))
|
|
52
|
-
#define g4(b0,b1,b2,b3) (PType(((((unsigned char)(b0))<<8)|(((unsigned char)(b2))<<16)|((((unsigned char)(b1))&0x0f)<<24)|((((unsigned int)(unsigned char)(b3))&0x0f)<<28)|GB4bt)&0xffffffffU))
|
|
53
|
-
#define funsio(diff) (PType((((unsigned int)(diff))<<8)|FUNsio))
|
|
54
|
-
|
|
55
|
-
#define getBT1(a) ((unsigned char)((a)>> 8))
|
|
56
|
-
#define getBT2(a) ((unsigned char)((a)>>16))
|
|
57
|
-
#define getBT3(a) ((unsigned char)((a)>>24))
|
|
58
|
-
#define getBT0(a) (((unsigned char)((a)>> 5)&0x07)|0xF0) /* for UTF-8 only!!! */
|
|
59
|
-
|
|
60
|
-
#define getGB4bt0(a) ((unsigned char)((a)>> 8))
|
|
61
|
-
#define getGB4bt1(a) (((unsigned char)((a)>>24)&0x0F)|0x30)
|
|
62
|
-
#define getGB4bt2(a) ((unsigned char)((a)>>16))
|
|
63
|
-
#define getGB4bt3(a) (((unsigned char)((a)>>28)&0x0F)|0x30)
|
|
64
|
-
|
|
65
|
-
#define o2FUNii(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|FUNii))
|
|
66
|
-
|
|
67
|
-
/* do we need these??? maybe not, can be done with simple tables */
|
|
68
|
-
#define ONETRAIL /* legal but undefined if one more trailing UTF-8 */
|
|
69
|
-
#define TWOTRAIL /* legal but undefined if two more trailing UTF-8 */
|
|
70
|
-
#define THREETRAIL /* legal but undefined if three more trailing UTF-8 */
|
|
71
|
-
|
|
72
|
-
typedef enum {
|
|
73
|
-
asciicompat_converter, /* ASCII-compatible -> ASCII-compatible */
|
|
74
|
-
asciicompat_decoder, /* ASCII-incompatible -> ASCII-compatible */
|
|
75
|
-
asciicompat_encoder /* ASCII-compatible -> ASCII-incompatible */
|
|
76
|
-
/* ASCII-incompatible -> ASCII-incompatible is intentionally omitted. */
|
|
77
|
-
} rb_transcoder_asciicompat_type_t;
|
|
78
|
-
|
|
79
|
-
typedef struct rb_transcoder rb_transcoder;
|
|
80
|
-
|
|
81
|
-
/* static structure, one per supported encoding pair */
|
|
82
|
-
struct rb_transcoder {
|
|
83
|
-
const char *src_encoding;
|
|
84
|
-
const char *dst_encoding;
|
|
85
|
-
unsigned int conv_tree_start;
|
|
86
|
-
const unsigned char *byte_array;
|
|
87
|
-
unsigned int byte_array_length;
|
|
88
|
-
const unsigned int *word_array;
|
|
89
|
-
unsigned int word_array_length;
|
|
90
|
-
int word_size;
|
|
91
|
-
int input_unit_length;
|
|
92
|
-
int max_input;
|
|
93
|
-
int max_output;
|
|
94
|
-
rb_transcoder_asciicompat_type_t asciicompat_type;
|
|
95
|
-
size_t state_size;
|
|
96
|
-
int (*state_init_func)(void*); /* ret==0:success ret!=0:failure(errno) */
|
|
97
|
-
int (*state_fini_func)(void*); /* ret==0:success ret!=0:failure(errno) */
|
|
98
|
-
VALUE (*func_ii)(void*, VALUE); /* info -> info */
|
|
99
|
-
VALUE (*func_si)(void*, const unsigned char*, size_t); /* start -> info */
|
|
100
|
-
ssize_t (*func_io)(void*, VALUE, const unsigned char*, size_t); /* info -> output */
|
|
101
|
-
ssize_t (*func_so)(void*, const unsigned char*, size_t, unsigned char*, size_t); /* start -> output */
|
|
102
|
-
ssize_t (*finish_func)(void*, unsigned char*, size_t); /* -> output */
|
|
103
|
-
ssize_t (*resetsize_func)(void*); /* -> len */
|
|
104
|
-
ssize_t (*resetstate_func)(void*, unsigned char*, size_t); /* -> output */
|
|
105
|
-
ssize_t (*func_sio)(void*, const unsigned char*, size_t, VALUE, unsigned char*, size_t); /* start -> output */
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);
|
|
109
|
-
void rb_register_transcoder(const rb_transcoder *);
|
|
110
|
-
|
|
111
|
-
/*
|
|
112
|
-
* To get rid of collision of initializer symbols in statically-linked encodings
|
|
113
|
-
* and transcoders
|
|
114
|
-
*/
|
|
115
|
-
#if defined(EXTSTATIC) && EXTSTATIC
|
|
116
|
-
# define TRANS_INIT(name) void Init_trans_ ## name(void)
|
|
117
|
-
#else
|
|
118
|
-
# define TRANS_INIT(name) void Init_ ## name(void)
|
|
119
|
-
#endif
|
|
120
|
-
|
|
121
|
-
RUBY_SYMBOL_EXPORT_END
|
|
122
|
-
|
|
123
|
-
#endif /* RUBY_TRANSCODE_DATA_H */
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#define RUBY_VERSION "2.2.0"
|
|
2
|
-
#define RUBY_RELEASE_DATE "2014-11-28"
|
|
3
|
-
#define RUBY_PATCHLEVEL -1
|
|
4
|
-
#define RUBY_BRANCH_NAME "trunk"
|
|
5
|
-
|
|
6
|
-
#define RUBY_RELEASE_YEAR 2014
|
|
7
|
-
#define RUBY_RELEASE_MONTH 11
|
|
8
|
-
#define RUBY_RELEASE_DAY 28
|
|
9
|
-
|
|
10
|
-
#include "ruby/version.h"
|
|
11
|
-
|
|
12
|
-
#if !defined RUBY_LIB_VERSION && defined RUBY_LIB_VERSION_STYLE
|
|
13
|
-
# if RUBY_LIB_VERSION_STYLE == 3
|
|
14
|
-
# define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR)"."STRINGIZE(RUBY_API_VERSION_TEENY)
|
|
15
|
-
# elif RUBY_LIB_VERSION_STYLE == 2
|
|
16
|
-
# define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR)
|
|
17
|
-
# endif
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
#if RUBY_PATCHLEVEL == -1
|
|
21
|
-
#define RUBY_PATCHLEVEL_STR "preview2"
|
|
22
|
-
#else
|
|
23
|
-
#define RUBY_PATCHLEVEL_STR "p"STRINGIZE(RUBY_PATCHLEVEL)
|
|
24
|
-
#endif
|
|
25
|
-
|
|
26
|
-
#ifndef RUBY_REVISION
|
|
27
|
-
# include "revision.h"
|
|
28
|
-
#endif
|
|
29
|
-
#ifndef RUBY_REVISION
|
|
30
|
-
# define RUBY_REVISION 0
|
|
31
|
-
#endif
|
|
32
|
-
|
|
33
|
-
#if RUBY_REVISION
|
|
34
|
-
# ifdef RUBY_BRANCH_NAME
|
|
35
|
-
# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "STRINGIZE(RUBY_REVISION)
|
|
36
|
-
# else
|
|
37
|
-
# define RUBY_REVISION_STR " revision "STRINGIZE(RUBY_REVISION)
|
|
38
|
-
# endif
|
|
39
|
-
#else
|
|
40
|
-
# define RUBY_REVISION_STR ""
|
|
41
|
-
#endif
|
|
42
|
-
|
|
43
|
-
# define RUBY_DESCRIPTION \
|
|
44
|
-
"ruby "RUBY_VERSION \
|
|
45
|
-
RUBY_PATCHLEVEL_STR \
|
|
46
|
-
" ("RUBY_RELEASE_DATE \
|
|
47
|
-
RUBY_REVISION_STR") " \
|
|
48
|
-
"["RUBY_PLATFORM"]"
|
|
49
|
-
# define RUBY_COPYRIGHT \
|
|
50
|
-
"ruby - Copyright (C) " \
|
|
51
|
-
STRINGIZE(RUBY_BIRTH_YEAR)"-" \
|
|
52
|
-
STRINGIZE(RUBY_RELEASE_YEAR)" " \
|
|
53
|
-
RUBY_AUTHOR
|
|
@@ -1,1158 +0,0 @@
|
|
|
1
|
-
/**********************************************************************
|
|
2
|
-
|
|
3
|
-
vm_core.h -
|
|
4
|
-
|
|
5
|
-
$Author: ko1 $
|
|
6
|
-
created at: 04/01/01 19:41:38 JST
|
|
7
|
-
|
|
8
|
-
Copyright (C) 2004-2007 Koichi Sasada
|
|
9
|
-
|
|
10
|
-
**********************************************************************/
|
|
11
|
-
|
|
12
|
-
#ifndef RUBY_VM_CORE_H
|
|
13
|
-
#define RUBY_VM_CORE_H
|
|
14
|
-
|
|
15
|
-
#define RUBY_VM_THREAD_MODEL 2
|
|
16
|
-
|
|
17
|
-
#include "ruby/ruby.h"
|
|
18
|
-
#include "ruby/st.h"
|
|
19
|
-
|
|
20
|
-
#include "node.h"
|
|
21
|
-
#include "vm_debug.h"
|
|
22
|
-
#include "vm_opts.h"
|
|
23
|
-
#include "id.h"
|
|
24
|
-
#include "method.h"
|
|
25
|
-
#include "ruby_atomic.h"
|
|
26
|
-
#include "ccan/list/list.h"
|
|
27
|
-
|
|
28
|
-
#include "ruby/thread_native.h"
|
|
29
|
-
#if defined(_WIN32)
|
|
30
|
-
#include "thread_win32.h"
|
|
31
|
-
#elif defined(HAVE_PTHREAD_H)
|
|
32
|
-
#include "thread_pthread.h"
|
|
33
|
-
#endif
|
|
34
|
-
|
|
35
|
-
#ifndef ENABLE_VM_OBJSPACE
|
|
36
|
-
#ifdef _WIN32
|
|
37
|
-
/*
|
|
38
|
-
* TODO: object space independent st_table.
|
|
39
|
-
* socklist needs st_table in rb_w32_sysinit(), before object space
|
|
40
|
-
* initialization.
|
|
41
|
-
* It is too early now to change st_hash_type, since it breaks binary
|
|
42
|
-
* compatibility.
|
|
43
|
-
*/
|
|
44
|
-
#define ENABLE_VM_OBJSPACE 0
|
|
45
|
-
#else
|
|
46
|
-
#define ENABLE_VM_OBJSPACE 1
|
|
47
|
-
#endif
|
|
48
|
-
#endif
|
|
49
|
-
|
|
50
|
-
#include <setjmp.h>
|
|
51
|
-
#include <signal.h>
|
|
52
|
-
|
|
53
|
-
#ifndef NSIG
|
|
54
|
-
# define NSIG (_SIGMAX + 1) /* For QNX */
|
|
55
|
-
#endif
|
|
56
|
-
|
|
57
|
-
#define RUBY_NSIG NSIG
|
|
58
|
-
|
|
59
|
-
#ifdef HAVE_STDARG_PROTOTYPES
|
|
60
|
-
#include <stdarg.h>
|
|
61
|
-
#define va_init_list(a,b) va_start((a),(b))
|
|
62
|
-
#else
|
|
63
|
-
#include <varargs.h>
|
|
64
|
-
#define va_init_list(a,b) va_start((a))
|
|
65
|
-
#endif
|
|
66
|
-
|
|
67
|
-
#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
|
|
68
|
-
#define USE_SIGALTSTACK
|
|
69
|
-
#endif
|
|
70
|
-
|
|
71
|
-
/*****************/
|
|
72
|
-
/* configuration */
|
|
73
|
-
/*****************/
|
|
74
|
-
|
|
75
|
-
/* gcc ver. check */
|
|
76
|
-
#if defined(__GNUC__) && __GNUC__ >= 2
|
|
77
|
-
|
|
78
|
-
#if OPT_TOKEN_THREADED_CODE
|
|
79
|
-
#if OPT_DIRECT_THREADED_CODE
|
|
80
|
-
#undef OPT_DIRECT_THREADED_CODE
|
|
81
|
-
#endif
|
|
82
|
-
#endif
|
|
83
|
-
|
|
84
|
-
#else /* defined(__GNUC__) && __GNUC__ >= 2 */
|
|
85
|
-
|
|
86
|
-
/* disable threaded code options */
|
|
87
|
-
#if OPT_DIRECT_THREADED_CODE
|
|
88
|
-
#undef OPT_DIRECT_THREADED_CODE
|
|
89
|
-
#endif
|
|
90
|
-
#if OPT_TOKEN_THREADED_CODE
|
|
91
|
-
#undef OPT_TOKEN_THREADED_CODE
|
|
92
|
-
#endif
|
|
93
|
-
#endif
|
|
94
|
-
|
|
95
|
-
#ifdef __native_client__
|
|
96
|
-
#undef OPT_DIRECT_THREADED_CODE
|
|
97
|
-
#endif
|
|
98
|
-
|
|
99
|
-
/* call threaded code */
|
|
100
|
-
#if OPT_CALL_THREADED_CODE
|
|
101
|
-
#if OPT_DIRECT_THREADED_CODE
|
|
102
|
-
#undef OPT_DIRECT_THREADED_CODE
|
|
103
|
-
#endif /* OPT_DIRECT_THREADED_CODE */
|
|
104
|
-
#if OPT_STACK_CACHING
|
|
105
|
-
#undef OPT_STACK_CACHING
|
|
106
|
-
#endif /* OPT_STACK_CACHING */
|
|
107
|
-
#endif /* OPT_CALL_THREADED_CODE */
|
|
108
|
-
|
|
109
|
-
typedef unsigned long rb_num_t;
|
|
110
|
-
|
|
111
|
-
/* iseq data type */
|
|
112
|
-
|
|
113
|
-
struct iseq_compile_data_ensure_node_stack;
|
|
114
|
-
|
|
115
|
-
typedef struct rb_compile_option_struct rb_compile_option_t;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
struct iseq_inline_cache_entry {
|
|
119
|
-
rb_serial_t ic_serial;
|
|
120
|
-
union {
|
|
121
|
-
size_t index;
|
|
122
|
-
VALUE value;
|
|
123
|
-
} ic_value;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
union iseq_inline_storage_entry {
|
|
127
|
-
struct {
|
|
128
|
-
struct rb_thread_struct *running_thread;
|
|
129
|
-
VALUE value;
|
|
130
|
-
} once;
|
|
131
|
-
struct iseq_inline_cache_entry cache;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
/* to avoid warning */
|
|
135
|
-
struct rb_thread_struct;
|
|
136
|
-
struct rb_control_frame_struct;
|
|
137
|
-
|
|
138
|
-
typedef struct rb_call_info_kw_arg_struct {
|
|
139
|
-
int keyword_len;
|
|
140
|
-
ID keywords[1];
|
|
141
|
-
} rb_call_info_kw_arg_t;
|
|
142
|
-
|
|
143
|
-
/* rb_call_info_t contains calling information including inline cache */
|
|
144
|
-
typedef struct rb_call_info_struct {
|
|
145
|
-
/* fixed at compile time */
|
|
146
|
-
ID mid;
|
|
147
|
-
|
|
148
|
-
unsigned int flag;
|
|
149
|
-
int orig_argc;
|
|
150
|
-
rb_iseq_t *blockiseq;
|
|
151
|
-
rb_call_info_kw_arg_t *kw_arg;
|
|
152
|
-
|
|
153
|
-
/* inline cache: keys */
|
|
154
|
-
rb_serial_t method_state;
|
|
155
|
-
rb_serial_t class_serial;
|
|
156
|
-
VALUE klass;
|
|
157
|
-
|
|
158
|
-
/* inline cache: values */
|
|
159
|
-
const rb_method_entry_t *me;
|
|
160
|
-
VALUE defined_class;
|
|
161
|
-
|
|
162
|
-
/* temporary values for method calling */
|
|
163
|
-
struct rb_block_struct *blockptr;
|
|
164
|
-
VALUE recv;
|
|
165
|
-
int argc;
|
|
166
|
-
union {
|
|
167
|
-
int opt_pc; /* used by iseq */
|
|
168
|
-
int index; /* used by ivar */
|
|
169
|
-
int missing_reason; /* used by method_missing */
|
|
170
|
-
int inc_sp; /* used by cfunc */
|
|
171
|
-
} aux;
|
|
172
|
-
|
|
173
|
-
VALUE (*call)(struct rb_thread_struct *th, struct rb_control_frame_struct *cfp, struct rb_call_info_struct *ci);
|
|
174
|
-
} rb_call_info_t;
|
|
175
|
-
|
|
176
|
-
#if 1
|
|
177
|
-
#define GetCoreDataFromValue(obj, type, ptr) do { \
|
|
178
|
-
(ptr) = (type*)DATA_PTR(obj); \
|
|
179
|
-
} while (0)
|
|
180
|
-
#else
|
|
181
|
-
#define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct((obj), type, (ptr))
|
|
182
|
-
#endif
|
|
183
|
-
|
|
184
|
-
#define GetISeqPtr(obj, ptr) \
|
|
185
|
-
GetCoreDataFromValue((obj), rb_iseq_t, (ptr))
|
|
186
|
-
|
|
187
|
-
typedef struct rb_iseq_location_struct {
|
|
188
|
-
const VALUE path;
|
|
189
|
-
const VALUE absolute_path;
|
|
190
|
-
const VALUE base_label;
|
|
191
|
-
const VALUE label;
|
|
192
|
-
VALUE first_lineno; /* TODO: may be unsigned short */
|
|
193
|
-
} rb_iseq_location_t;
|
|
194
|
-
|
|
195
|
-
struct rb_iseq_struct;
|
|
196
|
-
|
|
197
|
-
struct rb_iseq_struct {
|
|
198
|
-
/***************/
|
|
199
|
-
/* static data */
|
|
200
|
-
/***************/
|
|
201
|
-
|
|
202
|
-
enum iseq_type {
|
|
203
|
-
ISEQ_TYPE_TOP,
|
|
204
|
-
ISEQ_TYPE_METHOD,
|
|
205
|
-
ISEQ_TYPE_BLOCK,
|
|
206
|
-
ISEQ_TYPE_CLASS,
|
|
207
|
-
ISEQ_TYPE_RESCUE,
|
|
208
|
-
ISEQ_TYPE_ENSURE,
|
|
209
|
-
ISEQ_TYPE_EVAL,
|
|
210
|
-
ISEQ_TYPE_MAIN,
|
|
211
|
-
ISEQ_TYPE_DEFINED_GUARD
|
|
212
|
-
} type; /* instruction sequence type */
|
|
213
|
-
#if defined(WORDS_BIGENDIAN) && (SIZEOF_VALUE > SIZEOF_INT)
|
|
214
|
-
char dummy[SIZEOF_VALUE - SIZEOF_INT]; /* [Bug #10037][ruby-core:63721] */
|
|
215
|
-
#endif
|
|
216
|
-
int stack_max; /* for stack overflow check */
|
|
217
|
-
|
|
218
|
-
rb_iseq_location_t location;
|
|
219
|
-
|
|
220
|
-
VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
|
|
221
|
-
unsigned int iseq_size;
|
|
222
|
-
unsigned int line_info_size;
|
|
223
|
-
|
|
224
|
-
const VALUE mark_ary; /* Array: includes operands which should be GC marked */
|
|
225
|
-
const VALUE coverage; /* coverage array */
|
|
226
|
-
|
|
227
|
-
/* insn info, must be freed */
|
|
228
|
-
struct iseq_line_info_entry *line_info_table;
|
|
229
|
-
|
|
230
|
-
ID *local_table; /* must free */
|
|
231
|
-
int local_table_size;
|
|
232
|
-
|
|
233
|
-
/* sizeof(vars) + 1 */
|
|
234
|
-
int local_size;
|
|
235
|
-
|
|
236
|
-
union iseq_inline_storage_entry *is_entries;
|
|
237
|
-
int is_size;
|
|
238
|
-
|
|
239
|
-
int callinfo_size;
|
|
240
|
-
rb_call_info_t *callinfo_entries;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* parameter information
|
|
244
|
-
*
|
|
245
|
-
* def m(a1, a2, ..., aM, # mandatory
|
|
246
|
-
* b1=(...), b2=(...), ..., bN=(...), # optional
|
|
247
|
-
* *c, # rest
|
|
248
|
-
* d1, d2, ..., dO, # post
|
|
249
|
-
* e1:(...), e2:(...), ..., eK:(...), # keyword
|
|
250
|
-
* **f, # keyword_rest
|
|
251
|
-
* &g) # block
|
|
252
|
-
* =>
|
|
253
|
-
*
|
|
254
|
-
* lead_num = M
|
|
255
|
-
* opt_num = N
|
|
256
|
-
* rest_start = M+N
|
|
257
|
-
* post_start = M+N+(*1)
|
|
258
|
-
* post_num = O
|
|
259
|
-
* keyword_num = K
|
|
260
|
-
* block_start = M+N+(*1)+O+K
|
|
261
|
-
* keyword_bits = M+N+(*1)+O+K+(&1)
|
|
262
|
-
* size = M+N+O+(*1)+K+(&1)+(**1) // parameter size.
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
|
-
struct {
|
|
266
|
-
struct {
|
|
267
|
-
unsigned int has_lead : 1;
|
|
268
|
-
unsigned int has_opt : 1;
|
|
269
|
-
unsigned int has_rest : 1;
|
|
270
|
-
unsigned int has_post : 1;
|
|
271
|
-
unsigned int has_kw : 1;
|
|
272
|
-
unsigned int has_kwrest : 1;
|
|
273
|
-
unsigned int has_block : 1;
|
|
274
|
-
|
|
275
|
-
unsigned int ambiguous_param0 : 1; /* {|a|} */
|
|
276
|
-
} flags;
|
|
277
|
-
|
|
278
|
-
int size;
|
|
279
|
-
|
|
280
|
-
int lead_num;
|
|
281
|
-
int opt_num;
|
|
282
|
-
int rest_start;
|
|
283
|
-
int post_start;
|
|
284
|
-
int post_num;
|
|
285
|
-
int block_start;
|
|
286
|
-
|
|
287
|
-
VALUE *opt_table; /* (opt_num + 1) entries. */
|
|
288
|
-
/* opt_num and opt_table:
|
|
289
|
-
*
|
|
290
|
-
* def foo o1=e1, o2=e2, ..., oN=eN
|
|
291
|
-
* #=>
|
|
292
|
-
* # prologue code
|
|
293
|
-
* A1: e1
|
|
294
|
-
* A2: e2
|
|
295
|
-
* ...
|
|
296
|
-
* AN: eN
|
|
297
|
-
* AL: body
|
|
298
|
-
* opt_num = N
|
|
299
|
-
* opt_table = [A1, A2, ..., AN, AL]
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
struct rb_iseq_param_keyword {
|
|
303
|
-
int num;
|
|
304
|
-
int required_num;
|
|
305
|
-
int bits_start;
|
|
306
|
-
int rest_start;
|
|
307
|
-
ID *table;
|
|
308
|
-
VALUE *default_values;
|
|
309
|
-
} *keyword;
|
|
310
|
-
} param;
|
|
311
|
-
|
|
312
|
-
/* catch table */
|
|
313
|
-
struct iseq_catch_table *catch_table;
|
|
314
|
-
|
|
315
|
-
/* for child iseq */
|
|
316
|
-
struct rb_iseq_struct *parent_iseq;
|
|
317
|
-
struct rb_iseq_struct *local_iseq;
|
|
318
|
-
|
|
319
|
-
/****************/
|
|
320
|
-
/* dynamic data */
|
|
321
|
-
/****************/
|
|
322
|
-
|
|
323
|
-
VALUE self;
|
|
324
|
-
const VALUE orig; /* non-NULL if its data have origin */
|
|
325
|
-
|
|
326
|
-
/* block inlining */
|
|
327
|
-
/*
|
|
328
|
-
* NODE *node;
|
|
329
|
-
* void *special_block_builder;
|
|
330
|
-
* void *cached_special_block_builder;
|
|
331
|
-
* VALUE cached_special_block;
|
|
332
|
-
*/
|
|
333
|
-
|
|
334
|
-
/* klass/module nest information stack (cref) */
|
|
335
|
-
NODE * const cref_stack;
|
|
336
|
-
const VALUE klass;
|
|
337
|
-
|
|
338
|
-
/* misc */
|
|
339
|
-
ID defined_method_id; /* for define_method */
|
|
340
|
-
rb_num_t flip_cnt;
|
|
341
|
-
|
|
342
|
-
/* used at compile time */
|
|
343
|
-
struct iseq_compile_data *compile_data;
|
|
344
|
-
|
|
345
|
-
/* original iseq, before encoding
|
|
346
|
-
* used for debug/dump (TODO: union with compile_data) */
|
|
347
|
-
VALUE *iseq;
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
enum ruby_special_exceptions {
|
|
351
|
-
ruby_error_reenter,
|
|
352
|
-
ruby_error_nomemory,
|
|
353
|
-
ruby_error_sysstack,
|
|
354
|
-
ruby_error_closed_stream,
|
|
355
|
-
ruby_special_error_count
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
enum ruby_basic_operators {
|
|
359
|
-
BOP_PLUS,
|
|
360
|
-
BOP_MINUS,
|
|
361
|
-
BOP_MULT,
|
|
362
|
-
BOP_DIV,
|
|
363
|
-
BOP_MOD,
|
|
364
|
-
BOP_EQ,
|
|
365
|
-
BOP_EQQ,
|
|
366
|
-
BOP_LT,
|
|
367
|
-
BOP_LE,
|
|
368
|
-
BOP_LTLT,
|
|
369
|
-
BOP_AREF,
|
|
370
|
-
BOP_ASET,
|
|
371
|
-
BOP_LENGTH,
|
|
372
|
-
BOP_SIZE,
|
|
373
|
-
BOP_EMPTY_P,
|
|
374
|
-
BOP_SUCC,
|
|
375
|
-
BOP_GT,
|
|
376
|
-
BOP_GE,
|
|
377
|
-
BOP_NOT,
|
|
378
|
-
BOP_NEQ,
|
|
379
|
-
BOP_MATCH,
|
|
380
|
-
BOP_FREEZE,
|
|
381
|
-
|
|
382
|
-
BOP_LAST_
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
#define GetVMPtr(obj, ptr) \
|
|
386
|
-
GetCoreDataFromValue((obj), rb_vm_t, (ptr))
|
|
387
|
-
|
|
388
|
-
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
|
389
|
-
struct rb_objspace;
|
|
390
|
-
void rb_objspace_free(struct rb_objspace *);
|
|
391
|
-
#endif
|
|
392
|
-
|
|
393
|
-
typedef struct rb_hook_list_struct {
|
|
394
|
-
struct rb_event_hook_struct *hooks;
|
|
395
|
-
rb_event_flag_t events;
|
|
396
|
-
int need_clean;
|
|
397
|
-
} rb_hook_list_t;
|
|
398
|
-
|
|
399
|
-
typedef struct rb_vm_struct {
|
|
400
|
-
VALUE self;
|
|
401
|
-
|
|
402
|
-
rb_global_vm_lock_t gvl;
|
|
403
|
-
rb_nativethread_lock_t thread_destruct_lock;
|
|
404
|
-
|
|
405
|
-
struct rb_thread_struct *main_thread;
|
|
406
|
-
struct rb_thread_struct *running_thread;
|
|
407
|
-
|
|
408
|
-
struct list_head living_threads;
|
|
409
|
-
size_t living_thread_num;
|
|
410
|
-
VALUE thgroup_default;
|
|
411
|
-
|
|
412
|
-
int running;
|
|
413
|
-
int thread_abort_on_exception;
|
|
414
|
-
int trace_running;
|
|
415
|
-
volatile int sleeper;
|
|
416
|
-
|
|
417
|
-
/* object management */
|
|
418
|
-
VALUE mark_object_ary;
|
|
419
|
-
|
|
420
|
-
const VALUE special_exceptions[ruby_special_error_count];
|
|
421
|
-
|
|
422
|
-
/* load */
|
|
423
|
-
VALUE top_self;
|
|
424
|
-
VALUE load_path;
|
|
425
|
-
VALUE load_path_snapshot;
|
|
426
|
-
VALUE load_path_check_cache;
|
|
427
|
-
VALUE expanded_load_path;
|
|
428
|
-
VALUE loaded_features;
|
|
429
|
-
VALUE loaded_features_snapshot;
|
|
430
|
-
struct st_table *loaded_features_index;
|
|
431
|
-
struct st_table *loading_table;
|
|
432
|
-
|
|
433
|
-
/* signal */
|
|
434
|
-
struct {
|
|
435
|
-
VALUE cmd;
|
|
436
|
-
int safe;
|
|
437
|
-
} trap_list[RUBY_NSIG];
|
|
438
|
-
|
|
439
|
-
/* hook */
|
|
440
|
-
rb_hook_list_t event_hooks;
|
|
441
|
-
|
|
442
|
-
/* relation table of ensure - rollback for callcc */
|
|
443
|
-
struct st_table *ensure_rollback_table;
|
|
444
|
-
|
|
445
|
-
/* postponed_job */
|
|
446
|
-
struct rb_postponed_job_struct *postponed_job_buffer;
|
|
447
|
-
int postponed_job_index;
|
|
448
|
-
|
|
449
|
-
int src_encoding_index;
|
|
450
|
-
|
|
451
|
-
VALUE verbose, debug, orig_progname, progname;
|
|
452
|
-
VALUE coverages;
|
|
453
|
-
|
|
454
|
-
struct unlinked_method_entry_list_entry *unlinked_method_entry_list;
|
|
455
|
-
|
|
456
|
-
VALUE defined_module_hash;
|
|
457
|
-
|
|
458
|
-
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
|
459
|
-
struct rb_objspace *objspace;
|
|
460
|
-
#endif
|
|
461
|
-
|
|
462
|
-
/*
|
|
463
|
-
* @shyouhei notes that this is not for storing normal Ruby
|
|
464
|
-
* objects so do *NOT* mark this when you GC.
|
|
465
|
-
*/
|
|
466
|
-
struct RArray at_exit;
|
|
467
|
-
|
|
468
|
-
VALUE *defined_strings;
|
|
469
|
-
st_table *frozen_strings;
|
|
470
|
-
|
|
471
|
-
/* params */
|
|
472
|
-
struct { /* size in byte */
|
|
473
|
-
size_t thread_vm_stack_size;
|
|
474
|
-
size_t thread_machine_stack_size;
|
|
475
|
-
size_t fiber_vm_stack_size;
|
|
476
|
-
size_t fiber_machine_stack_size;
|
|
477
|
-
} default_params;
|
|
478
|
-
|
|
479
|
-
short redefined_flag[BOP_LAST_];
|
|
480
|
-
} rb_vm_t;
|
|
481
|
-
|
|
482
|
-
/* default values */
|
|
483
|
-
|
|
484
|
-
#define RUBY_VM_SIZE_ALIGN 4096
|
|
485
|
-
|
|
486
|
-
#define RUBY_VM_THREAD_VM_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
|
|
487
|
-
#define RUBY_VM_THREAD_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
|
|
488
|
-
#define RUBY_VM_THREAD_MACHINE_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
|
|
489
|
-
#define RUBY_VM_THREAD_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
|
|
490
|
-
|
|
491
|
-
#define RUBY_VM_FIBER_VM_STACK_SIZE ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
|
|
492
|
-
#define RUBY_VM_FIBER_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
|
|
493
|
-
#define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 64 * 1024 * sizeof(VALUE)) /* 256 KB or 512 KB */
|
|
494
|
-
#define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
|
|
495
|
-
|
|
496
|
-
/* optimize insn */
|
|
497
|
-
#define FIXNUM_REDEFINED_OP_FLAG (1 << 0)
|
|
498
|
-
#define FLOAT_REDEFINED_OP_FLAG (1 << 1)
|
|
499
|
-
#define STRING_REDEFINED_OP_FLAG (1 << 2)
|
|
500
|
-
#define ARRAY_REDEFINED_OP_FLAG (1 << 3)
|
|
501
|
-
#define HASH_REDEFINED_OP_FLAG (1 << 4)
|
|
502
|
-
#define BIGNUM_REDEFINED_OP_FLAG (1 << 5)
|
|
503
|
-
#define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
|
|
504
|
-
#define TIME_REDEFINED_OP_FLAG (1 << 7)
|
|
505
|
-
#define REGEXP_REDEFINED_OP_FLAG (1 << 8)
|
|
506
|
-
|
|
507
|
-
#define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0))
|
|
508
|
-
|
|
509
|
-
#ifndef VM_DEBUG_BP_CHECK
|
|
510
|
-
#define VM_DEBUG_BP_CHECK 0
|
|
511
|
-
#endif
|
|
512
|
-
|
|
513
|
-
#ifndef VM_DEBUG_VERIFY_METHOD_CACHE
|
|
514
|
-
#define VM_DEBUG_VERIFY_METHOD_CACHE 0
|
|
515
|
-
#endif
|
|
516
|
-
|
|
517
|
-
typedef struct rb_control_frame_struct {
|
|
518
|
-
VALUE *pc; /* cfp[0] */
|
|
519
|
-
VALUE *sp; /* cfp[1] */
|
|
520
|
-
rb_iseq_t *iseq; /* cfp[2] */
|
|
521
|
-
VALUE flag; /* cfp[3] */
|
|
522
|
-
VALUE self; /* cfp[4] / block[0] */
|
|
523
|
-
VALUE klass; /* cfp[5] / block[1] */
|
|
524
|
-
VALUE *ep; /* cfp[6] / block[2] */
|
|
525
|
-
rb_iseq_t *block_iseq; /* cfp[7] / block[3] */
|
|
526
|
-
VALUE proc; /* cfp[8] / block[4] */
|
|
527
|
-
const rb_method_entry_t *me;/* cfp[9] */
|
|
528
|
-
|
|
529
|
-
#if VM_DEBUG_BP_CHECK
|
|
530
|
-
VALUE *bp_check; /* cfp[10] */
|
|
531
|
-
#endif
|
|
532
|
-
} rb_control_frame_t;
|
|
533
|
-
|
|
534
|
-
typedef struct rb_block_struct {
|
|
535
|
-
VALUE self; /* share with method frame if it's only block */
|
|
536
|
-
VALUE klass; /* share with method frame if it's only block */
|
|
537
|
-
VALUE *ep; /* share with method frame if it's only block */
|
|
538
|
-
rb_iseq_t *iseq;
|
|
539
|
-
VALUE proc;
|
|
540
|
-
} rb_block_t;
|
|
541
|
-
|
|
542
|
-
extern const rb_data_type_t ruby_threadptr_data_type;
|
|
543
|
-
|
|
544
|
-
#define GetThreadPtr(obj, ptr) \
|
|
545
|
-
TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))
|
|
546
|
-
|
|
547
|
-
enum rb_thread_status {
|
|
548
|
-
THREAD_RUNNABLE,
|
|
549
|
-
THREAD_STOPPED,
|
|
550
|
-
THREAD_STOPPED_FOREVER,
|
|
551
|
-
THREAD_KILLED
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
typedef RUBY_JMP_BUF rb_jmpbuf_t;
|
|
555
|
-
|
|
556
|
-
/*
|
|
557
|
-
the members which are written in TH_PUSH_TAG() should be placed at
|
|
558
|
-
the beginning and the end, so that entire region is accessible.
|
|
559
|
-
*/
|
|
560
|
-
struct rb_vm_tag {
|
|
561
|
-
VALUE tag;
|
|
562
|
-
VALUE retval;
|
|
563
|
-
rb_jmpbuf_t buf;
|
|
564
|
-
struct rb_vm_tag *prev;
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
struct rb_vm_protect_tag {
|
|
568
|
-
struct rb_vm_protect_tag *prev;
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
struct rb_unblock_callback {
|
|
572
|
-
rb_unblock_function_t *func;
|
|
573
|
-
void *arg;
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
struct rb_mutex_struct;
|
|
577
|
-
|
|
578
|
-
struct rb_thread_struct;
|
|
579
|
-
typedef struct rb_thread_list_struct{
|
|
580
|
-
struct rb_thread_list_struct *next;
|
|
581
|
-
struct rb_thread_struct *th;
|
|
582
|
-
} rb_thread_list_t;
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
typedef struct rb_ensure_entry {
|
|
586
|
-
VALUE marker;
|
|
587
|
-
VALUE (*e_proc)(ANYARGS);
|
|
588
|
-
VALUE data2;
|
|
589
|
-
} rb_ensure_entry_t;
|
|
590
|
-
|
|
591
|
-
typedef struct rb_ensure_list {
|
|
592
|
-
struct rb_ensure_list *next;
|
|
593
|
-
struct rb_ensure_entry entry;
|
|
594
|
-
} rb_ensure_list_t;
|
|
595
|
-
|
|
596
|
-
typedef char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) * 2 + 3];
|
|
597
|
-
|
|
598
|
-
typedef struct rb_fiber_struct rb_fiber_t;
|
|
599
|
-
|
|
600
|
-
typedef struct rb_thread_struct {
|
|
601
|
-
struct list_node vmlt_node;
|
|
602
|
-
VALUE self;
|
|
603
|
-
rb_vm_t *vm;
|
|
604
|
-
|
|
605
|
-
/* execution information */
|
|
606
|
-
VALUE *stack; /* must free, must mark */
|
|
607
|
-
size_t stack_size; /* size in word (byte size / sizeof(VALUE)) */
|
|
608
|
-
rb_control_frame_t *cfp;
|
|
609
|
-
int safe_level;
|
|
610
|
-
int raised_flag;
|
|
611
|
-
VALUE last_status; /* $? */
|
|
612
|
-
|
|
613
|
-
/* passing state */
|
|
614
|
-
int state;
|
|
615
|
-
|
|
616
|
-
int waiting_fd;
|
|
617
|
-
|
|
618
|
-
/* for rb_iterate */
|
|
619
|
-
const rb_block_t *passed_block;
|
|
620
|
-
|
|
621
|
-
/* for bmethod */
|
|
622
|
-
const rb_method_entry_t *passed_bmethod_me;
|
|
623
|
-
|
|
624
|
-
/* for cfunc */
|
|
625
|
-
rb_call_info_t *passed_ci;
|
|
626
|
-
|
|
627
|
-
/* for load(true) */
|
|
628
|
-
VALUE top_self;
|
|
629
|
-
VALUE top_wrapper;
|
|
630
|
-
|
|
631
|
-
/* eval env */
|
|
632
|
-
rb_block_t *base_block;
|
|
633
|
-
|
|
634
|
-
VALUE *root_lep;
|
|
635
|
-
VALUE root_svar;
|
|
636
|
-
|
|
637
|
-
/* thread control */
|
|
638
|
-
rb_nativethread_id_t thread_id;
|
|
639
|
-
#ifdef NON_SCALAR_THREAD_ID
|
|
640
|
-
rb_thread_id_string_t thread_id_string;
|
|
641
|
-
#endif
|
|
642
|
-
enum rb_thread_status status;
|
|
643
|
-
int to_kill;
|
|
644
|
-
int priority;
|
|
645
|
-
int mark_stack_len;
|
|
646
|
-
|
|
647
|
-
native_thread_data_t native_thread_data;
|
|
648
|
-
void *blocking_region_buffer;
|
|
649
|
-
|
|
650
|
-
VALUE thgroup;
|
|
651
|
-
VALUE value;
|
|
652
|
-
|
|
653
|
-
/* temporary place of errinfo */
|
|
654
|
-
VALUE errinfo;
|
|
655
|
-
|
|
656
|
-
/* temporary place of retval on OPT_CALL_THREADED_CODE */
|
|
657
|
-
#if OPT_CALL_THREADED_CODE
|
|
658
|
-
VALUE retval;
|
|
659
|
-
#endif
|
|
660
|
-
|
|
661
|
-
/* async errinfo queue */
|
|
662
|
-
VALUE pending_interrupt_queue;
|
|
663
|
-
VALUE pending_interrupt_mask_stack;
|
|
664
|
-
int pending_interrupt_queue_checked;
|
|
665
|
-
|
|
666
|
-
rb_atomic_t interrupt_flag;
|
|
667
|
-
unsigned long interrupt_mask;
|
|
668
|
-
rb_nativethread_lock_t interrupt_lock;
|
|
669
|
-
rb_nativethread_cond_t interrupt_cond;
|
|
670
|
-
struct rb_unblock_callback unblock;
|
|
671
|
-
VALUE locking_mutex;
|
|
672
|
-
struct rb_mutex_struct *keeping_mutexes;
|
|
673
|
-
|
|
674
|
-
struct rb_vm_tag *tag;
|
|
675
|
-
struct rb_vm_protect_tag *protect_tag;
|
|
676
|
-
|
|
677
|
-
/*! Thread-local state of evaluation context.
|
|
678
|
-
*
|
|
679
|
-
* If negative, this thread is evaluating the main program.
|
|
680
|
-
* If positive, this thread is evaluating a program under Kernel::eval
|
|
681
|
-
* family.
|
|
682
|
-
*/
|
|
683
|
-
int parse_in_eval;
|
|
684
|
-
|
|
685
|
-
/*! Thread-local state of compiling context.
|
|
686
|
-
*
|
|
687
|
-
* If non-zero, the parser does not automatically print error messages to
|
|
688
|
-
* stderr. */
|
|
689
|
-
int mild_compile_error;
|
|
690
|
-
|
|
691
|
-
/* storage */
|
|
692
|
-
st_table *local_storage;
|
|
693
|
-
VALUE local_storage_recursive_hash;
|
|
694
|
-
|
|
695
|
-
rb_thread_list_t *join_list;
|
|
696
|
-
|
|
697
|
-
VALUE first_proc;
|
|
698
|
-
VALUE first_args;
|
|
699
|
-
VALUE (*first_func)(ANYARGS);
|
|
700
|
-
|
|
701
|
-
/* for GC */
|
|
702
|
-
struct {
|
|
703
|
-
VALUE *stack_start;
|
|
704
|
-
VALUE *stack_end;
|
|
705
|
-
size_t stack_maxsize;
|
|
706
|
-
#ifdef __ia64
|
|
707
|
-
VALUE *register_stack_start;
|
|
708
|
-
VALUE *register_stack_end;
|
|
709
|
-
size_t register_stack_maxsize;
|
|
710
|
-
#endif
|
|
711
|
-
jmp_buf regs;
|
|
712
|
-
} machine;
|
|
713
|
-
|
|
714
|
-
/* statistics data for profiler */
|
|
715
|
-
VALUE stat_insn_usage;
|
|
716
|
-
|
|
717
|
-
/* tracer */
|
|
718
|
-
rb_hook_list_t event_hooks;
|
|
719
|
-
struct rb_trace_arg_struct *trace_arg; /* trace information */
|
|
720
|
-
|
|
721
|
-
/* fiber */
|
|
722
|
-
rb_fiber_t *fiber;
|
|
723
|
-
rb_fiber_t *root_fiber;
|
|
724
|
-
rb_jmpbuf_t root_jmpbuf;
|
|
725
|
-
|
|
726
|
-
/* ensure & callcc */
|
|
727
|
-
rb_ensure_list_t *ensure_list;
|
|
728
|
-
|
|
729
|
-
/* misc */
|
|
730
|
-
int method_missing_reason;
|
|
731
|
-
int abort_on_exception;
|
|
732
|
-
#ifdef USE_SIGALTSTACK
|
|
733
|
-
void *altstack;
|
|
734
|
-
#endif
|
|
735
|
-
unsigned long running_time_us;
|
|
736
|
-
} rb_thread_t;
|
|
737
|
-
|
|
738
|
-
typedef enum {
|
|
739
|
-
VM_DEFINECLASS_TYPE_CLASS = 0x00,
|
|
740
|
-
VM_DEFINECLASS_TYPE_SINGLETON_CLASS = 0x01,
|
|
741
|
-
VM_DEFINECLASS_TYPE_MODULE = 0x02,
|
|
742
|
-
/* 0x03..0x06 is reserved */
|
|
743
|
-
VM_DEFINECLASS_TYPE_MASK = 0x07
|
|
744
|
-
} rb_vm_defineclass_type_t;
|
|
745
|
-
|
|
746
|
-
#define VM_DEFINECLASS_TYPE(x) ((rb_vm_defineclass_type_t)(x) & VM_DEFINECLASS_TYPE_MASK)
|
|
747
|
-
#define VM_DEFINECLASS_FLAG_SCOPED 0x08
|
|
748
|
-
#define VM_DEFINECLASS_FLAG_HAS_SUPERCLASS 0x10
|
|
749
|
-
#define VM_DEFINECLASS_SCOPED_P(x) ((x) & VM_DEFINECLASS_FLAG_SCOPED)
|
|
750
|
-
#define VM_DEFINECLASS_HAS_SUPERCLASS_P(x) \
|
|
751
|
-
((x) & VM_DEFINECLASS_FLAG_HAS_SUPERCLASS)
|
|
752
|
-
|
|
753
|
-
/* iseq.c */
|
|
754
|
-
RUBY_SYMBOL_EXPORT_BEGIN
|
|
755
|
-
|
|
756
|
-
/* node -> iseq */
|
|
757
|
-
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE, enum iseq_type);
|
|
758
|
-
VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE parent);
|
|
759
|
-
VALUE rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path);
|
|
760
|
-
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE);
|
|
761
|
-
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, const rb_compile_option_t*);
|
|
762
|
-
|
|
763
|
-
/* src -> iseq */
|
|
764
|
-
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
|
|
765
|
-
VALUE rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, rb_block_t *base_block);
|
|
766
|
-
VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt);
|
|
767
|
-
|
|
768
|
-
VALUE rb_iseq_disasm(VALUE self);
|
|
769
|
-
int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);
|
|
770
|
-
const char *ruby_node_name(int node);
|
|
771
|
-
|
|
772
|
-
RUBY_EXTERN VALUE rb_cISeq;
|
|
773
|
-
RUBY_EXTERN VALUE rb_cRubyVM;
|
|
774
|
-
RUBY_EXTERN VALUE rb_cEnv;
|
|
775
|
-
RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
|
|
776
|
-
RUBY_SYMBOL_EXPORT_END
|
|
777
|
-
|
|
778
|
-
#define GetProcPtr(obj, ptr) \
|
|
779
|
-
GetCoreDataFromValue((obj), rb_proc_t, (ptr))
|
|
780
|
-
|
|
781
|
-
typedef struct {
|
|
782
|
-
rb_block_t block;
|
|
783
|
-
|
|
784
|
-
VALUE envval; /* for GC mark */
|
|
785
|
-
VALUE blockprocval;
|
|
786
|
-
int8_t safe_level; /* 0..3 */
|
|
787
|
-
int8_t is_from_method; /* bool */
|
|
788
|
-
int8_t is_lambda; /* bool */
|
|
789
|
-
} rb_proc_t;
|
|
790
|
-
|
|
791
|
-
#define GetEnvPtr(obj, ptr) \
|
|
792
|
-
GetCoreDataFromValue((obj), rb_env_t, (ptr))
|
|
793
|
-
|
|
794
|
-
typedef struct {
|
|
795
|
-
int env_size;
|
|
796
|
-
int local_size;
|
|
797
|
-
VALUE prev_envval; /* for GC mark */
|
|
798
|
-
rb_block_t block;
|
|
799
|
-
VALUE env[1]; /* flexible array */
|
|
800
|
-
} rb_env_t;
|
|
801
|
-
|
|
802
|
-
extern const rb_data_type_t ruby_binding_data_type;
|
|
803
|
-
|
|
804
|
-
#define GetBindingPtr(obj, ptr) \
|
|
805
|
-
GetCoreDataFromValue((obj), rb_binding_t, (ptr))
|
|
806
|
-
|
|
807
|
-
typedef struct {
|
|
808
|
-
VALUE env;
|
|
809
|
-
VALUE path;
|
|
810
|
-
VALUE blockprocval; /* for GC mark */
|
|
811
|
-
unsigned short first_lineno;
|
|
812
|
-
} rb_binding_t;
|
|
813
|
-
|
|
814
|
-
/* used by compile time and send insn */
|
|
815
|
-
|
|
816
|
-
enum vm_check_match_type {
|
|
817
|
-
VM_CHECKMATCH_TYPE_WHEN = 1,
|
|
818
|
-
VM_CHECKMATCH_TYPE_CASE = 2,
|
|
819
|
-
VM_CHECKMATCH_TYPE_RESCUE = 3
|
|
820
|
-
};
|
|
821
|
-
|
|
822
|
-
#define VM_CHECKMATCH_TYPE_MASK 0x03
|
|
823
|
-
#define VM_CHECKMATCH_ARRAY 0x04
|
|
824
|
-
|
|
825
|
-
#define VM_CALL_ARGS_SPLAT (0x01 << 1) /* m(*args) */
|
|
826
|
-
#define VM_CALL_ARGS_BLOCKARG (0x01 << 2) /* m(&block) */
|
|
827
|
-
#define VM_CALL_FCALL (0x01 << 3) /* m(...) */
|
|
828
|
-
#define VM_CALL_VCALL (0x01 << 4) /* m */
|
|
829
|
-
#define VM_CALL_TAILCALL (0x01 << 5) /* located at tail position */
|
|
830
|
-
#define VM_CALL_SUPER (0x01 << 6) /* super */
|
|
831
|
-
#define VM_CALL_OPT_SEND (0x01 << 7) /* internal flag */
|
|
832
|
-
#define VM_CALL_ARGS_SIMPLE (0x01 << 8) /* (ci->flag & (SPLAT|BLOCKARG)) && ci->blockiseq == NULL && ci->kw_arg == NULL */
|
|
833
|
-
|
|
834
|
-
enum vm_special_object_type {
|
|
835
|
-
VM_SPECIAL_OBJECT_VMCORE = 1,
|
|
836
|
-
VM_SPECIAL_OBJECT_CBASE,
|
|
837
|
-
VM_SPECIAL_OBJECT_CONST_BASE
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
#define VM_FRAME_MAGIC_METHOD 0x11
|
|
841
|
-
#define VM_FRAME_MAGIC_BLOCK 0x21
|
|
842
|
-
#define VM_FRAME_MAGIC_CLASS 0x31
|
|
843
|
-
#define VM_FRAME_MAGIC_TOP 0x41
|
|
844
|
-
#define VM_FRAME_MAGIC_CFUNC 0x61
|
|
845
|
-
#define VM_FRAME_MAGIC_PROC 0x71
|
|
846
|
-
#define VM_FRAME_MAGIC_IFUNC 0x81
|
|
847
|
-
#define VM_FRAME_MAGIC_EVAL 0x91
|
|
848
|
-
#define VM_FRAME_MAGIC_LAMBDA 0xa1
|
|
849
|
-
#define VM_FRAME_MAGIC_RESCUE 0xb1
|
|
850
|
-
#define VM_FRAME_MAGIC_MASK_BITS 8
|
|
851
|
-
#define VM_FRAME_MAGIC_MASK (~(~(VALUE)0<<VM_FRAME_MAGIC_MASK_BITS))
|
|
852
|
-
|
|
853
|
-
#define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
|
|
854
|
-
|
|
855
|
-
/* other frame flag */
|
|
856
|
-
#define VM_FRAME_FLAG_PASSED 0x0100
|
|
857
|
-
#define VM_FRAME_FLAG_FINISH 0x0200
|
|
858
|
-
#define VM_FRAME_FLAG_BMETHOD 0x0400
|
|
859
|
-
#define VM_FRAME_TYPE_FINISH_P(cfp) (((cfp)->flag & VM_FRAME_FLAG_FINISH) != 0)
|
|
860
|
-
#define VM_FRAME_TYPE_BMETHOD_P(cfp) (((cfp)->flag & VM_FRAME_FLAG_BMETHOD) != 0)
|
|
861
|
-
|
|
862
|
-
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
|
863
|
-
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
|
864
|
-
|
|
865
|
-
/* inline cache */
|
|
866
|
-
typedef struct iseq_inline_cache_entry *IC;
|
|
867
|
-
typedef rb_call_info_t *CALL_INFO;
|
|
868
|
-
|
|
869
|
-
void rb_vm_change_state(void);
|
|
870
|
-
|
|
871
|
-
typedef VALUE CDHASH;
|
|
872
|
-
|
|
873
|
-
#ifndef FUNC_FASTCALL
|
|
874
|
-
#define FUNC_FASTCALL(x) x
|
|
875
|
-
#endif
|
|
876
|
-
|
|
877
|
-
typedef rb_control_frame_t *
|
|
878
|
-
(FUNC_FASTCALL(*rb_insn_func_t))(rb_thread_t *, rb_control_frame_t *);
|
|
879
|
-
|
|
880
|
-
#define GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
|
|
881
|
-
#define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)(p)) & ~0x03))
|
|
882
|
-
#define GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01)
|
|
883
|
-
|
|
884
|
-
/*
|
|
885
|
-
* block frame:
|
|
886
|
-
* ep[ 0]: prev frame
|
|
887
|
-
* ep[-1]: CREF (for *_eval)
|
|
888
|
-
*
|
|
889
|
-
* method frame:
|
|
890
|
-
* ep[ 0]: block pointer (ptr | VM_ENVVAL_BLOCK_PTR_FLAG)
|
|
891
|
-
*/
|
|
892
|
-
|
|
893
|
-
#define VM_ENVVAL_BLOCK_PTR_FLAG 0x02
|
|
894
|
-
#define VM_ENVVAL_BLOCK_PTR(v) (GC_GUARDED_PTR(v) | VM_ENVVAL_BLOCK_PTR_FLAG)
|
|
895
|
-
#define VM_ENVVAL_BLOCK_PTR_P(v) ((v) & VM_ENVVAL_BLOCK_PTR_FLAG)
|
|
896
|
-
#define VM_ENVVAL_PREV_EP_PTR(v) ((VALUE)GC_GUARDED_PTR(v))
|
|
897
|
-
#define VM_ENVVAL_PREV_EP_PTR_P(v) (!(VM_ENVVAL_BLOCK_PTR_P(v)))
|
|
898
|
-
|
|
899
|
-
#define VM_EP_PREV_EP(ep) ((VALUE *)GC_GUARDED_PTR_REF((ep)[0]))
|
|
900
|
-
#define VM_EP_BLOCK_PTR(ep) ((rb_block_t *)GC_GUARDED_PTR_REF((ep)[0]))
|
|
901
|
-
#define VM_EP_LEP_P(ep) VM_ENVVAL_BLOCK_PTR_P((ep)[0])
|
|
902
|
-
|
|
903
|
-
VALUE *rb_vm_ep_local_ep(VALUE *ep);
|
|
904
|
-
rb_block_t *rb_vm_control_frame_block_ptr(rb_control_frame_t *cfp);
|
|
905
|
-
|
|
906
|
-
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1)
|
|
907
|
-
#define RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1)
|
|
908
|
-
#define RUBY_VM_END_CONTROL_FRAME(th) \
|
|
909
|
-
((rb_control_frame_t *)((th)->stack + (th)->stack_size))
|
|
910
|
-
#define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
|
|
911
|
-
((void *)(ecfp) > (void *)(cfp))
|
|
912
|
-
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
|
913
|
-
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
|
914
|
-
|
|
915
|
-
#define RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
|
|
916
|
-
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
|
917
|
-
((ptr) && !RUBY_VM_IFUNC_P(ptr))
|
|
918
|
-
|
|
919
|
-
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
|
|
920
|
-
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
|
|
921
|
-
((rb_control_frame_t *)((VALUE *)(b) - 4))
|
|
922
|
-
/* magic number `4' is depend on rb_control_frame_t layout. */
|
|
923
|
-
|
|
924
|
-
/* VM related object allocate functions */
|
|
925
|
-
VALUE rb_thread_alloc(VALUE klass);
|
|
926
|
-
VALUE rb_proc_wrap(VALUE klass, rb_proc_t *); /* may use with rb_proc_alloc */
|
|
927
|
-
VALUE rb_binding_alloc(VALUE klass);
|
|
928
|
-
|
|
929
|
-
/* for debug */
|
|
930
|
-
extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
|
|
931
|
-
extern void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp, VALUE *_pc);
|
|
932
|
-
extern void rb_vmdebug_debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp);
|
|
933
|
-
|
|
934
|
-
#define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
|
|
935
|
-
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
|
|
936
|
-
void rb_vm_bugreport(const void *);
|
|
937
|
-
NORETURN(void rb_bug_context(const void *, const char *fmt, ...));
|
|
938
|
-
|
|
939
|
-
/* functions about thread/vm execution */
|
|
940
|
-
RUBY_SYMBOL_EXPORT_BEGIN
|
|
941
|
-
VALUE rb_iseq_eval(VALUE iseqval);
|
|
942
|
-
VALUE rb_iseq_eval_main(VALUE iseqval);
|
|
943
|
-
RUBY_SYMBOL_EXPORT_END
|
|
944
|
-
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
|
|
945
|
-
|
|
946
|
-
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
|
947
|
-
int argc, const VALUE *argv, const rb_block_t *blockptr);
|
|
948
|
-
VALUE rb_vm_make_proc_lambda(rb_thread_t *th, const rb_block_t *block, VALUE klass, int8_t is_lambda);
|
|
949
|
-
VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
|
|
950
|
-
VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp);
|
|
951
|
-
VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
|
|
952
|
-
VALUE rb_vm_env_local_variables(VALUE envval);
|
|
953
|
-
VALUE *rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars);
|
|
954
|
-
void rb_vm_inc_const_missing_count(void);
|
|
955
|
-
void rb_vm_gvl_destroy(rb_vm_t *vm);
|
|
956
|
-
VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc,
|
|
957
|
-
const VALUE *argv, const rb_method_entry_t *me,
|
|
958
|
-
VALUE defined_class);
|
|
959
|
-
void rb_unlink_method_entry(rb_method_entry_t *me);
|
|
960
|
-
void rb_gc_mark_unlinked_live_method_entries(void *pvm);
|
|
961
|
-
|
|
962
|
-
void rb_thread_start_timer_thread(void);
|
|
963
|
-
void rb_thread_stop_timer_thread(int);
|
|
964
|
-
void rb_thread_reset_timer_thread(void);
|
|
965
|
-
void rb_thread_wakeup_timer_thread(void);
|
|
966
|
-
|
|
967
|
-
static inline void
|
|
968
|
-
rb_vm_living_threads_init(rb_vm_t *vm)
|
|
969
|
-
{
|
|
970
|
-
list_head_init(&vm->living_threads);
|
|
971
|
-
vm->living_thread_num = 0;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
static inline void
|
|
975
|
-
rb_vm_living_threads_insert(rb_vm_t *vm, rb_thread_t *th)
|
|
976
|
-
{
|
|
977
|
-
list_add(&vm->living_threads, &th->vmlt_node);
|
|
978
|
-
vm->living_thread_num++;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
static inline void
|
|
982
|
-
rb_vm_living_threads_remove(rb_vm_t *vm, rb_thread_t *th)
|
|
983
|
-
{
|
|
984
|
-
list_del(&th->vmlt_node);
|
|
985
|
-
vm->living_thread_num--;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
int ruby_thread_has_gvl_p(void);
|
|
989
|
-
typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
|
|
990
|
-
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, const rb_control_frame_t *cfp);
|
|
991
|
-
rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(rb_thread_t *th, const rb_control_frame_t *cfp);
|
|
992
|
-
int rb_vm_get_sourceline(const rb_control_frame_t *);
|
|
993
|
-
VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method);
|
|
994
|
-
void rb_vm_stack_to_heap(rb_thread_t *th);
|
|
995
|
-
void ruby_thread_init_stack(rb_thread_t *th);
|
|
996
|
-
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, VALUE *klassp);
|
|
997
|
-
void rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
|
|
998
|
-
|
|
999
|
-
void rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE exception_class, const char *mesg);
|
|
1000
|
-
|
|
1001
|
-
void rb_gc_mark_machine_stack(rb_thread_t *th);
|
|
1002
|
-
|
|
1003
|
-
int rb_autoloading_value(VALUE mod, ID id, VALUE* value);
|
|
1004
|
-
|
|
1005
|
-
#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
|
|
1006
|
-
|
|
1007
|
-
#define RUBY_CONST_ASSERT(expr) (1/!!(expr)) /* expr must be a compile-time constant */
|
|
1008
|
-
#define VM_STACK_OVERFLOWED_P(cfp, sp, margin) \
|
|
1009
|
-
(!RUBY_CONST_ASSERT(sizeof(*(sp)) == sizeof(VALUE)) || \
|
|
1010
|
-
!RUBY_CONST_ASSERT(sizeof(*(cfp)) == sizeof(rb_control_frame_t)) || \
|
|
1011
|
-
((rb_control_frame_t *)((sp) + (margin)) + 1) >= (cfp))
|
|
1012
|
-
#define WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) \
|
|
1013
|
-
if (LIKELY(!VM_STACK_OVERFLOWED_P(cfp, sp, margin))) {(void)0;} else /* overflowed */
|
|
1014
|
-
#define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) \
|
|
1015
|
-
WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) vm_stackoverflow()
|
|
1016
|
-
#define CHECK_VM_STACK_OVERFLOW(cfp, margin) \
|
|
1017
|
-
WHEN_VM_STACK_OVERFLOWED(cfp, (cfp)->sp, margin) vm_stackoverflow()
|
|
1018
|
-
|
|
1019
|
-
/* for thread */
|
|
1020
|
-
|
|
1021
|
-
#if RUBY_VM_THREAD_MODEL == 2
|
|
1022
|
-
extern rb_thread_t *ruby_current_thread;
|
|
1023
|
-
extern rb_vm_t *ruby_current_vm;
|
|
1024
|
-
extern rb_event_flag_t ruby_vm_event_flags;
|
|
1025
|
-
|
|
1026
|
-
#define GET_VM() ruby_current_vm
|
|
1027
|
-
|
|
1028
|
-
#ifndef OPT_CALL_CFUNC_WITHOUT_FRAME
|
|
1029
|
-
#define OPT_CALL_CFUNC_WITHOUT_FRAME 0
|
|
1030
|
-
#endif
|
|
1031
|
-
|
|
1032
|
-
static inline rb_thread_t *
|
|
1033
|
-
GET_THREAD(void)
|
|
1034
|
-
{
|
|
1035
|
-
rb_thread_t *th = ruby_current_thread;
|
|
1036
|
-
#if OPT_CALL_CFUNC_WITHOUT_FRAME
|
|
1037
|
-
if (UNLIKELY(th->passed_ci != 0)) {
|
|
1038
|
-
void vm_call_cfunc_push_frame(rb_thread_t *th);
|
|
1039
|
-
vm_call_cfunc_push_frame(th);
|
|
1040
|
-
}
|
|
1041
|
-
#endif
|
|
1042
|
-
return th;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
#define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
|
|
1046
|
-
#define rb_thread_set_current(th) do { \
|
|
1047
|
-
if ((th)->vm->running_thread != (th)) { \
|
|
1048
|
-
(th)->running_time_us = 0; \
|
|
1049
|
-
} \
|
|
1050
|
-
rb_thread_set_current_raw(th); \
|
|
1051
|
-
(th)->vm->running_thread = (th); \
|
|
1052
|
-
} while (0)
|
|
1053
|
-
|
|
1054
|
-
#else
|
|
1055
|
-
#error "unsupported thread model"
|
|
1056
|
-
#endif
|
|
1057
|
-
|
|
1058
|
-
enum {
|
|
1059
|
-
TIMER_INTERRUPT_MASK = 0x01,
|
|
1060
|
-
PENDING_INTERRUPT_MASK = 0x02,
|
|
1061
|
-
POSTPONED_JOB_INTERRUPT_MASK = 0x04,
|
|
1062
|
-
TRAP_INTERRUPT_MASK = 0x08
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1065
|
-
#define RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TIMER_INTERRUPT_MASK)
|
|
1066
|
-
#define RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, PENDING_INTERRUPT_MASK)
|
|
1067
|
-
#define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
|
|
1068
|
-
#define RUBY_VM_SET_TRAP_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TRAP_INTERRUPT_MASK)
|
|
1069
|
-
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & ~(th)->interrupt_mask & (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
|
|
1070
|
-
#define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
|
|
1071
|
-
|
|
1072
|
-
int rb_signal_buff_size(void);
|
|
1073
|
-
void rb_signal_exec(rb_thread_t *th, int sig);
|
|
1074
|
-
void rb_threadptr_check_signal(rb_thread_t *mth);
|
|
1075
|
-
void rb_threadptr_signal_raise(rb_thread_t *th, int sig);
|
|
1076
|
-
void rb_threadptr_signal_exit(rb_thread_t *th);
|
|
1077
|
-
void rb_threadptr_execute_interrupts(rb_thread_t *, int);
|
|
1078
|
-
void rb_threadptr_interrupt(rb_thread_t *th);
|
|
1079
|
-
void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
|
|
1080
|
-
void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
|
|
1081
|
-
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
|
|
1082
|
-
int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th);
|
|
1083
|
-
|
|
1084
|
-
#define RUBY_VM_CHECK_INTS_BLOCKING(th) do { \
|
|
1085
|
-
if (UNLIKELY(!rb_threadptr_pending_interrupt_empty_p(th))) { \
|
|
1086
|
-
th->pending_interrupt_queue_checked = 0; \
|
|
1087
|
-
RUBY_VM_SET_INTERRUPT(th); \
|
|
1088
|
-
rb_threadptr_execute_interrupts(th, 1); \
|
|
1089
|
-
} \
|
|
1090
|
-
else if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { \
|
|
1091
|
-
rb_threadptr_execute_interrupts(th, 1); \
|
|
1092
|
-
} \
|
|
1093
|
-
} while (0)
|
|
1094
|
-
|
|
1095
|
-
#define RUBY_VM_CHECK_INTS(th) do { \
|
|
1096
|
-
if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { \
|
|
1097
|
-
rb_threadptr_execute_interrupts(th, 0); \
|
|
1098
|
-
} \
|
|
1099
|
-
} while (0)
|
|
1100
|
-
|
|
1101
|
-
/* tracer */
|
|
1102
|
-
struct rb_trace_arg_struct {
|
|
1103
|
-
rb_event_flag_t event;
|
|
1104
|
-
rb_thread_t *th;
|
|
1105
|
-
rb_control_frame_t *cfp;
|
|
1106
|
-
VALUE self;
|
|
1107
|
-
ID id;
|
|
1108
|
-
VALUE klass;
|
|
1109
|
-
VALUE data;
|
|
1110
|
-
|
|
1111
|
-
int klass_solved;
|
|
1112
|
-
|
|
1113
|
-
/* calc from cfp */
|
|
1114
|
-
int lineno;
|
|
1115
|
-
VALUE path;
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
|
-
void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg);
|
|
1119
|
-
void rb_threadptr_exec_event_hooks_and_pop_frame(struct rb_trace_arg_struct *trace_arg);
|
|
1120
|
-
|
|
1121
|
-
#define EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, pop_p_) do { \
|
|
1122
|
-
if (UNLIKELY(ruby_vm_event_flags & (flag_))) { \
|
|
1123
|
-
if (((th)->event_hooks.events | (th)->vm->event_hooks.events) & (flag_)) { \
|
|
1124
|
-
struct rb_trace_arg_struct trace_arg; \
|
|
1125
|
-
trace_arg.event = (flag_); \
|
|
1126
|
-
trace_arg.th = (th_); \
|
|
1127
|
-
trace_arg.cfp = (trace_arg.th)->cfp; \
|
|
1128
|
-
trace_arg.self = (self_); \
|
|
1129
|
-
trace_arg.id = (id_); \
|
|
1130
|
-
trace_arg.klass = (klass_); \
|
|
1131
|
-
trace_arg.data = (data_); \
|
|
1132
|
-
trace_arg.path = Qundef; \
|
|
1133
|
-
trace_arg.klass_solved = 0; \
|
|
1134
|
-
if (pop_p_) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg); \
|
|
1135
|
-
else rb_threadptr_exec_event_hooks(&trace_arg); \
|
|
1136
|
-
} \
|
|
1137
|
-
} \
|
|
1138
|
-
} while (0)
|
|
1139
|
-
|
|
1140
|
-
#define EXEC_EVENT_HOOK(th_, flag_, self_, id_, klass_, data_) \
|
|
1141
|
-
EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 0)
|
|
1142
|
-
|
|
1143
|
-
#define EXEC_EVENT_HOOK_AND_POP_FRAME(th_, flag_, self_, id_, klass_, data_) \
|
|
1144
|
-
EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 1)
|
|
1145
|
-
|
|
1146
|
-
RUBY_SYMBOL_EXPORT_BEGIN
|
|
1147
|
-
|
|
1148
|
-
int rb_thread_check_trap_pending(void);
|
|
1149
|
-
|
|
1150
|
-
extern VALUE rb_get_coverages(void);
|
|
1151
|
-
extern void rb_set_coverages(VALUE);
|
|
1152
|
-
extern void rb_reset_coverages(void);
|
|
1153
|
-
|
|
1154
|
-
void rb_postponed_job_flush(rb_vm_t *vm);
|
|
1155
|
-
|
|
1156
|
-
RUBY_SYMBOL_EXPORT_END
|
|
1157
|
-
|
|
1158
|
-
#endif /* RUBY_VM_CORE_H */
|