debase-ruby_core_source 0.9.9 → 0.9.10
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 +7 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/ccan/list/list.h +28 -166
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/constant.h +3 -10
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/eval_intern.h +49 -89
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/gc.h +1 -8
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/id.h +5 -15
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/insns.inc +107 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/insns_info.inc +45 -89
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/internal.h +164 -666
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/iseq.h +158 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/method.h +144 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/node.h +42 -18
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/node_name.inc +6 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/opt_sc.inc +0 -40
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/optunifs.inc +0 -5
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/parse.h +8 -28
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/probes_helper.h +67 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regenc.h +16 -16
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regint.h +10 -33
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regparse.h +1 -5
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/ruby_atomic.h +5 -68
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/symbol.h +13 -33
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/thread_pthread.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/transcode_data.h +7 -23
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/version.h +10 -31
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm.inc +497 -542
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm_core.h +305 -784
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm_insnhelper.h +56 -50
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/vm_opts.h +7 -8
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/vmtc.inc +0 -5
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/constant.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/eval_intern.h +3 -4
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/gc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/id.h +0 -9
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/insns.inc +46 -48
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/insns_info.inc +0 -20
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/internal.h +58 -290
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/iseq.h +15 -18
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/method.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/node.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/opt_sc.inc +0 -16
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/optunifs.inc +0 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/parse.h +8 -27
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/regenc.h +14 -14
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/regint.h +0 -8
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-2.3.5-p376/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/symbol.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/version.h +9 -27
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm.inc +255 -264
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_call_iseq_optimized.inc +5 -5
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_core.h +37 -28
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_insnhelper.h +32 -16
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vmtc.inc +0 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/eval_intern.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/gc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/insns.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/insns_info.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/internal.h +116 -51
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/iseq.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/method.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/node.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/opt_sc.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/parse.h +8 -27
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/regenc.h +79 -67
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/regint.h +187 -244
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/regparse.h +30 -27
- data/lib/debase/ruby_core_source/ruby-2.4.2-p198/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/ruby_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/version.h +6 -6
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm.inc +37 -34
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/vm_call_iseq_optimized.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_core.h +9 -7
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_insnhelper.h +30 -14
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/vmtc.inc +0 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +138 -143
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview1/method.h +0 -213
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview1/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview2/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview2/ruby_assert.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/encindex.h +0 -67
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/id_table.h +0 -31
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/insns.inc +0 -112
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/iseq.h +0 -252
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/probes_helper.h +0 -43
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/ruby_assert.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/vm_call_iseq_optimized.inc +0 -212
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
vm_core.h -
|
|
4
4
|
|
|
5
|
-
$Author:
|
|
5
|
+
$Author: usa $
|
|
6
6
|
created at: 04/01/01 19:41:38 JST
|
|
7
7
|
|
|
8
8
|
Copyright (C) 2004-2007 Koichi Sasada
|
|
@@ -12,49 +12,6 @@
|
|
|
12
12
|
#ifndef RUBY_VM_CORE_H
|
|
13
13
|
#define RUBY_VM_CORE_H
|
|
14
14
|
|
|
15
|
-
/*
|
|
16
|
-
* Enable check mode.
|
|
17
|
-
* 1: enable local assertions.
|
|
18
|
-
*/
|
|
19
|
-
#ifndef VM_CHECK_MODE
|
|
20
|
-
#define VM_CHECK_MODE 0
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* VM Debug Level
|
|
25
|
-
*
|
|
26
|
-
* debug level:
|
|
27
|
-
* 0: no debug output
|
|
28
|
-
* 1: show instruction name
|
|
29
|
-
* 2: show stack frame when control stack frame is changed
|
|
30
|
-
* 3: show stack status
|
|
31
|
-
* 4: show register
|
|
32
|
-
* 5:
|
|
33
|
-
* 10: gc check
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
#ifndef VMDEBUG
|
|
37
|
-
#define VMDEBUG 0
|
|
38
|
-
#endif
|
|
39
|
-
|
|
40
|
-
#if 0
|
|
41
|
-
#undef VMDEBUG
|
|
42
|
-
#define VMDEBUG 3
|
|
43
|
-
#endif
|
|
44
|
-
|
|
45
|
-
#include "ruby_assert.h"
|
|
46
|
-
|
|
47
|
-
#if VM_CHECK_MODE > 0
|
|
48
|
-
#define VM_ASSERT(expr) ( \
|
|
49
|
-
RUBY_ASSERT_WHEN(VM_CHECK_MODE > 0, expr))
|
|
50
|
-
|
|
51
|
-
#define VM_UNREACHABLE(func) rb_bug(#func ": unreachable")
|
|
52
|
-
|
|
53
|
-
#else
|
|
54
|
-
#define VM_ASSERT(expr) ((void)0)
|
|
55
|
-
#define VM_UNREACHABLE(func) ((void)0)
|
|
56
|
-
#endif
|
|
57
|
-
|
|
58
15
|
#define RUBY_VM_THREAD_MODEL 2
|
|
59
16
|
|
|
60
17
|
#include "ruby/ruby.h"
|
|
@@ -79,8 +36,10 @@
|
|
|
79
36
|
#ifdef _WIN32
|
|
80
37
|
/*
|
|
81
38
|
* TODO: object space independent st_table.
|
|
82
|
-
* socklist
|
|
83
|
-
*
|
|
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.
|
|
84
43
|
*/
|
|
85
44
|
#define ENABLE_VM_OBJSPACE 0
|
|
86
45
|
#else
|
|
@@ -149,43 +108,15 @@
|
|
|
149
108
|
|
|
150
109
|
typedef unsigned long rb_num_t;
|
|
151
110
|
|
|
152
|
-
|
|
153
|
-
RUBY_TAG_RETURN = 0x1,
|
|
154
|
-
RUBY_TAG_BREAK = 0x2,
|
|
155
|
-
RUBY_TAG_NEXT = 0x3,
|
|
156
|
-
RUBY_TAG_RETRY = 0x4,
|
|
157
|
-
RUBY_TAG_REDO = 0x5,
|
|
158
|
-
RUBY_TAG_RAISE = 0x6,
|
|
159
|
-
RUBY_TAG_THROW = 0x7,
|
|
160
|
-
RUBY_TAG_FATAL = 0x8,
|
|
161
|
-
RUBY_TAG_MASK = 0xf
|
|
162
|
-
};
|
|
163
|
-
#define TAG_RETURN RUBY_TAG_RETURN
|
|
164
|
-
#define TAG_BREAK RUBY_TAG_BREAK
|
|
165
|
-
#define TAG_NEXT RUBY_TAG_NEXT
|
|
166
|
-
#define TAG_RETRY RUBY_TAG_RETRY
|
|
167
|
-
#define TAG_REDO RUBY_TAG_REDO
|
|
168
|
-
#define TAG_RAISE RUBY_TAG_RAISE
|
|
169
|
-
#define TAG_THROW RUBY_TAG_THROW
|
|
170
|
-
#define TAG_FATAL RUBY_TAG_FATAL
|
|
171
|
-
#define TAG_MASK RUBY_TAG_MASK
|
|
172
|
-
|
|
173
|
-
enum ruby_vm_throw_flags {
|
|
174
|
-
VM_THROW_NO_ESCAPE_FLAG = 0x8000,
|
|
175
|
-
VM_THROW_LEVEL_SHIFT = 16,
|
|
176
|
-
VM_THROW_STATE_MASK = 0xff
|
|
177
|
-
};
|
|
111
|
+
/* iseq data type */
|
|
178
112
|
|
|
179
|
-
|
|
180
|
-
struct rb_thread_struct;
|
|
181
|
-
struct rb_control_frame_struct;
|
|
113
|
+
struct iseq_compile_data_ensure_node_stack;
|
|
182
114
|
|
|
183
|
-
/* iseq data type */
|
|
184
115
|
typedef struct rb_compile_option_struct rb_compile_option_t;
|
|
185
116
|
|
|
117
|
+
|
|
186
118
|
struct iseq_inline_cache_entry {
|
|
187
119
|
rb_serial_t ic_serial;
|
|
188
|
-
const rb_cref_t *ic_cref;
|
|
189
120
|
union {
|
|
190
121
|
size_t index;
|
|
191
122
|
VALUE value;
|
|
@@ -200,76 +131,74 @@ union iseq_inline_storage_entry {
|
|
|
200
131
|
struct iseq_inline_cache_entry cache;
|
|
201
132
|
};
|
|
202
133
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
MISSING_PROTECTED = 0x02,
|
|
207
|
-
MISSING_FCALL = 0x04,
|
|
208
|
-
MISSING_VCALL = 0x08,
|
|
209
|
-
MISSING_SUPER = 0x10,
|
|
210
|
-
MISSING_MISSING = 0x20,
|
|
211
|
-
MISSING_NONE = 0x40
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
struct rb_call_info {
|
|
215
|
-
/* fixed at compile time */
|
|
216
|
-
ID mid;
|
|
217
|
-
unsigned int flag;
|
|
218
|
-
int orig_argc;
|
|
219
|
-
};
|
|
134
|
+
/* to avoid warning */
|
|
135
|
+
struct rb_thread_struct;
|
|
136
|
+
struct rb_control_frame_struct;
|
|
220
137
|
|
|
221
|
-
struct
|
|
138
|
+
typedef struct rb_call_info_kw_arg_struct {
|
|
222
139
|
int keyword_len;
|
|
223
140
|
VALUE keywords[1];
|
|
224
|
-
};
|
|
141
|
+
} rb_call_info_kw_arg_t;
|
|
225
142
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
struct rb_calling_info {
|
|
232
|
-
VALUE block_handler;
|
|
233
|
-
VALUE recv;
|
|
234
|
-
int argc;
|
|
235
|
-
};
|
|
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;
|
|
236
147
|
|
|
237
|
-
|
|
238
|
-
|
|
148
|
+
unsigned int flag;
|
|
149
|
+
int orig_argc;
|
|
150
|
+
rb_iseq_t *blockiseq;
|
|
151
|
+
rb_call_info_kw_arg_t *kw_arg;
|
|
239
152
|
|
|
240
|
-
struct rb_call_cache {
|
|
241
153
|
/* inline cache: keys */
|
|
242
154
|
rb_serial_t method_state;
|
|
243
155
|
rb_serial_t class_serial;
|
|
156
|
+
VALUE klass;
|
|
244
157
|
|
|
245
158
|
/* inline cache: values */
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
vm_call_handler call;
|
|
159
|
+
const rb_method_entry_t *me;
|
|
160
|
+
VALUE defined_class;
|
|
249
161
|
|
|
162
|
+
/* temporary values for method calling */
|
|
163
|
+
struct rb_block_struct *blockptr;
|
|
164
|
+
VALUE recv;
|
|
165
|
+
int argc;
|
|
250
166
|
union {
|
|
251
|
-
|
|
252
|
-
|
|
167
|
+
int opt_pc; /* used by iseq */
|
|
168
|
+
int index; /* used by ivar */
|
|
169
|
+
int missing_reason; /* used by method_missing */
|
|
253
170
|
int inc_sp; /* used by cfunc */
|
|
254
171
|
} aux;
|
|
255
|
-
|
|
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;
|
|
256
175
|
|
|
257
176
|
#if 1
|
|
258
|
-
#define
|
|
177
|
+
#define GetCoreDataFromValue(obj, type, ptr) do { \
|
|
178
|
+
(ptr) = (type*)DATA_PTR(obj); \
|
|
179
|
+
} while (0)
|
|
259
180
|
#else
|
|
260
|
-
#define
|
|
181
|
+
#define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct((obj), type, (ptr))
|
|
261
182
|
#endif
|
|
262
|
-
|
|
183
|
+
|
|
184
|
+
#define GetISeqPtr(obj, ptr) \
|
|
185
|
+
GetCoreDataFromValue((obj), rb_iseq_t, (ptr))
|
|
263
186
|
|
|
264
187
|
typedef struct rb_iseq_location_struct {
|
|
265
|
-
VALUE path;
|
|
266
|
-
VALUE absolute_path;
|
|
267
|
-
VALUE base_label;
|
|
268
|
-
VALUE label;
|
|
188
|
+
const VALUE path;
|
|
189
|
+
const VALUE absolute_path;
|
|
190
|
+
const VALUE base_label;
|
|
191
|
+
const VALUE label;
|
|
269
192
|
VALUE first_lineno; /* TODO: may be unsigned short */
|
|
270
193
|
} rb_iseq_location_t;
|
|
271
194
|
|
|
272
|
-
struct
|
|
195
|
+
struct rb_iseq_struct;
|
|
196
|
+
|
|
197
|
+
struct rb_iseq_struct {
|
|
198
|
+
/***************/
|
|
199
|
+
/* static data */
|
|
200
|
+
/***************/
|
|
201
|
+
|
|
273
202
|
enum iseq_type {
|
|
274
203
|
ISEQ_TYPE_TOP,
|
|
275
204
|
ISEQ_TYPE_METHOD,
|
|
@@ -281,9 +210,34 @@ struct rb_iseq_constant_body {
|
|
|
281
210
|
ISEQ_TYPE_MAIN,
|
|
282
211
|
ISEQ_TYPE_DEFINED_GUARD
|
|
283
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;
|
|
284
219
|
|
|
220
|
+
VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
|
|
285
221
|
unsigned int iseq_size;
|
|
286
|
-
|
|
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;
|
|
287
241
|
|
|
288
242
|
/**
|
|
289
243
|
* parameter information
|
|
@@ -321,7 +275,7 @@ struct rb_iseq_constant_body {
|
|
|
321
275
|
unsigned int ambiguous_param0 : 1; /* {|a|} */
|
|
322
276
|
} flags;
|
|
323
277
|
|
|
324
|
-
|
|
278
|
+
int size;
|
|
325
279
|
|
|
326
280
|
int lead_num;
|
|
327
281
|
int opt_num;
|
|
@@ -330,7 +284,7 @@ struct rb_iseq_constant_body {
|
|
|
330
284
|
int post_num;
|
|
331
285
|
int block_start;
|
|
332
286
|
|
|
333
|
-
|
|
287
|
+
VALUE *opt_table; /* (opt_num + 1) entries. */
|
|
334
288
|
/* opt_num and opt_table:
|
|
335
289
|
*
|
|
336
290
|
* def foo o1=e1, o2=e2, ..., oN=eN
|
|
@@ -345,83 +299,53 @@ struct rb_iseq_constant_body {
|
|
|
345
299
|
* opt_table = [A1, A2, ..., AN, AL]
|
|
346
300
|
*/
|
|
347
301
|
|
|
348
|
-
|
|
302
|
+
struct rb_iseq_param_keyword {
|
|
349
303
|
int num;
|
|
350
304
|
int required_num;
|
|
351
305
|
int bits_start;
|
|
352
306
|
int rest_start;
|
|
353
|
-
|
|
354
|
-
|
|
307
|
+
ID *table;
|
|
308
|
+
VALUE *default_values;
|
|
355
309
|
} *keyword;
|
|
356
310
|
} param;
|
|
357
311
|
|
|
358
|
-
rb_iseq_location_t location;
|
|
359
|
-
|
|
360
|
-
/* insn info, must be freed */
|
|
361
|
-
const struct iseq_line_info_entry *line_info_table;
|
|
362
|
-
|
|
363
|
-
const ID *local_table; /* must free */
|
|
364
|
-
|
|
365
312
|
/* catch table */
|
|
366
|
-
|
|
313
|
+
struct iseq_catch_table *catch_table;
|
|
367
314
|
|
|
368
315
|
/* for child iseq */
|
|
369
|
-
|
|
370
|
-
struct rb_iseq_struct *local_iseq;
|
|
316
|
+
struct rb_iseq_struct *parent_iseq;
|
|
317
|
+
struct rb_iseq_struct *local_iseq;
|
|
371
318
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
* So that:
|
|
376
|
-
* struct rb_call_info_with_kwarg *cikw_entries = &body->ci_entries[ci_size];
|
|
377
|
-
*/
|
|
378
|
-
struct rb_call_cache *cc_entries; /* size is ci_size = ci_kw_size */
|
|
379
|
-
|
|
380
|
-
VALUE mark_ary; /* Array: includes operands which should be GC marked */
|
|
381
|
-
|
|
382
|
-
unsigned int local_table_size;
|
|
383
|
-
unsigned int is_size;
|
|
384
|
-
unsigned int ci_size;
|
|
385
|
-
unsigned int ci_kw_size;
|
|
386
|
-
unsigned int line_info_size;
|
|
387
|
-
unsigned int stack_max; /* for stack overflow check */
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
/* T_IMEMO/iseq */
|
|
391
|
-
/* typedef rb_iseq_t is in method.h */
|
|
392
|
-
struct rb_iseq_struct {
|
|
393
|
-
VALUE flags;
|
|
394
|
-
VALUE reserved1;
|
|
395
|
-
struct rb_iseq_constant_body *body;
|
|
319
|
+
/****************/
|
|
320
|
+
/* dynamic data */
|
|
321
|
+
/****************/
|
|
396
322
|
|
|
397
|
-
|
|
398
|
-
|
|
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
|
+
*/
|
|
399
333
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
} loader;
|
|
404
|
-
} aux;
|
|
405
|
-
};
|
|
334
|
+
/* klass/module nest information stack (cref) */
|
|
335
|
+
NODE * const cref_stack;
|
|
336
|
+
const VALUE klass;
|
|
406
337
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
338
|
+
/* misc */
|
|
339
|
+
ID defined_method_id; /* for define_method */
|
|
340
|
+
rb_num_t flip_cnt;
|
|
410
341
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
#endif
|
|
342
|
+
/* used at compile time */
|
|
343
|
+
struct iseq_compile_data *compile_data;
|
|
414
344
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if (iseq->body == NULL) {
|
|
420
|
-
rb_iseq_complete((rb_iseq_t *)iseq);
|
|
421
|
-
}
|
|
422
|
-
#endif
|
|
423
|
-
return iseq;
|
|
424
|
-
}
|
|
345
|
+
/* original iseq, before encoding
|
|
346
|
+
* used for debug/dump (TODO: union with compile_data) */
|
|
347
|
+
VALUE *iseq;
|
|
348
|
+
};
|
|
425
349
|
|
|
426
350
|
enum ruby_special_exceptions {
|
|
427
351
|
ruby_error_reenter,
|
|
@@ -454,8 +378,6 @@ enum ruby_basic_operators {
|
|
|
454
378
|
BOP_NEQ,
|
|
455
379
|
BOP_MATCH,
|
|
456
380
|
BOP_FREEZE,
|
|
457
|
-
BOP_MAX,
|
|
458
|
-
BOP_MIN,
|
|
459
381
|
|
|
460
382
|
BOP_LAST_
|
|
461
383
|
};
|
|
@@ -465,15 +387,15 @@ enum ruby_basic_operators {
|
|
|
465
387
|
|
|
466
388
|
struct rb_vm_struct;
|
|
467
389
|
typedef void rb_vm_at_exit_func(struct rb_vm_struct*);
|
|
468
|
-
|
|
469
390
|
typedef struct rb_at_exit_list {
|
|
470
391
|
rb_vm_at_exit_func *func;
|
|
471
392
|
struct rb_at_exit_list *next;
|
|
472
393
|
} rb_at_exit_list;
|
|
473
394
|
|
|
395
|
+
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
|
474
396
|
struct rb_objspace;
|
|
475
|
-
struct rb_objspace *rb_objspace_alloc(void);
|
|
476
397
|
void rb_objspace_free(struct rb_objspace *);
|
|
398
|
+
#endif
|
|
477
399
|
|
|
478
400
|
typedef struct rb_hook_list_struct {
|
|
479
401
|
struct rb_event_hook_struct *hooks;
|
|
@@ -494,14 +416,14 @@ typedef struct rb_vm_struct {
|
|
|
494
416
|
size_t living_thread_num;
|
|
495
417
|
VALUE thgroup_default;
|
|
496
418
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
unsigned int trace_running: 1;
|
|
419
|
+
int running;
|
|
420
|
+
int thread_abort_on_exception;
|
|
421
|
+
int trace_running;
|
|
501
422
|
volatile int sleeper;
|
|
502
423
|
|
|
503
424
|
/* object management */
|
|
504
425
|
VALUE mark_object_ary;
|
|
426
|
+
|
|
505
427
|
const VALUE special_exceptions[ruby_special_error_count];
|
|
506
428
|
|
|
507
429
|
/* load */
|
|
@@ -536,9 +458,13 @@ typedef struct rb_vm_struct {
|
|
|
536
458
|
VALUE verbose, debug, orig_progname, progname;
|
|
537
459
|
VALUE coverages;
|
|
538
460
|
|
|
461
|
+
struct unlinked_method_entry_list_entry *unlinked_method_entry_list;
|
|
462
|
+
|
|
539
463
|
VALUE defined_module_hash;
|
|
540
464
|
|
|
465
|
+
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
|
541
466
|
struct rb_objspace *objspace;
|
|
467
|
+
#endif
|
|
542
468
|
|
|
543
469
|
rb_at_exit_list *at_exit;
|
|
544
470
|
|
|
@@ -571,18 +497,15 @@ typedef struct rb_vm_struct {
|
|
|
571
497
|
#define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
|
|
572
498
|
|
|
573
499
|
/* optimize insn */
|
|
574
|
-
#define
|
|
500
|
+
#define FIXNUM_REDEFINED_OP_FLAG (1 << 0)
|
|
575
501
|
#define FLOAT_REDEFINED_OP_FLAG (1 << 1)
|
|
576
502
|
#define STRING_REDEFINED_OP_FLAG (1 << 2)
|
|
577
503
|
#define ARRAY_REDEFINED_OP_FLAG (1 << 3)
|
|
578
504
|
#define HASH_REDEFINED_OP_FLAG (1 << 4)
|
|
579
|
-
|
|
505
|
+
#define BIGNUM_REDEFINED_OP_FLAG (1 << 5)
|
|
580
506
|
#define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
|
|
581
507
|
#define TIME_REDEFINED_OP_FLAG (1 << 7)
|
|
582
508
|
#define REGEXP_REDEFINED_OP_FLAG (1 << 8)
|
|
583
|
-
#define NIL_REDEFINED_OP_FLAG (1 << 9)
|
|
584
|
-
#define TRUE_REDEFINED_OP_FLAG (1 << 10)
|
|
585
|
-
#define FALSE_REDEFINED_OP_FLAG (1 << 11)
|
|
586
509
|
|
|
587
510
|
#define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0))
|
|
588
511
|
|
|
@@ -591,55 +514,34 @@ typedef struct rb_vm_struct {
|
|
|
591
514
|
#endif
|
|
592
515
|
|
|
593
516
|
#ifndef VM_DEBUG_VERIFY_METHOD_CACHE
|
|
594
|
-
#define VM_DEBUG_VERIFY_METHOD_CACHE
|
|
517
|
+
#define VM_DEBUG_VERIFY_METHOD_CACHE 0
|
|
595
518
|
#endif
|
|
596
519
|
|
|
597
|
-
struct rb_captured_block {
|
|
598
|
-
VALUE self;
|
|
599
|
-
const VALUE *ep;
|
|
600
|
-
union {
|
|
601
|
-
const rb_iseq_t *iseq;
|
|
602
|
-
const struct vm_ifunc *ifunc;
|
|
603
|
-
VALUE val;
|
|
604
|
-
} code;
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
enum rb_block_handler_type {
|
|
608
|
-
block_handler_type_iseq,
|
|
609
|
-
block_handler_type_ifunc,
|
|
610
|
-
block_handler_type_symbol,
|
|
611
|
-
block_handler_type_proc
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
enum rb_block_type {
|
|
615
|
-
block_type_iseq,
|
|
616
|
-
block_type_ifunc,
|
|
617
|
-
block_type_symbol,
|
|
618
|
-
block_type_proc
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
struct rb_block {
|
|
622
|
-
union {
|
|
623
|
-
struct rb_captured_block captured;
|
|
624
|
-
VALUE symbol;
|
|
625
|
-
VALUE proc;
|
|
626
|
-
} as;
|
|
627
|
-
enum rb_block_type type;
|
|
628
|
-
};
|
|
629
|
-
|
|
630
520
|
typedef struct rb_control_frame_struct {
|
|
631
|
-
|
|
521
|
+
VALUE *pc; /* cfp[0] */
|
|
632
522
|
VALUE *sp; /* cfp[1] */
|
|
633
|
-
|
|
634
|
-
VALUE
|
|
635
|
-
|
|
636
|
-
|
|
523
|
+
rb_iseq_t *iseq; /* cfp[2] */
|
|
524
|
+
VALUE flag; /* cfp[3] */
|
|
525
|
+
VALUE self; /* cfp[4] / block[0] */
|
|
526
|
+
VALUE klass; /* cfp[5] / block[1] */
|
|
527
|
+
VALUE *ep; /* cfp[6] / block[2] */
|
|
528
|
+
rb_iseq_t *block_iseq; /* cfp[7] / block[3] */
|
|
529
|
+
VALUE proc; /* cfp[8] / block[4] */
|
|
530
|
+
const rb_method_entry_t *me;/* cfp[9] */
|
|
637
531
|
|
|
638
532
|
#if VM_DEBUG_BP_CHECK
|
|
639
|
-
VALUE *bp_check; /* cfp[
|
|
533
|
+
VALUE *bp_check; /* cfp[10] */
|
|
640
534
|
#endif
|
|
641
535
|
} rb_control_frame_t;
|
|
642
536
|
|
|
537
|
+
typedef struct rb_block_struct {
|
|
538
|
+
VALUE self; /* share with method frame if it's only block */
|
|
539
|
+
VALUE klass; /* share with method frame if it's only block */
|
|
540
|
+
VALUE *ep; /* share with method frame if it's only block */
|
|
541
|
+
rb_iseq_t *iseq;
|
|
542
|
+
VALUE proc;
|
|
543
|
+
} rb_block_t;
|
|
544
|
+
|
|
643
545
|
extern const rb_data_type_t ruby_threadptr_data_type;
|
|
644
546
|
|
|
645
547
|
#define GetThreadPtr(obj, ptr) \
|
|
@@ -676,11 +578,13 @@ struct rb_unblock_callback {
|
|
|
676
578
|
|
|
677
579
|
struct rb_mutex_struct;
|
|
678
580
|
|
|
581
|
+
struct rb_thread_struct;
|
|
679
582
|
typedef struct rb_thread_list_struct{
|
|
680
583
|
struct rb_thread_list_struct *next;
|
|
681
584
|
struct rb_thread_struct *th;
|
|
682
585
|
} rb_thread_list_t;
|
|
683
586
|
|
|
587
|
+
|
|
684
588
|
typedef struct rb_ensure_entry {
|
|
685
589
|
VALUE marker;
|
|
686
590
|
VALUE (*e_proc)(ANYARGS);
|
|
@@ -715,20 +619,22 @@ typedef struct rb_thread_struct {
|
|
|
715
619
|
int waiting_fd;
|
|
716
620
|
|
|
717
621
|
/* for rb_iterate */
|
|
718
|
-
|
|
622
|
+
const rb_block_t *passed_block;
|
|
719
623
|
|
|
720
624
|
/* for bmethod */
|
|
721
|
-
const
|
|
625
|
+
const rb_method_entry_t *passed_bmethod_me;
|
|
722
626
|
|
|
723
627
|
/* for cfunc */
|
|
724
|
-
|
|
628
|
+
rb_call_info_t *passed_ci;
|
|
725
629
|
|
|
726
630
|
/* for load(true) */
|
|
727
631
|
VALUE top_self;
|
|
728
632
|
VALUE top_wrapper;
|
|
729
633
|
|
|
730
634
|
/* eval env */
|
|
731
|
-
|
|
635
|
+
rb_block_t *base_block;
|
|
636
|
+
|
|
637
|
+
VALUE *root_lep;
|
|
732
638
|
VALUE root_svar;
|
|
733
639
|
|
|
734
640
|
/* thread control */
|
|
@@ -770,6 +676,20 @@ typedef struct rb_thread_struct {
|
|
|
770
676
|
struct rb_vm_tag *tag;
|
|
771
677
|
struct rb_vm_protect_tag *protect_tag;
|
|
772
678
|
|
|
679
|
+
/*! Thread-local state of evaluation context.
|
|
680
|
+
*
|
|
681
|
+
* If negative, this thread is evaluating the main program.
|
|
682
|
+
* If positive, this thread is evaluating a program under Kernel::eval
|
|
683
|
+
* family.
|
|
684
|
+
*/
|
|
685
|
+
int parse_in_eval;
|
|
686
|
+
|
|
687
|
+
/*! Thread-local state of compiling context.
|
|
688
|
+
*
|
|
689
|
+
* If non-zero, the parser does not automatically print error messages to
|
|
690
|
+
* stderr. */
|
|
691
|
+
int mild_compile_error;
|
|
692
|
+
|
|
773
693
|
/* storage */
|
|
774
694
|
st_table *local_storage;
|
|
775
695
|
VALUE local_storage_recursive_hash;
|
|
@@ -810,14 +730,12 @@ typedef struct rb_thread_struct {
|
|
|
810
730
|
rb_ensure_list_t *ensure_list;
|
|
811
731
|
|
|
812
732
|
/* misc */
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
unsigned int report_on_exception: 1;
|
|
733
|
+
int method_missing_reason;
|
|
734
|
+
int abort_on_exception;
|
|
816
735
|
#ifdef USE_SIGALTSTACK
|
|
817
736
|
void *altstack;
|
|
818
737
|
#endif
|
|
819
738
|
unsigned long running_time_us;
|
|
820
|
-
VALUE name;
|
|
821
739
|
} rb_thread_t;
|
|
822
740
|
|
|
823
741
|
typedef enum {
|
|
@@ -839,25 +757,24 @@ typedef enum {
|
|
|
839
757
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
840
758
|
|
|
841
759
|
/* node -> iseq */
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
760
|
+
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE, enum iseq_type);
|
|
761
|
+
VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE parent);
|
|
762
|
+
VALUE rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path);
|
|
763
|
+
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE);
|
|
764
|
+
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, const rb_compile_option_t*);
|
|
847
765
|
|
|
848
766
|
/* src -> iseq */
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
767
|
+
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
|
|
768
|
+
VALUE rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, rb_block_t *base_block);
|
|
769
|
+
VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt);
|
|
852
770
|
|
|
853
|
-
VALUE rb_iseq_disasm(
|
|
771
|
+
VALUE rb_iseq_disasm(VALUE self);
|
|
854
772
|
int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);
|
|
855
773
|
const char *ruby_node_name(int node);
|
|
856
774
|
|
|
857
|
-
VALUE rb_iseq_coverage(const rb_iseq_t *iseq);
|
|
858
|
-
|
|
859
775
|
RUBY_EXTERN VALUE rb_cISeq;
|
|
860
776
|
RUBY_EXTERN VALUE rb_cRubyVM;
|
|
777
|
+
RUBY_EXTERN VALUE rb_cEnv;
|
|
861
778
|
RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
|
|
862
779
|
RUBY_SYMBOL_EXPORT_END
|
|
863
780
|
|
|
@@ -865,18 +782,24 @@ RUBY_SYMBOL_EXPORT_END
|
|
|
865
782
|
GetCoreDataFromValue((obj), rb_proc_t, (ptr))
|
|
866
783
|
|
|
867
784
|
typedef struct {
|
|
868
|
-
|
|
869
|
-
|
|
785
|
+
rb_block_t block;
|
|
786
|
+
|
|
787
|
+
VALUE envval; /* for GC mark */
|
|
788
|
+
VALUE blockprocval;
|
|
789
|
+
int8_t safe_level; /* 0..3 */
|
|
870
790
|
int8_t is_from_method; /* bool */
|
|
871
791
|
int8_t is_lambda; /* bool */
|
|
872
792
|
} rb_proc_t;
|
|
873
793
|
|
|
794
|
+
#define GetEnvPtr(obj, ptr) \
|
|
795
|
+
GetCoreDataFromValue((obj), rb_env_t, (ptr))
|
|
796
|
+
|
|
874
797
|
typedef struct {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
798
|
+
int env_size;
|
|
799
|
+
int local_size;
|
|
800
|
+
VALUE prev_envval; /* for GC mark */
|
|
801
|
+
rb_block_t block;
|
|
802
|
+
VALUE env[1]; /* flexible array */
|
|
880
803
|
} rb_env_t;
|
|
881
804
|
|
|
882
805
|
extern const rb_data_type_t ruby_binding_data_type;
|
|
@@ -885,8 +808,9 @@ extern const rb_data_type_t ruby_binding_data_type;
|
|
|
885
808
|
GetCoreDataFromValue((obj), rb_binding_t, (ptr))
|
|
886
809
|
|
|
887
810
|
typedef struct {
|
|
888
|
-
|
|
811
|
+
VALUE env;
|
|
889
812
|
VALUE path;
|
|
813
|
+
VALUE blockprocval; /* for GC mark */
|
|
890
814
|
unsigned short first_lineno;
|
|
891
815
|
} rb_binding_t;
|
|
892
816
|
|
|
@@ -901,16 +825,14 @@ enum vm_check_match_type {
|
|
|
901
825
|
#define VM_CHECKMATCH_TYPE_MASK 0x03
|
|
902
826
|
#define VM_CHECKMATCH_ARRAY 0x04
|
|
903
827
|
|
|
904
|
-
#define VM_CALL_ARGS_SPLAT (0x01 <<
|
|
905
|
-
#define VM_CALL_ARGS_BLOCKARG (0x01 <<
|
|
906
|
-
#define VM_CALL_FCALL (0x01 <<
|
|
907
|
-
#define VM_CALL_VCALL (0x01 <<
|
|
908
|
-
#define
|
|
909
|
-
#define
|
|
910
|
-
#define
|
|
911
|
-
#define
|
|
912
|
-
#define VM_CALL_SUPER (0x01 << 8) /* super */
|
|
913
|
-
#define VM_CALL_OPT_SEND (0x01 << 9) /* internal flag */
|
|
828
|
+
#define VM_CALL_ARGS_SPLAT (0x01 << 1) /* m(*args) */
|
|
829
|
+
#define VM_CALL_ARGS_BLOCKARG (0x01 << 2) /* m(&block) */
|
|
830
|
+
#define VM_CALL_FCALL (0x01 << 3) /* m(...) */
|
|
831
|
+
#define VM_CALL_VCALL (0x01 << 4) /* m */
|
|
832
|
+
#define VM_CALL_TAILCALL (0x01 << 5) /* located at tail position */
|
|
833
|
+
#define VM_CALL_SUPER (0x01 << 6) /* super */
|
|
834
|
+
#define VM_CALL_OPT_SEND (0x01 << 7) /* internal flag */
|
|
835
|
+
#define VM_CALL_ARGS_SIMPLE (0x01 << 8) /* (ci->flag & (SPLAT|BLOCKARG)) && ci->blockiseq == NULL && ci->kw_arg == NULL */
|
|
914
836
|
|
|
915
837
|
enum vm_special_object_type {
|
|
916
838
|
VM_SPECIAL_OBJECT_VMCORE = 1,
|
|
@@ -918,18 +840,34 @@ enum vm_special_object_type {
|
|
|
918
840
|
VM_SPECIAL_OBJECT_CONST_BASE
|
|
919
841
|
};
|
|
920
842
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
843
|
+
#define VM_FRAME_MAGIC_METHOD 0x11
|
|
844
|
+
#define VM_FRAME_MAGIC_BLOCK 0x21
|
|
845
|
+
#define VM_FRAME_MAGIC_CLASS 0x31
|
|
846
|
+
#define VM_FRAME_MAGIC_TOP 0x41
|
|
847
|
+
#define VM_FRAME_MAGIC_CFUNC 0x61
|
|
848
|
+
#define VM_FRAME_MAGIC_PROC 0x71
|
|
849
|
+
#define VM_FRAME_MAGIC_IFUNC 0x81
|
|
850
|
+
#define VM_FRAME_MAGIC_EVAL 0x91
|
|
851
|
+
#define VM_FRAME_MAGIC_LAMBDA 0xa1
|
|
852
|
+
#define VM_FRAME_MAGIC_RESCUE 0xb1
|
|
853
|
+
#define VM_FRAME_MAGIC_MASK_BITS 8
|
|
854
|
+
#define VM_FRAME_MAGIC_MASK (~(~(VALUE)0<<VM_FRAME_MAGIC_MASK_BITS))
|
|
855
|
+
|
|
856
|
+
#define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
|
|
857
|
+
|
|
858
|
+
/* other frame flag */
|
|
859
|
+
#define VM_FRAME_FLAG_PASSED 0x0100
|
|
860
|
+
#define VM_FRAME_FLAG_FINISH 0x0200
|
|
861
|
+
#define VM_FRAME_FLAG_BMETHOD 0x0400
|
|
862
|
+
#define VM_FRAME_TYPE_FINISH_P(cfp) (((cfp)->flag & VM_FRAME_FLAG_FINISH) != 0)
|
|
863
|
+
#define VM_FRAME_TYPE_BMETHOD_P(cfp) (((cfp)->flag & VM_FRAME_FLAG_BMETHOD) != 0)
|
|
924
864
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
};
|
|
865
|
+
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
|
866
|
+
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
|
928
867
|
|
|
929
868
|
/* inline cache */
|
|
930
869
|
typedef struct iseq_inline_cache_entry *IC;
|
|
931
|
-
typedef
|
|
932
|
-
typedef struct rb_call_cache *CALL_CACHE;
|
|
870
|
+
typedef rb_call_info_t *CALL_INFO;
|
|
933
871
|
|
|
934
872
|
void rb_vm_change_state(void);
|
|
935
873
|
|
|
@@ -942,231 +880,31 @@ typedef VALUE CDHASH;
|
|
|
942
880
|
typedef rb_control_frame_t *
|
|
943
881
|
(FUNC_FASTCALL(*rb_insn_func_t))(rb_thread_t *, rb_control_frame_t *);
|
|
944
882
|
|
|
945
|
-
#define
|
|
946
|
-
#define
|
|
947
|
-
|
|
948
|
-
#define GC_GUARDED_PTR(p) VM_TAGGED_PTR_SET((p), 0x01)
|
|
949
|
-
#define GC_GUARDED_PTR_REF(p) VM_TAGGED_PTR_REF((p), 0x03)
|
|
883
|
+
#define GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
|
|
884
|
+
#define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)(p)) & ~0x03))
|
|
950
885
|
#define GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01)
|
|
951
886
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
*/
|
|
961
|
-
|
|
962
|
-
/* frame types */
|
|
963
|
-
VM_FRAME_MAGIC_METHOD = 0x11110001,
|
|
964
|
-
VM_FRAME_MAGIC_BLOCK = 0x22220001,
|
|
965
|
-
VM_FRAME_MAGIC_CLASS = 0x33330001,
|
|
966
|
-
VM_FRAME_MAGIC_TOP = 0x44440001,
|
|
967
|
-
VM_FRAME_MAGIC_CFUNC = 0x55550001,
|
|
968
|
-
VM_FRAME_MAGIC_PROC = 0x66660001,
|
|
969
|
-
VM_FRAME_MAGIC_IFUNC = 0x77770001,
|
|
970
|
-
VM_FRAME_MAGIC_EVAL = 0x88880001,
|
|
971
|
-
VM_FRAME_MAGIC_LAMBDA = 0x99990001,
|
|
972
|
-
VM_FRAME_MAGIC_RESCUE = 0xaaaa0001,
|
|
973
|
-
VM_FRAME_MAGIC_DUMMY = 0xbbbb0001,
|
|
974
|
-
|
|
975
|
-
VM_FRAME_MAGIC_MASK = 0xffff0001,
|
|
976
|
-
|
|
977
|
-
/* frame flag */
|
|
978
|
-
VM_FRAME_FLAG_PASSED = 0x0010,
|
|
979
|
-
VM_FRAME_FLAG_FINISH = 0x0020,
|
|
980
|
-
VM_FRAME_FLAG_BMETHOD = 0x0040,
|
|
981
|
-
VM_FRAME_FLAG_CFRAME = 0x0080,
|
|
982
|
-
|
|
983
|
-
/* env flag */
|
|
984
|
-
VM_ENV_FLAG_LOCAL = 0x0002,
|
|
985
|
-
VM_ENV_FLAG_ESCAPED = 0x0004,
|
|
986
|
-
VM_ENV_FLAG_WB_REQUIRED = 0x0008
|
|
987
|
-
};
|
|
988
|
-
|
|
989
|
-
#define VM_ENV_DATA_SIZE ( 3)
|
|
990
|
-
|
|
991
|
-
#define VM_ENV_DATA_INDEX_ME_CREF (-2) /* ep[-2] */
|
|
992
|
-
#define VM_ENV_DATA_INDEX_SPECVAL (-1) /* ep[-1] */
|
|
993
|
-
#define VM_ENV_DATA_INDEX_FLAGS ( 0) /* ep[ 0] */
|
|
994
|
-
#define VM_ENV_DATA_INDEX_ENV ( 1) /* ep[ 1] */
|
|
995
|
-
#define VM_ENV_DATA_INDEX_ENV_PROC ( 2) /* ep[ 2] */
|
|
996
|
-
|
|
997
|
-
#define VM_ENV_INDEX_LAST_LVAR (-VM_ENV_DATA_SIZE)
|
|
998
|
-
|
|
999
|
-
static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value);
|
|
1000
|
-
|
|
1001
|
-
static inline void
|
|
1002
|
-
VM_ENV_FLAGS_SET(const VALUE *ep, VALUE flag)
|
|
1003
|
-
{
|
|
1004
|
-
VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
|
|
1005
|
-
VM_ASSERT(FIXNUM_P(flags));
|
|
1006
|
-
VM_FORCE_WRITE_SPECIAL_CONST(&ep[VM_ENV_DATA_INDEX_FLAGS], flags | flag);
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
static inline void
|
|
1010
|
-
VM_ENV_FLAGS_UNSET(const VALUE *ep, VALUE flag)
|
|
1011
|
-
{
|
|
1012
|
-
VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
|
|
1013
|
-
VM_ASSERT(FIXNUM_P(flags));
|
|
1014
|
-
VM_FORCE_WRITE_SPECIAL_CONST(&ep[VM_ENV_DATA_INDEX_FLAGS], flags & ~flag);
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
static inline unsigned long
|
|
1018
|
-
VM_ENV_FLAGS(const VALUE *ep, long flag)
|
|
1019
|
-
{
|
|
1020
|
-
VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
|
|
1021
|
-
VM_ASSERT(FIXNUM_P(flags));
|
|
1022
|
-
return flags & flag;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
static inline unsigned long
|
|
1026
|
-
VM_FRAME_TYPE(const rb_control_frame_t *cfp)
|
|
1027
|
-
{
|
|
1028
|
-
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_MAGIC_MASK);
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
static inline int
|
|
1032
|
-
VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
|
|
1033
|
-
{
|
|
1034
|
-
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_FINISH ) != 0;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
static inline int
|
|
1038
|
-
VM_FRAME_BMETHOD_P(const rb_control_frame_t *cfp)
|
|
1039
|
-
{
|
|
1040
|
-
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_BMETHOD) != 0;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
static inline int
|
|
1044
|
-
rb_obj_is_iseq(VALUE iseq)
|
|
1045
|
-
{
|
|
1046
|
-
return RB_TYPE_P(iseq, T_IMEMO) && imemo_type(iseq) == imemo_iseq;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
#if VM_CHECK_MODE > 0
|
|
1050
|
-
#define RUBY_VM_NORMAL_ISEQ_P(iseq) rb_obj_is_iseq((VALUE)iseq)
|
|
1051
|
-
#endif
|
|
1052
|
-
|
|
1053
|
-
static inline int
|
|
1054
|
-
VM_FRAME_CFRAME_P(const rb_control_frame_t *cfp)
|
|
1055
|
-
{
|
|
1056
|
-
int cframe_p = VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME) != 0;
|
|
1057
|
-
VM_ASSERT(RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) != cframe_p);
|
|
1058
|
-
return cframe_p;
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
static inline int
|
|
1062
|
-
VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
|
|
1063
|
-
{
|
|
1064
|
-
return !VM_FRAME_CFRAME_P(cfp);
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
|
1068
|
-
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
|
1069
|
-
|
|
1070
|
-
#define VM_GUARDED_PREV_EP(ep) GC_GUARDED_PTR(ep)
|
|
1071
|
-
#define VM_BLOCK_HANDLER_NONE 0
|
|
1072
|
-
|
|
1073
|
-
static inline int
|
|
1074
|
-
VM_ENV_LOCAL_P(const VALUE *ep)
|
|
1075
|
-
{
|
|
1076
|
-
return VM_ENV_FLAGS(ep, VM_ENV_FLAG_LOCAL) ? 1 : 0;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
static inline const VALUE *
|
|
1080
|
-
VM_ENV_PREV_EP(const VALUE *ep)
|
|
1081
|
-
{
|
|
1082
|
-
VM_ASSERT(VM_ENV_LOCAL_P(ep) == 0);
|
|
1083
|
-
return GC_GUARDED_PTR_REF(ep[VM_ENV_DATA_INDEX_SPECVAL]);
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
static inline VALUE
|
|
1087
|
-
VM_ENV_BLOCK_HANDLER(const VALUE *ep)
|
|
1088
|
-
{
|
|
1089
|
-
VM_ASSERT(VM_ENV_LOCAL_P(ep));
|
|
1090
|
-
return ep[VM_ENV_DATA_INDEX_SPECVAL];
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
#if VM_CHECK_MODE > 0
|
|
1094
|
-
int rb_vm_ep_in_heap_p(const VALUE *ep);
|
|
1095
|
-
#endif
|
|
1096
|
-
|
|
1097
|
-
static inline int
|
|
1098
|
-
VM_ENV_ESCAPED_P(const VALUE *ep)
|
|
1099
|
-
{
|
|
1100
|
-
VM_ASSERT(rb_vm_ep_in_heap_p(ep) == !!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED));
|
|
1101
|
-
return VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) ? 1 : 0;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
#if VM_CHECK_MODE > 0
|
|
1105
|
-
static inline int
|
|
1106
|
-
vm_assert_env(VALUE obj)
|
|
1107
|
-
{
|
|
1108
|
-
VM_ASSERT(RB_TYPE_P(obj, T_IMEMO));
|
|
1109
|
-
VM_ASSERT(imemo_type(obj) == imemo_env);
|
|
1110
|
-
return 1;
|
|
1111
|
-
}
|
|
1112
|
-
#endif
|
|
1113
|
-
|
|
1114
|
-
static inline VALUE
|
|
1115
|
-
VM_ENV_ENVVAL(const VALUE *ep)
|
|
1116
|
-
{
|
|
1117
|
-
VALUE envval = ep[VM_ENV_DATA_INDEX_ENV];
|
|
1118
|
-
VM_ASSERT(VM_ENV_ESCAPED_P(ep));
|
|
1119
|
-
VM_ASSERT(vm_assert_env(envval));
|
|
1120
|
-
return envval;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
static inline const rb_env_t *
|
|
1124
|
-
VM_ENV_ENVVAL_PTR(const VALUE *ep)
|
|
1125
|
-
{
|
|
1126
|
-
return (const rb_env_t *)VM_ENV_ENVVAL(ep);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
static inline VALUE
|
|
1130
|
-
VM_ENV_PROCVAL(const VALUE *ep)
|
|
1131
|
-
{
|
|
1132
|
-
VM_ASSERT(VM_ENV_ESCAPED_P(ep));
|
|
1133
|
-
VM_ASSERT(VM_ENV_LOCAL_P(ep));
|
|
1134
|
-
VM_ASSERT(VM_ENV_BLOCK_HANDLER(ep) != VM_BLOCK_HANDLER_NONE);
|
|
1135
|
-
|
|
1136
|
-
return ep[VM_ENV_DATA_INDEX_ENV_PROC];
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
static inline const rb_env_t *
|
|
1140
|
-
vm_env_new(VALUE *env_ep, VALUE *env_body, unsigned int env_size, const rb_iseq_t *iseq)
|
|
1141
|
-
{
|
|
1142
|
-
rb_env_t *env = (rb_env_t *)rb_imemo_new(imemo_env, (VALUE)env_ep, (VALUE)env_body, 0, (VALUE)iseq);
|
|
1143
|
-
env->env_size = env_size;
|
|
1144
|
-
env_ep[VM_ENV_DATA_INDEX_ENV] = (VALUE)env;
|
|
1145
|
-
return env;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
static inline void
|
|
1149
|
-
VM_FORCE_WRITE(const VALUE *ptr, VALUE v)
|
|
1150
|
-
{
|
|
1151
|
-
*((VALUE *)ptr) = v;
|
|
1152
|
-
}
|
|
887
|
+
/*
|
|
888
|
+
* block frame:
|
|
889
|
+
* ep[ 0]: prev frame
|
|
890
|
+
* ep[-1]: CREF (for *_eval)
|
|
891
|
+
*
|
|
892
|
+
* method frame:
|
|
893
|
+
* ep[ 0]: block pointer (ptr | VM_ENVVAL_BLOCK_PTR_FLAG)
|
|
894
|
+
*/
|
|
1153
895
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
}
|
|
896
|
+
#define VM_ENVVAL_BLOCK_PTR_FLAG 0x02
|
|
897
|
+
#define VM_ENVVAL_BLOCK_PTR(v) (GC_GUARDED_PTR(v) | VM_ENVVAL_BLOCK_PTR_FLAG)
|
|
898
|
+
#define VM_ENVVAL_BLOCK_PTR_P(v) ((v) & VM_ENVVAL_BLOCK_PTR_FLAG)
|
|
899
|
+
#define VM_ENVVAL_PREV_EP_PTR(v) ((VALUE)GC_GUARDED_PTR(v))
|
|
900
|
+
#define VM_ENVVAL_PREV_EP_PTR_P(v) (!(VM_ENVVAL_BLOCK_PTR_P(v)))
|
|
1160
901
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
VM_ASSERT(VM_ENV_FLAGS(ep, VM_ENV_FLAG_WB_REQUIRED) == 0);
|
|
1165
|
-
VM_FORCE_WRITE(&ep[index], v);
|
|
1166
|
-
}
|
|
902
|
+
#define VM_EP_PREV_EP(ep) ((VALUE *)GC_GUARDED_PTR_REF((ep)[0]))
|
|
903
|
+
#define VM_EP_BLOCK_PTR(ep) ((rb_block_t *)GC_GUARDED_PTR_REF((ep)[0]))
|
|
904
|
+
#define VM_EP_LEP_P(ep) VM_ENVVAL_BLOCK_PTR_P((ep)[0])
|
|
1167
905
|
|
|
1168
|
-
|
|
1169
|
-
|
|
906
|
+
VALUE *rb_vm_ep_local_ep(VALUE *ep);
|
|
907
|
+
rb_block_t *rb_vm_control_frame_block_ptr(rb_control_frame_t *cfp);
|
|
1170
908
|
|
|
1171
909
|
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1)
|
|
1172
910
|
#define RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1)
|
|
@@ -1177,232 +915,18 @@ VALUE rb_vm_frame_block_handler(const rb_control_frame_t *cfp);
|
|
|
1177
915
|
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
|
1178
916
|
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
|
1179
917
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
if ((block_handler & 0x03) == 0x01) {
|
|
1184
|
-
#if VM_CHECK_MODE > 0
|
|
1185
|
-
struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
|
|
1186
|
-
VM_ASSERT(RB_TYPE_P(captured->code.val, T_IMEMO));
|
|
1187
|
-
VM_ASSERT(imemo_type(captured->code.val) == imemo_iseq);
|
|
1188
|
-
#endif
|
|
1189
|
-
return 1;
|
|
1190
|
-
}
|
|
1191
|
-
else {
|
|
1192
|
-
return 0;
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
static inline VALUE
|
|
1197
|
-
VM_BH_FROM_ISEQ_BLOCK(const struct rb_captured_block *captured)
|
|
1198
|
-
{
|
|
1199
|
-
VALUE block_handler = VM_TAGGED_PTR_SET(captured, 0x01);
|
|
1200
|
-
VM_ASSERT(VM_BH_ISEQ_BLOCK_P(block_handler));
|
|
1201
|
-
return block_handler;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
static inline const struct rb_captured_block *
|
|
1205
|
-
VM_BH_TO_ISEQ_BLOCK(VALUE block_handler)
|
|
1206
|
-
{
|
|
1207
|
-
struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
|
|
1208
|
-
VM_ASSERT(VM_BH_ISEQ_BLOCK_P(block_handler));
|
|
1209
|
-
return captured;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
static inline int
|
|
1213
|
-
VM_BH_IFUNC_P(VALUE block_handler)
|
|
1214
|
-
{
|
|
1215
|
-
if ((block_handler & 0x03) == 0x03) {
|
|
1216
|
-
#if VM_CHECK_MODE > 0
|
|
1217
|
-
struct rb_captured_block *captured = (void *)(block_handler & ~0x03);
|
|
1218
|
-
VM_ASSERT(RB_TYPE_P(captured->code.val, T_IMEMO));
|
|
1219
|
-
VM_ASSERT(imemo_type(captured->code.val) == imemo_ifunc);
|
|
1220
|
-
#endif
|
|
1221
|
-
return 1;
|
|
1222
|
-
}
|
|
1223
|
-
else {
|
|
1224
|
-
return 0;
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
static inline VALUE
|
|
1229
|
-
VM_BH_FROM_IFUNC_BLOCK(const struct rb_captured_block *captured)
|
|
1230
|
-
{
|
|
1231
|
-
VALUE block_handler = VM_TAGGED_PTR_SET(captured, 0x03);
|
|
1232
|
-
VM_ASSERT(VM_BH_IFUNC_P(block_handler));
|
|
1233
|
-
return block_handler;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
static inline const struct rb_captured_block *
|
|
1237
|
-
VM_BH_TO_IFUNC_BLOCK(VALUE block_handler)
|
|
1238
|
-
{
|
|
1239
|
-
struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
|
|
1240
|
-
VM_ASSERT(VM_BH_IFUNC_P(block_handler));
|
|
1241
|
-
return captured;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
static inline const struct rb_captured_block *
|
|
1245
|
-
VM_BH_TO_CAPT_BLOCK(VALUE block_handler)
|
|
1246
|
-
{
|
|
1247
|
-
struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
|
|
1248
|
-
VM_ASSERT(VM_BH_IFUNC_P(block_handler) || VM_BH_ISEQ_BLOCK_P(block_handler));
|
|
1249
|
-
return captured;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
static inline enum rb_block_handler_type
|
|
1253
|
-
vm_block_handler_type(VALUE block_handler)
|
|
1254
|
-
{
|
|
1255
|
-
if (VM_BH_ISEQ_BLOCK_P(block_handler)) {
|
|
1256
|
-
return block_handler_type_iseq;
|
|
1257
|
-
}
|
|
1258
|
-
else if (VM_BH_IFUNC_P(block_handler)) {
|
|
1259
|
-
return block_handler_type_ifunc;
|
|
1260
|
-
}
|
|
1261
|
-
else if (SYMBOL_P(block_handler)) {
|
|
1262
|
-
return block_handler_type_symbol;
|
|
1263
|
-
}
|
|
1264
|
-
else {
|
|
1265
|
-
VM_ASSERT(rb_obj_is_proc(block_handler));
|
|
1266
|
-
return block_handler_type_proc;
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
static inline int
|
|
1271
|
-
vm_block_handler_verify(VALUE block_handler)
|
|
1272
|
-
{
|
|
1273
|
-
VM_ASSERT(block_handler == VM_BLOCK_HANDLER_NONE ||
|
|
1274
|
-
vm_block_handler_type(block_handler) >= 0);
|
|
1275
|
-
return 1;
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
static inline enum rb_block_type
|
|
1279
|
-
vm_block_type(const struct rb_block *block)
|
|
1280
|
-
{
|
|
1281
|
-
#if VM_CHECK_MODE > 0
|
|
1282
|
-
switch (block->type) {
|
|
1283
|
-
case block_type_iseq:
|
|
1284
|
-
VM_ASSERT(RB_TYPE_P(block->as.captured.code.val, T_IMEMO));
|
|
1285
|
-
VM_ASSERT(imemo_type(block->as.captured.code.val) == imemo_iseq);
|
|
1286
|
-
break;
|
|
1287
|
-
case block_type_ifunc:
|
|
1288
|
-
VM_ASSERT(RB_TYPE_P(block->as.captured.code.val, T_IMEMO));
|
|
1289
|
-
VM_ASSERT(imemo_type(block->as.captured.code.val) == imemo_ifunc);
|
|
1290
|
-
break;
|
|
1291
|
-
case block_type_symbol:
|
|
1292
|
-
VM_ASSERT(SYMBOL_P(block->as.symbol));
|
|
1293
|
-
break;
|
|
1294
|
-
case block_type_proc:
|
|
1295
|
-
VM_ASSERT(rb_obj_is_proc(block->as.proc));
|
|
1296
|
-
break;
|
|
1297
|
-
}
|
|
1298
|
-
#endif
|
|
1299
|
-
return block->type;
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
static inline void
|
|
1303
|
-
vm_block_type_set(const struct rb_block *block, enum rb_block_type type)
|
|
1304
|
-
{
|
|
1305
|
-
struct rb_block *mb = (struct rb_block *)block;
|
|
1306
|
-
mb->type = type;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
static inline const struct rb_block *
|
|
1310
|
-
vm_proc_block(VALUE procval)
|
|
1311
|
-
{
|
|
1312
|
-
rb_proc_t *proc = RTYPEDDATA_DATA(procval);
|
|
1313
|
-
VM_ASSERT(rb_obj_is_proc(procval));
|
|
1314
|
-
return &proc->block;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
static inline const rb_iseq_t *vm_block_iseq(const struct rb_block *block);
|
|
1318
|
-
static inline const VALUE *vm_block_ep(const struct rb_block *block);
|
|
1319
|
-
|
|
1320
|
-
static inline const rb_iseq_t *
|
|
1321
|
-
vm_proc_iseq(VALUE procval)
|
|
1322
|
-
{
|
|
1323
|
-
VM_ASSERT(rb_obj_is_proc(procval));
|
|
1324
|
-
return vm_block_iseq(vm_proc_block(procval));
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
static inline const VALUE *
|
|
1328
|
-
vm_proc_ep(VALUE procval)
|
|
1329
|
-
{
|
|
1330
|
-
return vm_block_ep(vm_proc_block(procval));
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
static inline const rb_iseq_t *
|
|
1334
|
-
vm_block_iseq(const struct rb_block *block)
|
|
1335
|
-
{
|
|
1336
|
-
switch (vm_block_type(block)) {
|
|
1337
|
-
case block_type_iseq: return block->as.captured.code.iseq;
|
|
1338
|
-
case block_type_proc: return vm_proc_iseq(block->as.proc);
|
|
1339
|
-
case block_type_ifunc:
|
|
1340
|
-
case block_type_symbol: return NULL;
|
|
1341
|
-
}
|
|
1342
|
-
VM_UNREACHABLE(vm_block_iseq);
|
|
1343
|
-
return NULL;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
static inline const VALUE *
|
|
1347
|
-
vm_block_ep(const struct rb_block *block)
|
|
1348
|
-
{
|
|
1349
|
-
switch (vm_block_type(block)) {
|
|
1350
|
-
case block_type_iseq:
|
|
1351
|
-
case block_type_ifunc: return block->as.captured.ep;
|
|
1352
|
-
case block_type_proc: return vm_proc_ep(block->as.proc);
|
|
1353
|
-
case block_type_symbol: return NULL;
|
|
1354
|
-
}
|
|
1355
|
-
VM_UNREACHABLE(vm_block_ep);
|
|
1356
|
-
return NULL;
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
static inline VALUE
|
|
1360
|
-
vm_block_self(const struct rb_block *block)
|
|
1361
|
-
{
|
|
1362
|
-
switch (vm_block_type(block)) {
|
|
1363
|
-
case block_type_iseq:
|
|
1364
|
-
case block_type_ifunc:
|
|
1365
|
-
return block->as.captured.self;
|
|
1366
|
-
case block_type_proc:
|
|
1367
|
-
return vm_block_self(vm_proc_block(block->as.proc));
|
|
1368
|
-
case block_type_symbol:
|
|
1369
|
-
return Qundef;
|
|
1370
|
-
}
|
|
1371
|
-
VM_UNREACHABLE(vm_block_self);
|
|
1372
|
-
return Qundef;
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
static inline VALUE
|
|
1376
|
-
VM_BH_TO_SYMBOL(VALUE block_handler)
|
|
1377
|
-
{
|
|
1378
|
-
VM_ASSERT(SYMBOL_P(block_handler));
|
|
1379
|
-
return block_handler;
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
static inline VALUE
|
|
1383
|
-
VM_BH_FROM_SYMBOL(VALUE symbol)
|
|
1384
|
-
{
|
|
1385
|
-
VM_ASSERT(SYMBOL_P(symbol));
|
|
1386
|
-
return symbol;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
static inline VALUE
|
|
1390
|
-
VM_BH_TO_PROC(VALUE block_handler)
|
|
1391
|
-
{
|
|
1392
|
-
VM_ASSERT(rb_obj_is_proc(block_handler));
|
|
1393
|
-
return block_handler;
|
|
1394
|
-
}
|
|
918
|
+
#define RUBY_VM_IFUNC_P(ptr) RB_TYPE_P((VALUE)(ptr), T_NODE)
|
|
919
|
+
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
|
920
|
+
((ptr) && !RUBY_VM_IFUNC_P(ptr))
|
|
1395
921
|
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
return procval;
|
|
1401
|
-
}
|
|
922
|
+
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
|
|
923
|
+
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
|
|
924
|
+
((rb_control_frame_t *)((VALUE *)(b) - 4))
|
|
925
|
+
/* magic number `4' is depend on rb_control_frame_t layout. */
|
|
1402
926
|
|
|
1403
927
|
/* VM related object allocate functions */
|
|
1404
928
|
VALUE rb_thread_alloc(VALUE klass);
|
|
1405
|
-
VALUE
|
|
929
|
+
VALUE rb_proc_wrap(VALUE klass, rb_proc_t *); /* may use with rb_proc_alloc */
|
|
1406
930
|
VALUE rb_binding_alloc(VALUE klass);
|
|
1407
931
|
|
|
1408
932
|
/* for debug */
|
|
@@ -1417,26 +941,29 @@ NORETURN(void rb_bug_context(const void *, const char *fmt, ...));
|
|
|
1417
941
|
|
|
1418
942
|
/* functions about thread/vm execution */
|
|
1419
943
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
1420
|
-
VALUE rb_iseq_eval(
|
|
1421
|
-
VALUE rb_iseq_eval_main(
|
|
944
|
+
VALUE rb_iseq_eval(VALUE iseqval);
|
|
945
|
+
VALUE rb_iseq_eval_main(VALUE iseqval);
|
|
1422
946
|
RUBY_SYMBOL_EXPORT_END
|
|
1423
947
|
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
|
|
1424
948
|
|
|
1425
|
-
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
|
1426
|
-
|
|
1427
|
-
VALUE
|
|
949
|
+
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
|
950
|
+
int argc, const VALUE *argv, const rb_block_t *blockptr);
|
|
951
|
+
VALUE rb_vm_make_proc_lambda(rb_thread_t *th, const rb_block_t *block, VALUE klass, int8_t is_lambda);
|
|
952
|
+
VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
|
|
1428
953
|
VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp);
|
|
1429
|
-
VALUE
|
|
1430
|
-
|
|
1431
|
-
|
|
954
|
+
VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
|
|
955
|
+
VALUE rb_vm_env_local_variables(VALUE envval);
|
|
956
|
+
VALUE *rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars);
|
|
1432
957
|
void rb_vm_inc_const_missing_count(void);
|
|
1433
958
|
void rb_vm_gvl_destroy(rb_vm_t *vm);
|
|
1434
959
|
VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc,
|
|
1435
|
-
const VALUE *argv, const
|
|
1436
|
-
|
|
960
|
+
const VALUE *argv, const rb_method_entry_t *me,
|
|
961
|
+
VALUE defined_class);
|
|
962
|
+
void rb_unlink_method_entry(rb_method_entry_t *me);
|
|
963
|
+
void rb_gc_mark_unlinked_live_method_entries(void *pvm);
|
|
1437
964
|
|
|
1438
965
|
void rb_thread_start_timer_thread(void);
|
|
1439
|
-
void rb_thread_stop_timer_thread(
|
|
966
|
+
void rb_thread_stop_timer_thread(int);
|
|
1440
967
|
void rb_thread_reset_timer_thread(void);
|
|
1441
968
|
void rb_thread_wakeup_timer_thread(void);
|
|
1442
969
|
|
|
@@ -1461,11 +988,12 @@ rb_vm_living_threads_remove(rb_vm_t *vm, rb_thread_t *th)
|
|
|
1461
988
|
vm->living_thread_num--;
|
|
1462
989
|
}
|
|
1463
990
|
|
|
991
|
+
int ruby_thread_has_gvl_p(void);
|
|
1464
992
|
typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
|
|
1465
993
|
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
|
|
1466
994
|
rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
|
|
1467
995
|
int rb_vm_get_sourceline(const rb_control_frame_t *);
|
|
1468
|
-
VALUE rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method);
|
|
996
|
+
VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method);
|
|
1469
997
|
void rb_vm_stack_to_heap(rb_thread_t *th);
|
|
1470
998
|
void ruby_thread_init_stack(rb_thread_t *th);
|
|
1471
999
|
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, VALUE *klassp);
|
|
@@ -1477,9 +1005,7 @@ void rb_gc_mark_machine_stack(rb_thread_t *th);
|
|
|
1477
1005
|
|
|
1478
1006
|
int rb_autoloading_value(VALUE mod, ID id, VALUE* value);
|
|
1479
1007
|
|
|
1480
|
-
void
|
|
1481
|
-
|
|
1482
|
-
const rb_callable_method_entry_t *rb_vm_frame_method_entry(const rb_control_frame_t *cfp);
|
|
1008
|
+
void rb_vm_rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass, NODE **new_cref_ptr);
|
|
1483
1009
|
|
|
1484
1010
|
#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
|
|
1485
1011
|
|
|
@@ -1508,20 +1034,18 @@ extern rb_event_flag_t ruby_vm_event_flags;
|
|
|
1508
1034
|
#define OPT_CALL_CFUNC_WITHOUT_FRAME 0
|
|
1509
1035
|
#endif
|
|
1510
1036
|
|
|
1511
|
-
#define GET_THREAD() vm_thread_with_frame(ruby_current_thread)
|
|
1512
|
-
#if OPT_CALL_CFUNC_WITHOUT_FRAME
|
|
1513
1037
|
static inline rb_thread_t *
|
|
1514
|
-
|
|
1038
|
+
GET_THREAD(void)
|
|
1515
1039
|
{
|
|
1040
|
+
rb_thread_t *th = ruby_current_thread;
|
|
1041
|
+
#if OPT_CALL_CFUNC_WITHOUT_FRAME
|
|
1516
1042
|
if (UNLIKELY(th->passed_ci != 0)) {
|
|
1517
|
-
void
|
|
1518
|
-
|
|
1043
|
+
void vm_call_cfunc_push_frame(rb_thread_t *th);
|
|
1044
|
+
vm_call_cfunc_push_frame(th);
|
|
1519
1045
|
}
|
|
1046
|
+
#endif
|
|
1520
1047
|
return th;
|
|
1521
1048
|
}
|
|
1522
|
-
#else
|
|
1523
|
-
#define vm_thread_with_frame(th) (th)
|
|
1524
|
-
#endif
|
|
1525
1049
|
|
|
1526
1050
|
#define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
|
|
1527
1051
|
#define rb_thread_set_current(th) do { \
|
|
@@ -1550,7 +1074,6 @@ enum {
|
|
|
1550
1074
|
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & ~(th)->interrupt_mask & (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
|
|
1551
1075
|
#define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
|
|
1552
1076
|
|
|
1553
|
-
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
|
|
1554
1077
|
int rb_signal_buff_size(void);
|
|
1555
1078
|
void rb_signal_exec(rb_thread_t *th, int sig);
|
|
1556
1079
|
void rb_threadptr_check_signal(rb_thread_t *mth);
|
|
@@ -1562,16 +1085,23 @@ void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
|
|
|
1562
1085
|
void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
|
|
1563
1086
|
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
|
|
1564
1087
|
int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th);
|
|
1565
|
-
void rb_threadptr_error_print(rb_thread_t *th, VALUE errinfo);
|
|
1566
1088
|
|
|
1567
|
-
#define
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1089
|
+
#define RUBY_VM_CHECK_INTS_BLOCKING(th) do { \
|
|
1090
|
+
if (UNLIKELY(!rb_threadptr_pending_interrupt_empty_p(th))) { \
|
|
1091
|
+
th->pending_interrupt_queue_checked = 0; \
|
|
1092
|
+
RUBY_VM_SET_INTERRUPT(th); \
|
|
1093
|
+
rb_threadptr_execute_interrupts(th, 1); \
|
|
1094
|
+
} \
|
|
1095
|
+
else if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { \
|
|
1096
|
+
rb_threadptr_execute_interrupts(th, 1); \
|
|
1097
|
+
} \
|
|
1098
|
+
} while (0)
|
|
1099
|
+
|
|
1100
|
+
#define RUBY_VM_CHECK_INTS(th) do { \
|
|
1101
|
+
if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { \
|
|
1102
|
+
rb_threadptr_execute_interrupts(th, 0); \
|
|
1103
|
+
} \
|
|
1104
|
+
} while (0)
|
|
1575
1105
|
|
|
1576
1106
|
/* tracer */
|
|
1577
1107
|
struct rb_trace_arg_struct {
|
|
@@ -1594,33 +1124,24 @@ void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg);
|
|
|
1594
1124
|
void rb_threadptr_exec_event_hooks_and_pop_frame(struct rb_trace_arg_struct *trace_arg);
|
|
1595
1125
|
|
|
1596
1126
|
#define EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, pop_p_) do { \
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1127
|
+
if (UNLIKELY(ruby_vm_event_flags & (flag_))) { \
|
|
1128
|
+
if (((th)->event_hooks.events | (th)->vm->event_hooks.events) & (flag_)) { \
|
|
1129
|
+
struct rb_trace_arg_struct trace_arg; \
|
|
1130
|
+
trace_arg.event = (flag_); \
|
|
1131
|
+
trace_arg.th = (th_); \
|
|
1132
|
+
trace_arg.cfp = (trace_arg.th)->cfp; \
|
|
1133
|
+
trace_arg.self = (self_); \
|
|
1134
|
+
trace_arg.id = (id_); \
|
|
1135
|
+
trace_arg.klass = (klass_); \
|
|
1136
|
+
trace_arg.data = (data_); \
|
|
1137
|
+
trace_arg.path = Qundef; \
|
|
1138
|
+
trace_arg.klass_solved = 0; \
|
|
1139
|
+
if (pop_p_) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg); \
|
|
1140
|
+
else rb_threadptr_exec_event_hooks(&trace_arg); \
|
|
1141
|
+
} \
|
|
1601
1142
|
} \
|
|
1602
1143
|
} while (0)
|
|
1603
1144
|
|
|
1604
|
-
static inline void
|
|
1605
|
-
ruby_exec_event_hook_orig(rb_thread_t *const th, const rb_event_flag_t flag,
|
|
1606
|
-
VALUE self, ID id, VALUE klass, VALUE data, int pop_p)
|
|
1607
|
-
{
|
|
1608
|
-
if ((th->event_hooks.events | th->vm->event_hooks.events) & flag) {
|
|
1609
|
-
struct rb_trace_arg_struct trace_arg;
|
|
1610
|
-
trace_arg.event = flag;
|
|
1611
|
-
trace_arg.th = th;
|
|
1612
|
-
trace_arg.cfp = th->cfp;
|
|
1613
|
-
trace_arg.self = self;
|
|
1614
|
-
trace_arg.id = id;
|
|
1615
|
-
trace_arg.klass = klass;
|
|
1616
|
-
trace_arg.data = data;
|
|
1617
|
-
trace_arg.path = Qundef;
|
|
1618
|
-
trace_arg.klass_solved = 0;
|
|
1619
|
-
if (pop_p) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg);
|
|
1620
|
-
else rb_threadptr_exec_event_hooks(&trace_arg);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
1145
|
#define EXEC_EVENT_HOOK(th_, flag_, self_, id_, klass_, data_) \
|
|
1625
1146
|
EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 0)
|
|
1626
1147
|
|