debase-ruby_core_source 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/debase/ruby_core_source.rb +1 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/addr2line.h +21 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/list/list.h +773 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/constant.h +50 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/dln.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/encindex.h +67 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/eval_intern.h +325 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/gc.h +114 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/id.h +212 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/id_table.h +30 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/insns.inc +109 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/insns_info.inc +769 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/internal.h +1373 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/iseq.h +181 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/known_errors.inc +746 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/method.h +210 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/node.h +521 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/node_name.inc +208 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/opt_sc.inc +750 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/optinsn.inc +83 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/optunifs.inc +126 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/parse.h +204 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/probes_helper.h +43 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/regenc.h +234 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/regint.h +972 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/regparse.h +363 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/revision.h +1 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ruby_atomic.h +233 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/symbol.h +108 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/thread_pthread.h +54 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/thread_win32.h +36 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/timev.h +42 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/transcode_data.h +139 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/version.h +55 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm.inc +3374 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_call_iseq_optimized.inc +212 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_core.h +1216 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_debug.h +37 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_exec.h +182 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_insnhelper.h +246 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_opts.h +57 -0
- data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vmtc.inc +107 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +49 -3
@@ -0,0 +1,37 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
vm_debug.h - YARV Debug function interface
|
4
|
+
|
5
|
+
$Author: nobu $
|
6
|
+
created at: 04/08/25 02:33:49 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_DEBUG_H
|
13
|
+
#define RUBY_DEBUG_H
|
14
|
+
|
15
|
+
#include "ruby/ruby.h"
|
16
|
+
#include "node.h"
|
17
|
+
|
18
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
19
|
+
|
20
|
+
#define dpv(h,v) ruby_debug_print_value(-1, 0, (h), (v))
|
21
|
+
#define dp(v) ruby_debug_print_value(-1, 0, "", (v))
|
22
|
+
#define dpi(i) ruby_debug_print_id(-1, 0, "", (i))
|
23
|
+
#define dpn(n) ruby_debug_print_node(-1, 0, "", (n))
|
24
|
+
|
25
|
+
#define bp() ruby_debug_breakpoint()
|
26
|
+
|
27
|
+
VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
|
28
|
+
ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
|
29
|
+
NODE *ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node);
|
30
|
+
int ruby_debug_print_indent(int level, int debug_level, int indent_level);
|
31
|
+
void ruby_debug_breakpoint(void);
|
32
|
+
void ruby_debug_gc_check_func(void);
|
33
|
+
void ruby_set_debug_option(const char *str);
|
34
|
+
|
35
|
+
RUBY_SYMBOL_EXPORT_END
|
36
|
+
|
37
|
+
#endif /* RUBY_DEBUG_H */
|
@@ -0,0 +1,182 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
vm.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: 04/01/01 16:56:59 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_VM_EXEC_H
|
13
|
+
#define RUBY_VM_EXEC_H
|
14
|
+
|
15
|
+
typedef long OFFSET;
|
16
|
+
typedef unsigned long lindex_t;
|
17
|
+
typedef VALUE GENTRY;
|
18
|
+
typedef rb_iseq_t *ISEQ;
|
19
|
+
|
20
|
+
#ifdef __GCC__
|
21
|
+
/* TODO: machine dependent prefetch instruction */
|
22
|
+
#define PREFETCH(pc)
|
23
|
+
#else
|
24
|
+
#define PREFETCH(pc)
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#if VMDEBUG > 0
|
28
|
+
#define debugs printf
|
29
|
+
#define DEBUG_ENTER_INSN(insn) \
|
30
|
+
rb_vmdebug_debug_print_pre(th, GET_CFP(),GET_PC());
|
31
|
+
|
32
|
+
#if OPT_STACK_CACHING
|
33
|
+
#define SC_REGS() , reg_a, reg_b
|
34
|
+
#else
|
35
|
+
#define SC_REGS()
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#define DEBUG_END_INSN() \
|
39
|
+
rb_vmdebug_debug_print_post(th, GET_CFP() SC_REGS());
|
40
|
+
|
41
|
+
#else
|
42
|
+
|
43
|
+
#define debugs
|
44
|
+
#define DEBUG_ENTER_INSN(insn)
|
45
|
+
#define DEBUG_END_INSN()
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#define throwdebug if(0)printf
|
49
|
+
/* #define throwdebug printf */
|
50
|
+
|
51
|
+
/************************************************/
|
52
|
+
#if defined(DISPATCH_XXX)
|
53
|
+
error !
|
54
|
+
/************************************************/
|
55
|
+
#elif OPT_CALL_THREADED_CODE
|
56
|
+
|
57
|
+
#define LABEL(x) insn_func_##x
|
58
|
+
#define ELABEL(x)
|
59
|
+
#define LABEL_PTR(x) &LABEL(x)
|
60
|
+
|
61
|
+
#define INSN_ENTRY(insn) \
|
62
|
+
static rb_control_frame_t * \
|
63
|
+
FUNC_FASTCALL(LABEL(insn))(rb_thread_t *th, rb_control_frame_t *reg_cfp) {
|
64
|
+
|
65
|
+
#define END_INSN(insn) return reg_cfp;}
|
66
|
+
|
67
|
+
#define NEXT_INSN() return reg_cfp;
|
68
|
+
|
69
|
+
/************************************************/
|
70
|
+
#elif OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
|
71
|
+
/* threaded code with gcc */
|
72
|
+
|
73
|
+
#define LABEL(x) INSN_LABEL_##x
|
74
|
+
#define ELABEL(x) INSN_ELABEL_##x
|
75
|
+
#define LABEL_PTR(x) &&LABEL(x)
|
76
|
+
|
77
|
+
#define INSN_ENTRY_SIG(insn)
|
78
|
+
|
79
|
+
|
80
|
+
#define INSN_DISPATCH_SIG(insn)
|
81
|
+
|
82
|
+
#define INSN_ENTRY(insn) \
|
83
|
+
LABEL(insn): \
|
84
|
+
INSN_ENTRY_SIG(insn); \
|
85
|
+
|
86
|
+
/* dispatcher */
|
87
|
+
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && __GNUC__ == 3
|
88
|
+
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
|
89
|
+
__asm__ __volatile__("jmp *%0;\t# -- inserted by vm.h\t[length = 2]" : : "r" (addr))
|
90
|
+
|
91
|
+
#else
|
92
|
+
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
|
93
|
+
/* do nothing */
|
94
|
+
|
95
|
+
#endif
|
96
|
+
|
97
|
+
|
98
|
+
/**********************************/
|
99
|
+
#if OPT_DIRECT_THREADED_CODE
|
100
|
+
|
101
|
+
/* for GCC 3.4.x */
|
102
|
+
#define TC_DISPATCH(insn) \
|
103
|
+
INSN_DISPATCH_SIG(insn); \
|
104
|
+
goto *(void const *)GET_CURRENT_INSN(); \
|
105
|
+
;
|
106
|
+
|
107
|
+
#else
|
108
|
+
/* token threaded code */
|
109
|
+
|
110
|
+
#define TC_DISPATCH(insn) \
|
111
|
+
DISPATCH_ARCH_DEPEND_WAY(insns_address_table[GET_CURRENT_INSN()]); \
|
112
|
+
INSN_DISPATCH_SIG(insn); \
|
113
|
+
goto *insns_address_table[GET_CURRENT_INSN()]; \
|
114
|
+
rb_bug("tc error");
|
115
|
+
|
116
|
+
|
117
|
+
#endif /* DISPATCH_DIRECT_THREADED_CODE */
|
118
|
+
|
119
|
+
#define END_INSN(insn) \
|
120
|
+
DEBUG_END_INSN(); \
|
121
|
+
TC_DISPATCH(insn);
|
122
|
+
|
123
|
+
#define INSN_DISPATCH() \
|
124
|
+
TC_DISPATCH(__START__) \
|
125
|
+
{
|
126
|
+
|
127
|
+
#define END_INSNS_DISPATCH() \
|
128
|
+
rb_bug("unknown insn: %"PRIdVALUE, GET_CURRENT_INSN()); \
|
129
|
+
} /* end of while loop */ \
|
130
|
+
|
131
|
+
#define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)
|
132
|
+
|
133
|
+
/************************************************/
|
134
|
+
#else /* no threaded code */
|
135
|
+
/* most common method */
|
136
|
+
|
137
|
+
#define INSN_ENTRY(insn) \
|
138
|
+
case BIN(insn):
|
139
|
+
|
140
|
+
#define END_INSN(insn) \
|
141
|
+
DEBUG_END_INSN(); \
|
142
|
+
break;
|
143
|
+
|
144
|
+
|
145
|
+
#define INSN_DISPATCH() \
|
146
|
+
while (1) { \
|
147
|
+
switch (GET_CURRENT_INSN()) {
|
148
|
+
|
149
|
+
#define END_INSNS_DISPATCH() \
|
150
|
+
default: \
|
151
|
+
SDR(); \
|
152
|
+
rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \
|
153
|
+
} /* end of switch */ \
|
154
|
+
} /* end of while loop */ \
|
155
|
+
|
156
|
+
#define NEXT_INSN() goto first
|
157
|
+
|
158
|
+
#endif
|
159
|
+
|
160
|
+
#define VM_SP_CNT(th, sp) ((sp) - (th)->stack)
|
161
|
+
|
162
|
+
#if OPT_CALL_THREADED_CODE
|
163
|
+
#define THROW_EXCEPTION(exc) do { \
|
164
|
+
th->errinfo = (VALUE)(exc); \
|
165
|
+
return 0; \
|
166
|
+
} while (0)
|
167
|
+
#else
|
168
|
+
#define THROW_EXCEPTION(exc) return (VALUE)(exc)
|
169
|
+
#endif
|
170
|
+
|
171
|
+
#define SCREG(r) (reg_##r)
|
172
|
+
|
173
|
+
#define VM_DEBUG_STACKOVERFLOW 0
|
174
|
+
|
175
|
+
#if VM_DEBUG_STACKOVERFLOW
|
176
|
+
#define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin) \
|
177
|
+
WHEN_VM_STACK_OVERFLOWED(cfp, (cfp)->sp, margin) vm_stack_overflow_for_insn()
|
178
|
+
#else
|
179
|
+
#define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin)
|
180
|
+
#endif
|
181
|
+
|
182
|
+
#endif /* RUBY_VM_EXEC_H */
|
@@ -0,0 +1,246 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
insnhelper.h - helper macros to implement each instructions
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: 04/01/01 15:50:34 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_INSNHELPER_H
|
13
|
+
#define RUBY_INSNHELPER_H
|
14
|
+
|
15
|
+
extern VALUE ruby_vm_const_missing_count;
|
16
|
+
|
17
|
+
#if VM_COLLECT_USAGE_DETAILS
|
18
|
+
#define COLLECT_USAGE_INSN(insn) vm_collect_usage_insn(insn)
|
19
|
+
#define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op)))
|
20
|
+
|
21
|
+
#define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s))
|
22
|
+
#else
|
23
|
+
#define COLLECT_USAGE_INSN(insn) /* none */
|
24
|
+
#define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
|
25
|
+
#define COLLECT_USAGE_REGISTER(reg, s) /* none */
|
26
|
+
#endif
|
27
|
+
|
28
|
+
/**********************************************************/
|
29
|
+
/* deal with stack */
|
30
|
+
/**********************************************************/
|
31
|
+
|
32
|
+
#define PUSH(x) (SET_SV(x), INC_SP(1))
|
33
|
+
#define TOPN(n) (*(GET_SP()-(n)-1))
|
34
|
+
#define POPN(n) (DEC_SP(n))
|
35
|
+
#define POP() (DEC_SP(1))
|
36
|
+
#define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
|
37
|
+
|
38
|
+
#define GET_TOS() (tos) /* dummy */
|
39
|
+
|
40
|
+
/**********************************************************/
|
41
|
+
/* deal with registers */
|
42
|
+
/**********************************************************/
|
43
|
+
|
44
|
+
#define REG_CFP (reg_cfp)
|
45
|
+
#define REG_PC (REG_CFP->pc)
|
46
|
+
#define REG_SP (REG_CFP->sp)
|
47
|
+
#define REG_EP (REG_CFP->ep)
|
48
|
+
|
49
|
+
#define RESTORE_REGS() do { \
|
50
|
+
REG_CFP = th->cfp; \
|
51
|
+
} while (0)
|
52
|
+
|
53
|
+
#define REG_A reg_a
|
54
|
+
#define REG_B reg_b
|
55
|
+
|
56
|
+
enum vm_regan_regtype {
|
57
|
+
VM_REGAN_PC = 0,
|
58
|
+
VM_REGAN_SP = 1,
|
59
|
+
VM_REGAN_EP = 2,
|
60
|
+
VM_REGAN_CFP = 3,
|
61
|
+
VM_REGAN_SELF = 4,
|
62
|
+
VM_REGAN_ISEQ = 5,
|
63
|
+
};
|
64
|
+
enum vm_regan_acttype {
|
65
|
+
VM_REGAN_ACT_GET = 0,
|
66
|
+
VM_REGAN_ACT_SET = 1,
|
67
|
+
};
|
68
|
+
|
69
|
+
#if VM_COLLECT_USAGE_DETAILS
|
70
|
+
#define COLLECT_USAGE_REGISTER_HELPER(a, b, v) \
|
71
|
+
(COLLECT_USAGE_REGISTER((VM_REGAN_##a), (VM_REGAN_ACT_##b)), (v))
|
72
|
+
#else
|
73
|
+
#define COLLECT_USAGE_REGISTER_HELPER(a, b, v) (v)
|
74
|
+
#endif
|
75
|
+
|
76
|
+
/* PC */
|
77
|
+
#define GET_PC() (COLLECT_USAGE_REGISTER_HELPER(PC, GET, REG_PC))
|
78
|
+
#define SET_PC(x) (REG_PC = (COLLECT_USAGE_REGISTER_HELPER(PC, SET, (x))))
|
79
|
+
#define GET_CURRENT_INSN() (*GET_PC())
|
80
|
+
#define GET_OPERAND(n) (GET_PC()[(n)])
|
81
|
+
#define ADD_PC(n) (SET_PC(REG_PC + (n)))
|
82
|
+
#define JUMP(dst) (REG_PC += (dst))
|
83
|
+
|
84
|
+
/* frame pointer, environment pointer */
|
85
|
+
#define GET_CFP() (COLLECT_USAGE_REGISTER_HELPER(CFP, GET, REG_CFP))
|
86
|
+
#define GET_EP() (COLLECT_USAGE_REGISTER_HELPER(EP, GET, REG_EP))
|
87
|
+
#define SET_EP(x) (REG_EP = (COLLECT_USAGE_REGISTER_HELPER(EP, SET, (x))))
|
88
|
+
#define GET_LEP() (VM_EP_LEP(GET_EP()))
|
89
|
+
|
90
|
+
/* SP */
|
91
|
+
#define GET_SP() (COLLECT_USAGE_REGISTER_HELPER(SP, GET, REG_SP))
|
92
|
+
#define SET_SP(x) (REG_SP = (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
|
93
|
+
#define INC_SP(x) (REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
|
94
|
+
#define DEC_SP(x) (REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
|
95
|
+
#define SET_SV(x) (*GET_SP() = (x))
|
96
|
+
/* set current stack value as x */
|
97
|
+
|
98
|
+
#define GET_SP_COUNT() (REG_SP - th->stack)
|
99
|
+
|
100
|
+
/* instruction sequence C struct */
|
101
|
+
#define GET_ISEQ() (GET_CFP()->iseq)
|
102
|
+
|
103
|
+
/**********************************************************/
|
104
|
+
/* deal with variables */
|
105
|
+
/**********************************************************/
|
106
|
+
|
107
|
+
#define GET_PREV_EP(ep) ((VALUE *)((ep)[0] & ~0x03))
|
108
|
+
|
109
|
+
#define GET_GLOBAL(entry) rb_gvar_get((struct rb_global_entry*)(entry))
|
110
|
+
#define SET_GLOBAL(entry, val) rb_gvar_set((struct rb_global_entry*)(entry), (val))
|
111
|
+
|
112
|
+
#define GET_CONST_INLINE_CACHE(dst) ((IC) * (GET_PC() + (dst) + 2))
|
113
|
+
|
114
|
+
/**********************************************************/
|
115
|
+
/* deal with values */
|
116
|
+
/**********************************************************/
|
117
|
+
|
118
|
+
#define GET_SELF() (COLLECT_USAGE_REGISTER_HELPER(SELF, GET, GET_CFP()->self))
|
119
|
+
|
120
|
+
/**********************************************************/
|
121
|
+
/* deal with control flow 2: method/iterator */
|
122
|
+
/**********************************************************/
|
123
|
+
|
124
|
+
#define COPY_CREF_OMOD(c1, c2) do { \
|
125
|
+
CREF_REFINEMENTS_SET(c1, CREF_REFINEMENTS(c2)); \
|
126
|
+
if (!NIL_P(CREF_REFINEMENTS(c2))) { \
|
127
|
+
CREF_OMOD_SHARED_SET(c1); \
|
128
|
+
CREF_OMOD_SHARED_SET(c2); \
|
129
|
+
} \
|
130
|
+
} while (0)
|
131
|
+
|
132
|
+
#define COPY_CREF(c1, c2) do { \
|
133
|
+
rb_cref_t *__tmp_c2 = (c2); \
|
134
|
+
COPY_CREF_OMOD((c1), __tmp_c2); \
|
135
|
+
CREF_CLASS_SET((c1), CREF_CLASS(__tmp_c2));\
|
136
|
+
CREF_SCOPE_VISI_COPY((c1), __tmp_c2);\
|
137
|
+
CREF_NEXT_SET((c1), CREF_NEXT(__tmp_c2));\
|
138
|
+
if (CREF_PUSHED_BY_EVAL(__tmp_c2)) { \
|
139
|
+
CREF_PUSHED_BY_EVAL_SET(c1); \
|
140
|
+
} \
|
141
|
+
} while (0)
|
142
|
+
|
143
|
+
#define CALL_METHOD(calling, ci, cc) do { \
|
144
|
+
VALUE v = (*(cc)->call)(th, GET_CFP(), (calling), (ci), (cc)); \
|
145
|
+
if (v == Qundef) { \
|
146
|
+
RESTORE_REGS(); \
|
147
|
+
NEXT_INSN(); \
|
148
|
+
} \
|
149
|
+
else { \
|
150
|
+
val = v; \
|
151
|
+
} \
|
152
|
+
} while (0)
|
153
|
+
|
154
|
+
/* set fastpath when cached method is *NOT* protected
|
155
|
+
* because inline method cache does not care about receiver.
|
156
|
+
*/
|
157
|
+
|
158
|
+
#ifndef OPT_CALL_FASTPATH
|
159
|
+
#define OPT_CALL_FASTPATH 1
|
160
|
+
#endif
|
161
|
+
|
162
|
+
#if OPT_CALL_FASTPATH
|
163
|
+
#define CI_SET_FASTPATH(cc, func, enabled) do { \
|
164
|
+
if (LIKELY(enabled)) ((cc)->call = (func)); \
|
165
|
+
} while (0)
|
166
|
+
#else
|
167
|
+
#define CI_SET_FASTPATH(ci, func, enabled) /* do nothing */
|
168
|
+
#endif
|
169
|
+
|
170
|
+
#define GET_BLOCK_PTR() ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LEP()[0])))
|
171
|
+
|
172
|
+
/**********************************************************/
|
173
|
+
/* deal with control flow 3: exception */
|
174
|
+
/**********************************************************/
|
175
|
+
|
176
|
+
|
177
|
+
/**********************************************************/
|
178
|
+
/* others */
|
179
|
+
/**********************************************************/
|
180
|
+
|
181
|
+
/* optimize insn */
|
182
|
+
#define FIXNUM_2_P(a, b) ((a) & (b) & 1)
|
183
|
+
#if USE_FLONUM
|
184
|
+
#define FLONUM_2_P(a, b) (((((a)^2) | ((b)^2)) & 3) == 0) /* (FLONUM_P(a) && FLONUM_P(b)) */
|
185
|
+
#else
|
186
|
+
#define FLONUM_2_P(a, b) 0
|
187
|
+
#endif
|
188
|
+
|
189
|
+
#ifndef USE_IC_FOR_SPECIALIZED_METHOD
|
190
|
+
#define USE_IC_FOR_SPECIALIZED_METHOD 1
|
191
|
+
#endif
|
192
|
+
|
193
|
+
#define CALL_SIMPLE_METHOD(recv_) do { \
|
194
|
+
struct rb_calling_info calling; \
|
195
|
+
calling.blockptr = NULL; \
|
196
|
+
calling.argc = ci->orig_argc; \
|
197
|
+
vm_search_method(ci, cc, calling.recv = (recv_)); \
|
198
|
+
CALL_METHOD(&calling, ci, cc); \
|
199
|
+
} while (0)
|
200
|
+
|
201
|
+
#define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial)
|
202
|
+
#define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state)
|
203
|
+
#define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state)
|
204
|
+
#define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
|
205
|
+
#define INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state)
|
206
|
+
|
207
|
+
static VALUE make_no_method_exception(VALUE exc, const char *format,
|
208
|
+
VALUE obj, int argc, const VALUE *argv);
|
209
|
+
|
210
|
+
static inline struct vm_throw_data *
|
211
|
+
THROW_DATA_NEW(VALUE val, rb_control_frame_t *cf, VALUE st)
|
212
|
+
{
|
213
|
+
return (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, st, 0);
|
214
|
+
}
|
215
|
+
|
216
|
+
static inline void
|
217
|
+
THROW_DATA_CATCH_FRAME_SET(struct vm_throw_data *obj, const rb_control_frame_t *cfp)
|
218
|
+
{
|
219
|
+
obj->catch_frame = cfp;
|
220
|
+
}
|
221
|
+
|
222
|
+
static inline void
|
223
|
+
THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
|
224
|
+
{
|
225
|
+
obj->throw_state = (VALUE)st;
|
226
|
+
}
|
227
|
+
|
228
|
+
static inline VALUE
|
229
|
+
THROW_DATA_VAL(const struct vm_throw_data *obj)
|
230
|
+
{
|
231
|
+
return obj->throw_obj;
|
232
|
+
}
|
233
|
+
|
234
|
+
static inline const rb_control_frame_t *
|
235
|
+
THROW_DATA_CATCH_FRAME(const struct vm_throw_data *obj)
|
236
|
+
{
|
237
|
+
return obj->catch_frame;
|
238
|
+
}
|
239
|
+
|
240
|
+
static int
|
241
|
+
THROW_DATA_STATE(const struct vm_throw_data *obj)
|
242
|
+
{
|
243
|
+
return (int)obj->throw_state;
|
244
|
+
}
|
245
|
+
|
246
|
+
#endif /* RUBY_INSNHELPER_H */
|