debase-ruby_core_source 0.10.5 → 0.10.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +1 -1
- data/debase-ruby_core_source.gemspec +3 -2
- data/lib/debase/ruby_core_source.rb +1 -1
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/addr2line.h +21 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/list/list.h +788 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/constant.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/debug_counter.h +283 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/dln.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/encindex.h +69 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/eval_intern.h +333 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/gc.h +116 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/hrtime.h +168 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/id.h +252 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/id_table.h +31 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/insns.inc +249 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/insns_info.inc +9374 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/internal.h +2470 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/iseq.h +304 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/method.h +229 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/mjit.h +148 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/mjit_compile.inc +4226 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/node.h +449 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/node_name.inc +200 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/opt_sc.inc +109 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/optunifs.inc +43 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/parse.h +207 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/probes_helper.h +42 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/regint.h +938 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/revision.h +1 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ruby_assert.h +60 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ruby_atomic.h +244 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/symbol.h +112 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/thread_pthread.h +75 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/thread_win32.h +36 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/timev.h +53 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/transcode_data.h +139 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/transient_heap.h +60 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/version.h +73 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm.inc +4504 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_call_iseq_optimized.inc +213 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_core.h +1910 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_debug.h +37 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_exec.h +202 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_insnhelper.h +316 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_opts.h +70 -0
- data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vmtc.inc +243 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/addr2line.h +21 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/builtin.h +78 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/constant.h +50 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/debug_counter.h +390 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/dln.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/encindex.h +69 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/eval_intern.h +312 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/gc.h +131 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/hrtime.h +168 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id_table.h +34 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns.inc +253 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns_info.inc +9197 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit.h +177 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit_compile.inc +7779 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node_name.inc +208 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/opt_sc.inc +109 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optunifs.inc +43 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/parse.h +210 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/probes_helper.h +42 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regint.h +938 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/revision.h +2 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_assert.h +15 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/symbol.h +119 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/timev.h +56 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transcode_data.h +139 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transient_heap.h +62 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/variable.h +9 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/version.h +77 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm.inc +5466 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_call_iseq_optimized.inc +237 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_debug.h +34 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_exec.h +193 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_insnhelper.h +267 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vmtc.inc +247 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +128 -8
@@ -0,0 +1,229 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
method.h -
|
4
|
+
|
5
|
+
$Author: nobu $
|
6
|
+
created at: Wed Jul 15 20:02:33 2009
|
7
|
+
|
8
|
+
Copyright (C) 2009 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
#ifndef RUBY_METHOD_H
|
12
|
+
#define RUBY_METHOD_H 1
|
13
|
+
|
14
|
+
#include "internal.h"
|
15
|
+
|
16
|
+
#ifndef END_OF_ENUMERATION
|
17
|
+
# if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
|
18
|
+
# define END_OF_ENUMERATION(key)
|
19
|
+
# else
|
20
|
+
# define END_OF_ENUMERATION(key) END_OF_##key##_PLACEHOLDER = 0
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
|
24
|
+
/* cref */
|
25
|
+
|
26
|
+
typedef enum {
|
27
|
+
METHOD_VISI_UNDEF = 0x00,
|
28
|
+
METHOD_VISI_PUBLIC = 0x01,
|
29
|
+
METHOD_VISI_PRIVATE = 0x02,
|
30
|
+
METHOD_VISI_PROTECTED = 0x03,
|
31
|
+
|
32
|
+
METHOD_VISI_MASK = 0x03
|
33
|
+
} rb_method_visibility_t;
|
34
|
+
|
35
|
+
typedef struct rb_scope_visi_struct {
|
36
|
+
BITFIELD(rb_method_visibility_t, method_visi, 3);
|
37
|
+
unsigned int module_func : 1;
|
38
|
+
} rb_scope_visibility_t;
|
39
|
+
|
40
|
+
/*! CREF (Class REFerence) */
|
41
|
+
typedef struct rb_cref_struct {
|
42
|
+
VALUE flags;
|
43
|
+
const VALUE refinements;
|
44
|
+
const VALUE klass;
|
45
|
+
struct rb_cref_struct * const next;
|
46
|
+
const rb_scope_visibility_t scope_visi;
|
47
|
+
} rb_cref_t;
|
48
|
+
|
49
|
+
/* method data type */
|
50
|
+
|
51
|
+
typedef struct rb_method_entry_struct {
|
52
|
+
VALUE flags;
|
53
|
+
const VALUE defined_class;
|
54
|
+
struct rb_method_definition_struct * const def;
|
55
|
+
ID called_id;
|
56
|
+
const VALUE owner;
|
57
|
+
} rb_method_entry_t;
|
58
|
+
|
59
|
+
typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_entry_t */
|
60
|
+
VALUE flags;
|
61
|
+
const VALUE defined_class;
|
62
|
+
struct rb_method_definition_struct * const def;
|
63
|
+
ID called_id;
|
64
|
+
const VALUE owner;
|
65
|
+
} rb_callable_method_entry_t;
|
66
|
+
|
67
|
+
#define METHOD_ENTRY_VISI(me) (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
|
68
|
+
#define METHOD_ENTRY_BASIC(me) (int) (((me)->flags & (IMEMO_FL_USER2 )) >> (IMEMO_FL_USHIFT+2))
|
69
|
+
#define METHOD_ENTRY_COMPLEMENTED(me) ((me)->flags & IMEMO_FL_USER3)
|
70
|
+
#define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags = (me)->flags | IMEMO_FL_USER3)
|
71
|
+
|
72
|
+
static inline void
|
73
|
+
METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
|
74
|
+
{
|
75
|
+
VM_ASSERT((int)visi >= 0 && visi <= 3);
|
76
|
+
me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << (IMEMO_FL_USHIFT+0));
|
77
|
+
}
|
78
|
+
static inline void
|
79
|
+
METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, unsigned int basic)
|
80
|
+
{
|
81
|
+
VM_ASSERT(basic <= 1);
|
82
|
+
me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << (IMEMO_FL_USHIFT+2));
|
83
|
+
}
|
84
|
+
static inline void
|
85
|
+
METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic)
|
86
|
+
{
|
87
|
+
VM_ASSERT((int)visi >= 0 && visi <= 3);
|
88
|
+
VM_ASSERT(basic <= 1);
|
89
|
+
me->flags =
|
90
|
+
(me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
|
91
|
+
((visi << (IMEMO_FL_USHIFT+0)) | (basic << (IMEMO_FL_USHIFT+2)));
|
92
|
+
}
|
93
|
+
static inline void
|
94
|
+
METHOD_ENTRY_FLAGS_COPY(rb_method_entry_t *dst, const rb_method_entry_t *src)
|
95
|
+
{
|
96
|
+
dst->flags =
|
97
|
+
(dst->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
|
98
|
+
(src->flags & (IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2));
|
99
|
+
}
|
100
|
+
|
101
|
+
typedef enum {
|
102
|
+
VM_METHOD_TYPE_ISEQ, /*!< Ruby method */
|
103
|
+
VM_METHOD_TYPE_CFUNC, /*!< C method */
|
104
|
+
VM_METHOD_TYPE_ATTRSET, /*!< attr_writer or attr_accessor */
|
105
|
+
VM_METHOD_TYPE_IVAR, /*!< attr_reader or attr_accessor */
|
106
|
+
VM_METHOD_TYPE_BMETHOD,
|
107
|
+
VM_METHOD_TYPE_ZSUPER,
|
108
|
+
VM_METHOD_TYPE_ALIAS,
|
109
|
+
VM_METHOD_TYPE_UNDEF,
|
110
|
+
VM_METHOD_TYPE_NOTIMPLEMENTED,
|
111
|
+
VM_METHOD_TYPE_OPTIMIZED, /*!< Kernel#send, Proc#call, etc */
|
112
|
+
VM_METHOD_TYPE_MISSING, /*!< wrapper for method_missing(id) */
|
113
|
+
VM_METHOD_TYPE_REFINED, /*!< refinement */
|
114
|
+
|
115
|
+
END_OF_ENUMERATION(VM_METHOD_TYPE)
|
116
|
+
} rb_method_type_t;
|
117
|
+
#define VM_METHOD_TYPE_MINIMUM_BITS 4
|
118
|
+
/* TODO: STATIC_ASSERT for VM_METHOD_TYPE_MINIMUM_BITS */
|
119
|
+
|
120
|
+
#ifndef rb_iseq_t
|
121
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
122
|
+
#define rb_iseq_t rb_iseq_t
|
123
|
+
#endif
|
124
|
+
|
125
|
+
typedef struct rb_method_iseq_struct {
|
126
|
+
const rb_iseq_t * const iseqptr; /*!< iseq pointer, should be separated from iseqval */
|
127
|
+
rb_cref_t * const cref; /*!< class reference, should be marked */
|
128
|
+
} rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
|
129
|
+
|
130
|
+
typedef struct rb_method_cfunc_struct {
|
131
|
+
VALUE (*func)(ANYARGS);
|
132
|
+
VALUE (*invoker)(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv);
|
133
|
+
int argc;
|
134
|
+
} rb_method_cfunc_t;
|
135
|
+
|
136
|
+
typedef struct rb_method_attr_struct {
|
137
|
+
ID id;
|
138
|
+
const VALUE location; /* should be marked */
|
139
|
+
} rb_method_attr_t;
|
140
|
+
|
141
|
+
typedef struct rb_method_alias_struct {
|
142
|
+
const struct rb_method_entry_struct * const original_me; /* original_me->klass is original owner */
|
143
|
+
} rb_method_alias_t;
|
144
|
+
|
145
|
+
typedef struct rb_method_refined_struct {
|
146
|
+
const struct rb_method_entry_struct * const orig_me;
|
147
|
+
const VALUE owner;
|
148
|
+
} rb_method_refined_t;
|
149
|
+
|
150
|
+
typedef struct rb_method_bmethod_struct {
|
151
|
+
const VALUE proc; /* should be marked */
|
152
|
+
struct rb_hook_list_struct *hooks;
|
153
|
+
} rb_method_bmethod_t;
|
154
|
+
|
155
|
+
enum method_optimized_type {
|
156
|
+
OPTIMIZED_METHOD_TYPE_SEND,
|
157
|
+
OPTIMIZED_METHOD_TYPE_CALL,
|
158
|
+
OPTIMIZED_METHOD_TYPE_BLOCK_CALL,
|
159
|
+
OPTIMIZED_METHOD_TYPE__MAX
|
160
|
+
};
|
161
|
+
|
162
|
+
PACKED_STRUCT_UNALIGNED(struct rb_method_definition_struct {
|
163
|
+
BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS);
|
164
|
+
int alias_count : 28;
|
165
|
+
int complemented_count : 28;
|
166
|
+
|
167
|
+
union {
|
168
|
+
rb_method_iseq_t iseq;
|
169
|
+
rb_method_cfunc_t cfunc;
|
170
|
+
rb_method_attr_t attr;
|
171
|
+
rb_method_alias_t alias;
|
172
|
+
rb_method_refined_t refined;
|
173
|
+
rb_method_bmethod_t bmethod;
|
174
|
+
|
175
|
+
enum method_optimized_type optimize_type;
|
176
|
+
} body;
|
177
|
+
|
178
|
+
ID original_id;
|
179
|
+
});
|
180
|
+
|
181
|
+
typedef struct rb_method_definition_struct rb_method_definition_t;
|
182
|
+
|
183
|
+
#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
|
184
|
+
#define UNDEFINED_REFINED_METHOD_P(def) \
|
185
|
+
((def)->type == VM_METHOD_TYPE_REFINED && \
|
186
|
+
UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me))
|
187
|
+
|
188
|
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi);
|
189
|
+
void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi);
|
190
|
+
void rb_add_refined_method_entry(VALUE refined_class, ID mid);
|
191
|
+
|
192
|
+
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi);
|
193
|
+
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
|
194
|
+
rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
|
195
|
+
|
196
|
+
const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
|
197
|
+
|
198
|
+
const rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
|
199
|
+
const rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
200
|
+
const rb_method_entry_t *rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
|
201
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
202
|
+
const rb_callable_method_entry_t *rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
|
203
|
+
const rb_method_entry_t *rb_resolve_me_location(const rb_method_entry_t *, VALUE[5]);
|
204
|
+
RUBY_SYMBOL_EXPORT_END
|
205
|
+
|
206
|
+
const rb_callable_method_entry_t *rb_callable_method_entry(VALUE klass, ID id);
|
207
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
|
208
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
209
|
+
|
210
|
+
int rb_method_entry_arity(const rb_method_entry_t *me);
|
211
|
+
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
|
212
|
+
st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
|
213
|
+
|
214
|
+
VALUE rb_method_entry_location(const rb_method_entry_t *me);
|
215
|
+
VALUE rb_mod_method_location(VALUE mod, ID id);
|
216
|
+
VALUE rb_obj_method_location(VALUE obj, ID id);
|
217
|
+
|
218
|
+
void rb_free_method_entry(const rb_method_entry_t *me);
|
219
|
+
void rb_sweep_method_entry(void *vm);
|
220
|
+
|
221
|
+
const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
|
222
|
+
const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
|
223
|
+
void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
|
224
|
+
|
225
|
+
void rb_scope_visibility_set(rb_method_visibility_t);
|
226
|
+
|
227
|
+
VALUE rb_unnamed_parameters(int arity);
|
228
|
+
|
229
|
+
#endif /* RUBY_METHOD_H */
|
@@ -0,0 +1,148 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
mjit.h - Interface to MRI method JIT compiler for Ruby's main thread
|
4
|
+
|
5
|
+
Copyright (C) 2017 Vladimir Makarov <vmakarov@redhat.com>.
|
6
|
+
|
7
|
+
**********************************************************************/
|
8
|
+
|
9
|
+
#ifndef RUBY_MJIT_H
|
10
|
+
#define RUBY_MJIT_H 1
|
11
|
+
|
12
|
+
#include "ruby.h"
|
13
|
+
|
14
|
+
#if USE_MJIT
|
15
|
+
|
16
|
+
/* Special address values of a function generated from the
|
17
|
+
corresponding iseq by MJIT: */
|
18
|
+
enum rb_mjit_iseq_func {
|
19
|
+
/* ISEQ was not queued yet for the machine code generation */
|
20
|
+
NOT_ADDED_JIT_ISEQ_FUNC = 0,
|
21
|
+
/* ISEQ is already queued for the machine code generation but the
|
22
|
+
code is not ready yet for the execution */
|
23
|
+
NOT_READY_JIT_ISEQ_FUNC = 1,
|
24
|
+
/* ISEQ included not compilable insn, some internal assertion failed
|
25
|
+
or the unit is unloaded */
|
26
|
+
NOT_COMPILED_JIT_ISEQ_FUNC = 2,
|
27
|
+
/* End mark */
|
28
|
+
LAST_JIT_ISEQ_FUNC = 3
|
29
|
+
};
|
30
|
+
|
31
|
+
/* MJIT options which can be defined on the MRI command line. */
|
32
|
+
struct mjit_options {
|
33
|
+
/* Converted from "jit" feature flag to tell the enablement
|
34
|
+
information to ruby_show_version(). */
|
35
|
+
char on;
|
36
|
+
/* Save temporary files after MRI finish. The temporary files
|
37
|
+
include the pre-compiled header, C code file generated for ISEQ,
|
38
|
+
and the corresponding object file. */
|
39
|
+
char save_temps;
|
40
|
+
/* Print MJIT warnings to stderr. */
|
41
|
+
char warnings;
|
42
|
+
/* Disable compiler optimization and add debug symbols. It can be
|
43
|
+
very slow. */
|
44
|
+
char debug;
|
45
|
+
/* If not 0, all ISeqs are synchronously compiled. For testing. */
|
46
|
+
unsigned int wait;
|
47
|
+
/* Number of calls to trigger JIT compilation. For testing. */
|
48
|
+
unsigned int min_calls;
|
49
|
+
/* Force printing info about MJIT work of level VERBOSE or
|
50
|
+
less. 0=silence, 1=medium, 2=verbose. */
|
51
|
+
int verbose;
|
52
|
+
/* Maximal permitted number of iseq JIT codes in a MJIT memory
|
53
|
+
cache. */
|
54
|
+
int max_cache_size;
|
55
|
+
};
|
56
|
+
|
57
|
+
typedef VALUE (*mjit_func_t)(rb_execution_context_t *, rb_control_frame_t *);
|
58
|
+
|
59
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
60
|
+
RUBY_EXTERN struct mjit_options mjit_opts;
|
61
|
+
RUBY_EXTERN int mjit_call_p;
|
62
|
+
|
63
|
+
extern void mjit_add_iseq_to_process(const rb_iseq_t *iseq);
|
64
|
+
extern VALUE mjit_wait_call(rb_execution_context_t *ec, struct rb_iseq_constant_body *body);
|
65
|
+
RUBY_SYMBOL_EXPORT_END
|
66
|
+
|
67
|
+
extern int mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *funcname, struct rb_call_cache *cc_entries, union iseq_inline_storage_entry *is_entries);
|
68
|
+
extern void mjit_init(struct mjit_options *opts);
|
69
|
+
extern void mjit_postponed_job_register_start_hook(void);
|
70
|
+
extern void mjit_postponed_job_register_finish_hook(void);
|
71
|
+
extern void mjit_gc_start_hook(void);
|
72
|
+
extern void mjit_gc_finish_hook(void);
|
73
|
+
extern void mjit_free_iseq(const rb_iseq_t *iseq);
|
74
|
+
extern void mjit_mark(void);
|
75
|
+
extern struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec);
|
76
|
+
extern void mjit_cont_free(struct mjit_cont *cont);
|
77
|
+
extern void mjit_add_class_serial(rb_serial_t class_serial);
|
78
|
+
extern void mjit_remove_class_serial(rb_serial_t class_serial);
|
79
|
+
|
80
|
+
/* A threshold used to reject long iseqs from JITting as such iseqs
|
81
|
+
takes too much time to be compiled. */
|
82
|
+
#define JIT_ISEQ_SIZE_THRESHOLD 1000
|
83
|
+
|
84
|
+
/* Return TRUE if given ISeq body should be compiled by MJIT */
|
85
|
+
static inline int
|
86
|
+
mjit_target_iseq_p(struct rb_iseq_constant_body *body)
|
87
|
+
{
|
88
|
+
return (body->type == ISEQ_TYPE_METHOD || body->type == ISEQ_TYPE_BLOCK)
|
89
|
+
&& body->iseq_size < JIT_ISEQ_SIZE_THRESHOLD;
|
90
|
+
}
|
91
|
+
|
92
|
+
/* Try to execute the current iseq in ec. Use JIT code if it is ready.
|
93
|
+
If it is not, add ISEQ to the compilation queue and return Qundef. */
|
94
|
+
static inline VALUE
|
95
|
+
mjit_exec(rb_execution_context_t *ec)
|
96
|
+
{
|
97
|
+
const rb_iseq_t *iseq;
|
98
|
+
struct rb_iseq_constant_body *body;
|
99
|
+
long unsigned total_calls;
|
100
|
+
mjit_func_t func;
|
101
|
+
|
102
|
+
if (!mjit_call_p)
|
103
|
+
return Qundef;
|
104
|
+
|
105
|
+
iseq = ec->cfp->iseq;
|
106
|
+
body = iseq->body;
|
107
|
+
total_calls = ++body->total_calls;
|
108
|
+
|
109
|
+
func = body->jit_func;
|
110
|
+
if (UNLIKELY((uintptr_t)func <= (uintptr_t)LAST_JIT_ISEQ_FUNC)) {
|
111
|
+
switch ((enum rb_mjit_iseq_func)func) {
|
112
|
+
case NOT_ADDED_JIT_ISEQ_FUNC:
|
113
|
+
if (total_calls == mjit_opts.min_calls && mjit_target_iseq_p(body)) {
|
114
|
+
mjit_add_iseq_to_process(iseq);
|
115
|
+
if (UNLIKELY(mjit_opts.wait)) {
|
116
|
+
return mjit_wait_call(ec, body);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
return Qundef;
|
120
|
+
case NOT_READY_JIT_ISEQ_FUNC:
|
121
|
+
case NOT_COMPILED_JIT_ISEQ_FUNC:
|
122
|
+
return Qundef;
|
123
|
+
default: /* to avoid warning with LAST_JIT_ISEQ_FUNC */
|
124
|
+
break;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
return func(ec, ec->cfp);
|
129
|
+
}
|
130
|
+
|
131
|
+
void mjit_child_after_fork(void);
|
132
|
+
|
133
|
+
#else /* USE_MJIT */
|
134
|
+
static inline struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec){return NULL;}
|
135
|
+
static inline void mjit_cont_free(struct mjit_cont *cont){}
|
136
|
+
static inline void mjit_postponed_job_register_start_hook(void){}
|
137
|
+
static inline void mjit_postponed_job_register_finish_hook(void){}
|
138
|
+
static inline void mjit_gc_start_hook(void){}
|
139
|
+
static inline void mjit_gc_finish_hook(void){}
|
140
|
+
static inline void mjit_free_iseq(const rb_iseq_t *iseq){}
|
141
|
+
static inline void mjit_mark(void){}
|
142
|
+
static inline void mjit_add_class_serial(rb_serial_t class_serial){}
|
143
|
+
static inline void mjit_remove_class_serial(rb_serial_t class_serial){}
|
144
|
+
static inline VALUE mjit_exec(rb_execution_context_t *ec) { return Qundef; /* unreachable */ }
|
145
|
+
static inline void mjit_child_after_fork(void){}
|
146
|
+
|
147
|
+
#endif /* USE_MJIT */
|
148
|
+
#endif /* RUBY_MJIT_H */
|
@@ -0,0 +1,4226 @@
|
|
1
|
+
/* -*- mode:c; style:ruby; coding: utf-8; indent-tabs-mode: nil -*- */
|
2
|
+
|
3
|
+
/* This is an auto-generated file and is a part of the programming language
|
4
|
+
* Ruby. The person who created a program to generate this file (``I''
|
5
|
+
* hereafter) would like to refrain from defining licensing of this generated
|
6
|
+
* source code.
|
7
|
+
*
|
8
|
+
* This file consist of many small parts of codes copyrighted by each authors,
|
9
|
+
* not only the ``I'' person. Those original authors agree with some
|
10
|
+
* open-source license. I believe that the license we agree is the condition
|
11
|
+
* mentioned in the file COPYING. It states "4. You may modify and include
|
12
|
+
* the part of the software into any other software ...". But the problem is,
|
13
|
+
* the license never makes it clear if such modified parts still remain in the
|
14
|
+
* same license, or not. The fact that we agree with the source code's
|
15
|
+
* licensing terms do not automatically define that of generated ones. This is
|
16
|
+
* the reason why this file is under unclear situation. All that I know is
|
17
|
+
* that above provision guarantees this file to exist.
|
18
|
+
*
|
19
|
+
* Please let me hesitate to declare something about this nuanced contract. I
|
20
|
+
* am not in the position to take over other authors' license to merge into my
|
21
|
+
* one. Changing them to (say) GPLv3 is not doable by myself. Perhaps someday
|
22
|
+
* it might turn out to be okay to say this file is under a license. I wish the
|
23
|
+
* situation would become more clear in the future. */
|
24
|
+
|
25
|
+
/*******************************************************************/
|
26
|
+
/*******************************************************************/
|
27
|
+
/*******************************************************************/
|
28
|
+
/**
|
29
|
+
This file is the main part of compile_insn() in mjit_compile.c.
|
30
|
+
|
31
|
+
----
|
32
|
+
This file is auto generated by insns2vm.rb
|
33
|
+
DO NOT TOUCH!
|
34
|
+
|
35
|
+
If you want to fix something, you must edit "tool/ruby_vm/views/mjit_compile.inc.erb"
|
36
|
+
or tool/insns2vm.rb
|
37
|
+
*/
|
38
|
+
|
39
|
+
switch (insn) {
|
40
|
+
case BIN(nop):
|
41
|
+
fprintf(f, "{\n");
|
42
|
+
{
|
43
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
44
|
+
if (status->local_stack_p) {
|
45
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
46
|
+
}
|
47
|
+
|
48
|
+
if (body->catch_except_p || FALSE) {
|
49
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
50
|
+
pc_moved_p = TRUE;
|
51
|
+
}
|
52
|
+
if (status->local_stack_p) {
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
56
|
+
}
|
57
|
+
fprintf(f, " {\n");
|
58
|
+
fprintf(f, " /* none */\n");
|
59
|
+
fprintf(f, " }\n");
|
60
|
+
b->stack_size += attr_sp_inc_nop();
|
61
|
+
}
|
62
|
+
fprintf(f, "}\n");
|
63
|
+
break;
|
64
|
+
case BIN(getlocal):
|
65
|
+
fprintf(f, "{\n");
|
66
|
+
{
|
67
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
68
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
69
|
+
MAYBE_UNUSED(rb_num_t level) = (rb_num_t)operands[1];
|
70
|
+
if (status->local_stack_p) {
|
71
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
72
|
+
}
|
73
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
74
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
75
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
76
|
+
|
77
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
78
|
+
fprintf(f, "\n");
|
79
|
+
fprintf(f, " level = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
80
|
+
fprintf(f, "\n");
|
81
|
+
if (body->catch_except_p || FALSE) {
|
82
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
83
|
+
pc_moved_p = TRUE;
|
84
|
+
}
|
85
|
+
if (status->local_stack_p) {
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
89
|
+
}
|
90
|
+
fprintf(f, " {\n");
|
91
|
+
fprintf(f, " val = *(vm_get_ep(GET_EP(), level) - idx);\n");
|
92
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_get);\n");
|
93
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);\n");
|
94
|
+
fprintf(f, " }\n");
|
95
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getlocal(idx, level) - 1);
|
96
|
+
b->stack_size += attr_sp_inc_getlocal(idx, level);
|
97
|
+
}
|
98
|
+
fprintf(f, "}\n");
|
99
|
+
break;
|
100
|
+
case BIN(setlocal):
|
101
|
+
fprintf(f, "{\n");
|
102
|
+
{
|
103
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
104
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
105
|
+
MAYBE_UNUSED(rb_num_t level) = (rb_num_t)operands[1];
|
106
|
+
if (status->local_stack_p) {
|
107
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
108
|
+
}
|
109
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
110
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
111
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
112
|
+
|
113
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
114
|
+
fprintf(f, "\n");
|
115
|
+
fprintf(f, " level = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
116
|
+
fprintf(f, "\n");
|
117
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
118
|
+
if (body->catch_except_p || FALSE) {
|
119
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
120
|
+
pc_moved_p = TRUE;
|
121
|
+
}
|
122
|
+
if (status->local_stack_p) {
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
126
|
+
}
|
127
|
+
fprintf(f, " {\n");
|
128
|
+
fprintf(f, " vm_env_write(vm_get_ep(GET_EP(), level), -(int)idx, val);\n");
|
129
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_set);\n");
|
130
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_set_dynamic, level > 0);\n");
|
131
|
+
fprintf(f, " }\n");
|
132
|
+
b->stack_size += attr_sp_inc_setlocal(idx, level);
|
133
|
+
}
|
134
|
+
fprintf(f, "}\n");
|
135
|
+
break;
|
136
|
+
case BIN(getblockparam):
|
137
|
+
fprintf(f, "{\n");
|
138
|
+
{
|
139
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
140
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
141
|
+
MAYBE_UNUSED(rb_num_t level) = (rb_num_t)operands[1];
|
142
|
+
if (status->local_stack_p) {
|
143
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
144
|
+
}
|
145
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
146
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
147
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
148
|
+
|
149
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
150
|
+
fprintf(f, "\n");
|
151
|
+
fprintf(f, " level = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
152
|
+
fprintf(f, "\n");
|
153
|
+
if (body->catch_except_p || FALSE) {
|
154
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
155
|
+
pc_moved_p = TRUE;
|
156
|
+
}
|
157
|
+
if (status->local_stack_p) {
|
158
|
+
}
|
159
|
+
else {
|
160
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
161
|
+
}
|
162
|
+
fprintf(f, " {\n");
|
163
|
+
fprintf(f, " const VALUE *ep = vm_get_ep(GET_EP(), level);\n");
|
164
|
+
fprintf(f, " VM_ASSERT(VM_ENV_LOCAL_P(ep));\n");
|
165
|
+
fprintf(f, "\n");
|
166
|
+
fprintf(f, " if (!VM_ENV_FLAGS(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM)) {\n");
|
167
|
+
fprintf(f, " val = rb_vm_bh_to_procval(ec, VM_ENV_BLOCK_HANDLER(ep));\n");
|
168
|
+
fprintf(f, " vm_env_write(ep, -(int)idx, val);\n");
|
169
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM);\n");
|
170
|
+
fprintf(f, " }\n");
|
171
|
+
fprintf(f, " else {\n");
|
172
|
+
fprintf(f, " val = *(ep - idx);\n");
|
173
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_get);\n");
|
174
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);\n");
|
175
|
+
fprintf(f, " }\n");
|
176
|
+
fprintf(f, " }\n");
|
177
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getblockparam(idx, level) - 1);
|
178
|
+
b->stack_size += attr_sp_inc_getblockparam(idx, level);
|
179
|
+
}
|
180
|
+
fprintf(f, "}\n");
|
181
|
+
break;
|
182
|
+
case BIN(setblockparam):
|
183
|
+
fprintf(f, "{\n");
|
184
|
+
{
|
185
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
186
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
187
|
+
MAYBE_UNUSED(rb_num_t level) = (rb_num_t)operands[1];
|
188
|
+
if (status->local_stack_p) {
|
189
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
190
|
+
}
|
191
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
192
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
193
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
194
|
+
|
195
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
196
|
+
fprintf(f, "\n");
|
197
|
+
fprintf(f, " level = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
198
|
+
fprintf(f, "\n");
|
199
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
200
|
+
if (body->catch_except_p || FALSE) {
|
201
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
202
|
+
pc_moved_p = TRUE;
|
203
|
+
}
|
204
|
+
if (status->local_stack_p) {
|
205
|
+
}
|
206
|
+
else {
|
207
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
208
|
+
}
|
209
|
+
fprintf(f, " {\n");
|
210
|
+
fprintf(f, " const VALUE *ep = vm_get_ep(GET_EP(), level);\n");
|
211
|
+
fprintf(f, " VM_ASSERT(VM_ENV_LOCAL_P(ep));\n");
|
212
|
+
fprintf(f, "\n");
|
213
|
+
fprintf(f, " vm_env_write(ep, -(int)idx, val);\n");
|
214
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_set);\n");
|
215
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_set_dynamic, level > 0);\n");
|
216
|
+
fprintf(f, "\n");
|
217
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM);\n");
|
218
|
+
fprintf(f, " }\n");
|
219
|
+
b->stack_size += attr_sp_inc_setblockparam(idx, level);
|
220
|
+
}
|
221
|
+
fprintf(f, "}\n");
|
222
|
+
break;
|
223
|
+
case BIN(getspecial):
|
224
|
+
fprintf(f, "{\n");
|
225
|
+
{
|
226
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
227
|
+
MAYBE_UNUSED(rb_num_t key) = (rb_num_t)operands[0];
|
228
|
+
MAYBE_UNUSED(rb_num_t type) = (rb_num_t)operands[1];
|
229
|
+
if (status->local_stack_p) {
|
230
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
231
|
+
}
|
232
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
233
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) key, type;\n");
|
234
|
+
|
235
|
+
fprintf(f, " key = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
236
|
+
fprintf(f, "\n");
|
237
|
+
fprintf(f, " type = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
238
|
+
fprintf(f, "\n");
|
239
|
+
if (body->catch_except_p || FALSE) {
|
240
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
241
|
+
pc_moved_p = TRUE;
|
242
|
+
}
|
243
|
+
if (status->local_stack_p) {
|
244
|
+
}
|
245
|
+
else {
|
246
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
247
|
+
}
|
248
|
+
fprintf(f, " {\n");
|
249
|
+
fprintf(f, " val = vm_getspecial(ec, GET_LEP(), key, type);\n");
|
250
|
+
fprintf(f, " }\n");
|
251
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getspecial(key, type) - 1);
|
252
|
+
b->stack_size += attr_sp_inc_getspecial(key, type);
|
253
|
+
}
|
254
|
+
fprintf(f, "}\n");
|
255
|
+
break;
|
256
|
+
case BIN(setspecial):
|
257
|
+
fprintf(f, "{\n");
|
258
|
+
{
|
259
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
260
|
+
MAYBE_UNUSED(rb_num_t key) = (rb_num_t)operands[0];
|
261
|
+
if (status->local_stack_p) {
|
262
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
263
|
+
}
|
264
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj;\n");
|
265
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) key;\n");
|
266
|
+
|
267
|
+
fprintf(f, " key = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
268
|
+
fprintf(f, "\n");
|
269
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
270
|
+
if (body->catch_except_p || FALSE) {
|
271
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
272
|
+
pc_moved_p = TRUE;
|
273
|
+
}
|
274
|
+
if (status->local_stack_p) {
|
275
|
+
}
|
276
|
+
else {
|
277
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
278
|
+
}
|
279
|
+
fprintf(f, " {\n");
|
280
|
+
fprintf(f, " lep_svar_set(ec, GET_LEP(), key, obj);\n");
|
281
|
+
fprintf(f, " }\n");
|
282
|
+
b->stack_size += attr_sp_inc_setspecial(key);
|
283
|
+
}
|
284
|
+
fprintf(f, "}\n");
|
285
|
+
break;
|
286
|
+
case BIN(getinstancevariable):
|
287
|
+
#if OPT_IC_FOR_IVAR
|
288
|
+
{
|
289
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
290
|
+
MAYBE_UNUSED(IC ic) = (IC)operands[1];
|
291
|
+
IC ic_copy = &(status->is_entries + ((union iseq_inline_storage_entry *)ic - body->is_entries))->cache;
|
292
|
+
if (ic_copy->ic_serial) {
|
293
|
+
fprintf(f, "{\n");
|
294
|
+
fprintf(f, " VALUE obj = GET_SELF();\n");
|
295
|
+
fprintf(f, " const rb_serial_t ic_serial = (rb_serial_t)%"PRI_SERIALT_PREFIX"u;\n", ic_copy->ic_serial);
|
296
|
+
fprintf(f, " const st_index_t index = %"PRIuSIZE";\n", ic_copy->ic_value.index);
|
297
|
+
fprintf(f, " VALUE val;\n");
|
298
|
+
fprintf(f, " if (LIKELY(RB_TYPE_P(obj, T_OBJECT) && ic_serial == RCLASS_SERIAL(RBASIC(obj)->klass) && index < ROBJECT_NUMIV(obj) && (val = ROBJECT_IVPTR(obj)[index]) != Qundef)) {\n");
|
299
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size);
|
300
|
+
fprintf(f, " }\n");
|
301
|
+
fprintf(f, " else {\n");
|
302
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
303
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
304
|
+
fprintf(f, " goto cancel;\n");
|
305
|
+
fprintf(f, " }\n");
|
306
|
+
|
307
|
+
b->stack_size += attr_sp_inc_getinstancevariable(id, ic);
|
308
|
+
fprintf(f, "}\n");
|
309
|
+
break;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
#endif /* OPT_IC_FOR_IVAR */
|
313
|
+
fprintf(f, "{\n");
|
314
|
+
{
|
315
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
316
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
317
|
+
MAYBE_UNUSED(IC ic) = (IC)operands[1];
|
318
|
+
if (status->local_stack_p) {
|
319
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
320
|
+
}
|
321
|
+
fprintf(f, " MAYBE_UNUSED(IC) ic;\n");
|
322
|
+
fprintf(f, " MAYBE_UNUSED(ID) id;\n");
|
323
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
324
|
+
|
325
|
+
fprintf(f, " id = (ID)0x%"PRIxVALUE";", operands[0]);
|
326
|
+
comment_id(f, (ID)operands[0]);
|
327
|
+
fprintf(f, "\n");
|
328
|
+
fprintf(f, " ic = (IC)0x%"PRIxVALUE";", operands[1]);
|
329
|
+
fprintf(f, "\n");
|
330
|
+
if (body->catch_except_p || TRUE) {
|
331
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
332
|
+
pc_moved_p = TRUE;
|
333
|
+
}
|
334
|
+
if (status->local_stack_p) {
|
335
|
+
}
|
336
|
+
else {
|
337
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
338
|
+
}
|
339
|
+
fprintf(f, " {\n");
|
340
|
+
fprintf(f, " val = vm_getinstancevariable(GET_SELF(), id, ic);\n");
|
341
|
+
fprintf(f, " }\n");
|
342
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getinstancevariable(id, ic) - 1);
|
343
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
344
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_getinstancevariable(id, ic) + 1);
|
345
|
+
if (!pc_moved_p) {
|
346
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
347
|
+
}
|
348
|
+
fprintf(f, " goto cancel;\n");
|
349
|
+
fprintf(f, " }\n");
|
350
|
+
b->stack_size += attr_sp_inc_getinstancevariable(id, ic);
|
351
|
+
}
|
352
|
+
fprintf(f, "}\n");
|
353
|
+
break;
|
354
|
+
case BIN(setinstancevariable):
|
355
|
+
#if OPT_IC_FOR_IVAR
|
356
|
+
{
|
357
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
358
|
+
MAYBE_UNUSED(IC ic) = (IC)operands[1];
|
359
|
+
IC ic_copy = &(status->is_entries + ((union iseq_inline_storage_entry *)ic - body->is_entries))->cache;
|
360
|
+
if (ic_copy->ic_serial) {
|
361
|
+
fprintf(f, "{\n");
|
362
|
+
fprintf(f, " VALUE obj = GET_SELF();\n");
|
363
|
+
fprintf(f, " const rb_serial_t ic_serial = (rb_serial_t)%"PRI_SERIALT_PREFIX"u;\n", ic_copy->ic_serial);
|
364
|
+
fprintf(f, " const st_index_t index = %"PRIuSIZE";\n", ic_copy->ic_value.index);
|
365
|
+
fprintf(f, " VALUE val = stack[%d];\n", b->stack_size - 1);
|
366
|
+
fprintf(f, " if (LIKELY(RB_TYPE_P(obj, T_OBJECT) && ic_serial == RCLASS_SERIAL(RBASIC(obj)->klass) && index < ROBJECT_NUMIV(obj))) {\n");
|
367
|
+
fprintf(f, " VALUE *ptr = ROBJECT_IVPTR(obj);\n");
|
368
|
+
fprintf(f, " RB_OBJ_WRITE(obj, &ptr[index], val);\n");
|
369
|
+
fprintf(f, " }\n");
|
370
|
+
fprintf(f, " else {\n");
|
371
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
372
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
373
|
+
fprintf(f, " goto cancel;\n");
|
374
|
+
fprintf(f, " }\n");
|
375
|
+
|
376
|
+
b->stack_size += attr_sp_inc_setinstancevariable(id, ic);
|
377
|
+
fprintf(f, "}\n");
|
378
|
+
break;
|
379
|
+
}
|
380
|
+
}
|
381
|
+
#endif /* OPT_IC_FOR_IVAR */
|
382
|
+
fprintf(f, "{\n");
|
383
|
+
{
|
384
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
385
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
386
|
+
MAYBE_UNUSED(IC ic) = (IC)operands[1];
|
387
|
+
if (status->local_stack_p) {
|
388
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
389
|
+
}
|
390
|
+
fprintf(f, " MAYBE_UNUSED(IC) ic;\n");
|
391
|
+
fprintf(f, " MAYBE_UNUSED(ID) id;\n");
|
392
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
393
|
+
|
394
|
+
fprintf(f, " id = (ID)0x%"PRIxVALUE";", operands[0]);
|
395
|
+
comment_id(f, (ID)operands[0]);
|
396
|
+
fprintf(f, "\n");
|
397
|
+
fprintf(f, " ic = (IC)0x%"PRIxVALUE";", operands[1]);
|
398
|
+
fprintf(f, "\n");
|
399
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
400
|
+
if (body->catch_except_p || FALSE) {
|
401
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
402
|
+
pc_moved_p = TRUE;
|
403
|
+
}
|
404
|
+
if (status->local_stack_p) {
|
405
|
+
}
|
406
|
+
else {
|
407
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
408
|
+
}
|
409
|
+
fprintf(f, " {\n");
|
410
|
+
fprintf(f, " vm_setinstancevariable(GET_SELF(), id, val, ic);\n");
|
411
|
+
fprintf(f, " }\n");
|
412
|
+
b->stack_size += attr_sp_inc_setinstancevariable(id, ic);
|
413
|
+
}
|
414
|
+
fprintf(f, "}\n");
|
415
|
+
break;
|
416
|
+
case BIN(getclassvariable):
|
417
|
+
fprintf(f, "{\n");
|
418
|
+
{
|
419
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
420
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
421
|
+
if (status->local_stack_p) {
|
422
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
423
|
+
}
|
424
|
+
fprintf(f, " MAYBE_UNUSED(ID) id;\n");
|
425
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
426
|
+
|
427
|
+
fprintf(f, " id = (ID)0x%"PRIxVALUE";", operands[0]);
|
428
|
+
comment_id(f, (ID)operands[0]);
|
429
|
+
fprintf(f, "\n");
|
430
|
+
if (body->catch_except_p || TRUE) {
|
431
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
432
|
+
pc_moved_p = TRUE;
|
433
|
+
}
|
434
|
+
if (status->local_stack_p) {
|
435
|
+
}
|
436
|
+
else {
|
437
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
438
|
+
}
|
439
|
+
fprintf(f, " {\n");
|
440
|
+
fprintf(f, " val = rb_cvar_get(vm_get_cvar_base(rb_vm_get_cref(GET_EP()), GET_CFP()), id);\n");
|
441
|
+
fprintf(f, " }\n");
|
442
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getclassvariable(id) - 1);
|
443
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
444
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_getclassvariable(id) + 1);
|
445
|
+
if (!pc_moved_p) {
|
446
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
447
|
+
}
|
448
|
+
fprintf(f, " goto cancel;\n");
|
449
|
+
fprintf(f, " }\n");
|
450
|
+
b->stack_size += attr_sp_inc_getclassvariable(id);
|
451
|
+
}
|
452
|
+
fprintf(f, "}\n");
|
453
|
+
break;
|
454
|
+
case BIN(setclassvariable):
|
455
|
+
fprintf(f, "{\n");
|
456
|
+
{
|
457
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
458
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
459
|
+
if (status->local_stack_p) {
|
460
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
461
|
+
}
|
462
|
+
fprintf(f, " MAYBE_UNUSED(ID) id;\n");
|
463
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
464
|
+
|
465
|
+
fprintf(f, " id = (ID)0x%"PRIxVALUE";", operands[0]);
|
466
|
+
comment_id(f, (ID)operands[0]);
|
467
|
+
fprintf(f, "\n");
|
468
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
469
|
+
if (body->catch_except_p || TRUE) {
|
470
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
471
|
+
pc_moved_p = TRUE;
|
472
|
+
}
|
473
|
+
if (status->local_stack_p) {
|
474
|
+
}
|
475
|
+
else {
|
476
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
477
|
+
}
|
478
|
+
fprintf(f, " {\n");
|
479
|
+
fprintf(f, " vm_ensure_not_refinement_module(GET_SELF());\n");
|
480
|
+
fprintf(f, " rb_cvar_set(vm_get_cvar_base(rb_vm_get_cref(GET_EP()), GET_CFP()), id, val);\n");
|
481
|
+
fprintf(f, " }\n");
|
482
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
483
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_setclassvariable(id) + 1);
|
484
|
+
if (!pc_moved_p) {
|
485
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
486
|
+
}
|
487
|
+
fprintf(f, " goto cancel;\n");
|
488
|
+
fprintf(f, " }\n");
|
489
|
+
b->stack_size += attr_sp_inc_setclassvariable(id);
|
490
|
+
}
|
491
|
+
fprintf(f, "}\n");
|
492
|
+
break;
|
493
|
+
case BIN(getconstant):
|
494
|
+
fprintf(f, "{\n");
|
495
|
+
{
|
496
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
497
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
498
|
+
if (status->local_stack_p) {
|
499
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
500
|
+
}
|
501
|
+
fprintf(f, " MAYBE_UNUSED(ID) id;\n");
|
502
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) klass, val;\n");
|
503
|
+
|
504
|
+
fprintf(f, " id = (ID)0x%"PRIxVALUE";", operands[0]);
|
505
|
+
comment_id(f, (ID)operands[0]);
|
506
|
+
fprintf(f, "\n");
|
507
|
+
fprintf(f, " klass = stack[%d];\n", b->stack_size - 1);
|
508
|
+
if (body->catch_except_p || TRUE) {
|
509
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
510
|
+
pc_moved_p = TRUE;
|
511
|
+
}
|
512
|
+
if (status->local_stack_p) {
|
513
|
+
}
|
514
|
+
else {
|
515
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
516
|
+
}
|
517
|
+
fprintf(f, " {\n");
|
518
|
+
fprintf(f, " val = vm_get_ev_const(ec, klass, id, 0);\n");
|
519
|
+
fprintf(f, " }\n");
|
520
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getconstant(id) - 1);
|
521
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
522
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_getconstant(id) + 1);
|
523
|
+
if (!pc_moved_p) {
|
524
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
525
|
+
}
|
526
|
+
fprintf(f, " goto cancel;\n");
|
527
|
+
fprintf(f, " }\n");
|
528
|
+
b->stack_size += attr_sp_inc_getconstant(id);
|
529
|
+
}
|
530
|
+
fprintf(f, "}\n");
|
531
|
+
break;
|
532
|
+
case BIN(setconstant):
|
533
|
+
fprintf(f, "{\n");
|
534
|
+
{
|
535
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
536
|
+
MAYBE_UNUSED(ID id) = (ID)operands[0];
|
537
|
+
if (status->local_stack_p) {
|
538
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
539
|
+
}
|
540
|
+
fprintf(f, " MAYBE_UNUSED(ID) id;\n");
|
541
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) cbase, val;\n");
|
542
|
+
|
543
|
+
fprintf(f, " id = (ID)0x%"PRIxVALUE";", operands[0]);
|
544
|
+
comment_id(f, (ID)operands[0]);
|
545
|
+
fprintf(f, "\n");
|
546
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 2);
|
547
|
+
fprintf(f, " cbase = stack[%d];\n", b->stack_size - 1);
|
548
|
+
if (body->catch_except_p || TRUE) {
|
549
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
550
|
+
pc_moved_p = TRUE;
|
551
|
+
}
|
552
|
+
if (status->local_stack_p) {
|
553
|
+
}
|
554
|
+
else {
|
555
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
556
|
+
}
|
557
|
+
fprintf(f, " {\n");
|
558
|
+
fprintf(f, " vm_check_if_namespace(cbase);\n");
|
559
|
+
fprintf(f, " vm_ensure_not_refinement_module(GET_SELF());\n");
|
560
|
+
fprintf(f, " rb_const_set(cbase, id, val);\n");
|
561
|
+
fprintf(f, " }\n");
|
562
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
563
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_setconstant(id) + 1);
|
564
|
+
if (!pc_moved_p) {
|
565
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
566
|
+
}
|
567
|
+
fprintf(f, " goto cancel;\n");
|
568
|
+
fprintf(f, " }\n");
|
569
|
+
b->stack_size += attr_sp_inc_setconstant(id);
|
570
|
+
}
|
571
|
+
fprintf(f, "}\n");
|
572
|
+
break;
|
573
|
+
case BIN(getglobal):
|
574
|
+
fprintf(f, "{\n");
|
575
|
+
{
|
576
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
577
|
+
MAYBE_UNUSED(GENTRY entry) = (GENTRY)operands[0];
|
578
|
+
if (status->local_stack_p) {
|
579
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
580
|
+
}
|
581
|
+
fprintf(f, " MAYBE_UNUSED(GENTRY) entry;\n");
|
582
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
583
|
+
|
584
|
+
fprintf(f, " entry = (GENTRY)0x%"PRIxVALUE";", operands[0]);
|
585
|
+
fprintf(f, "\n");
|
586
|
+
if (body->catch_except_p || TRUE) {
|
587
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
588
|
+
pc_moved_p = TRUE;
|
589
|
+
}
|
590
|
+
if (status->local_stack_p) {
|
591
|
+
}
|
592
|
+
else {
|
593
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
594
|
+
}
|
595
|
+
fprintf(f, " {\n");
|
596
|
+
fprintf(f, " val = GET_GLOBAL((VALUE)entry);\n");
|
597
|
+
fprintf(f, " }\n");
|
598
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getglobal(entry) - 1);
|
599
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
600
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_getglobal(entry) + 1);
|
601
|
+
if (!pc_moved_p) {
|
602
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
603
|
+
}
|
604
|
+
fprintf(f, " goto cancel;\n");
|
605
|
+
fprintf(f, " }\n");
|
606
|
+
b->stack_size += attr_sp_inc_getglobal(entry);
|
607
|
+
}
|
608
|
+
fprintf(f, "}\n");
|
609
|
+
break;
|
610
|
+
case BIN(setglobal):
|
611
|
+
fprintf(f, "{\n");
|
612
|
+
{
|
613
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
614
|
+
MAYBE_UNUSED(GENTRY entry) = (GENTRY)operands[0];
|
615
|
+
if (status->local_stack_p) {
|
616
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
617
|
+
}
|
618
|
+
fprintf(f, " MAYBE_UNUSED(GENTRY) entry;\n");
|
619
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
620
|
+
|
621
|
+
fprintf(f, " entry = (GENTRY)0x%"PRIxVALUE";", operands[0]);
|
622
|
+
fprintf(f, "\n");
|
623
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
624
|
+
if (body->catch_except_p || TRUE) {
|
625
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
626
|
+
pc_moved_p = TRUE;
|
627
|
+
}
|
628
|
+
if (status->local_stack_p) {
|
629
|
+
}
|
630
|
+
else {
|
631
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
632
|
+
}
|
633
|
+
fprintf(f, " {\n");
|
634
|
+
fprintf(f, " SET_GLOBAL((VALUE)entry, val);\n");
|
635
|
+
fprintf(f, " }\n");
|
636
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
637
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_setglobal(entry) + 1);
|
638
|
+
if (!pc_moved_p) {
|
639
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
640
|
+
}
|
641
|
+
fprintf(f, " goto cancel;\n");
|
642
|
+
fprintf(f, " }\n");
|
643
|
+
b->stack_size += attr_sp_inc_setglobal(entry);
|
644
|
+
}
|
645
|
+
fprintf(f, "}\n");
|
646
|
+
break;
|
647
|
+
case BIN(putnil):
|
648
|
+
fprintf(f, "{\n");
|
649
|
+
{
|
650
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
651
|
+
if (status->local_stack_p) {
|
652
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
653
|
+
}
|
654
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
655
|
+
|
656
|
+
if (body->catch_except_p || FALSE) {
|
657
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
658
|
+
pc_moved_p = TRUE;
|
659
|
+
}
|
660
|
+
if (status->local_stack_p) {
|
661
|
+
}
|
662
|
+
else {
|
663
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
664
|
+
}
|
665
|
+
fprintf(f, " {\n");
|
666
|
+
fprintf(f, " val = Qnil;\n");
|
667
|
+
fprintf(f, " }\n");
|
668
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putnil() - 1);
|
669
|
+
b->stack_size += attr_sp_inc_putnil();
|
670
|
+
}
|
671
|
+
fprintf(f, "}\n");
|
672
|
+
break;
|
673
|
+
case BIN(putself):
|
674
|
+
fprintf(f, "{\n");
|
675
|
+
{
|
676
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
677
|
+
if (status->local_stack_p) {
|
678
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
679
|
+
}
|
680
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
681
|
+
|
682
|
+
if (body->catch_except_p || FALSE) {
|
683
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
684
|
+
pc_moved_p = TRUE;
|
685
|
+
}
|
686
|
+
if (status->local_stack_p) {
|
687
|
+
}
|
688
|
+
else {
|
689
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
690
|
+
}
|
691
|
+
fprintf(f, " {\n");
|
692
|
+
fprintf(f, " val = GET_SELF();\n");
|
693
|
+
fprintf(f, " }\n");
|
694
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putself() - 1);
|
695
|
+
b->stack_size += attr_sp_inc_putself();
|
696
|
+
}
|
697
|
+
fprintf(f, "}\n");
|
698
|
+
break;
|
699
|
+
case BIN(putobject):
|
700
|
+
fprintf(f, "{\n");
|
701
|
+
{
|
702
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
703
|
+
MAYBE_UNUSED(VALUE val) = (VALUE)operands[0];
|
704
|
+
if (status->local_stack_p) {
|
705
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
706
|
+
}
|
707
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
708
|
+
|
709
|
+
fprintf(f, " val = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
710
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
711
|
+
fprintf(f, "\n");
|
712
|
+
if (body->catch_except_p || FALSE) {
|
713
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
714
|
+
pc_moved_p = TRUE;
|
715
|
+
}
|
716
|
+
if (status->local_stack_p) {
|
717
|
+
}
|
718
|
+
else {
|
719
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
720
|
+
}
|
721
|
+
fprintf(f, " {\n");
|
722
|
+
fprintf(f, " /* */\n");
|
723
|
+
fprintf(f, " }\n");
|
724
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putobject(val) - 1);
|
725
|
+
b->stack_size += attr_sp_inc_putobject(val);
|
726
|
+
}
|
727
|
+
fprintf(f, "}\n");
|
728
|
+
break;
|
729
|
+
case BIN(putspecialobject):
|
730
|
+
fprintf(f, "{\n");
|
731
|
+
{
|
732
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
733
|
+
MAYBE_UNUSED(rb_num_t value_type) = (rb_num_t)operands[0];
|
734
|
+
if (status->local_stack_p) {
|
735
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
736
|
+
}
|
737
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
738
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) value_type;\n");
|
739
|
+
|
740
|
+
fprintf(f, " value_type = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
741
|
+
fprintf(f, "\n");
|
742
|
+
if (body->catch_except_p || FALSE) {
|
743
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
744
|
+
pc_moved_p = TRUE;
|
745
|
+
}
|
746
|
+
if (status->local_stack_p) {
|
747
|
+
}
|
748
|
+
else {
|
749
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
750
|
+
}
|
751
|
+
fprintf(f, " {\n");
|
752
|
+
fprintf(f, " enum vm_special_object_type type;\n");
|
753
|
+
fprintf(f, "\n");
|
754
|
+
fprintf(f, " type = (enum vm_special_object_type)value_type;\n");
|
755
|
+
fprintf(f, " val = vm_get_special_object(GET_EP(), type);\n");
|
756
|
+
fprintf(f, " }\n");
|
757
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putspecialobject(value_type) - 1);
|
758
|
+
b->stack_size += attr_sp_inc_putspecialobject(value_type);
|
759
|
+
}
|
760
|
+
fprintf(f, "}\n");
|
761
|
+
break;
|
762
|
+
case BIN(putiseq):
|
763
|
+
fprintf(f, "{\n");
|
764
|
+
{
|
765
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
766
|
+
MAYBE_UNUSED(ISEQ iseq) = (ISEQ)operands[0];
|
767
|
+
if (status->local_stack_p) {
|
768
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
769
|
+
}
|
770
|
+
fprintf(f, " MAYBE_UNUSED(ISEQ) iseq;\n");
|
771
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ret;\n");
|
772
|
+
|
773
|
+
fprintf(f, " iseq = (ISEQ)0x%"PRIxVALUE";", operands[0]);
|
774
|
+
fprintf(f, "\n");
|
775
|
+
if (body->catch_except_p || FALSE) {
|
776
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
777
|
+
pc_moved_p = TRUE;
|
778
|
+
}
|
779
|
+
if (status->local_stack_p) {
|
780
|
+
}
|
781
|
+
else {
|
782
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
783
|
+
}
|
784
|
+
fprintf(f, " {\n");
|
785
|
+
fprintf(f, " ret = (VALUE)iseq;\n");
|
786
|
+
fprintf(f, " }\n");
|
787
|
+
fprintf(f, " stack[%d] = ret;\n", b->stack_size + (int)attr_sp_inc_putiseq(iseq) - 1);
|
788
|
+
b->stack_size += attr_sp_inc_putiseq(iseq);
|
789
|
+
}
|
790
|
+
fprintf(f, "}\n");
|
791
|
+
break;
|
792
|
+
case BIN(putstring):
|
793
|
+
fprintf(f, "{\n");
|
794
|
+
{
|
795
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
796
|
+
MAYBE_UNUSED(VALUE str) = (VALUE)operands[0];
|
797
|
+
if (status->local_stack_p) {
|
798
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
799
|
+
}
|
800
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) str, val;\n");
|
801
|
+
|
802
|
+
fprintf(f, " str = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
803
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
804
|
+
fprintf(f, "\n");
|
805
|
+
if (body->catch_except_p || FALSE) {
|
806
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
807
|
+
pc_moved_p = TRUE;
|
808
|
+
}
|
809
|
+
if (status->local_stack_p) {
|
810
|
+
}
|
811
|
+
else {
|
812
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
813
|
+
}
|
814
|
+
fprintf(f, " {\n");
|
815
|
+
fprintf(f, " val = rb_str_resurrect(str);\n");
|
816
|
+
fprintf(f, " }\n");
|
817
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putstring(str) - 1);
|
818
|
+
b->stack_size += attr_sp_inc_putstring(str);
|
819
|
+
}
|
820
|
+
fprintf(f, "}\n");
|
821
|
+
break;
|
822
|
+
case BIN(concatstrings):
|
823
|
+
fprintf(f, "{\n");
|
824
|
+
{
|
825
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
826
|
+
MAYBE_UNUSED(rb_num_t num) = (rb_num_t)operands[0];
|
827
|
+
if (status->local_stack_p) {
|
828
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
829
|
+
}
|
830
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
831
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) num;\n");
|
832
|
+
|
833
|
+
fprintf(f, " num = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
834
|
+
fprintf(f, "\n");
|
835
|
+
if (body->catch_except_p || FALSE) {
|
836
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
837
|
+
pc_moved_p = TRUE;
|
838
|
+
}
|
839
|
+
if (status->local_stack_p) {
|
840
|
+
}
|
841
|
+
else {
|
842
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
843
|
+
}
|
844
|
+
fprintf(f, " {\n");
|
845
|
+
fprintf(f, " val = rb_str_concat_literals(num, %s);\n",
|
846
|
+
(status->local_stack_p ? "stack + (stack_size - (num))" : "STACK_ADDR_FROM_TOP(num)"));
|
847
|
+
fprintf(f, " }\n");
|
848
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_concatstrings(num) - 1);
|
849
|
+
b->stack_size += attr_sp_inc_concatstrings(num);
|
850
|
+
}
|
851
|
+
fprintf(f, "}\n");
|
852
|
+
break;
|
853
|
+
case BIN(tostring):
|
854
|
+
fprintf(f, "{\n");
|
855
|
+
{
|
856
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
857
|
+
if (status->local_stack_p) {
|
858
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
859
|
+
}
|
860
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) str, val;\n");
|
861
|
+
|
862
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 2);
|
863
|
+
fprintf(f, " str = stack[%d];\n", b->stack_size - 1);
|
864
|
+
if (body->catch_except_p || FALSE) {
|
865
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
866
|
+
pc_moved_p = TRUE;
|
867
|
+
}
|
868
|
+
if (status->local_stack_p) {
|
869
|
+
}
|
870
|
+
else {
|
871
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
872
|
+
}
|
873
|
+
fprintf(f, " {\n");
|
874
|
+
fprintf(f, " val = rb_obj_as_string_result(str, val);\n");
|
875
|
+
fprintf(f, " }\n");
|
876
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_tostring() - 1);
|
877
|
+
b->stack_size += attr_sp_inc_tostring();
|
878
|
+
}
|
879
|
+
fprintf(f, "}\n");
|
880
|
+
break;
|
881
|
+
case BIN(freezestring):
|
882
|
+
fprintf(f, "{\n");
|
883
|
+
{
|
884
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
885
|
+
MAYBE_UNUSED(VALUE debug_info) = (VALUE)operands[0];
|
886
|
+
if (status->local_stack_p) {
|
887
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
888
|
+
}
|
889
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) debug_info, str;\n");
|
890
|
+
|
891
|
+
fprintf(f, " debug_info = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
892
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
893
|
+
fprintf(f, "\n");
|
894
|
+
fprintf(f, " str = stack[%d];\n", b->stack_size - 1);
|
895
|
+
if (body->catch_except_p || FALSE) {
|
896
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
897
|
+
pc_moved_p = TRUE;
|
898
|
+
}
|
899
|
+
if (status->local_stack_p) {
|
900
|
+
}
|
901
|
+
else {
|
902
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
903
|
+
}
|
904
|
+
fprintf(f, " {\n");
|
905
|
+
fprintf(f, " vm_freezestring(str, debug_info);\n");
|
906
|
+
fprintf(f, " }\n");
|
907
|
+
fprintf(f, " stack[%d] = str;\n", b->stack_size + (int)attr_sp_inc_freezestring(debug_info) - 1);
|
908
|
+
b->stack_size += attr_sp_inc_freezestring(debug_info);
|
909
|
+
}
|
910
|
+
fprintf(f, "}\n");
|
911
|
+
break;
|
912
|
+
case BIN(toregexp):
|
913
|
+
fprintf(f, "{\n");
|
914
|
+
{
|
915
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
916
|
+
MAYBE_UNUSED(rb_num_t opt) = (rb_num_t)operands[0];
|
917
|
+
MAYBE_UNUSED(rb_num_t cnt) = (rb_num_t)operands[1];
|
918
|
+
if (status->local_stack_p) {
|
919
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
920
|
+
}
|
921
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
922
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) cnt, opt;\n");
|
923
|
+
|
924
|
+
fprintf(f, " opt = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
925
|
+
fprintf(f, "\n");
|
926
|
+
fprintf(f, " cnt = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
927
|
+
fprintf(f, "\n");
|
928
|
+
if (body->catch_except_p || FALSE) {
|
929
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
930
|
+
pc_moved_p = TRUE;
|
931
|
+
}
|
932
|
+
if (status->local_stack_p) {
|
933
|
+
}
|
934
|
+
else {
|
935
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
936
|
+
}
|
937
|
+
fprintf(f, " {\n");
|
938
|
+
fprintf(f, " const VALUE ary = rb_ary_tmp_new_from_values(0, cnt, %s);\n",
|
939
|
+
(status->local_stack_p ? "stack + (stack_size - (cnt))" : "STACK_ADDR_FROM_TOP(cnt)"));
|
940
|
+
fprintf(f, " val = rb_reg_new_ary(ary, (int)opt);\n");
|
941
|
+
fprintf(f, " rb_ary_clear(ary);\n");
|
942
|
+
fprintf(f, " }\n");
|
943
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_toregexp(opt, cnt) - 1);
|
944
|
+
b->stack_size += attr_sp_inc_toregexp(opt, cnt);
|
945
|
+
}
|
946
|
+
fprintf(f, "}\n");
|
947
|
+
break;
|
948
|
+
case BIN(intern):
|
949
|
+
fprintf(f, "{\n");
|
950
|
+
{
|
951
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
952
|
+
if (status->local_stack_p) {
|
953
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
954
|
+
}
|
955
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) str, sym;\n");
|
956
|
+
|
957
|
+
fprintf(f, " str = stack[%d];\n", b->stack_size - 1);
|
958
|
+
if (body->catch_except_p || FALSE) {
|
959
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
960
|
+
pc_moved_p = TRUE;
|
961
|
+
}
|
962
|
+
if (status->local_stack_p) {
|
963
|
+
}
|
964
|
+
else {
|
965
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
966
|
+
}
|
967
|
+
fprintf(f, " {\n");
|
968
|
+
fprintf(f, " sym = rb_str_intern(str);\n");
|
969
|
+
fprintf(f, " }\n");
|
970
|
+
fprintf(f, " stack[%d] = sym;\n", b->stack_size + (int)attr_sp_inc_intern() - 1);
|
971
|
+
b->stack_size += attr_sp_inc_intern();
|
972
|
+
}
|
973
|
+
fprintf(f, "}\n");
|
974
|
+
break;
|
975
|
+
case BIN(newarray):
|
976
|
+
fprintf(f, "{\n");
|
977
|
+
{
|
978
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
979
|
+
MAYBE_UNUSED(rb_num_t num) = (rb_num_t)operands[0];
|
980
|
+
if (status->local_stack_p) {
|
981
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
982
|
+
}
|
983
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
984
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) num;\n");
|
985
|
+
|
986
|
+
fprintf(f, " num = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
987
|
+
fprintf(f, "\n");
|
988
|
+
if (body->catch_except_p || FALSE) {
|
989
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
990
|
+
pc_moved_p = TRUE;
|
991
|
+
}
|
992
|
+
if (status->local_stack_p) {
|
993
|
+
}
|
994
|
+
else {
|
995
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
996
|
+
}
|
997
|
+
fprintf(f, " {\n");
|
998
|
+
fprintf(f, " val = rb_ary_new4(num, %s);\n",
|
999
|
+
(status->local_stack_p ? "stack + (stack_size - (num))" : "STACK_ADDR_FROM_TOP(num)"));
|
1000
|
+
fprintf(f, " }\n");
|
1001
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_newarray(num) - 1);
|
1002
|
+
b->stack_size += attr_sp_inc_newarray(num);
|
1003
|
+
}
|
1004
|
+
fprintf(f, "}\n");
|
1005
|
+
break;
|
1006
|
+
case BIN(duparray):
|
1007
|
+
fprintf(f, "{\n");
|
1008
|
+
{
|
1009
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1010
|
+
MAYBE_UNUSED(VALUE ary) = (VALUE)operands[0];
|
1011
|
+
if (status->local_stack_p) {
|
1012
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1013
|
+
}
|
1014
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ary, val;\n");
|
1015
|
+
|
1016
|
+
fprintf(f, " ary = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
1017
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
1018
|
+
fprintf(f, "\n");
|
1019
|
+
if (body->catch_except_p || FALSE) {
|
1020
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1021
|
+
pc_moved_p = TRUE;
|
1022
|
+
}
|
1023
|
+
if (status->local_stack_p) {
|
1024
|
+
}
|
1025
|
+
else {
|
1026
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1027
|
+
}
|
1028
|
+
fprintf(f, " {\n");
|
1029
|
+
fprintf(f, " RUBY_DTRACE_CREATE_HOOK(ARRAY, RARRAY_LEN(ary));\n");
|
1030
|
+
fprintf(f, " val = rb_ary_resurrect(ary);\n");
|
1031
|
+
fprintf(f, " }\n");
|
1032
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_duparray(ary) - 1);
|
1033
|
+
b->stack_size += attr_sp_inc_duparray(ary);
|
1034
|
+
}
|
1035
|
+
fprintf(f, "}\n");
|
1036
|
+
break;
|
1037
|
+
case BIN(duphash):
|
1038
|
+
fprintf(f, "{\n");
|
1039
|
+
{
|
1040
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1041
|
+
MAYBE_UNUSED(VALUE hash) = (VALUE)operands[0];
|
1042
|
+
if (status->local_stack_p) {
|
1043
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1044
|
+
}
|
1045
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) hash, val;\n");
|
1046
|
+
|
1047
|
+
fprintf(f, " hash = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
1048
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
1049
|
+
fprintf(f, "\n");
|
1050
|
+
if (body->catch_except_p || FALSE) {
|
1051
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1052
|
+
pc_moved_p = TRUE;
|
1053
|
+
}
|
1054
|
+
if (status->local_stack_p) {
|
1055
|
+
}
|
1056
|
+
else {
|
1057
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1058
|
+
}
|
1059
|
+
fprintf(f, " {\n");
|
1060
|
+
fprintf(f, " RUBY_DTRACE_CREATE_HOOK(HASH, RHASH_SIZE(hash) << 1);\n");
|
1061
|
+
fprintf(f, " val = rb_hash_resurrect(hash);\n");
|
1062
|
+
fprintf(f, " }\n");
|
1063
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_duphash(hash) - 1);
|
1064
|
+
b->stack_size += attr_sp_inc_duphash(hash);
|
1065
|
+
}
|
1066
|
+
fprintf(f, "}\n");
|
1067
|
+
break;
|
1068
|
+
case BIN(expandarray):
|
1069
|
+
fprintf(f, "{\n");
|
1070
|
+
{
|
1071
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1072
|
+
MAYBE_UNUSED(rb_num_t num) = (rb_num_t)operands[0];
|
1073
|
+
MAYBE_UNUSED(rb_num_t flag) = (rb_num_t)operands[1];
|
1074
|
+
if (status->local_stack_p) {
|
1075
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1076
|
+
}
|
1077
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ary;\n");
|
1078
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) flag, num;\n");
|
1079
|
+
|
1080
|
+
fprintf(f, " num = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1081
|
+
fprintf(f, "\n");
|
1082
|
+
fprintf(f, " flag = (rb_num_t)0x%"PRIxVALUE";", operands[1]);
|
1083
|
+
fprintf(f, "\n");
|
1084
|
+
fprintf(f, " ary = stack[%d];\n", b->stack_size - 1);
|
1085
|
+
if (body->catch_except_p || TRUE) {
|
1086
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1087
|
+
pc_moved_p = TRUE;
|
1088
|
+
}
|
1089
|
+
if (status->local_stack_p) {
|
1090
|
+
}
|
1091
|
+
else {
|
1092
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1093
|
+
}
|
1094
|
+
fprintf(f, " {\n");
|
1095
|
+
fprintf(f, " vm_expandarray(%s, ary, num, (int)flag);\n", (status->local_stack_p ? "(stack + stack_size)" : "GET_SP()"));
|
1096
|
+
fprintf(f, " }\n");
|
1097
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1098
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_expandarray(num, flag) + 1);
|
1099
|
+
if (!pc_moved_p) {
|
1100
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1101
|
+
}
|
1102
|
+
fprintf(f, " goto cancel;\n");
|
1103
|
+
fprintf(f, " }\n");
|
1104
|
+
b->stack_size += attr_sp_inc_expandarray(num, flag);
|
1105
|
+
}
|
1106
|
+
fprintf(f, "}\n");
|
1107
|
+
break;
|
1108
|
+
case BIN(concatarray):
|
1109
|
+
fprintf(f, "{\n");
|
1110
|
+
{
|
1111
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1112
|
+
if (status->local_stack_p) {
|
1113
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1114
|
+
}
|
1115
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ary, ary1, ary2;\n");
|
1116
|
+
|
1117
|
+
fprintf(f, " ary1 = stack[%d];\n", b->stack_size - 2);
|
1118
|
+
fprintf(f, " ary2 = stack[%d];\n", b->stack_size - 1);
|
1119
|
+
if (body->catch_except_p || TRUE) {
|
1120
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1121
|
+
pc_moved_p = TRUE;
|
1122
|
+
}
|
1123
|
+
if (status->local_stack_p) {
|
1124
|
+
}
|
1125
|
+
else {
|
1126
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1127
|
+
}
|
1128
|
+
fprintf(f, " {\n");
|
1129
|
+
fprintf(f, " ary = vm_concat_array(ary1, ary2);\n");
|
1130
|
+
fprintf(f, " }\n");
|
1131
|
+
fprintf(f, " stack[%d] = ary;\n", b->stack_size + (int)attr_sp_inc_concatarray() - 1);
|
1132
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1133
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_concatarray() + 1);
|
1134
|
+
if (!pc_moved_p) {
|
1135
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1136
|
+
}
|
1137
|
+
fprintf(f, " goto cancel;\n");
|
1138
|
+
fprintf(f, " }\n");
|
1139
|
+
b->stack_size += attr_sp_inc_concatarray();
|
1140
|
+
}
|
1141
|
+
fprintf(f, "}\n");
|
1142
|
+
break;
|
1143
|
+
case BIN(splatarray):
|
1144
|
+
fprintf(f, "{\n");
|
1145
|
+
{
|
1146
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1147
|
+
MAYBE_UNUSED(VALUE flag) = (VALUE)operands[0];
|
1148
|
+
if (status->local_stack_p) {
|
1149
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1150
|
+
}
|
1151
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ary, flag, obj;\n");
|
1152
|
+
|
1153
|
+
fprintf(f, " flag = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
1154
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
1155
|
+
fprintf(f, "\n");
|
1156
|
+
fprintf(f, " ary = stack[%d];\n", b->stack_size - 1);
|
1157
|
+
if (body->catch_except_p || TRUE) {
|
1158
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1159
|
+
pc_moved_p = TRUE;
|
1160
|
+
}
|
1161
|
+
if (status->local_stack_p) {
|
1162
|
+
}
|
1163
|
+
else {
|
1164
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1165
|
+
}
|
1166
|
+
fprintf(f, " {\n");
|
1167
|
+
fprintf(f, " obj = vm_splat_array(flag, ary);\n");
|
1168
|
+
fprintf(f, " }\n");
|
1169
|
+
fprintf(f, " stack[%d] = obj;\n", b->stack_size + (int)attr_sp_inc_splatarray(flag) - 1);
|
1170
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1171
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_splatarray(flag) + 1);
|
1172
|
+
if (!pc_moved_p) {
|
1173
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1174
|
+
}
|
1175
|
+
fprintf(f, " goto cancel;\n");
|
1176
|
+
fprintf(f, " }\n");
|
1177
|
+
b->stack_size += attr_sp_inc_splatarray(flag);
|
1178
|
+
}
|
1179
|
+
fprintf(f, "}\n");
|
1180
|
+
break;
|
1181
|
+
case BIN(newhash):
|
1182
|
+
fprintf(f, "{\n");
|
1183
|
+
{
|
1184
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1185
|
+
MAYBE_UNUSED(rb_num_t num) = (rb_num_t)operands[0];
|
1186
|
+
if (status->local_stack_p) {
|
1187
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1188
|
+
}
|
1189
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1190
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) num;\n");
|
1191
|
+
|
1192
|
+
fprintf(f, " num = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1193
|
+
fprintf(f, "\n");
|
1194
|
+
if (body->catch_except_p || TRUE) {
|
1195
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1196
|
+
pc_moved_p = TRUE;
|
1197
|
+
}
|
1198
|
+
if (status->local_stack_p) {
|
1199
|
+
}
|
1200
|
+
else {
|
1201
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1202
|
+
}
|
1203
|
+
fprintf(f, " {\n");
|
1204
|
+
fprintf(f, " RUBY_DTRACE_CREATE_HOOK(HASH, num);\n");
|
1205
|
+
fprintf(f, "\n");
|
1206
|
+
fprintf(f, " val = rb_hash_new_with_size(num / 2);\n");
|
1207
|
+
fprintf(f, "\n");
|
1208
|
+
fprintf(f, " if (num) {\n");
|
1209
|
+
fprintf(f, " rb_hash_bulk_insert(num, %s, val);\n",
|
1210
|
+
(status->local_stack_p ? "stack + (stack_size - (num))" : "STACK_ADDR_FROM_TOP(num)"));
|
1211
|
+
fprintf(f, " }\n");
|
1212
|
+
fprintf(f, " }\n");
|
1213
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_newhash(num) - 1);
|
1214
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1215
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_newhash(num) + 1);
|
1216
|
+
if (!pc_moved_p) {
|
1217
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1218
|
+
}
|
1219
|
+
fprintf(f, " goto cancel;\n");
|
1220
|
+
fprintf(f, " }\n");
|
1221
|
+
b->stack_size += attr_sp_inc_newhash(num);
|
1222
|
+
}
|
1223
|
+
fprintf(f, "}\n");
|
1224
|
+
break;
|
1225
|
+
case BIN(newrange):
|
1226
|
+
fprintf(f, "{\n");
|
1227
|
+
{
|
1228
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1229
|
+
MAYBE_UNUSED(rb_num_t flag) = (rb_num_t)operands[0];
|
1230
|
+
if (status->local_stack_p) {
|
1231
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1232
|
+
}
|
1233
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) high, low, val;\n");
|
1234
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) flag;\n");
|
1235
|
+
|
1236
|
+
fprintf(f, " flag = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1237
|
+
fprintf(f, "\n");
|
1238
|
+
fprintf(f, " low = stack[%d];\n", b->stack_size - 2);
|
1239
|
+
fprintf(f, " high = stack[%d];\n", b->stack_size - 1);
|
1240
|
+
if (body->catch_except_p || TRUE) {
|
1241
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1242
|
+
pc_moved_p = TRUE;
|
1243
|
+
}
|
1244
|
+
if (status->local_stack_p) {
|
1245
|
+
}
|
1246
|
+
else {
|
1247
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1248
|
+
}
|
1249
|
+
fprintf(f, " {\n");
|
1250
|
+
fprintf(f, " val = rb_range_new(low, high, (int)flag);\n");
|
1251
|
+
fprintf(f, " }\n");
|
1252
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_newrange(flag) - 1);
|
1253
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1254
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_newrange(flag) + 1);
|
1255
|
+
if (!pc_moved_p) {
|
1256
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1257
|
+
}
|
1258
|
+
fprintf(f, " goto cancel;\n");
|
1259
|
+
fprintf(f, " }\n");
|
1260
|
+
b->stack_size += attr_sp_inc_newrange(flag);
|
1261
|
+
}
|
1262
|
+
fprintf(f, "}\n");
|
1263
|
+
break;
|
1264
|
+
case BIN(pop):
|
1265
|
+
fprintf(f, "{\n");
|
1266
|
+
{
|
1267
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1268
|
+
if (status->local_stack_p) {
|
1269
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1270
|
+
}
|
1271
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1272
|
+
|
1273
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
1274
|
+
if (body->catch_except_p || FALSE) {
|
1275
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1276
|
+
pc_moved_p = TRUE;
|
1277
|
+
}
|
1278
|
+
if (status->local_stack_p) {
|
1279
|
+
}
|
1280
|
+
else {
|
1281
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1282
|
+
}
|
1283
|
+
fprintf(f, " {\n");
|
1284
|
+
fprintf(f, " (void)val;\n");
|
1285
|
+
fprintf(f, " /* none */\n");
|
1286
|
+
fprintf(f, " }\n");
|
1287
|
+
b->stack_size += attr_sp_inc_pop();
|
1288
|
+
}
|
1289
|
+
fprintf(f, "}\n");
|
1290
|
+
break;
|
1291
|
+
case BIN(dup):
|
1292
|
+
fprintf(f, "{\n");
|
1293
|
+
{
|
1294
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1295
|
+
if (status->local_stack_p) {
|
1296
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1297
|
+
}
|
1298
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val, val1, val2;\n");
|
1299
|
+
|
1300
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
1301
|
+
if (body->catch_except_p || FALSE) {
|
1302
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1303
|
+
pc_moved_p = TRUE;
|
1304
|
+
}
|
1305
|
+
if (status->local_stack_p) {
|
1306
|
+
}
|
1307
|
+
else {
|
1308
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1309
|
+
}
|
1310
|
+
fprintf(f, " {\n");
|
1311
|
+
fprintf(f, " val1 = val2 = val;\n");
|
1312
|
+
fprintf(f, " }\n");
|
1313
|
+
fprintf(f, " stack[%d] = val2;\n", b->stack_size + (int)attr_sp_inc_dup() - 1);
|
1314
|
+
fprintf(f, " stack[%d] = val1;\n", b->stack_size + (int)attr_sp_inc_dup() - 2);
|
1315
|
+
b->stack_size += attr_sp_inc_dup();
|
1316
|
+
}
|
1317
|
+
fprintf(f, "}\n");
|
1318
|
+
break;
|
1319
|
+
case BIN(dupn):
|
1320
|
+
fprintf(f, "{\n");
|
1321
|
+
{
|
1322
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1323
|
+
MAYBE_UNUSED(rb_num_t n) = (rb_num_t)operands[0];
|
1324
|
+
if (status->local_stack_p) {
|
1325
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1326
|
+
}
|
1327
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) n;\n");
|
1328
|
+
|
1329
|
+
fprintf(f, " n = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1330
|
+
fprintf(f, "\n");
|
1331
|
+
if (body->catch_except_p || FALSE) {
|
1332
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1333
|
+
pc_moved_p = TRUE;
|
1334
|
+
}
|
1335
|
+
if (status->local_stack_p) {
|
1336
|
+
}
|
1337
|
+
else {
|
1338
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1339
|
+
}
|
1340
|
+
fprintf(f, " {\n");
|
1341
|
+
fprintf(f, " void *dst = %s;\n", (status->local_stack_p ? "(stack + stack_size)" : "GET_SP()"));
|
1342
|
+
fprintf(f, " void *src = %s;\n",
|
1343
|
+
(status->local_stack_p ? "stack + (stack_size - (n))" : "STACK_ADDR_FROM_TOP(n)"));
|
1344
|
+
fprintf(f, "\n");
|
1345
|
+
fprintf(f, " MEMCPY(dst, src, VALUE, n);\n");
|
1346
|
+
fprintf(f, " }\n");
|
1347
|
+
b->stack_size += attr_sp_inc_dupn(n);
|
1348
|
+
}
|
1349
|
+
fprintf(f, "}\n");
|
1350
|
+
break;
|
1351
|
+
case BIN(swap):
|
1352
|
+
fprintf(f, "{\n");
|
1353
|
+
{
|
1354
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1355
|
+
if (status->local_stack_p) {
|
1356
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1357
|
+
}
|
1358
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, val;\n");
|
1359
|
+
|
1360
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 2);
|
1361
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
1362
|
+
if (body->catch_except_p || FALSE) {
|
1363
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1364
|
+
pc_moved_p = TRUE;
|
1365
|
+
}
|
1366
|
+
if (status->local_stack_p) {
|
1367
|
+
}
|
1368
|
+
else {
|
1369
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1370
|
+
}
|
1371
|
+
fprintf(f, " {\n");
|
1372
|
+
fprintf(f, " /* none */\n");
|
1373
|
+
fprintf(f, " }\n");
|
1374
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_swap() - 1);
|
1375
|
+
fprintf(f, " stack[%d] = obj;\n", b->stack_size + (int)attr_sp_inc_swap() - 2);
|
1376
|
+
b->stack_size += attr_sp_inc_swap();
|
1377
|
+
}
|
1378
|
+
fprintf(f, "}\n");
|
1379
|
+
break;
|
1380
|
+
case BIN(reverse):
|
1381
|
+
fprintf(f, "{\n");
|
1382
|
+
{
|
1383
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1384
|
+
MAYBE_UNUSED(rb_num_t n) = (rb_num_t)operands[0];
|
1385
|
+
if (status->local_stack_p) {
|
1386
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1387
|
+
}
|
1388
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) n;\n");
|
1389
|
+
|
1390
|
+
fprintf(f, " n = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1391
|
+
fprintf(f, "\n");
|
1392
|
+
if (body->catch_except_p || FALSE) {
|
1393
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1394
|
+
pc_moved_p = TRUE;
|
1395
|
+
}
|
1396
|
+
if (status->local_stack_p) {
|
1397
|
+
}
|
1398
|
+
else {
|
1399
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1400
|
+
}
|
1401
|
+
fprintf(f, " {\n");
|
1402
|
+
fprintf(f, " rb_num_t i;\n");
|
1403
|
+
fprintf(f, " VALUE *sp = %s;\n",
|
1404
|
+
(status->local_stack_p ? "stack + (stack_size - (n))" : "STACK_ADDR_FROM_TOP(n)"));
|
1405
|
+
fprintf(f, "\n");
|
1406
|
+
fprintf(f, " for (i=0; i<n/2; i++) {\n");
|
1407
|
+
fprintf(f, " VALUE v0 = sp[i];\n");
|
1408
|
+
fprintf(f, " VALUE v1 = %s;\n",
|
1409
|
+
(status->local_stack_p ? "*(stack + (stack_size - (i) - 1))" : "TOPN(i)"));
|
1410
|
+
fprintf(f, " sp[i] = v1;\n");
|
1411
|
+
fprintf(f, " %s = v0;\n",
|
1412
|
+
(status->local_stack_p ? "*(stack + (stack_size - (i) - 1))" : "TOPN(i)"));
|
1413
|
+
fprintf(f, " }\n");
|
1414
|
+
fprintf(f, " }\n");
|
1415
|
+
b->stack_size += attr_sp_inc_reverse(n);
|
1416
|
+
}
|
1417
|
+
fprintf(f, "}\n");
|
1418
|
+
break;
|
1419
|
+
case BIN(reput):
|
1420
|
+
fprintf(f, "{\n");
|
1421
|
+
{
|
1422
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1423
|
+
if (status->local_stack_p) {
|
1424
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1425
|
+
}
|
1426
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1427
|
+
|
1428
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
1429
|
+
if (body->catch_except_p || FALSE) {
|
1430
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1431
|
+
pc_moved_p = TRUE;
|
1432
|
+
}
|
1433
|
+
if (status->local_stack_p) {
|
1434
|
+
}
|
1435
|
+
else {
|
1436
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1437
|
+
}
|
1438
|
+
fprintf(f, " {\n");
|
1439
|
+
fprintf(f, " /* none */\n");
|
1440
|
+
fprintf(f, " }\n");
|
1441
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_reput() - 1);
|
1442
|
+
b->stack_size += attr_sp_inc_reput();
|
1443
|
+
}
|
1444
|
+
fprintf(f, "}\n");
|
1445
|
+
break;
|
1446
|
+
case BIN(topn):
|
1447
|
+
fprintf(f, "{\n");
|
1448
|
+
{
|
1449
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1450
|
+
MAYBE_UNUSED(rb_num_t n) = (rb_num_t)operands[0];
|
1451
|
+
if (status->local_stack_p) {
|
1452
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1453
|
+
}
|
1454
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1455
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) n;\n");
|
1456
|
+
|
1457
|
+
fprintf(f, " n = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1458
|
+
fprintf(f, "\n");
|
1459
|
+
if (body->catch_except_p || FALSE) {
|
1460
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1461
|
+
pc_moved_p = TRUE;
|
1462
|
+
}
|
1463
|
+
if (status->local_stack_p) {
|
1464
|
+
}
|
1465
|
+
else {
|
1466
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1467
|
+
}
|
1468
|
+
fprintf(f, " {\n");
|
1469
|
+
fprintf(f, " val = %s;\n",
|
1470
|
+
(status->local_stack_p ? "*(stack + (stack_size - (n) - 1))" : "TOPN(n)"));
|
1471
|
+
fprintf(f, " }\n");
|
1472
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_topn(n) - 1);
|
1473
|
+
b->stack_size += attr_sp_inc_topn(n);
|
1474
|
+
}
|
1475
|
+
fprintf(f, "}\n");
|
1476
|
+
break;
|
1477
|
+
case BIN(setn):
|
1478
|
+
fprintf(f, "{\n");
|
1479
|
+
{
|
1480
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1481
|
+
MAYBE_UNUSED(rb_num_t n) = (rb_num_t)operands[0];
|
1482
|
+
if (status->local_stack_p) {
|
1483
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1484
|
+
}
|
1485
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1486
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) n;\n");
|
1487
|
+
|
1488
|
+
fprintf(f, " n = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1489
|
+
fprintf(f, "\n");
|
1490
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
1491
|
+
if (body->catch_except_p || FALSE) {
|
1492
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1493
|
+
pc_moved_p = TRUE;
|
1494
|
+
}
|
1495
|
+
if (status->local_stack_p) {
|
1496
|
+
}
|
1497
|
+
else {
|
1498
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1499
|
+
}
|
1500
|
+
fprintf(f, " {\n");
|
1501
|
+
fprintf(f, " %s = val;\n",
|
1502
|
+
(status->local_stack_p ? "*(stack + (stack_size - (n) - 1))" : "TOPN(n)"));
|
1503
|
+
fprintf(f, " }\n");
|
1504
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_setn(n) - 1);
|
1505
|
+
b->stack_size += attr_sp_inc_setn(n);
|
1506
|
+
}
|
1507
|
+
fprintf(f, "}\n");
|
1508
|
+
break;
|
1509
|
+
case BIN(adjuststack):
|
1510
|
+
fprintf(f, "{\n");
|
1511
|
+
{
|
1512
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1513
|
+
MAYBE_UNUSED(rb_num_t n) = (rb_num_t)operands[0];
|
1514
|
+
if (status->local_stack_p) {
|
1515
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1516
|
+
}
|
1517
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) n;\n");
|
1518
|
+
|
1519
|
+
fprintf(f, " n = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1520
|
+
fprintf(f, "\n");
|
1521
|
+
if (body->catch_except_p || FALSE) {
|
1522
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1523
|
+
pc_moved_p = TRUE;
|
1524
|
+
}
|
1525
|
+
if (status->local_stack_p) {
|
1526
|
+
}
|
1527
|
+
else {
|
1528
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1529
|
+
}
|
1530
|
+
fprintf(f, " {\n");
|
1531
|
+
fprintf(f, " /* none */\n");
|
1532
|
+
fprintf(f, " }\n");
|
1533
|
+
b->stack_size += attr_sp_inc_adjuststack(n);
|
1534
|
+
}
|
1535
|
+
fprintf(f, "}\n");
|
1536
|
+
break;
|
1537
|
+
case BIN(defined):
|
1538
|
+
fprintf(f, "{\n");
|
1539
|
+
{
|
1540
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1541
|
+
MAYBE_UNUSED(rb_num_t op_type) = (rb_num_t)operands[0];
|
1542
|
+
MAYBE_UNUSED(VALUE obj) = (VALUE)operands[1];
|
1543
|
+
MAYBE_UNUSED(VALUE needstr) = (VALUE)operands[2];
|
1544
|
+
if (status->local_stack_p) {
|
1545
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1546
|
+
}
|
1547
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) needstr, obj, v, val;\n");
|
1548
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) op_type;\n");
|
1549
|
+
|
1550
|
+
fprintf(f, " op_type = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1551
|
+
fprintf(f, "\n");
|
1552
|
+
fprintf(f, " obj = (VALUE)0x%"PRIxVALUE";", operands[1]);
|
1553
|
+
if (SYMBOL_P((VALUE)operands[1])) comment_id(f, SYM2ID((VALUE)operands[1]));
|
1554
|
+
fprintf(f, "\n");
|
1555
|
+
fprintf(f, " needstr = (VALUE)0x%"PRIxVALUE";", operands[2]);
|
1556
|
+
if (SYMBOL_P((VALUE)operands[2])) comment_id(f, SYM2ID((VALUE)operands[2]));
|
1557
|
+
fprintf(f, "\n");
|
1558
|
+
fprintf(f, " v = stack[%d];\n", b->stack_size - 1);
|
1559
|
+
if (body->catch_except_p || TRUE) {
|
1560
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1561
|
+
pc_moved_p = TRUE;
|
1562
|
+
}
|
1563
|
+
if (status->local_stack_p) {
|
1564
|
+
}
|
1565
|
+
else {
|
1566
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1567
|
+
}
|
1568
|
+
fprintf(f, " {\n");
|
1569
|
+
fprintf(f, " val = vm_defined(ec, GET_CFP(), op_type, obj, needstr, v);\n");
|
1570
|
+
fprintf(f, " }\n");
|
1571
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_defined(op_type, obj, needstr) - 1);
|
1572
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1573
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_defined(op_type, obj, needstr) + 1);
|
1574
|
+
if (!pc_moved_p) {
|
1575
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1576
|
+
}
|
1577
|
+
fprintf(f, " goto cancel;\n");
|
1578
|
+
fprintf(f, " }\n");
|
1579
|
+
b->stack_size += attr_sp_inc_defined(op_type, obj, needstr);
|
1580
|
+
}
|
1581
|
+
fprintf(f, "}\n");
|
1582
|
+
break;
|
1583
|
+
case BIN(checkmatch):
|
1584
|
+
fprintf(f, "{\n");
|
1585
|
+
{
|
1586
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1587
|
+
MAYBE_UNUSED(rb_num_t flag) = (rb_num_t)operands[0];
|
1588
|
+
if (status->local_stack_p) {
|
1589
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1590
|
+
}
|
1591
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) pattern, result, target;\n");
|
1592
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) flag;\n");
|
1593
|
+
|
1594
|
+
fprintf(f, " flag = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1595
|
+
fprintf(f, "\n");
|
1596
|
+
fprintf(f, " target = stack[%d];\n", b->stack_size - 2);
|
1597
|
+
fprintf(f, " pattern = stack[%d];\n", b->stack_size - 1);
|
1598
|
+
if (body->catch_except_p || TRUE) {
|
1599
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1600
|
+
pc_moved_p = TRUE;
|
1601
|
+
}
|
1602
|
+
if (status->local_stack_p) {
|
1603
|
+
}
|
1604
|
+
else {
|
1605
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1606
|
+
}
|
1607
|
+
fprintf(f, " {\n");
|
1608
|
+
fprintf(f, " result = vm_check_match(ec, target, pattern, flag);\n");
|
1609
|
+
fprintf(f, " }\n");
|
1610
|
+
fprintf(f, " stack[%d] = result;\n", b->stack_size + (int)attr_sp_inc_checkmatch(flag) - 1);
|
1611
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1612
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_checkmatch(flag) + 1);
|
1613
|
+
if (!pc_moved_p) {
|
1614
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1615
|
+
}
|
1616
|
+
fprintf(f, " goto cancel;\n");
|
1617
|
+
fprintf(f, " }\n");
|
1618
|
+
b->stack_size += attr_sp_inc_checkmatch(flag);
|
1619
|
+
}
|
1620
|
+
fprintf(f, "}\n");
|
1621
|
+
break;
|
1622
|
+
case BIN(checkkeyword):
|
1623
|
+
fprintf(f, "{\n");
|
1624
|
+
{
|
1625
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1626
|
+
MAYBE_UNUSED(lindex_t kw_bits_index) = (lindex_t)operands[0];
|
1627
|
+
MAYBE_UNUSED(lindex_t keyword_index) = (lindex_t)operands[1];
|
1628
|
+
if (status->local_stack_p) {
|
1629
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1630
|
+
}
|
1631
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ret;\n");
|
1632
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) keyword_index, kw_bits_index;\n");
|
1633
|
+
|
1634
|
+
fprintf(f, " kw_bits_index = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
1635
|
+
fprintf(f, "\n");
|
1636
|
+
fprintf(f, " keyword_index = (lindex_t)0x%"PRIxVALUE";", operands[1]);
|
1637
|
+
fprintf(f, "\n");
|
1638
|
+
if (body->catch_except_p || FALSE) {
|
1639
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1640
|
+
pc_moved_p = TRUE;
|
1641
|
+
}
|
1642
|
+
if (status->local_stack_p) {
|
1643
|
+
}
|
1644
|
+
else {
|
1645
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1646
|
+
}
|
1647
|
+
fprintf(f, " {\n");
|
1648
|
+
fprintf(f, " ret = vm_check_keyword(kw_bits_index, keyword_index, GET_EP());\n");
|
1649
|
+
fprintf(f, " }\n");
|
1650
|
+
fprintf(f, " stack[%d] = ret;\n", b->stack_size + (int)attr_sp_inc_checkkeyword(kw_bits_index, keyword_index) - 1);
|
1651
|
+
b->stack_size += attr_sp_inc_checkkeyword(kw_bits_index, keyword_index);
|
1652
|
+
}
|
1653
|
+
fprintf(f, "}\n");
|
1654
|
+
break;
|
1655
|
+
case BIN(checktype):
|
1656
|
+
fprintf(f, "{\n");
|
1657
|
+
{
|
1658
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1659
|
+
MAYBE_UNUSED(rb_num_t type) = (rb_num_t)operands[0];
|
1660
|
+
if (status->local_stack_p) {
|
1661
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1662
|
+
}
|
1663
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ret, val;\n");
|
1664
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) type;\n");
|
1665
|
+
|
1666
|
+
fprintf(f, " type = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
1667
|
+
fprintf(f, "\n");
|
1668
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
1669
|
+
if (body->catch_except_p || FALSE) {
|
1670
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1671
|
+
pc_moved_p = TRUE;
|
1672
|
+
}
|
1673
|
+
if (status->local_stack_p) {
|
1674
|
+
}
|
1675
|
+
else {
|
1676
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1677
|
+
}
|
1678
|
+
fprintf(f, " {\n");
|
1679
|
+
fprintf(f, " ret = (TYPE(val) == (int)type) ? Qtrue : Qfalse;\n");
|
1680
|
+
fprintf(f, " }\n");
|
1681
|
+
fprintf(f, " stack[%d] = ret;\n", b->stack_size + (int)attr_sp_inc_checktype(type) - 1);
|
1682
|
+
b->stack_size += attr_sp_inc_checktype(type);
|
1683
|
+
}
|
1684
|
+
fprintf(f, "}\n");
|
1685
|
+
break;
|
1686
|
+
case BIN(send):
|
1687
|
+
{
|
1688
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1689
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
1690
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
1691
|
+
MAYBE_UNUSED(ISEQ blockiseq) = (ISEQ)operands[2];
|
1692
|
+
CALL_CACHE cc_copy = status->cc_entries + (cc - body->cc_entries);
|
1693
|
+
if (has_valid_method_type(cc_copy)) {
|
1694
|
+
const rb_iseq_t *iseq;
|
1695
|
+
unsigned int argc = ci->orig_argc; /* unlike `ci->orig_argc`, `argc` may include blockarg */
|
1696
|
+
argc += ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0);
|
1697
|
+
|
1698
|
+
if (!(ci->flag & VM_CALL_TAILCALL) && /* inlining non-tailcall path */
|
1699
|
+
cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def)) /* CC_SET_FASTPATH in vm_callee_setup_arg */) {
|
1700
|
+
int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */
|
1701
|
+
|
1702
|
+
fprintf(f, "{\n");
|
1703
|
+
if (status->local_stack_p) {
|
1704
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1705
|
+
}
|
1706
|
+
|
1707
|
+
fprintf(f, " if (UNLIKELY(GET_GLOBAL_METHOD_STATE() != %"PRI_SERIALT_PREFIX"u ||\n", cc_copy->method_state);
|
1708
|
+
fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial);
|
1709
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
1710
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1711
|
+
fprintf(f, " goto cancel;\n");
|
1712
|
+
fprintf(f, " }\n");
|
1713
|
+
|
1714
|
+
if (body->catch_except_p || TRUE) {
|
1715
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1716
|
+
pc_moved_p = TRUE;
|
1717
|
+
}
|
1718
|
+
if (status->local_stack_p) {
|
1719
|
+
{
|
1720
|
+
rb_snum_t i, push_size;
|
1721
|
+
push_size = -attr_sp_inc_send(ci, cc, blockiseq) + 1 - 0;
|
1722
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
1723
|
+
for (i = 0; i < push_size; i++) {
|
1724
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
}
|
1728
|
+
else {
|
1729
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
1730
|
+
}
|
1731
|
+
|
1732
|
+
fprintf(f, " {\n");
|
1733
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
1734
|
+
fprintf(f, " calling.block_handler = vm_caller_setup_arg_block(ec, reg_cfp, (CALL_INFO)0x%"PRIxVALUE", (rb_iseq_t *)0x%"PRIxVALUE", FALSE);\n", operands[0], operands[2]);
|
1735
|
+
fprintf(f, " calling.argc = %d;\n", ci->orig_argc);
|
1736
|
+
fprintf(f, " calling.recv = stack[%d];\n", b->stack_size - 1 - argc);
|
1737
|
+
|
1738
|
+
fprintf(f, " {\n");
|
1739
|
+
fprintf(f, " VALUE v;\n");
|
1740
|
+
fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, (const rb_callable_method_entry_t *)0x%"PRIxVALUE", 0, %d, %d);\n",
|
1741
|
+
(VALUE)cc_copy->me, param_size, iseq->body->local_table_size); /* rb_simple_iseq_p checks rb_simple_iseq_p, which ensures has_opt == FALSE */
|
1742
|
+
if (iseq->body->catch_except_p) {
|
1743
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n");
|
1744
|
+
fprintf(f, " v = vm_exec(ec, TRUE);\n");
|
1745
|
+
}
|
1746
|
+
else {
|
1747
|
+
fprintf(f, " if ((v = mjit_exec(ec)) == Qundef) {\n");
|
1748
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); /* This is vm_call0_body's code after vm_call_iseq_setup */
|
1749
|
+
fprintf(f, " v = vm_exec(ec, FALSE);\n");
|
1750
|
+
fprintf(f, " }\n");
|
1751
|
+
}
|
1752
|
+
fprintf(f, " stack[%d] = v;\n", b->stack_size - argc - 1);
|
1753
|
+
fprintf(f, " }\n");
|
1754
|
+
|
1755
|
+
fprintf(f, " }\n");
|
1756
|
+
|
1757
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1758
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_send(ci, cc, blockiseq) + 1);
|
1759
|
+
if (!pc_moved_p) {
|
1760
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1761
|
+
}
|
1762
|
+
fprintf(f, " goto cancel;\n");
|
1763
|
+
fprintf(f, " }\n");
|
1764
|
+
|
1765
|
+
b->stack_size += attr_sp_inc_send(ci, cc, blockiseq);
|
1766
|
+
|
1767
|
+
fprintf(f, "}\n");
|
1768
|
+
break;
|
1769
|
+
}
|
1770
|
+
}
|
1771
|
+
}
|
1772
|
+
fprintf(f, "{\n");
|
1773
|
+
{
|
1774
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1775
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
1776
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
1777
|
+
MAYBE_UNUSED(ISEQ blockiseq) = (ISEQ)operands[2];
|
1778
|
+
if (status->local_stack_p) {
|
1779
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1780
|
+
}
|
1781
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
1782
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
1783
|
+
fprintf(f, " MAYBE_UNUSED(ISEQ) blockiseq;\n");
|
1784
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1785
|
+
|
1786
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
1787
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
1788
|
+
fprintf(f, "\n");
|
1789
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
1790
|
+
fprintf(f, "\n");
|
1791
|
+
fprintf(f, " blockiseq = (ISEQ)0x%"PRIxVALUE";", operands[2]);
|
1792
|
+
fprintf(f, "\n");
|
1793
|
+
if (body->catch_except_p || TRUE) {
|
1794
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1795
|
+
pc_moved_p = TRUE;
|
1796
|
+
}
|
1797
|
+
if (status->local_stack_p) {
|
1798
|
+
{
|
1799
|
+
rb_snum_t i, push_size;
|
1800
|
+
push_size = -attr_sp_inc_send(ci, cc, blockiseq) + 1 - 0;
|
1801
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
1802
|
+
for (i = 0; i < push_size; i++) {
|
1803
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
1804
|
+
}
|
1805
|
+
}
|
1806
|
+
}
|
1807
|
+
else {
|
1808
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
1809
|
+
}
|
1810
|
+
fprintf(f, " {\n");
|
1811
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
1812
|
+
fprintf(f, "\n");
|
1813
|
+
fprintf(f, " calling.block_handler = vm_caller_setup_arg_block(ec, reg_cfp, ci, blockiseq, FALSE);\n");
|
1814
|
+
fprintf(f, " calling.recv = TOPN(calling.argc = ci->orig_argc);\n");
|
1815
|
+
fprintf(f, " vm_search_method(ci, cc, calling.recv);\n");
|
1816
|
+
fprintf(f, " CALL_METHOD(&calling, ci, cc);\n");
|
1817
|
+
fprintf(f, " }\n");
|
1818
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_send(ci, cc, blockiseq) - 1);
|
1819
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1820
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_send(ci, cc, blockiseq) + 1);
|
1821
|
+
if (!pc_moved_p) {
|
1822
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1823
|
+
}
|
1824
|
+
fprintf(f, " goto cancel;\n");
|
1825
|
+
fprintf(f, " }\n");
|
1826
|
+
b->stack_size += attr_sp_inc_send(ci, cc, blockiseq);
|
1827
|
+
}
|
1828
|
+
fprintf(f, "}\n");
|
1829
|
+
break;
|
1830
|
+
case BIN(opt_send_without_block):
|
1831
|
+
{
|
1832
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1833
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
1834
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
1835
|
+
CALL_CACHE cc_copy = status->cc_entries + (cc - body->cc_entries);
|
1836
|
+
if (has_valid_method_type(cc_copy)) {
|
1837
|
+
const rb_iseq_t *iseq;
|
1838
|
+
unsigned int argc = ci->orig_argc; /* unlike `ci->orig_argc`, `argc` may include blockarg */
|
1839
|
+
|
1840
|
+
if (!(ci->flag & VM_CALL_TAILCALL) && /* inlining non-tailcall path */
|
1841
|
+
cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def)) /* CC_SET_FASTPATH in vm_callee_setup_arg */) {
|
1842
|
+
int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */
|
1843
|
+
|
1844
|
+
fprintf(f, "{\n");
|
1845
|
+
if (status->local_stack_p) {
|
1846
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1847
|
+
}
|
1848
|
+
|
1849
|
+
fprintf(f, " if (UNLIKELY(GET_GLOBAL_METHOD_STATE() != %"PRI_SERIALT_PREFIX"u ||\n", cc_copy->method_state);
|
1850
|
+
fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial);
|
1851
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
1852
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1853
|
+
fprintf(f, " goto cancel;\n");
|
1854
|
+
fprintf(f, " }\n");
|
1855
|
+
|
1856
|
+
if (body->catch_except_p || TRUE) {
|
1857
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1858
|
+
pc_moved_p = TRUE;
|
1859
|
+
}
|
1860
|
+
if (status->local_stack_p) {
|
1861
|
+
{
|
1862
|
+
rb_snum_t i, push_size;
|
1863
|
+
push_size = -attr_sp_inc_opt_send_without_block(ci, cc) + 1 - 0;
|
1864
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
1865
|
+
for (i = 0; i < push_size; i++) {
|
1866
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
1867
|
+
}
|
1868
|
+
}
|
1869
|
+
}
|
1870
|
+
else {
|
1871
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
1872
|
+
}
|
1873
|
+
|
1874
|
+
fprintf(f, " {\n");
|
1875
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
1876
|
+
fprintf(f, " calling.block_handler = VM_BLOCK_HANDLER_NONE;\n");
|
1877
|
+
fprintf(f, " calling.argc = %d;\n", ci->orig_argc);
|
1878
|
+
fprintf(f, " calling.recv = stack[%d];\n", b->stack_size - 1 - argc);
|
1879
|
+
|
1880
|
+
fprintf(f, " {\n");
|
1881
|
+
fprintf(f, " VALUE v;\n");
|
1882
|
+
fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, (const rb_callable_method_entry_t *)0x%"PRIxVALUE", 0, %d, %d);\n",
|
1883
|
+
(VALUE)cc_copy->me, param_size, iseq->body->local_table_size); /* rb_simple_iseq_p checks rb_simple_iseq_p, which ensures has_opt == FALSE */
|
1884
|
+
if (iseq->body->catch_except_p) {
|
1885
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n");
|
1886
|
+
fprintf(f, " v = vm_exec(ec, TRUE);\n");
|
1887
|
+
}
|
1888
|
+
else {
|
1889
|
+
fprintf(f, " if ((v = mjit_exec(ec)) == Qundef) {\n");
|
1890
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); /* This is vm_call0_body's code after vm_call_iseq_setup */
|
1891
|
+
fprintf(f, " v = vm_exec(ec, FALSE);\n");
|
1892
|
+
fprintf(f, " }\n");
|
1893
|
+
}
|
1894
|
+
fprintf(f, " stack[%d] = v;\n", b->stack_size - argc - 1);
|
1895
|
+
fprintf(f, " }\n");
|
1896
|
+
|
1897
|
+
fprintf(f, " }\n");
|
1898
|
+
|
1899
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1900
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_send_without_block(ci, cc) + 1);
|
1901
|
+
if (!pc_moved_p) {
|
1902
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1903
|
+
}
|
1904
|
+
fprintf(f, " goto cancel;\n");
|
1905
|
+
fprintf(f, " }\n");
|
1906
|
+
|
1907
|
+
b->stack_size += attr_sp_inc_opt_send_without_block(ci, cc);
|
1908
|
+
|
1909
|
+
fprintf(f, "}\n");
|
1910
|
+
break;
|
1911
|
+
}
|
1912
|
+
}
|
1913
|
+
}
|
1914
|
+
fprintf(f, "{\n");
|
1915
|
+
{
|
1916
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1917
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
1918
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
1919
|
+
if (status->local_stack_p) {
|
1920
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1921
|
+
}
|
1922
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
1923
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
1924
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
1925
|
+
|
1926
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
1927
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
1928
|
+
fprintf(f, "\n");
|
1929
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
1930
|
+
fprintf(f, "\n");
|
1931
|
+
if (body->catch_except_p || TRUE) {
|
1932
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1933
|
+
pc_moved_p = TRUE;
|
1934
|
+
}
|
1935
|
+
if (status->local_stack_p) {
|
1936
|
+
{
|
1937
|
+
rb_snum_t i, push_size;
|
1938
|
+
push_size = -attr_sp_inc_opt_send_without_block(ci, cc) + 1 - 0;
|
1939
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
1940
|
+
for (i = 0; i < push_size; i++) {
|
1941
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
1942
|
+
}
|
1943
|
+
}
|
1944
|
+
}
|
1945
|
+
else {
|
1946
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
1947
|
+
}
|
1948
|
+
fprintf(f, " {\n");
|
1949
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
1950
|
+
fprintf(f, " calling.block_handler = VM_BLOCK_HANDLER_NONE;\n");
|
1951
|
+
fprintf(f, " vm_search_method(ci, cc, calling.recv = TOPN(calling.argc = ci->orig_argc));\n");
|
1952
|
+
fprintf(f, " CALL_METHOD(&calling, ci, cc);\n");
|
1953
|
+
fprintf(f, " }\n");
|
1954
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_send_without_block(ci, cc) - 1);
|
1955
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
1956
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_send_without_block(ci, cc) + 1);
|
1957
|
+
if (!pc_moved_p) {
|
1958
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
1959
|
+
}
|
1960
|
+
fprintf(f, " goto cancel;\n");
|
1961
|
+
fprintf(f, " }\n");
|
1962
|
+
b->stack_size += attr_sp_inc_opt_send_without_block(ci, cc);
|
1963
|
+
}
|
1964
|
+
fprintf(f, "}\n");
|
1965
|
+
break;
|
1966
|
+
case BIN(opt_str_freeze):
|
1967
|
+
fprintf(f, "{\n");
|
1968
|
+
{
|
1969
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
1970
|
+
MAYBE_UNUSED(VALUE str) = (VALUE)operands[0];
|
1971
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[1];
|
1972
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[2];
|
1973
|
+
if (status->local_stack_p) {
|
1974
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
1975
|
+
}
|
1976
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
1977
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
1978
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) str, val;\n");
|
1979
|
+
|
1980
|
+
fprintf(f, " str = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
1981
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
1982
|
+
fprintf(f, "\n");
|
1983
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[1]);
|
1984
|
+
comment_id(f, ((CALL_INFO)operands[1])->mid);
|
1985
|
+
fprintf(f, "\n");
|
1986
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[2]);
|
1987
|
+
fprintf(f, "\n");
|
1988
|
+
if (body->catch_except_p || FALSE) {
|
1989
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
1990
|
+
pc_moved_p = TRUE;
|
1991
|
+
}
|
1992
|
+
if (status->local_stack_p) {
|
1993
|
+
}
|
1994
|
+
else {
|
1995
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
1996
|
+
}
|
1997
|
+
fprintf(f, " {\n");
|
1998
|
+
fprintf(f, " val = vm_opt_str_freeze(str, BOP_FREEZE, idFreeze);\n");
|
1999
|
+
fprintf(f, "\n");
|
2000
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2001
|
+
fprintf(f, " PUSH(rb_str_resurrect(str));\n");
|
2002
|
+
if (status->local_stack_p) {
|
2003
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2004
|
+
}
|
2005
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2006
|
+
fprintf(f, " goto cancel;\n");
|
2007
|
+
fprintf(f, " }\n");
|
2008
|
+
fprintf(f, " }\n");
|
2009
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_str_freeze(str, ci, cc) - 1);
|
2010
|
+
b->stack_size += attr_sp_inc_opt_str_freeze(str, ci, cc);
|
2011
|
+
}
|
2012
|
+
fprintf(f, "}\n");
|
2013
|
+
break;
|
2014
|
+
case BIN(opt_str_uminus):
|
2015
|
+
fprintf(f, "{\n");
|
2016
|
+
{
|
2017
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2018
|
+
MAYBE_UNUSED(VALUE str) = (VALUE)operands[0];
|
2019
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[1];
|
2020
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[2];
|
2021
|
+
if (status->local_stack_p) {
|
2022
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2023
|
+
}
|
2024
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2025
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2026
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) str, val;\n");
|
2027
|
+
|
2028
|
+
fprintf(f, " str = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
2029
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
2030
|
+
fprintf(f, "\n");
|
2031
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[1]);
|
2032
|
+
comment_id(f, ((CALL_INFO)operands[1])->mid);
|
2033
|
+
fprintf(f, "\n");
|
2034
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[2]);
|
2035
|
+
fprintf(f, "\n");
|
2036
|
+
if (body->catch_except_p || FALSE) {
|
2037
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2038
|
+
pc_moved_p = TRUE;
|
2039
|
+
}
|
2040
|
+
if (status->local_stack_p) {
|
2041
|
+
}
|
2042
|
+
else {
|
2043
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2044
|
+
}
|
2045
|
+
fprintf(f, " {\n");
|
2046
|
+
fprintf(f, " val = vm_opt_str_freeze(str, BOP_UMINUS, idUMinus);\n");
|
2047
|
+
fprintf(f, "\n");
|
2048
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2049
|
+
fprintf(f, " PUSH(rb_str_resurrect(str));\n");
|
2050
|
+
if (status->local_stack_p) {
|
2051
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2052
|
+
}
|
2053
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2054
|
+
fprintf(f, " goto cancel;\n");
|
2055
|
+
fprintf(f, " }\n");
|
2056
|
+
fprintf(f, " }\n");
|
2057
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_str_uminus(str, ci, cc) - 1);
|
2058
|
+
b->stack_size += attr_sp_inc_opt_str_uminus(str, ci, cc);
|
2059
|
+
}
|
2060
|
+
fprintf(f, "}\n");
|
2061
|
+
break;
|
2062
|
+
case BIN(opt_newarray_max):
|
2063
|
+
fprintf(f, "{\n");
|
2064
|
+
{
|
2065
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2066
|
+
MAYBE_UNUSED(rb_num_t num) = (rb_num_t)operands[0];
|
2067
|
+
if (status->local_stack_p) {
|
2068
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2069
|
+
}
|
2070
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2071
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) num;\n");
|
2072
|
+
|
2073
|
+
fprintf(f, " num = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
2074
|
+
fprintf(f, "\n");
|
2075
|
+
if (body->catch_except_p || TRUE) {
|
2076
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2077
|
+
pc_moved_p = TRUE;
|
2078
|
+
}
|
2079
|
+
if (status->local_stack_p) {
|
2080
|
+
}
|
2081
|
+
else {
|
2082
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2083
|
+
}
|
2084
|
+
fprintf(f, " {\n");
|
2085
|
+
fprintf(f, " val = vm_opt_newarray_max(num, %s);\n",
|
2086
|
+
(status->local_stack_p ? "stack + (stack_size - (num))" : "STACK_ADDR_FROM_TOP(num)"));
|
2087
|
+
fprintf(f, " }\n");
|
2088
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_newarray_max(num) - 1);
|
2089
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2090
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_newarray_max(num) + 1);
|
2091
|
+
if (!pc_moved_p) {
|
2092
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2093
|
+
}
|
2094
|
+
fprintf(f, " goto cancel;\n");
|
2095
|
+
fprintf(f, " }\n");
|
2096
|
+
b->stack_size += attr_sp_inc_opt_newarray_max(num);
|
2097
|
+
}
|
2098
|
+
fprintf(f, "}\n");
|
2099
|
+
break;
|
2100
|
+
case BIN(opt_newarray_min):
|
2101
|
+
fprintf(f, "{\n");
|
2102
|
+
{
|
2103
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2104
|
+
MAYBE_UNUSED(rb_num_t num) = (rb_num_t)operands[0];
|
2105
|
+
if (status->local_stack_p) {
|
2106
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2107
|
+
}
|
2108
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2109
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) num;\n");
|
2110
|
+
|
2111
|
+
fprintf(f, " num = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
2112
|
+
fprintf(f, "\n");
|
2113
|
+
if (body->catch_except_p || TRUE) {
|
2114
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2115
|
+
pc_moved_p = TRUE;
|
2116
|
+
}
|
2117
|
+
if (status->local_stack_p) {
|
2118
|
+
}
|
2119
|
+
else {
|
2120
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2121
|
+
}
|
2122
|
+
fprintf(f, " {\n");
|
2123
|
+
fprintf(f, " val = vm_opt_newarray_min(num, %s);\n",
|
2124
|
+
(status->local_stack_p ? "stack + (stack_size - (num))" : "STACK_ADDR_FROM_TOP(num)"));
|
2125
|
+
fprintf(f, " }\n");
|
2126
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_newarray_min(num) - 1);
|
2127
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2128
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_newarray_min(num) + 1);
|
2129
|
+
if (!pc_moved_p) {
|
2130
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2131
|
+
}
|
2132
|
+
fprintf(f, " goto cancel;\n");
|
2133
|
+
fprintf(f, " }\n");
|
2134
|
+
b->stack_size += attr_sp_inc_opt_newarray_min(num);
|
2135
|
+
}
|
2136
|
+
fprintf(f, "}\n");
|
2137
|
+
break;
|
2138
|
+
case BIN(invokesuper):
|
2139
|
+
fprintf(f, "{\n");
|
2140
|
+
{
|
2141
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2142
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2143
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2144
|
+
MAYBE_UNUSED(ISEQ blockiseq) = (ISEQ)operands[2];
|
2145
|
+
if (status->local_stack_p) {
|
2146
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2147
|
+
}
|
2148
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2149
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2150
|
+
fprintf(f, " MAYBE_UNUSED(ISEQ) blockiseq;\n");
|
2151
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2152
|
+
|
2153
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2154
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2155
|
+
fprintf(f, "\n");
|
2156
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2157
|
+
fprintf(f, "\n");
|
2158
|
+
fprintf(f, " blockiseq = (ISEQ)0x%"PRIxVALUE";", operands[2]);
|
2159
|
+
fprintf(f, "\n");
|
2160
|
+
if (body->catch_except_p || TRUE) {
|
2161
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2162
|
+
pc_moved_p = TRUE;
|
2163
|
+
}
|
2164
|
+
if (status->local_stack_p) {
|
2165
|
+
{
|
2166
|
+
rb_snum_t i, push_size;
|
2167
|
+
push_size = -attr_sp_inc_invokesuper(ci, cc, blockiseq) + 1 - 0;
|
2168
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
2169
|
+
for (i = 0; i < push_size; i++) {
|
2170
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
2171
|
+
}
|
2172
|
+
}
|
2173
|
+
}
|
2174
|
+
else {
|
2175
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
2176
|
+
}
|
2177
|
+
fprintf(f, " {\n");
|
2178
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
2179
|
+
fprintf(f, "\n");
|
2180
|
+
fprintf(f, " calling.block_handler = vm_caller_setup_arg_block(ec, reg_cfp, ci, blockiseq, TRUE);\n");
|
2181
|
+
fprintf(f, " calling.recv = TOPN(calling.argc = ci->orig_argc);\n");
|
2182
|
+
fprintf(f, " vm_search_super_method(ec, GET_CFP(), &calling, ci, cc);\n");
|
2183
|
+
fprintf(f, " CALL_METHOD(&calling, ci, cc);\n");
|
2184
|
+
fprintf(f, " }\n");
|
2185
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_invokesuper(ci, cc, blockiseq) - 1);
|
2186
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2187
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_invokesuper(ci, cc, blockiseq) + 1);
|
2188
|
+
if (!pc_moved_p) {
|
2189
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2190
|
+
}
|
2191
|
+
fprintf(f, " goto cancel;\n");
|
2192
|
+
fprintf(f, " }\n");
|
2193
|
+
b->stack_size += attr_sp_inc_invokesuper(ci, cc, blockiseq);
|
2194
|
+
}
|
2195
|
+
fprintf(f, "}\n");
|
2196
|
+
break;
|
2197
|
+
case BIN(invokeblock):
|
2198
|
+
fprintf(f, "{\n");
|
2199
|
+
{
|
2200
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2201
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2202
|
+
if (status->local_stack_p) {
|
2203
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2204
|
+
}
|
2205
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2206
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2207
|
+
|
2208
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2209
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2210
|
+
fprintf(f, "\n");
|
2211
|
+
if (body->catch_except_p || TRUE) {
|
2212
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2213
|
+
pc_moved_p = TRUE;
|
2214
|
+
}
|
2215
|
+
if (status->local_stack_p) {
|
2216
|
+
{
|
2217
|
+
rb_snum_t i, push_size;
|
2218
|
+
push_size = -attr_sp_inc_invokeblock(ci) + 1 - 0;
|
2219
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
2220
|
+
for (i = 0; i < push_size; i++) {
|
2221
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
2222
|
+
}
|
2223
|
+
}
|
2224
|
+
}
|
2225
|
+
else {
|
2226
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
2227
|
+
}
|
2228
|
+
fprintf(f, " {\n");
|
2229
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
2230
|
+
fprintf(f, " VALUE block_handler;\n");
|
2231
|
+
fprintf(f, "\n");
|
2232
|
+
fprintf(f, " calling.argc = ci->orig_argc;\n");
|
2233
|
+
fprintf(f, " calling.block_handler = VM_BLOCK_HANDLER_NONE;\n");
|
2234
|
+
fprintf(f, " calling.recv = Qundef; /* should not be used */\n");
|
2235
|
+
fprintf(f, "\n");
|
2236
|
+
fprintf(f, " block_handler = VM_CF_BLOCK_HANDLER(GET_CFP());\n");
|
2237
|
+
fprintf(f, " if (block_handler == VM_BLOCK_HANDLER_NONE) {\n");
|
2238
|
+
fprintf(f, " rb_vm_localjump_error(\"no block given (yield)\", Qnil, 0);\n");
|
2239
|
+
fprintf(f, " }\n");
|
2240
|
+
fprintf(f, "\n");
|
2241
|
+
fprintf(f, " val = vm_invoke_block(ec, GET_CFP(), &calling, ci, block_handler);\n");
|
2242
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2243
|
+
fprintf(f, " EXEC_EC_CFP(val);\n");
|
2244
|
+
fprintf(f, " }\n");
|
2245
|
+
fprintf(f, " }\n");
|
2246
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_invokeblock(ci) - 1);
|
2247
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2248
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_invokeblock(ci) + 1);
|
2249
|
+
if (!pc_moved_p) {
|
2250
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2251
|
+
}
|
2252
|
+
fprintf(f, " goto cancel;\n");
|
2253
|
+
fprintf(f, " }\n");
|
2254
|
+
b->stack_size += attr_sp_inc_invokeblock(ci);
|
2255
|
+
}
|
2256
|
+
fprintf(f, "}\n");
|
2257
|
+
break;
|
2258
|
+
case BIN(leave):
|
2259
|
+
if (b->stack_size != 1) {
|
2260
|
+
if (mjit_opts.warnings || mjit_opts.verbose)
|
2261
|
+
fprintf(stderr, "MJIT warning: Unexpected JIT stack_size on leave: %d\n", b->stack_size);
|
2262
|
+
status->success = FALSE;
|
2263
|
+
}
|
2264
|
+
fprintf(f, "{\n");
|
2265
|
+
{
|
2266
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2267
|
+
if (status->local_stack_p) {
|
2268
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2269
|
+
}
|
2270
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2271
|
+
|
2272
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
2273
|
+
if (body->catch_except_p || TRUE) {
|
2274
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2275
|
+
pc_moved_p = TRUE;
|
2276
|
+
}
|
2277
|
+
if (status->local_stack_p) {
|
2278
|
+
{
|
2279
|
+
rb_snum_t i, push_size;
|
2280
|
+
push_size = -attr_sp_inc_leave() + 1 - 1;
|
2281
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
2282
|
+
for (i = 0; i < push_size; i++) {
|
2283
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
2284
|
+
}
|
2285
|
+
}
|
2286
|
+
}
|
2287
|
+
else {
|
2288
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 1); /* POPN(INSN_ATTR(popn)); */
|
2289
|
+
}
|
2290
|
+
fprintf(f, " {\n");
|
2291
|
+
fprintf(f, " if (OPT_CHECKED_RUN) {\n");
|
2292
|
+
fprintf(f, " const VALUE *const bp = vm_base_ptr(reg_cfp);\n");
|
2293
|
+
fprintf(f, " if (reg_cfp->sp != bp) {\n");
|
2294
|
+
fprintf(f, " vm_stack_consistency_error(ec, reg_cfp, bp);\n");
|
2295
|
+
fprintf(f, " }\n");
|
2296
|
+
fprintf(f, " }\n");
|
2297
|
+
fprintf(f, "\n");
|
2298
|
+
fprintf(f, " RUBY_VM_CHECK_INTS(ec);\n");
|
2299
|
+
fprintf(f, "\n");
|
2300
|
+
fprintf(f, " if (vm_pop_frame(ec, GET_CFP(), GET_EP())) {\n");
|
2301
|
+
fprintf(f, "#if OPT_CALL_THREADED_CODE\n");
|
2302
|
+
fprintf(f, " rb_ec_thread_ptr(ec)->retval = val;\n");
|
2303
|
+
fprintf(f, " return 0;\n");
|
2304
|
+
fprintf(f, "#else\n");
|
2305
|
+
fprintf(f, " return val;\n");
|
2306
|
+
fprintf(f, "#endif\n");
|
2307
|
+
fprintf(f, " }\n");
|
2308
|
+
fprintf(f, " else {\n");
|
2309
|
+
fprintf(f, "#if OPT_CALL_THREADED_CODE\n");
|
2310
|
+
fprintf(f, " rb_ec_thread_ptr(ec)->retval = val;\n");
|
2311
|
+
fprintf(f, " return 0;\n");
|
2312
|
+
fprintf(f, "#else\n");
|
2313
|
+
fprintf(f, " return val;\n");
|
2314
|
+
fprintf(f, "#endif\n");
|
2315
|
+
fprintf(f, " }\n");
|
2316
|
+
fprintf(f, " }\n");
|
2317
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_leave() - 1);
|
2318
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2319
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_leave() + 1);
|
2320
|
+
if (!pc_moved_p) {
|
2321
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2322
|
+
}
|
2323
|
+
fprintf(f, " goto cancel;\n");
|
2324
|
+
fprintf(f, " }\n");
|
2325
|
+
b->stack_size += attr_sp_inc_leave();
|
2326
|
+
}
|
2327
|
+
fprintf(f, "}\n");
|
2328
|
+
b->finish_p = TRUE;
|
2329
|
+
break;
|
2330
|
+
case BIN(throw):
|
2331
|
+
fprintf(f, "{\n");
|
2332
|
+
{
|
2333
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2334
|
+
MAYBE_UNUSED(rb_num_t throw_state) = (rb_num_t)operands[0];
|
2335
|
+
if (status->local_stack_p) {
|
2336
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2337
|
+
}
|
2338
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) throwobj, val;\n");
|
2339
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) throw_state;\n");
|
2340
|
+
|
2341
|
+
fprintf(f, " throw_state = (rb_num_t)0x%"PRIxVALUE";", operands[0]);
|
2342
|
+
fprintf(f, "\n");
|
2343
|
+
fprintf(f, " throwobj = stack[%d];\n", b->stack_size - 1);
|
2344
|
+
if (body->catch_except_p || TRUE) {
|
2345
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2346
|
+
pc_moved_p = TRUE;
|
2347
|
+
}
|
2348
|
+
if (status->local_stack_p) {
|
2349
|
+
}
|
2350
|
+
else {
|
2351
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2352
|
+
}
|
2353
|
+
fprintf(f, " {\n");
|
2354
|
+
fprintf(f, " RUBY_VM_CHECK_INTS(ec);\n");
|
2355
|
+
fprintf(f, " val = vm_throw(ec, GET_CFP(), throw_state, throwobj);\n");
|
2356
|
+
fprintf(f, " THROW_EXCEPTION(val);\n");
|
2357
|
+
fprintf(f, " /* unreachable */\n");
|
2358
|
+
fprintf(f, " }\n");
|
2359
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_throw(throw_state) - 1);
|
2360
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2361
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_throw(throw_state) + 1);
|
2362
|
+
if (!pc_moved_p) {
|
2363
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2364
|
+
}
|
2365
|
+
fprintf(f, " goto cancel;\n");
|
2366
|
+
fprintf(f, " }\n");
|
2367
|
+
b->stack_size += attr_sp_inc_throw(throw_state);
|
2368
|
+
}
|
2369
|
+
fprintf(f, "}\n");
|
2370
|
+
b->finish_p = TRUE;
|
2371
|
+
break;
|
2372
|
+
case BIN(jump):
|
2373
|
+
fprintf(f, "{\n");
|
2374
|
+
{
|
2375
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2376
|
+
MAYBE_UNUSED(OFFSET dst) = (OFFSET)operands[0];
|
2377
|
+
if (status->local_stack_p) {
|
2378
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2379
|
+
}
|
2380
|
+
fprintf(f, " MAYBE_UNUSED(OFFSET) dst;\n");
|
2381
|
+
|
2382
|
+
fprintf(f, " dst = (OFFSET)0x%"PRIxVALUE";", operands[0]);
|
2383
|
+
fprintf(f, "\n");
|
2384
|
+
if (body->catch_except_p || TRUE) {
|
2385
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2386
|
+
pc_moved_p = TRUE;
|
2387
|
+
}
|
2388
|
+
if (status->local_stack_p) {
|
2389
|
+
}
|
2390
|
+
else {
|
2391
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2392
|
+
}
|
2393
|
+
fprintf(f, " {\n");
|
2394
|
+
fprintf(f, " RUBY_VM_CHECK_INTS(ec);\n");
|
2395
|
+
next_pos = pos + insn_len(insn) + (unsigned int)dst;
|
2396
|
+
fprintf(f, " goto label_%d;\n", next_pos);
|
2397
|
+
fprintf(f, " }\n");
|
2398
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2399
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_jump(dst) + 1);
|
2400
|
+
if (!pc_moved_p) {
|
2401
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2402
|
+
}
|
2403
|
+
fprintf(f, " goto cancel;\n");
|
2404
|
+
fprintf(f, " }\n");
|
2405
|
+
b->stack_size += attr_sp_inc_jump(dst);
|
2406
|
+
}
|
2407
|
+
fprintf(f, "}\n");
|
2408
|
+
break;
|
2409
|
+
case BIN(branchif):
|
2410
|
+
fprintf(f, "{\n");
|
2411
|
+
{
|
2412
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2413
|
+
MAYBE_UNUSED(OFFSET dst) = (OFFSET)operands[0];
|
2414
|
+
if (status->local_stack_p) {
|
2415
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2416
|
+
}
|
2417
|
+
fprintf(f, " MAYBE_UNUSED(OFFSET) dst;\n");
|
2418
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2419
|
+
|
2420
|
+
fprintf(f, " dst = (OFFSET)0x%"PRIxVALUE";", operands[0]);
|
2421
|
+
fprintf(f, "\n");
|
2422
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
2423
|
+
if (body->catch_except_p || TRUE) {
|
2424
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2425
|
+
pc_moved_p = TRUE;
|
2426
|
+
}
|
2427
|
+
if (status->local_stack_p) {
|
2428
|
+
}
|
2429
|
+
else {
|
2430
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2431
|
+
}
|
2432
|
+
fprintf(f, " {\n");
|
2433
|
+
fprintf(f, " if (RTEST(val)) {\n");
|
2434
|
+
fprintf(f, " RUBY_VM_CHECK_INTS(ec);\n");
|
2435
|
+
next_pos = pos + insn_len(insn) + (unsigned int)dst;
|
2436
|
+
fprintf(f, " goto label_%d;\n", next_pos);
|
2437
|
+
fprintf(f, " }\n");
|
2438
|
+
fprintf(f, " }\n");
|
2439
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2440
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_branchif(dst) + 1);
|
2441
|
+
if (!pc_moved_p) {
|
2442
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2443
|
+
}
|
2444
|
+
fprintf(f, " goto cancel;\n");
|
2445
|
+
fprintf(f, " }\n");
|
2446
|
+
b->stack_size += attr_sp_inc_branchif(dst);
|
2447
|
+
}
|
2448
|
+
fprintf(f, "}\n");
|
2449
|
+
compile_insns(f, body, b->stack_size, pos + insn_len(insn), status);
|
2450
|
+
break;
|
2451
|
+
case BIN(branchunless):
|
2452
|
+
fprintf(f, "{\n");
|
2453
|
+
{
|
2454
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2455
|
+
MAYBE_UNUSED(OFFSET dst) = (OFFSET)operands[0];
|
2456
|
+
if (status->local_stack_p) {
|
2457
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2458
|
+
}
|
2459
|
+
fprintf(f, " MAYBE_UNUSED(OFFSET) dst;\n");
|
2460
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2461
|
+
|
2462
|
+
fprintf(f, " dst = (OFFSET)0x%"PRIxVALUE";", operands[0]);
|
2463
|
+
fprintf(f, "\n");
|
2464
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
2465
|
+
if (body->catch_except_p || TRUE) {
|
2466
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2467
|
+
pc_moved_p = TRUE;
|
2468
|
+
}
|
2469
|
+
if (status->local_stack_p) {
|
2470
|
+
}
|
2471
|
+
else {
|
2472
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2473
|
+
}
|
2474
|
+
fprintf(f, " {\n");
|
2475
|
+
fprintf(f, " if (!RTEST(val)) {\n");
|
2476
|
+
fprintf(f, " RUBY_VM_CHECK_INTS(ec);\n");
|
2477
|
+
next_pos = pos + insn_len(insn) + (unsigned int)dst;
|
2478
|
+
fprintf(f, " goto label_%d;\n", next_pos);
|
2479
|
+
fprintf(f, " }\n");
|
2480
|
+
fprintf(f, " }\n");
|
2481
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2482
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_branchunless(dst) + 1);
|
2483
|
+
if (!pc_moved_p) {
|
2484
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2485
|
+
}
|
2486
|
+
fprintf(f, " goto cancel;\n");
|
2487
|
+
fprintf(f, " }\n");
|
2488
|
+
b->stack_size += attr_sp_inc_branchunless(dst);
|
2489
|
+
}
|
2490
|
+
fprintf(f, "}\n");
|
2491
|
+
compile_insns(f, body, b->stack_size, pos + insn_len(insn), status);
|
2492
|
+
break;
|
2493
|
+
case BIN(branchnil):
|
2494
|
+
fprintf(f, "{\n");
|
2495
|
+
{
|
2496
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2497
|
+
MAYBE_UNUSED(OFFSET dst) = (OFFSET)operands[0];
|
2498
|
+
if (status->local_stack_p) {
|
2499
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2500
|
+
}
|
2501
|
+
fprintf(f, " MAYBE_UNUSED(OFFSET) dst;\n");
|
2502
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2503
|
+
|
2504
|
+
fprintf(f, " dst = (OFFSET)0x%"PRIxVALUE";", operands[0]);
|
2505
|
+
fprintf(f, "\n");
|
2506
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
2507
|
+
if (body->catch_except_p || TRUE) {
|
2508
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2509
|
+
pc_moved_p = TRUE;
|
2510
|
+
}
|
2511
|
+
if (status->local_stack_p) {
|
2512
|
+
}
|
2513
|
+
else {
|
2514
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2515
|
+
}
|
2516
|
+
fprintf(f, " {\n");
|
2517
|
+
fprintf(f, " if (NIL_P(val)) {\n");
|
2518
|
+
fprintf(f, " RUBY_VM_CHECK_INTS(ec);\n");
|
2519
|
+
next_pos = pos + insn_len(insn) + (unsigned int)dst;
|
2520
|
+
fprintf(f, " goto label_%d;\n", next_pos);
|
2521
|
+
fprintf(f, " }\n");
|
2522
|
+
fprintf(f, " }\n");
|
2523
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2524
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_branchnil(dst) + 1);
|
2525
|
+
if (!pc_moved_p) {
|
2526
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2527
|
+
}
|
2528
|
+
fprintf(f, " goto cancel;\n");
|
2529
|
+
fprintf(f, " }\n");
|
2530
|
+
b->stack_size += attr_sp_inc_branchnil(dst);
|
2531
|
+
}
|
2532
|
+
fprintf(f, "}\n");
|
2533
|
+
compile_insns(f, body, b->stack_size, pos + insn_len(insn), status);
|
2534
|
+
break;
|
2535
|
+
case BIN(opt_getinlinecache):
|
2536
|
+
fprintf(f, "{\n");
|
2537
|
+
{
|
2538
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2539
|
+
MAYBE_UNUSED(OFFSET dst) = (OFFSET)operands[0];
|
2540
|
+
MAYBE_UNUSED(IC ic) = (IC)operands[1];
|
2541
|
+
if (status->local_stack_p) {
|
2542
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2543
|
+
}
|
2544
|
+
fprintf(f, " MAYBE_UNUSED(IC) ic;\n");
|
2545
|
+
fprintf(f, " MAYBE_UNUSED(OFFSET) dst;\n");
|
2546
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2547
|
+
|
2548
|
+
fprintf(f, " dst = (OFFSET)0x%"PRIxVALUE";", operands[0]);
|
2549
|
+
fprintf(f, "\n");
|
2550
|
+
fprintf(f, " ic = (IC)0x%"PRIxVALUE";", operands[1]);
|
2551
|
+
fprintf(f, "\n");
|
2552
|
+
if (body->catch_except_p || FALSE) {
|
2553
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2554
|
+
pc_moved_p = TRUE;
|
2555
|
+
}
|
2556
|
+
if (status->local_stack_p) {
|
2557
|
+
}
|
2558
|
+
else {
|
2559
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2560
|
+
}
|
2561
|
+
fprintf(f, " {\n");
|
2562
|
+
fprintf(f, " if (vm_ic_hit_p(ic, GET_EP())) {\n");
|
2563
|
+
fprintf(f, " val = ic->ic_value.value;\n");
|
2564
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_getinlinecache(dst, ic) - 1);
|
2565
|
+
next_pos = pos + insn_len(insn) + (unsigned int)dst;
|
2566
|
+
fprintf(f, " goto label_%d;\n", next_pos);
|
2567
|
+
fprintf(f, " }\n");
|
2568
|
+
fprintf(f, " else {\n");
|
2569
|
+
fprintf(f, " val = Qnil;\n");
|
2570
|
+
fprintf(f, " }\n");
|
2571
|
+
fprintf(f, " }\n");
|
2572
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_getinlinecache(dst, ic) - 1);
|
2573
|
+
b->stack_size += attr_sp_inc_opt_getinlinecache(dst, ic);
|
2574
|
+
}
|
2575
|
+
fprintf(f, "}\n");
|
2576
|
+
compile_insns(f, body, b->stack_size, pos + insn_len(insn), status);
|
2577
|
+
break;
|
2578
|
+
case BIN(opt_setinlinecache):
|
2579
|
+
fprintf(f, "{\n");
|
2580
|
+
{
|
2581
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2582
|
+
MAYBE_UNUSED(IC ic) = (IC)operands[0];
|
2583
|
+
if (status->local_stack_p) {
|
2584
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2585
|
+
}
|
2586
|
+
fprintf(f, " MAYBE_UNUSED(IC) ic;\n");
|
2587
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2588
|
+
|
2589
|
+
fprintf(f, " ic = (IC)0x%"PRIxVALUE";", operands[0]);
|
2590
|
+
fprintf(f, "\n");
|
2591
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
2592
|
+
if (body->catch_except_p || FALSE) {
|
2593
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2594
|
+
pc_moved_p = TRUE;
|
2595
|
+
}
|
2596
|
+
if (status->local_stack_p) {
|
2597
|
+
}
|
2598
|
+
else {
|
2599
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2600
|
+
}
|
2601
|
+
fprintf(f, " {\n");
|
2602
|
+
fprintf(f, " vm_ic_update(ic, val, GET_EP());\n");
|
2603
|
+
fprintf(f, " }\n");
|
2604
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_setinlinecache(ic) - 1);
|
2605
|
+
b->stack_size += attr_sp_inc_opt_setinlinecache(ic);
|
2606
|
+
}
|
2607
|
+
fprintf(f, "}\n");
|
2608
|
+
break;
|
2609
|
+
case BIN(once):
|
2610
|
+
fprintf(f, "{\n");
|
2611
|
+
{
|
2612
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2613
|
+
MAYBE_UNUSED(ISEQ iseq) = (ISEQ)operands[0];
|
2614
|
+
MAYBE_UNUSED(ISE ise) = (ISE)operands[1];
|
2615
|
+
if (status->local_stack_p) {
|
2616
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2617
|
+
}
|
2618
|
+
fprintf(f, " MAYBE_UNUSED(ISE) ise;\n");
|
2619
|
+
fprintf(f, " MAYBE_UNUSED(ISEQ) iseq;\n");
|
2620
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
2621
|
+
|
2622
|
+
fprintf(f, " iseq = (ISEQ)0x%"PRIxVALUE";", operands[0]);
|
2623
|
+
fprintf(f, "\n");
|
2624
|
+
fprintf(f, " ise = (ISE)0x%"PRIxVALUE";", operands[1]);
|
2625
|
+
fprintf(f, "\n");
|
2626
|
+
if (body->catch_except_p || TRUE) {
|
2627
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2628
|
+
pc_moved_p = TRUE;
|
2629
|
+
}
|
2630
|
+
if (status->local_stack_p) {
|
2631
|
+
{
|
2632
|
+
rb_snum_t i, push_size;
|
2633
|
+
push_size = -attr_sp_inc_once(iseq, ise) + 1 - 0;
|
2634
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
2635
|
+
for (i = 0; i < push_size; i++) {
|
2636
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
2637
|
+
}
|
2638
|
+
}
|
2639
|
+
}
|
2640
|
+
else {
|
2641
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
2642
|
+
}
|
2643
|
+
fprintf(f, " {\n");
|
2644
|
+
fprintf(f, " val = vm_once_dispatch(ec, iseq, ise);\n");
|
2645
|
+
fprintf(f, " }\n");
|
2646
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_once(iseq, ise) - 1);
|
2647
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2648
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_once(iseq, ise) + 1);
|
2649
|
+
if (!pc_moved_p) {
|
2650
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2651
|
+
}
|
2652
|
+
fprintf(f, " goto cancel;\n");
|
2653
|
+
fprintf(f, " }\n");
|
2654
|
+
b->stack_size += attr_sp_inc_once(iseq, ise);
|
2655
|
+
}
|
2656
|
+
fprintf(f, "}\n");
|
2657
|
+
break;
|
2658
|
+
case BIN(opt_case_dispatch):
|
2659
|
+
fprintf(f, "{\n");
|
2660
|
+
{
|
2661
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2662
|
+
MAYBE_UNUSED(CDHASH hash) = (CDHASH)operands[0];
|
2663
|
+
MAYBE_UNUSED(OFFSET else_offset) = (OFFSET)operands[1];
|
2664
|
+
if (status->local_stack_p) {
|
2665
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2666
|
+
}
|
2667
|
+
fprintf(f, " MAYBE_UNUSED(CDHASH) hash;\n");
|
2668
|
+
fprintf(f, " MAYBE_UNUSED(OFFSET) else_offset;\n");
|
2669
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) key;\n");
|
2670
|
+
|
2671
|
+
fprintf(f, " hash = (CDHASH)0x%"PRIxVALUE";", operands[0]);
|
2672
|
+
fprintf(f, "\n");
|
2673
|
+
fprintf(f, " else_offset = (OFFSET)0x%"PRIxVALUE";", operands[1]);
|
2674
|
+
fprintf(f, "\n");
|
2675
|
+
fprintf(f, " key = stack[%d];\n", b->stack_size - 1);
|
2676
|
+
if (body->catch_except_p || FALSE) {
|
2677
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2678
|
+
pc_moved_p = TRUE;
|
2679
|
+
}
|
2680
|
+
if (status->local_stack_p) {
|
2681
|
+
}
|
2682
|
+
else {
|
2683
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2684
|
+
}
|
2685
|
+
fprintf(f, " {\n");
|
2686
|
+
fprintf(f, " OFFSET dst = vm_case_dispatch(hash, else_offset, key);\n");
|
2687
|
+
fprintf(f, "\n");
|
2688
|
+
fprintf(f, " if (dst) {\n");
|
2689
|
+
{
|
2690
|
+
struct case_dispatch_var arg;
|
2691
|
+
arg.f = f;
|
2692
|
+
arg.base_pos = pos + insn_len(insn);
|
2693
|
+
arg.last_value = Qundef;
|
2694
|
+
|
2695
|
+
fprintf(f, " switch (dst) {\n");
|
2696
|
+
st_foreach(RHASH_TBL_RAW(hash), compile_case_dispatch_each, (VALUE)&arg);
|
2697
|
+
fprintf(f, " case %lu:\n", else_offset);
|
2698
|
+
fprintf(f, " goto label_%lu;\n", arg.base_pos + else_offset);
|
2699
|
+
fprintf(f, " }\n");
|
2700
|
+
}
|
2701
|
+
fprintf(f, " }\n");
|
2702
|
+
fprintf(f, " }\n");
|
2703
|
+
b->stack_size += attr_sp_inc_opt_case_dispatch(hash, else_offset);
|
2704
|
+
}
|
2705
|
+
fprintf(f, "}\n");
|
2706
|
+
compile_insns(f, body, b->stack_size, pos + insn_len(insn), status);
|
2707
|
+
break;
|
2708
|
+
case BIN(opt_plus):
|
2709
|
+
fprintf(f, "{\n");
|
2710
|
+
{
|
2711
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2712
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2713
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2714
|
+
if (status->local_stack_p) {
|
2715
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2716
|
+
}
|
2717
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2718
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2719
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
2720
|
+
|
2721
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2722
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2723
|
+
fprintf(f, "\n");
|
2724
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2725
|
+
fprintf(f, "\n");
|
2726
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
2727
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
2728
|
+
if (body->catch_except_p || TRUE) {
|
2729
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2730
|
+
pc_moved_p = TRUE;
|
2731
|
+
}
|
2732
|
+
if (status->local_stack_p) {
|
2733
|
+
}
|
2734
|
+
else {
|
2735
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2736
|
+
}
|
2737
|
+
fprintf(f, " {\n");
|
2738
|
+
fprintf(f, " val = vm_opt_plus(recv, obj);\n");
|
2739
|
+
fprintf(f, "\n");
|
2740
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2741
|
+
if (status->local_stack_p) {
|
2742
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2743
|
+
}
|
2744
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2745
|
+
fprintf(f, " goto cancel;\n");
|
2746
|
+
fprintf(f, " }\n");
|
2747
|
+
fprintf(f, " }\n");
|
2748
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_plus(ci, cc) - 1);
|
2749
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2750
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_plus(ci, cc) + 1);
|
2751
|
+
if (!pc_moved_p) {
|
2752
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2753
|
+
}
|
2754
|
+
fprintf(f, " goto cancel;\n");
|
2755
|
+
fprintf(f, " }\n");
|
2756
|
+
b->stack_size += attr_sp_inc_opt_plus(ci, cc);
|
2757
|
+
}
|
2758
|
+
fprintf(f, "}\n");
|
2759
|
+
break;
|
2760
|
+
case BIN(opt_minus):
|
2761
|
+
fprintf(f, "{\n");
|
2762
|
+
{
|
2763
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2764
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2765
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2766
|
+
if (status->local_stack_p) {
|
2767
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2768
|
+
}
|
2769
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2770
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2771
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
2772
|
+
|
2773
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2774
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2775
|
+
fprintf(f, "\n");
|
2776
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2777
|
+
fprintf(f, "\n");
|
2778
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
2779
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
2780
|
+
if (body->catch_except_p || FALSE) {
|
2781
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2782
|
+
pc_moved_p = TRUE;
|
2783
|
+
}
|
2784
|
+
if (status->local_stack_p) {
|
2785
|
+
}
|
2786
|
+
else {
|
2787
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2788
|
+
}
|
2789
|
+
fprintf(f, " {\n");
|
2790
|
+
fprintf(f, " val = vm_opt_minus(recv, obj);\n");
|
2791
|
+
fprintf(f, "\n");
|
2792
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2793
|
+
if (status->local_stack_p) {
|
2794
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2795
|
+
}
|
2796
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2797
|
+
fprintf(f, " goto cancel;\n");
|
2798
|
+
fprintf(f, " }\n");
|
2799
|
+
fprintf(f, " }\n");
|
2800
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_minus(ci, cc) - 1);
|
2801
|
+
b->stack_size += attr_sp_inc_opt_minus(ci, cc);
|
2802
|
+
}
|
2803
|
+
fprintf(f, "}\n");
|
2804
|
+
break;
|
2805
|
+
case BIN(opt_mult):
|
2806
|
+
fprintf(f, "{\n");
|
2807
|
+
{
|
2808
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2809
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2810
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2811
|
+
if (status->local_stack_p) {
|
2812
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2813
|
+
}
|
2814
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2815
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2816
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
2817
|
+
|
2818
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2819
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2820
|
+
fprintf(f, "\n");
|
2821
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2822
|
+
fprintf(f, "\n");
|
2823
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
2824
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
2825
|
+
if (body->catch_except_p || FALSE) {
|
2826
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2827
|
+
pc_moved_p = TRUE;
|
2828
|
+
}
|
2829
|
+
if (status->local_stack_p) {
|
2830
|
+
}
|
2831
|
+
else {
|
2832
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2833
|
+
}
|
2834
|
+
fprintf(f, " {\n");
|
2835
|
+
fprintf(f, " val = vm_opt_mult(recv, obj);\n");
|
2836
|
+
fprintf(f, "\n");
|
2837
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2838
|
+
if (status->local_stack_p) {
|
2839
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2840
|
+
}
|
2841
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2842
|
+
fprintf(f, " goto cancel;\n");
|
2843
|
+
fprintf(f, " }\n");
|
2844
|
+
fprintf(f, " }\n");
|
2845
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_mult(ci, cc) - 1);
|
2846
|
+
b->stack_size += attr_sp_inc_opt_mult(ci, cc);
|
2847
|
+
}
|
2848
|
+
fprintf(f, "}\n");
|
2849
|
+
break;
|
2850
|
+
case BIN(opt_div):
|
2851
|
+
fprintf(f, "{\n");
|
2852
|
+
{
|
2853
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2854
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2855
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2856
|
+
if (status->local_stack_p) {
|
2857
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2858
|
+
}
|
2859
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2860
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2861
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
2862
|
+
|
2863
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2864
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2865
|
+
fprintf(f, "\n");
|
2866
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2867
|
+
fprintf(f, "\n");
|
2868
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
2869
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
2870
|
+
if (body->catch_except_p || FALSE) {
|
2871
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2872
|
+
pc_moved_p = TRUE;
|
2873
|
+
}
|
2874
|
+
if (status->local_stack_p) {
|
2875
|
+
}
|
2876
|
+
else {
|
2877
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2878
|
+
}
|
2879
|
+
fprintf(f, " {\n");
|
2880
|
+
fprintf(f, " val = vm_opt_div(recv, obj);\n");
|
2881
|
+
fprintf(f, "\n");
|
2882
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2883
|
+
if (status->local_stack_p) {
|
2884
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2885
|
+
}
|
2886
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2887
|
+
fprintf(f, " goto cancel;\n");
|
2888
|
+
fprintf(f, " }\n");
|
2889
|
+
fprintf(f, " }\n");
|
2890
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_div(ci, cc) - 1);
|
2891
|
+
b->stack_size += attr_sp_inc_opt_div(ci, cc);
|
2892
|
+
}
|
2893
|
+
fprintf(f, "}\n");
|
2894
|
+
break;
|
2895
|
+
case BIN(opt_mod):
|
2896
|
+
fprintf(f, "{\n");
|
2897
|
+
{
|
2898
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2899
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2900
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2901
|
+
if (status->local_stack_p) {
|
2902
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2903
|
+
}
|
2904
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2905
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2906
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
2907
|
+
|
2908
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2909
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2910
|
+
fprintf(f, "\n");
|
2911
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2912
|
+
fprintf(f, "\n");
|
2913
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
2914
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
2915
|
+
if (body->catch_except_p || FALSE) {
|
2916
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2917
|
+
pc_moved_p = TRUE;
|
2918
|
+
}
|
2919
|
+
if (status->local_stack_p) {
|
2920
|
+
}
|
2921
|
+
else {
|
2922
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2923
|
+
}
|
2924
|
+
fprintf(f, " {\n");
|
2925
|
+
fprintf(f, " val = vm_opt_mod(recv, obj);\n");
|
2926
|
+
fprintf(f, "\n");
|
2927
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2928
|
+
if (status->local_stack_p) {
|
2929
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2930
|
+
}
|
2931
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2932
|
+
fprintf(f, " goto cancel;\n");
|
2933
|
+
fprintf(f, " }\n");
|
2934
|
+
fprintf(f, " }\n");
|
2935
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_mod(ci, cc) - 1);
|
2936
|
+
b->stack_size += attr_sp_inc_opt_mod(ci, cc);
|
2937
|
+
}
|
2938
|
+
fprintf(f, "}\n");
|
2939
|
+
break;
|
2940
|
+
case BIN(opt_eq):
|
2941
|
+
fprintf(f, "{\n");
|
2942
|
+
{
|
2943
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2944
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
2945
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
2946
|
+
if (status->local_stack_p) {
|
2947
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
2948
|
+
}
|
2949
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
2950
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
2951
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
2952
|
+
|
2953
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
2954
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
2955
|
+
fprintf(f, "\n");
|
2956
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
2957
|
+
fprintf(f, "\n");
|
2958
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
2959
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
2960
|
+
if (body->catch_except_p || TRUE) {
|
2961
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
2962
|
+
pc_moved_p = TRUE;
|
2963
|
+
}
|
2964
|
+
if (status->local_stack_p) {
|
2965
|
+
}
|
2966
|
+
else {
|
2967
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2968
|
+
}
|
2969
|
+
fprintf(f, " {\n");
|
2970
|
+
fprintf(f, " val = opt_eq_func(recv, obj, ci, cc);\n");
|
2971
|
+
fprintf(f, "\n");
|
2972
|
+
fprintf(f, " if (val == Qundef) {\n");
|
2973
|
+
if (status->local_stack_p) {
|
2974
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
2975
|
+
}
|
2976
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
2977
|
+
fprintf(f, " goto cancel;\n");
|
2978
|
+
fprintf(f, " }\n");
|
2979
|
+
fprintf(f, " }\n");
|
2980
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_eq(ci, cc) - 1);
|
2981
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
2982
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_eq(ci, cc) + 1);
|
2983
|
+
if (!pc_moved_p) {
|
2984
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
2985
|
+
}
|
2986
|
+
fprintf(f, " goto cancel;\n");
|
2987
|
+
fprintf(f, " }\n");
|
2988
|
+
b->stack_size += attr_sp_inc_opt_eq(ci, cc);
|
2989
|
+
}
|
2990
|
+
fprintf(f, "}\n");
|
2991
|
+
break;
|
2992
|
+
case BIN(opt_neq):
|
2993
|
+
fprintf(f, "{\n");
|
2994
|
+
{
|
2995
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
2996
|
+
MAYBE_UNUSED(CALL_INFO ci_eq) = (CALL_INFO)operands[0];
|
2997
|
+
MAYBE_UNUSED(CALL_CACHE cc_eq) = (CALL_CACHE)operands[1];
|
2998
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[2];
|
2999
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[3];
|
3000
|
+
if (status->local_stack_p) {
|
3001
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3002
|
+
}
|
3003
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc, cc_eq;\n");
|
3004
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci, ci_eq;\n");
|
3005
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3006
|
+
|
3007
|
+
fprintf(f, " ci_eq = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3008
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3009
|
+
fprintf(f, "\n");
|
3010
|
+
fprintf(f, " cc_eq = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3011
|
+
fprintf(f, "\n");
|
3012
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[2]);
|
3013
|
+
comment_id(f, ((CALL_INFO)operands[2])->mid);
|
3014
|
+
fprintf(f, "\n");
|
3015
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[3]);
|
3016
|
+
fprintf(f, "\n");
|
3017
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3018
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3019
|
+
if (body->catch_except_p || TRUE) {
|
3020
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3021
|
+
pc_moved_p = TRUE;
|
3022
|
+
}
|
3023
|
+
if (status->local_stack_p) {
|
3024
|
+
}
|
3025
|
+
else {
|
3026
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3027
|
+
}
|
3028
|
+
fprintf(f, " {\n");
|
3029
|
+
fprintf(f, " val = vm_opt_neq(ci, cc, ci_eq, cc_eq, recv, obj);\n");
|
3030
|
+
fprintf(f, "\n");
|
3031
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3032
|
+
if (status->local_stack_p) {
|
3033
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3034
|
+
}
|
3035
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3036
|
+
fprintf(f, " goto cancel;\n");
|
3037
|
+
fprintf(f, " }\n");
|
3038
|
+
fprintf(f, " }\n");
|
3039
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_neq(ci_eq, cc_eq, ci, cc) - 1);
|
3040
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3041
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_neq(ci_eq, cc_eq, ci, cc) + 1);
|
3042
|
+
if (!pc_moved_p) {
|
3043
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3044
|
+
}
|
3045
|
+
fprintf(f, " goto cancel;\n");
|
3046
|
+
fprintf(f, " }\n");
|
3047
|
+
b->stack_size += attr_sp_inc_opt_neq(ci_eq, cc_eq, ci, cc);
|
3048
|
+
}
|
3049
|
+
fprintf(f, "}\n");
|
3050
|
+
break;
|
3051
|
+
case BIN(opt_lt):
|
3052
|
+
fprintf(f, "{\n");
|
3053
|
+
{
|
3054
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3055
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3056
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3057
|
+
if (status->local_stack_p) {
|
3058
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3059
|
+
}
|
3060
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3061
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3062
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3063
|
+
|
3064
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3065
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3066
|
+
fprintf(f, "\n");
|
3067
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3068
|
+
fprintf(f, "\n");
|
3069
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3070
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3071
|
+
if (body->catch_except_p || FALSE) {
|
3072
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3073
|
+
pc_moved_p = TRUE;
|
3074
|
+
}
|
3075
|
+
if (status->local_stack_p) {
|
3076
|
+
}
|
3077
|
+
else {
|
3078
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3079
|
+
}
|
3080
|
+
fprintf(f, " {\n");
|
3081
|
+
fprintf(f, " val = vm_opt_lt(recv, obj);\n");
|
3082
|
+
fprintf(f, "\n");
|
3083
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3084
|
+
if (status->local_stack_p) {
|
3085
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3086
|
+
}
|
3087
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3088
|
+
fprintf(f, " goto cancel;\n");
|
3089
|
+
fprintf(f, " }\n");
|
3090
|
+
fprintf(f, " }\n");
|
3091
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_lt(ci, cc) - 1);
|
3092
|
+
b->stack_size += attr_sp_inc_opt_lt(ci, cc);
|
3093
|
+
}
|
3094
|
+
fprintf(f, "}\n");
|
3095
|
+
break;
|
3096
|
+
case BIN(opt_le):
|
3097
|
+
fprintf(f, "{\n");
|
3098
|
+
{
|
3099
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3100
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3101
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3102
|
+
if (status->local_stack_p) {
|
3103
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3104
|
+
}
|
3105
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3106
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3107
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3108
|
+
|
3109
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3110
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3111
|
+
fprintf(f, "\n");
|
3112
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3113
|
+
fprintf(f, "\n");
|
3114
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3115
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3116
|
+
if (body->catch_except_p || FALSE) {
|
3117
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3118
|
+
pc_moved_p = TRUE;
|
3119
|
+
}
|
3120
|
+
if (status->local_stack_p) {
|
3121
|
+
}
|
3122
|
+
else {
|
3123
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3124
|
+
}
|
3125
|
+
fprintf(f, " {\n");
|
3126
|
+
fprintf(f, " val = vm_opt_le(recv, obj);\n");
|
3127
|
+
fprintf(f, "\n");
|
3128
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3129
|
+
if (status->local_stack_p) {
|
3130
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3131
|
+
}
|
3132
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3133
|
+
fprintf(f, " goto cancel;\n");
|
3134
|
+
fprintf(f, " }\n");
|
3135
|
+
fprintf(f, " }\n");
|
3136
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_le(ci, cc) - 1);
|
3137
|
+
b->stack_size += attr_sp_inc_opt_le(ci, cc);
|
3138
|
+
}
|
3139
|
+
fprintf(f, "}\n");
|
3140
|
+
break;
|
3141
|
+
case BIN(opt_gt):
|
3142
|
+
fprintf(f, "{\n");
|
3143
|
+
{
|
3144
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3145
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3146
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3147
|
+
if (status->local_stack_p) {
|
3148
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3149
|
+
}
|
3150
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3151
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3152
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3153
|
+
|
3154
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3155
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3156
|
+
fprintf(f, "\n");
|
3157
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3158
|
+
fprintf(f, "\n");
|
3159
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3160
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3161
|
+
if (body->catch_except_p || FALSE) {
|
3162
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3163
|
+
pc_moved_p = TRUE;
|
3164
|
+
}
|
3165
|
+
if (status->local_stack_p) {
|
3166
|
+
}
|
3167
|
+
else {
|
3168
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3169
|
+
}
|
3170
|
+
fprintf(f, " {\n");
|
3171
|
+
fprintf(f, " val = vm_opt_gt(recv, obj);\n");
|
3172
|
+
fprintf(f, "\n");
|
3173
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3174
|
+
if (status->local_stack_p) {
|
3175
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3176
|
+
}
|
3177
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3178
|
+
fprintf(f, " goto cancel;\n");
|
3179
|
+
fprintf(f, " }\n");
|
3180
|
+
fprintf(f, " }\n");
|
3181
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_gt(ci, cc) - 1);
|
3182
|
+
b->stack_size += attr_sp_inc_opt_gt(ci, cc);
|
3183
|
+
}
|
3184
|
+
fprintf(f, "}\n");
|
3185
|
+
break;
|
3186
|
+
case BIN(opt_ge):
|
3187
|
+
fprintf(f, "{\n");
|
3188
|
+
{
|
3189
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3190
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3191
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3192
|
+
if (status->local_stack_p) {
|
3193
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3194
|
+
}
|
3195
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3196
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3197
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3198
|
+
|
3199
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3200
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3201
|
+
fprintf(f, "\n");
|
3202
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3203
|
+
fprintf(f, "\n");
|
3204
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3205
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3206
|
+
if (body->catch_except_p || FALSE) {
|
3207
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3208
|
+
pc_moved_p = TRUE;
|
3209
|
+
}
|
3210
|
+
if (status->local_stack_p) {
|
3211
|
+
}
|
3212
|
+
else {
|
3213
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3214
|
+
}
|
3215
|
+
fprintf(f, " {\n");
|
3216
|
+
fprintf(f, " val = vm_opt_ge(recv, obj);\n");
|
3217
|
+
fprintf(f, "\n");
|
3218
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3219
|
+
if (status->local_stack_p) {
|
3220
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3221
|
+
}
|
3222
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3223
|
+
fprintf(f, " goto cancel;\n");
|
3224
|
+
fprintf(f, " }\n");
|
3225
|
+
fprintf(f, " }\n");
|
3226
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_ge(ci, cc) - 1);
|
3227
|
+
b->stack_size += attr_sp_inc_opt_ge(ci, cc);
|
3228
|
+
}
|
3229
|
+
fprintf(f, "}\n");
|
3230
|
+
break;
|
3231
|
+
case BIN(opt_ltlt):
|
3232
|
+
fprintf(f, "{\n");
|
3233
|
+
{
|
3234
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3235
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3236
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3237
|
+
if (status->local_stack_p) {
|
3238
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3239
|
+
}
|
3240
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3241
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3242
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3243
|
+
|
3244
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3245
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3246
|
+
fprintf(f, "\n");
|
3247
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3248
|
+
fprintf(f, "\n");
|
3249
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3250
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3251
|
+
if (body->catch_except_p || FALSE) {
|
3252
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3253
|
+
pc_moved_p = TRUE;
|
3254
|
+
}
|
3255
|
+
if (status->local_stack_p) {
|
3256
|
+
}
|
3257
|
+
else {
|
3258
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3259
|
+
}
|
3260
|
+
fprintf(f, " {\n");
|
3261
|
+
fprintf(f, " val = vm_opt_ltlt(recv, obj);\n");
|
3262
|
+
fprintf(f, "\n");
|
3263
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3264
|
+
if (status->local_stack_p) {
|
3265
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3266
|
+
}
|
3267
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3268
|
+
fprintf(f, " goto cancel;\n");
|
3269
|
+
fprintf(f, " }\n");
|
3270
|
+
fprintf(f, " }\n");
|
3271
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_ltlt(ci, cc) - 1);
|
3272
|
+
b->stack_size += attr_sp_inc_opt_ltlt(ci, cc);
|
3273
|
+
}
|
3274
|
+
fprintf(f, "}\n");
|
3275
|
+
break;
|
3276
|
+
case BIN(opt_and):
|
3277
|
+
fprintf(f, "{\n");
|
3278
|
+
{
|
3279
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3280
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3281
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3282
|
+
if (status->local_stack_p) {
|
3283
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3284
|
+
}
|
3285
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3286
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3287
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3288
|
+
|
3289
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3290
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3291
|
+
fprintf(f, "\n");
|
3292
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3293
|
+
fprintf(f, "\n");
|
3294
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3295
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3296
|
+
if (body->catch_except_p || FALSE) {
|
3297
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3298
|
+
pc_moved_p = TRUE;
|
3299
|
+
}
|
3300
|
+
if (status->local_stack_p) {
|
3301
|
+
}
|
3302
|
+
else {
|
3303
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3304
|
+
}
|
3305
|
+
fprintf(f, " {\n");
|
3306
|
+
fprintf(f, " val = vm_opt_and(recv, obj);\n");
|
3307
|
+
fprintf(f, "\n");
|
3308
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3309
|
+
if (status->local_stack_p) {
|
3310
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3311
|
+
}
|
3312
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3313
|
+
fprintf(f, " goto cancel;\n");
|
3314
|
+
fprintf(f, " }\n");
|
3315
|
+
fprintf(f, " }\n");
|
3316
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_and(ci, cc) - 1);
|
3317
|
+
b->stack_size += attr_sp_inc_opt_and(ci, cc);
|
3318
|
+
}
|
3319
|
+
fprintf(f, "}\n");
|
3320
|
+
break;
|
3321
|
+
case BIN(opt_or):
|
3322
|
+
fprintf(f, "{\n");
|
3323
|
+
{
|
3324
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3325
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3326
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3327
|
+
if (status->local_stack_p) {
|
3328
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3329
|
+
}
|
3330
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3331
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3332
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3333
|
+
|
3334
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3335
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3336
|
+
fprintf(f, "\n");
|
3337
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3338
|
+
fprintf(f, "\n");
|
3339
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3340
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3341
|
+
if (body->catch_except_p || FALSE) {
|
3342
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3343
|
+
pc_moved_p = TRUE;
|
3344
|
+
}
|
3345
|
+
if (status->local_stack_p) {
|
3346
|
+
}
|
3347
|
+
else {
|
3348
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3349
|
+
}
|
3350
|
+
fprintf(f, " {\n");
|
3351
|
+
fprintf(f, " val = vm_opt_or(recv, obj);\n");
|
3352
|
+
fprintf(f, "\n");
|
3353
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3354
|
+
if (status->local_stack_p) {
|
3355
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3356
|
+
}
|
3357
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3358
|
+
fprintf(f, " goto cancel;\n");
|
3359
|
+
fprintf(f, " }\n");
|
3360
|
+
fprintf(f, " }\n");
|
3361
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_or(ci, cc) - 1);
|
3362
|
+
b->stack_size += attr_sp_inc_opt_or(ci, cc);
|
3363
|
+
}
|
3364
|
+
fprintf(f, "}\n");
|
3365
|
+
break;
|
3366
|
+
case BIN(opt_aref):
|
3367
|
+
{
|
3368
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3369
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3370
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3371
|
+
CALL_CACHE cc_copy = status->cc_entries + (cc - body->cc_entries);
|
3372
|
+
if (has_valid_method_type(cc_copy)) {
|
3373
|
+
const rb_iseq_t *iseq;
|
3374
|
+
unsigned int argc = ci->orig_argc; /* unlike `ci->orig_argc`, `argc` may include blockarg */
|
3375
|
+
|
3376
|
+
if (!(ci->flag & VM_CALL_TAILCALL) && /* inlining non-tailcall path */
|
3377
|
+
cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def)) /* CC_SET_FASTPATH in vm_callee_setup_arg */) {
|
3378
|
+
int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */
|
3379
|
+
|
3380
|
+
fprintf(f, "{\n");
|
3381
|
+
if (status->local_stack_p) {
|
3382
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3383
|
+
}
|
3384
|
+
|
3385
|
+
fprintf(f, " if (UNLIKELY(GET_GLOBAL_METHOD_STATE() != %"PRI_SERIALT_PREFIX"u ||\n", cc_copy->method_state);
|
3386
|
+
fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial);
|
3387
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3388
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3389
|
+
fprintf(f, " goto cancel;\n");
|
3390
|
+
fprintf(f, " }\n");
|
3391
|
+
|
3392
|
+
if (body->catch_except_p || TRUE) {
|
3393
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3394
|
+
pc_moved_p = TRUE;
|
3395
|
+
}
|
3396
|
+
if (status->local_stack_p) {
|
3397
|
+
{
|
3398
|
+
rb_snum_t i, push_size;
|
3399
|
+
push_size = -attr_sp_inc_opt_send_without_block(ci, cc) + 1 - 0;
|
3400
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
3401
|
+
for (i = 0; i < push_size; i++) {
|
3402
|
+
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
3403
|
+
}
|
3404
|
+
}
|
3405
|
+
}
|
3406
|
+
else {
|
3407
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - 0); /* POPN(INSN_ATTR(popn)); */
|
3408
|
+
}
|
3409
|
+
|
3410
|
+
fprintf(f, " {\n");
|
3411
|
+
fprintf(f, " struct rb_calling_info calling;\n");
|
3412
|
+
fprintf(f, " calling.block_handler = VM_BLOCK_HANDLER_NONE;\n");
|
3413
|
+
fprintf(f, " calling.argc = %d;\n", ci->orig_argc);
|
3414
|
+
fprintf(f, " calling.recv = stack[%d];\n", b->stack_size - 1 - argc);
|
3415
|
+
|
3416
|
+
fprintf(f, " {\n");
|
3417
|
+
fprintf(f, " VALUE v;\n");
|
3418
|
+
fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, (const rb_callable_method_entry_t *)0x%"PRIxVALUE", 0, %d, %d);\n",
|
3419
|
+
(VALUE)cc_copy->me, param_size, iseq->body->local_table_size); /* rb_simple_iseq_p checks rb_simple_iseq_p, which ensures has_opt == FALSE */
|
3420
|
+
if (iseq->body->catch_except_p) {
|
3421
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n");
|
3422
|
+
fprintf(f, " v = vm_exec(ec, TRUE);\n");
|
3423
|
+
}
|
3424
|
+
else {
|
3425
|
+
fprintf(f, " if ((v = mjit_exec(ec)) == Qundef) {\n");
|
3426
|
+
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); /* This is vm_call0_body's code after vm_call_iseq_setup */
|
3427
|
+
fprintf(f, " v = vm_exec(ec, FALSE);\n");
|
3428
|
+
fprintf(f, " }\n");
|
3429
|
+
}
|
3430
|
+
fprintf(f, " stack[%d] = v;\n", b->stack_size - argc - 1);
|
3431
|
+
fprintf(f, " }\n");
|
3432
|
+
|
3433
|
+
fprintf(f, " }\n");
|
3434
|
+
|
3435
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3436
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_send_without_block(ci, cc) + 1);
|
3437
|
+
if (!pc_moved_p) {
|
3438
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3439
|
+
}
|
3440
|
+
fprintf(f, " goto cancel;\n");
|
3441
|
+
fprintf(f, " }\n");
|
3442
|
+
|
3443
|
+
b->stack_size += attr_sp_inc_opt_send_without_block(ci, cc);
|
3444
|
+
|
3445
|
+
fprintf(f, "}\n");
|
3446
|
+
break;
|
3447
|
+
}
|
3448
|
+
}
|
3449
|
+
}
|
3450
|
+
fprintf(f, "{\n");
|
3451
|
+
{
|
3452
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3453
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3454
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3455
|
+
if (status->local_stack_p) {
|
3456
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3457
|
+
}
|
3458
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3459
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3460
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3461
|
+
|
3462
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3463
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3464
|
+
fprintf(f, "\n");
|
3465
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3466
|
+
fprintf(f, "\n");
|
3467
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3468
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3469
|
+
if (body->catch_except_p || TRUE) {
|
3470
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3471
|
+
pc_moved_p = TRUE;
|
3472
|
+
}
|
3473
|
+
if (status->local_stack_p) {
|
3474
|
+
}
|
3475
|
+
else {
|
3476
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3477
|
+
}
|
3478
|
+
fprintf(f, " {\n");
|
3479
|
+
fprintf(f, " val = vm_opt_aref(recv, obj);\n");
|
3480
|
+
fprintf(f, "\n");
|
3481
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3482
|
+
if (status->local_stack_p) {
|
3483
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3484
|
+
}
|
3485
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3486
|
+
fprintf(f, " goto cancel;\n");
|
3487
|
+
fprintf(f, " }\n");
|
3488
|
+
fprintf(f, " }\n");
|
3489
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_aref(ci, cc) - 1);
|
3490
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3491
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_aref(ci, cc) + 1);
|
3492
|
+
if (!pc_moved_p) {
|
3493
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3494
|
+
}
|
3495
|
+
fprintf(f, " goto cancel;\n");
|
3496
|
+
fprintf(f, " }\n");
|
3497
|
+
b->stack_size += attr_sp_inc_opt_aref(ci, cc);
|
3498
|
+
}
|
3499
|
+
fprintf(f, "}\n");
|
3500
|
+
break;
|
3501
|
+
case BIN(opt_aset):
|
3502
|
+
fprintf(f, "{\n");
|
3503
|
+
{
|
3504
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3505
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3506
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3507
|
+
if (status->local_stack_p) {
|
3508
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3509
|
+
}
|
3510
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3511
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3512
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, set, val;\n");
|
3513
|
+
|
3514
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3515
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3516
|
+
fprintf(f, "\n");
|
3517
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3518
|
+
fprintf(f, "\n");
|
3519
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 3);
|
3520
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 2);
|
3521
|
+
fprintf(f, " set = stack[%d];\n", b->stack_size - 1);
|
3522
|
+
if (body->catch_except_p || TRUE) {
|
3523
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3524
|
+
pc_moved_p = TRUE;
|
3525
|
+
}
|
3526
|
+
if (status->local_stack_p) {
|
3527
|
+
}
|
3528
|
+
else {
|
3529
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3530
|
+
}
|
3531
|
+
fprintf(f, " {\n");
|
3532
|
+
fprintf(f, " val = vm_opt_aset(recv, obj, set);\n");
|
3533
|
+
fprintf(f, "\n");
|
3534
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3535
|
+
if (status->local_stack_p) {
|
3536
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3537
|
+
}
|
3538
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3539
|
+
fprintf(f, " goto cancel;\n");
|
3540
|
+
fprintf(f, " }\n");
|
3541
|
+
fprintf(f, " }\n");
|
3542
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_aset(ci, cc) - 1);
|
3543
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3544
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_aset(ci, cc) + 1);
|
3545
|
+
if (!pc_moved_p) {
|
3546
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3547
|
+
}
|
3548
|
+
fprintf(f, " goto cancel;\n");
|
3549
|
+
fprintf(f, " }\n");
|
3550
|
+
b->stack_size += attr_sp_inc_opt_aset(ci, cc);
|
3551
|
+
}
|
3552
|
+
fprintf(f, "}\n");
|
3553
|
+
break;
|
3554
|
+
case BIN(opt_aset_with):
|
3555
|
+
fprintf(f, "{\n");
|
3556
|
+
{
|
3557
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3558
|
+
MAYBE_UNUSED(VALUE key) = (VALUE)operands[0];
|
3559
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[1];
|
3560
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[2];
|
3561
|
+
if (status->local_stack_p) {
|
3562
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3563
|
+
}
|
3564
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3565
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3566
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) key, recv, val;\n");
|
3567
|
+
|
3568
|
+
fprintf(f, " key = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
3569
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
3570
|
+
fprintf(f, "\n");
|
3571
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[1]);
|
3572
|
+
comment_id(f, ((CALL_INFO)operands[1])->mid);
|
3573
|
+
fprintf(f, "\n");
|
3574
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[2]);
|
3575
|
+
fprintf(f, "\n");
|
3576
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 2);
|
3577
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
3578
|
+
if (body->catch_except_p || TRUE) {
|
3579
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3580
|
+
pc_moved_p = TRUE;
|
3581
|
+
}
|
3582
|
+
if (status->local_stack_p) {
|
3583
|
+
}
|
3584
|
+
else {
|
3585
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3586
|
+
}
|
3587
|
+
fprintf(f, " {\n");
|
3588
|
+
fprintf(f, " VALUE tmp = vm_opt_aset_with(recv, key, val);\n");
|
3589
|
+
fprintf(f, "\n");
|
3590
|
+
fprintf(f, " if (tmp != Qundef) {\n");
|
3591
|
+
fprintf(f, " val = tmp;\n");
|
3592
|
+
fprintf(f, " }\n");
|
3593
|
+
fprintf(f, " else {\n");
|
3594
|
+
fprintf(f, "#ifndef MJIT_HEADER\n");
|
3595
|
+
fprintf(f, " %s = rb_str_resurrect(key);\n",
|
3596
|
+
(status->local_stack_p ? "*(stack + (stack_size - (0) - 1))" : "TOPN(0)"));
|
3597
|
+
fprintf(f, " PUSH(val);\n");
|
3598
|
+
fprintf(f, "#endif\n");
|
3599
|
+
if (status->local_stack_p) {
|
3600
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3601
|
+
}
|
3602
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3603
|
+
fprintf(f, " goto cancel;\n");
|
3604
|
+
fprintf(f, " }\n");
|
3605
|
+
fprintf(f, " }\n");
|
3606
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_aset_with(key, ci, cc) - 1);
|
3607
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3608
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_aset_with(key, ci, cc) + 1);
|
3609
|
+
if (!pc_moved_p) {
|
3610
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3611
|
+
}
|
3612
|
+
fprintf(f, " goto cancel;\n");
|
3613
|
+
fprintf(f, " }\n");
|
3614
|
+
b->stack_size += attr_sp_inc_opt_aset_with(key, ci, cc);
|
3615
|
+
}
|
3616
|
+
fprintf(f, "}\n");
|
3617
|
+
break;
|
3618
|
+
case BIN(opt_aref_with):
|
3619
|
+
fprintf(f, "{\n");
|
3620
|
+
{
|
3621
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3622
|
+
MAYBE_UNUSED(VALUE key) = (VALUE)operands[0];
|
3623
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[1];
|
3624
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[2];
|
3625
|
+
if (status->local_stack_p) {
|
3626
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3627
|
+
}
|
3628
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3629
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3630
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) key, recv, val;\n");
|
3631
|
+
|
3632
|
+
fprintf(f, " key = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
3633
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
3634
|
+
fprintf(f, "\n");
|
3635
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[1]);
|
3636
|
+
comment_id(f, ((CALL_INFO)operands[1])->mid);
|
3637
|
+
fprintf(f, "\n");
|
3638
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[2]);
|
3639
|
+
fprintf(f, "\n");
|
3640
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 1);
|
3641
|
+
if (body->catch_except_p || TRUE) {
|
3642
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3643
|
+
pc_moved_p = TRUE;
|
3644
|
+
}
|
3645
|
+
if (status->local_stack_p) {
|
3646
|
+
}
|
3647
|
+
else {
|
3648
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3649
|
+
}
|
3650
|
+
fprintf(f, " {\n");
|
3651
|
+
fprintf(f, " val = vm_opt_aref_with(recv, key);\n");
|
3652
|
+
fprintf(f, "\n");
|
3653
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3654
|
+
fprintf(f, "#ifndef MJIT_HEADER\n");
|
3655
|
+
fprintf(f, " PUSH(rb_str_resurrect(key));\n");
|
3656
|
+
fprintf(f, "#endif\n");
|
3657
|
+
if (status->local_stack_p) {
|
3658
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3659
|
+
}
|
3660
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3661
|
+
fprintf(f, " goto cancel;\n");
|
3662
|
+
fprintf(f, " }\n");
|
3663
|
+
fprintf(f, " }\n");
|
3664
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_aref_with(key, ci, cc) - 1);
|
3665
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3666
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_aref_with(key, ci, cc) + 1);
|
3667
|
+
if (!pc_moved_p) {
|
3668
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3669
|
+
}
|
3670
|
+
fprintf(f, " goto cancel;\n");
|
3671
|
+
fprintf(f, " }\n");
|
3672
|
+
b->stack_size += attr_sp_inc_opt_aref_with(key, ci, cc);
|
3673
|
+
}
|
3674
|
+
fprintf(f, "}\n");
|
3675
|
+
break;
|
3676
|
+
case BIN(opt_length):
|
3677
|
+
fprintf(f, "{\n");
|
3678
|
+
{
|
3679
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3680
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3681
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3682
|
+
if (status->local_stack_p) {
|
3683
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3684
|
+
}
|
3685
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3686
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3687
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) recv, val;\n");
|
3688
|
+
|
3689
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3690
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3691
|
+
fprintf(f, "\n");
|
3692
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3693
|
+
fprintf(f, "\n");
|
3694
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 1);
|
3695
|
+
if (body->catch_except_p || FALSE) {
|
3696
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3697
|
+
pc_moved_p = TRUE;
|
3698
|
+
}
|
3699
|
+
if (status->local_stack_p) {
|
3700
|
+
}
|
3701
|
+
else {
|
3702
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3703
|
+
}
|
3704
|
+
fprintf(f, " {\n");
|
3705
|
+
fprintf(f, " val = vm_opt_length(recv, BOP_LENGTH);\n");
|
3706
|
+
fprintf(f, "\n");
|
3707
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3708
|
+
if (status->local_stack_p) {
|
3709
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3710
|
+
}
|
3711
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3712
|
+
fprintf(f, " goto cancel;\n");
|
3713
|
+
fprintf(f, " }\n");
|
3714
|
+
fprintf(f, " }\n");
|
3715
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_length(ci, cc) - 1);
|
3716
|
+
b->stack_size += attr_sp_inc_opt_length(ci, cc);
|
3717
|
+
}
|
3718
|
+
fprintf(f, "}\n");
|
3719
|
+
break;
|
3720
|
+
case BIN(opt_size):
|
3721
|
+
fprintf(f, "{\n");
|
3722
|
+
{
|
3723
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3724
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3725
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3726
|
+
if (status->local_stack_p) {
|
3727
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3728
|
+
}
|
3729
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3730
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3731
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) recv, val;\n");
|
3732
|
+
|
3733
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3734
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3735
|
+
fprintf(f, "\n");
|
3736
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3737
|
+
fprintf(f, "\n");
|
3738
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 1);
|
3739
|
+
if (body->catch_except_p || FALSE) {
|
3740
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3741
|
+
pc_moved_p = TRUE;
|
3742
|
+
}
|
3743
|
+
if (status->local_stack_p) {
|
3744
|
+
}
|
3745
|
+
else {
|
3746
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3747
|
+
}
|
3748
|
+
fprintf(f, " {\n");
|
3749
|
+
fprintf(f, " val = vm_opt_length(recv, BOP_SIZE);\n");
|
3750
|
+
fprintf(f, "\n");
|
3751
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3752
|
+
if (status->local_stack_p) {
|
3753
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3754
|
+
}
|
3755
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3756
|
+
fprintf(f, " goto cancel;\n");
|
3757
|
+
fprintf(f, " }\n");
|
3758
|
+
fprintf(f, " }\n");
|
3759
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_size(ci, cc) - 1);
|
3760
|
+
b->stack_size += attr_sp_inc_opt_size(ci, cc);
|
3761
|
+
}
|
3762
|
+
fprintf(f, "}\n");
|
3763
|
+
break;
|
3764
|
+
case BIN(opt_empty_p):
|
3765
|
+
fprintf(f, "{\n");
|
3766
|
+
{
|
3767
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3768
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3769
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3770
|
+
if (status->local_stack_p) {
|
3771
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3772
|
+
}
|
3773
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3774
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3775
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) recv, val;\n");
|
3776
|
+
|
3777
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3778
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3779
|
+
fprintf(f, "\n");
|
3780
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3781
|
+
fprintf(f, "\n");
|
3782
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 1);
|
3783
|
+
if (body->catch_except_p || FALSE) {
|
3784
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3785
|
+
pc_moved_p = TRUE;
|
3786
|
+
}
|
3787
|
+
if (status->local_stack_p) {
|
3788
|
+
}
|
3789
|
+
else {
|
3790
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3791
|
+
}
|
3792
|
+
fprintf(f, " {\n");
|
3793
|
+
fprintf(f, " val = vm_opt_empty_p(recv);\n");
|
3794
|
+
fprintf(f, "\n");
|
3795
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3796
|
+
if (status->local_stack_p) {
|
3797
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3798
|
+
}
|
3799
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3800
|
+
fprintf(f, " goto cancel;\n");
|
3801
|
+
fprintf(f, " }\n");
|
3802
|
+
fprintf(f, " }\n");
|
3803
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_empty_p(ci, cc) - 1);
|
3804
|
+
b->stack_size += attr_sp_inc_opt_empty_p(ci, cc);
|
3805
|
+
}
|
3806
|
+
fprintf(f, "}\n");
|
3807
|
+
break;
|
3808
|
+
case BIN(opt_succ):
|
3809
|
+
fprintf(f, "{\n");
|
3810
|
+
{
|
3811
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3812
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3813
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3814
|
+
if (status->local_stack_p) {
|
3815
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3816
|
+
}
|
3817
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3818
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3819
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) recv, val;\n");
|
3820
|
+
|
3821
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3822
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3823
|
+
fprintf(f, "\n");
|
3824
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3825
|
+
fprintf(f, "\n");
|
3826
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 1);
|
3827
|
+
if (body->catch_except_p || FALSE) {
|
3828
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3829
|
+
pc_moved_p = TRUE;
|
3830
|
+
}
|
3831
|
+
if (status->local_stack_p) {
|
3832
|
+
}
|
3833
|
+
else {
|
3834
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3835
|
+
}
|
3836
|
+
fprintf(f, " {\n");
|
3837
|
+
fprintf(f, " val = vm_opt_succ(recv);\n");
|
3838
|
+
fprintf(f, "\n");
|
3839
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3840
|
+
if (status->local_stack_p) {
|
3841
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3842
|
+
}
|
3843
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3844
|
+
fprintf(f, " goto cancel;\n");
|
3845
|
+
fprintf(f, " }\n");
|
3846
|
+
fprintf(f, " }\n");
|
3847
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_succ(ci, cc) - 1);
|
3848
|
+
b->stack_size += attr_sp_inc_opt_succ(ci, cc);
|
3849
|
+
}
|
3850
|
+
fprintf(f, "}\n");
|
3851
|
+
break;
|
3852
|
+
case BIN(opt_not):
|
3853
|
+
fprintf(f, "{\n");
|
3854
|
+
{
|
3855
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3856
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3857
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3858
|
+
if (status->local_stack_p) {
|
3859
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3860
|
+
}
|
3861
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3862
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3863
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) recv, val;\n");
|
3864
|
+
|
3865
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3866
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3867
|
+
fprintf(f, "\n");
|
3868
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3869
|
+
fprintf(f, "\n");
|
3870
|
+
fprintf(f, " recv = stack[%d];\n", b->stack_size - 1);
|
3871
|
+
if (body->catch_except_p || FALSE) {
|
3872
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3873
|
+
pc_moved_p = TRUE;
|
3874
|
+
}
|
3875
|
+
if (status->local_stack_p) {
|
3876
|
+
}
|
3877
|
+
else {
|
3878
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3879
|
+
}
|
3880
|
+
fprintf(f, " {\n");
|
3881
|
+
fprintf(f, " val = vm_opt_not(ci, cc, recv);\n");
|
3882
|
+
fprintf(f, "\n");
|
3883
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3884
|
+
if (status->local_stack_p) {
|
3885
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3886
|
+
}
|
3887
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3888
|
+
fprintf(f, " goto cancel;\n");
|
3889
|
+
fprintf(f, " }\n");
|
3890
|
+
fprintf(f, " }\n");
|
3891
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_not(ci, cc) - 1);
|
3892
|
+
b->stack_size += attr_sp_inc_opt_not(ci, cc);
|
3893
|
+
}
|
3894
|
+
fprintf(f, "}\n");
|
3895
|
+
break;
|
3896
|
+
case BIN(opt_regexpmatch1):
|
3897
|
+
fprintf(f, "{\n");
|
3898
|
+
{
|
3899
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3900
|
+
MAYBE_UNUSED(VALUE recv) = (VALUE)operands[0];
|
3901
|
+
if (status->local_stack_p) {
|
3902
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3903
|
+
}
|
3904
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj, recv, val;\n");
|
3905
|
+
|
3906
|
+
fprintf(f, " recv = (VALUE)0x%"PRIxVALUE";", operands[0]);
|
3907
|
+
if (SYMBOL_P((VALUE)operands[0])) comment_id(f, SYM2ID((VALUE)operands[0]));
|
3908
|
+
fprintf(f, "\n");
|
3909
|
+
fprintf(f, " obj = stack[%d];\n", b->stack_size - 1);
|
3910
|
+
if (body->catch_except_p || TRUE) {
|
3911
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3912
|
+
pc_moved_p = TRUE;
|
3913
|
+
}
|
3914
|
+
if (status->local_stack_p) {
|
3915
|
+
}
|
3916
|
+
else {
|
3917
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3918
|
+
}
|
3919
|
+
fprintf(f, " {\n");
|
3920
|
+
fprintf(f, " val = vm_opt_regexpmatch1(recv, obj);\n");
|
3921
|
+
fprintf(f, " }\n");
|
3922
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_regexpmatch1(recv) - 1);
|
3923
|
+
fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n");
|
3924
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)attr_sp_inc_opt_regexpmatch1(recv) + 1);
|
3925
|
+
if (!pc_moved_p) {
|
3926
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos);
|
3927
|
+
}
|
3928
|
+
fprintf(f, " goto cancel;\n");
|
3929
|
+
fprintf(f, " }\n");
|
3930
|
+
b->stack_size += attr_sp_inc_opt_regexpmatch1(recv);
|
3931
|
+
}
|
3932
|
+
fprintf(f, "}\n");
|
3933
|
+
break;
|
3934
|
+
case BIN(opt_regexpmatch2):
|
3935
|
+
fprintf(f, "{\n");
|
3936
|
+
{
|
3937
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3938
|
+
MAYBE_UNUSED(CALL_INFO ci) = (CALL_INFO)operands[0];
|
3939
|
+
MAYBE_UNUSED(CALL_CACHE cc) = (CALL_CACHE)operands[1];
|
3940
|
+
if (status->local_stack_p) {
|
3941
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3942
|
+
}
|
3943
|
+
fprintf(f, " MAYBE_UNUSED(CALL_CACHE) cc;\n");
|
3944
|
+
fprintf(f, " MAYBE_UNUSED(CALL_INFO) ci;\n");
|
3945
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) obj1, obj2, val;\n");
|
3946
|
+
|
3947
|
+
fprintf(f, " ci = (CALL_INFO)0x%"PRIxVALUE";", operands[0]);
|
3948
|
+
comment_id(f, ((CALL_INFO)operands[0])->mid);
|
3949
|
+
fprintf(f, "\n");
|
3950
|
+
fprintf(f, " cc = (CALL_CACHE)0x%"PRIxVALUE";", operands[1]);
|
3951
|
+
fprintf(f, "\n");
|
3952
|
+
fprintf(f, " obj2 = stack[%d];\n", b->stack_size - 2);
|
3953
|
+
fprintf(f, " obj1 = stack[%d];\n", b->stack_size - 1);
|
3954
|
+
if (body->catch_except_p || FALSE) {
|
3955
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3956
|
+
pc_moved_p = TRUE;
|
3957
|
+
}
|
3958
|
+
if (status->local_stack_p) {
|
3959
|
+
}
|
3960
|
+
else {
|
3961
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3962
|
+
}
|
3963
|
+
fprintf(f, " {\n");
|
3964
|
+
fprintf(f, " val = vm_opt_regexpmatch2(obj2, obj1);\n");
|
3965
|
+
fprintf(f, "\n");
|
3966
|
+
fprintf(f, " if (val == Qundef) {\n");
|
3967
|
+
if (status->local_stack_p) {
|
3968
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3969
|
+
}
|
3970
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
3971
|
+
fprintf(f, " goto cancel;\n");
|
3972
|
+
fprintf(f, " }\n");
|
3973
|
+
fprintf(f, " }\n");
|
3974
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_opt_regexpmatch2(ci, cc) - 1);
|
3975
|
+
b->stack_size += attr_sp_inc_opt_regexpmatch2(ci, cc);
|
3976
|
+
}
|
3977
|
+
fprintf(f, "}\n");
|
3978
|
+
break;
|
3979
|
+
case BIN(bitblt):
|
3980
|
+
fprintf(f, "{\n");
|
3981
|
+
{
|
3982
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
3983
|
+
if (status->local_stack_p) {
|
3984
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
3985
|
+
}
|
3986
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ret;\n");
|
3987
|
+
|
3988
|
+
if (body->catch_except_p || FALSE) {
|
3989
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
3990
|
+
pc_moved_p = TRUE;
|
3991
|
+
}
|
3992
|
+
if (status->local_stack_p) {
|
3993
|
+
}
|
3994
|
+
else {
|
3995
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
3996
|
+
}
|
3997
|
+
fprintf(f, " {\n");
|
3998
|
+
fprintf(f, " ret = rb_str_new2(\"a bit of bacon, lettuce and tomato\");\n");
|
3999
|
+
fprintf(f, " }\n");
|
4000
|
+
fprintf(f, " stack[%d] = ret;\n", b->stack_size + (int)attr_sp_inc_bitblt() - 1);
|
4001
|
+
b->stack_size += attr_sp_inc_bitblt();
|
4002
|
+
}
|
4003
|
+
fprintf(f, "}\n");
|
4004
|
+
break;
|
4005
|
+
case BIN(answer):
|
4006
|
+
fprintf(f, "{\n");
|
4007
|
+
{
|
4008
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4009
|
+
if (status->local_stack_p) {
|
4010
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4011
|
+
}
|
4012
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) ret;\n");
|
4013
|
+
|
4014
|
+
if (body->catch_except_p || FALSE) {
|
4015
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4016
|
+
pc_moved_p = TRUE;
|
4017
|
+
}
|
4018
|
+
if (status->local_stack_p) {
|
4019
|
+
}
|
4020
|
+
else {
|
4021
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4022
|
+
}
|
4023
|
+
fprintf(f, " {\n");
|
4024
|
+
fprintf(f, " ret = INT2FIX(42);\n");
|
4025
|
+
fprintf(f, " }\n");
|
4026
|
+
fprintf(f, " stack[%d] = ret;\n", b->stack_size + (int)attr_sp_inc_answer() - 1);
|
4027
|
+
b->stack_size += attr_sp_inc_answer();
|
4028
|
+
}
|
4029
|
+
fprintf(f, "}\n");
|
4030
|
+
break;
|
4031
|
+
case BIN(getlocal_WC_0):
|
4032
|
+
fprintf(f, "{\n");
|
4033
|
+
{
|
4034
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4035
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
4036
|
+
if (status->local_stack_p) {
|
4037
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4038
|
+
}
|
4039
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
4040
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
4041
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
4042
|
+
|
4043
|
+
fprintf(f, " level = 0;\n");
|
4044
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
4045
|
+
fprintf(f, "\n");
|
4046
|
+
if (body->catch_except_p || FALSE) {
|
4047
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4048
|
+
pc_moved_p = TRUE;
|
4049
|
+
}
|
4050
|
+
if (status->local_stack_p) {
|
4051
|
+
}
|
4052
|
+
else {
|
4053
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4054
|
+
}
|
4055
|
+
fprintf(f, " {\n");
|
4056
|
+
fprintf(f, " val = *(vm_get_ep(GET_EP(), level) - idx);\n");
|
4057
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_get);\n");
|
4058
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);\n");
|
4059
|
+
fprintf(f, " }\n");
|
4060
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getlocal_WC_0(idx) - 1);
|
4061
|
+
b->stack_size += attr_sp_inc_getlocal_WC_0(idx);
|
4062
|
+
}
|
4063
|
+
fprintf(f, "}\n");
|
4064
|
+
break;
|
4065
|
+
case BIN(getlocal_WC_1):
|
4066
|
+
fprintf(f, "{\n");
|
4067
|
+
{
|
4068
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4069
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
4070
|
+
if (status->local_stack_p) {
|
4071
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4072
|
+
}
|
4073
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
4074
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
4075
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
4076
|
+
|
4077
|
+
fprintf(f, " level = 1;\n");
|
4078
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
4079
|
+
fprintf(f, "\n");
|
4080
|
+
if (body->catch_except_p || FALSE) {
|
4081
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4082
|
+
pc_moved_p = TRUE;
|
4083
|
+
}
|
4084
|
+
if (status->local_stack_p) {
|
4085
|
+
}
|
4086
|
+
else {
|
4087
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4088
|
+
}
|
4089
|
+
fprintf(f, " {\n");
|
4090
|
+
fprintf(f, " val = *(vm_get_ep(GET_EP(), level) - idx);\n");
|
4091
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_get);\n");
|
4092
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_get_dynamic, level > 0);\n");
|
4093
|
+
fprintf(f, " }\n");
|
4094
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_getlocal_WC_1(idx) - 1);
|
4095
|
+
b->stack_size += attr_sp_inc_getlocal_WC_1(idx);
|
4096
|
+
}
|
4097
|
+
fprintf(f, "}\n");
|
4098
|
+
break;
|
4099
|
+
case BIN(setlocal_WC_0):
|
4100
|
+
fprintf(f, "{\n");
|
4101
|
+
{
|
4102
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4103
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
4104
|
+
if (status->local_stack_p) {
|
4105
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4106
|
+
}
|
4107
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
4108
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
4109
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
4110
|
+
|
4111
|
+
fprintf(f, " level = 0;\n");
|
4112
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
4113
|
+
fprintf(f, "\n");
|
4114
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
4115
|
+
if (body->catch_except_p || FALSE) {
|
4116
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4117
|
+
pc_moved_p = TRUE;
|
4118
|
+
}
|
4119
|
+
if (status->local_stack_p) {
|
4120
|
+
}
|
4121
|
+
else {
|
4122
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4123
|
+
}
|
4124
|
+
fprintf(f, " {\n");
|
4125
|
+
fprintf(f, " vm_env_write(vm_get_ep(GET_EP(), level), -(int)idx, val);\n");
|
4126
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_set);\n");
|
4127
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_set_dynamic, level > 0);\n");
|
4128
|
+
fprintf(f, " }\n");
|
4129
|
+
b->stack_size += attr_sp_inc_setlocal_WC_0(idx);
|
4130
|
+
}
|
4131
|
+
fprintf(f, "}\n");
|
4132
|
+
break;
|
4133
|
+
case BIN(setlocal_WC_1):
|
4134
|
+
fprintf(f, "{\n");
|
4135
|
+
{
|
4136
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4137
|
+
MAYBE_UNUSED(lindex_t idx) = (lindex_t)operands[0];
|
4138
|
+
if (status->local_stack_p) {
|
4139
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4140
|
+
}
|
4141
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
4142
|
+
fprintf(f, " MAYBE_UNUSED(lindex_t) idx;\n");
|
4143
|
+
fprintf(f, " MAYBE_UNUSED(rb_num_t) level;\n");
|
4144
|
+
|
4145
|
+
fprintf(f, " level = 1;\n");
|
4146
|
+
fprintf(f, " idx = (lindex_t)0x%"PRIxVALUE";", operands[0]);
|
4147
|
+
fprintf(f, "\n");
|
4148
|
+
fprintf(f, " val = stack[%d];\n", b->stack_size - 1);
|
4149
|
+
if (body->catch_except_p || FALSE) {
|
4150
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4151
|
+
pc_moved_p = TRUE;
|
4152
|
+
}
|
4153
|
+
if (status->local_stack_p) {
|
4154
|
+
}
|
4155
|
+
else {
|
4156
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4157
|
+
}
|
4158
|
+
fprintf(f, " {\n");
|
4159
|
+
fprintf(f, " vm_env_write(vm_get_ep(GET_EP(), level), -(int)idx, val);\n");
|
4160
|
+
fprintf(f, " RB_DEBUG_COUNTER_INC(lvar_set);\n");
|
4161
|
+
fprintf(f, " (void)RB_DEBUG_COUNTER_INC_IF(lvar_set_dynamic, level > 0);\n");
|
4162
|
+
fprintf(f, " }\n");
|
4163
|
+
b->stack_size += attr_sp_inc_setlocal_WC_1(idx);
|
4164
|
+
}
|
4165
|
+
fprintf(f, "}\n");
|
4166
|
+
break;
|
4167
|
+
case BIN(putobject_INT2FIX_0_):
|
4168
|
+
fprintf(f, "{\n");
|
4169
|
+
{
|
4170
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4171
|
+
if (status->local_stack_p) {
|
4172
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4173
|
+
}
|
4174
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
4175
|
+
|
4176
|
+
fprintf(f, " val = INT2FIX(0);\n");
|
4177
|
+
if (body->catch_except_p || FALSE) {
|
4178
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4179
|
+
pc_moved_p = TRUE;
|
4180
|
+
}
|
4181
|
+
if (status->local_stack_p) {
|
4182
|
+
}
|
4183
|
+
else {
|
4184
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4185
|
+
}
|
4186
|
+
fprintf(f, " {\n");
|
4187
|
+
fprintf(f, " /* */\n");
|
4188
|
+
fprintf(f, " }\n");
|
4189
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putobject_INT2FIX_0_() - 1);
|
4190
|
+
b->stack_size += attr_sp_inc_putobject_INT2FIX_0_();
|
4191
|
+
}
|
4192
|
+
fprintf(f, "}\n");
|
4193
|
+
break;
|
4194
|
+
case BIN(putobject_INT2FIX_1_):
|
4195
|
+
fprintf(f, "{\n");
|
4196
|
+
{
|
4197
|
+
MAYBE_UNUSED(int pc_moved_p) = FALSE;
|
4198
|
+
if (status->local_stack_p) {
|
4199
|
+
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
4200
|
+
}
|
4201
|
+
fprintf(f, " MAYBE_UNUSED(VALUE) val;\n");
|
4202
|
+
|
4203
|
+
fprintf(f, " val = INT2FIX(1);\n");
|
4204
|
+
if (body->catch_except_p || FALSE) {
|
4205
|
+
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
|
4206
|
+
pc_moved_p = TRUE;
|
4207
|
+
}
|
4208
|
+
if (status->local_stack_p) {
|
4209
|
+
}
|
4210
|
+
else {
|
4211
|
+
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
4212
|
+
}
|
4213
|
+
fprintf(f, " {\n");
|
4214
|
+
fprintf(f, " /* */\n");
|
4215
|
+
fprintf(f, " }\n");
|
4216
|
+
fprintf(f, " stack[%d] = val;\n", b->stack_size + (int)attr_sp_inc_putobject_INT2FIX_1_() - 1);
|
4217
|
+
b->stack_size += attr_sp_inc_putobject_INT2FIX_1_();
|
4218
|
+
}
|
4219
|
+
fprintf(f, "}\n");
|
4220
|
+
break;
|
4221
|
+
default:
|
4222
|
+
if (mjit_opts.warnings || mjit_opts.verbose)
|
4223
|
+
fprintf(stderr, "MJIT warning: Skipped to compile unsupported instruction: %s\n", insn_name(insn));
|
4224
|
+
status->success = FALSE;
|
4225
|
+
break;
|
4226
|
+
}
|