line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
// Copyright (c) 2023 Yuki Kimoto |
2
|
|
|
|
|
|
|
// MIT License |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#include |
5
|
|
|
|
|
|
|
#include |
6
|
|
|
|
|
|
|
#include |
7
|
|
|
|
|
|
|
#include |
8
|
|
|
|
|
|
|
#include |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#include "spvm_compiler.h" |
12
|
|
|
|
|
|
|
#include "spvm_opcode_builder.h" |
13
|
|
|
|
|
|
|
#include "spvm_opcode.h" |
14
|
|
|
|
|
|
|
#include "spvm_opcode_list.h" |
15
|
|
|
|
|
|
|
#include "spvm_constant.h" |
16
|
|
|
|
|
|
|
#include "spvm_op.h" |
17
|
|
|
|
|
|
|
#include "spvm_check.h" |
18
|
|
|
|
|
|
|
#include "spvm_type.h" |
19
|
|
|
|
|
|
|
#include "spvm_list.h" |
20
|
|
|
|
|
|
|
#include "spvm_method.h" |
21
|
|
|
|
|
|
|
#include "spvm_var.h" |
22
|
|
|
|
|
|
|
#include "spvm_var_decl.h" |
23
|
|
|
|
|
|
|
#include "spvm_allocator.h" |
24
|
|
|
|
|
|
|
#include "spvm_field_access.h" |
25
|
|
|
|
|
|
|
#include "spvm_call_method.h" |
26
|
|
|
|
|
|
|
#include "spvm_hash.h" |
27
|
|
|
|
|
|
|
#include "spvm_field.h" |
28
|
|
|
|
|
|
|
#include "spvm_switch_info.h" |
29
|
|
|
|
|
|
|
#include "spvm_type.h" |
30
|
|
|
|
|
|
|
#include "spvm_object.h" |
31
|
|
|
|
|
|
|
#include "spvm_class_var.h" |
32
|
|
|
|
|
|
|
#include "spvm_class_var_access.h" |
33
|
|
|
|
|
|
|
#include "spvm_dumper.h" |
34
|
|
|
|
|
|
|
#include "spvm_opcode.h" |
35
|
|
|
|
|
|
|
#include "spvm_block.h" |
36
|
|
|
|
|
|
|
#include "spvm_basic_type.h" |
37
|
|
|
|
|
|
|
#include "spvm_case_info.h" |
38
|
|
|
|
|
|
|
#include "spvm_array_field_access.h" |
39
|
|
|
|
|
|
|
#include "spvm_string.h" |
40
|
|
|
|
|
|
|
#include "spvm_dumper.h" |
41
|
|
|
|
|
|
|
|
42
|
3041
|
|
|
|
|
|
void SPVM_OPCODE_BUILDER_build_opcode_list(SPVM_COMPILER* compiler) { |
43
|
|
|
|
|
|
|
|
44
|
48083
|
100
|
|
|
|
|
for (int32_t basic_type_id = compiler->basic_types_base_id; basic_type_id < compiler->basic_types->length; basic_type_id++) { |
45
|
45042
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
46
|
45042
|
|
|
|
|
|
SPVM_LIST* methods = basic_type->methods; |
47
|
329515
|
100
|
|
|
|
|
for (int32_t method_index = 0; method_index < methods->length; method_index++) { |
48
|
284473
|
|
|
|
|
|
SPVM_METHOD* method = SPVM_LIST_get(methods, method_index); |
49
|
|
|
|
|
|
|
|
50
|
284473
|
|
|
|
|
|
SPVM_OPCODE_LIST* opcode_list = method->opcode_list; |
51
|
|
|
|
|
|
|
|
52
|
284473
|
|
|
|
|
|
int32_t method_opcodes_base_address_id = 0; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
// Check sub information |
55
|
284473
|
50
|
|
|
|
|
assert(method->op_name); |
56
|
284473
|
50
|
|
|
|
|
assert(method->return_type); |
57
|
284473
|
50
|
|
|
|
|
assert(method->current_basic_type->class_file); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
// Copy arguments to variables |
60
|
284473
|
|
|
|
|
|
int32_t stack_index = 0; |
61
|
771200
|
100
|
|
|
|
|
for (int32_t args_index = 0; args_index < method->args_length; args_index++) { |
62
|
486727
|
|
|
|
|
|
SPVM_VAR_DECL* arg = SPVM_LIST_get(method->var_decls, args_index); |
63
|
486727
|
|
|
|
|
|
SPVM_TYPE* arg_type = arg->type; |
64
|
486727
|
|
|
|
|
|
int32_t arg_type_dimension = arg->type->dimension; |
65
|
486727
|
|
|
|
|
|
SPVM_BASIC_TYPE* arg_basic_type = arg_type->basic_type; |
66
|
486727
|
|
|
|
|
|
int32_t arg_type_is_ref = SPVM_TYPE_is_ref_type(compiler, arg_basic_type->id, arg_type_dimension, arg_type->flag); |
67
|
486727
|
|
|
|
|
|
int32_t arg_basic_type_category = arg_type->basic_type->category; |
68
|
|
|
|
|
|
|
|
69
|
486727
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
70
|
|
|
|
|
|
|
|
71
|
486727
|
|
|
|
|
|
int32_t args_width = SPVM_TYPE_get_width(compiler, arg_type->basic_type->id, arg_type->dimension, arg_type->flag); |
72
|
|
|
|
|
|
|
|
73
|
486727
|
100
|
|
|
|
|
if (arg_type_dimension == 0) { |
74
|
402509
|
100
|
|
|
|
|
if (arg_type_is_ref) { |
75
|
2826
|
50
|
|
|
|
|
switch (arg_basic_type_category) { |
76
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_NUMERIC: |
77
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM: |
78
|
|
|
|
|
|
|
{ |
79
|
2826
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_REF); |
80
|
2826
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
81
|
2826
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
82
|
2826
|
|
|
|
|
|
stack_index++; |
83
|
2826
|
|
|
|
|
|
break; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
default: { |
86
|
2826
|
|
|
|
|
|
assert(0); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else { |
91
|
399683
|
|
|
|
|
|
switch (arg_basic_type_category) { |
92
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_NUMERIC: { |
93
|
201071
|
|
|
|
|
|
switch (arg_basic_type->id) { |
94
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
95
|
1195
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
96
|
31
|
|
|
|
|
|
SPVM_CONSTANT* constant = arg->op_optional_arg_default->uv.constant; |
97
|
31
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_BYTE); |
98
|
31
|
|
|
|
|
|
opcode.operand1 = (uint16_t)(uint8_t)constant->value.bval; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
else { |
101
|
1164
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_BYTE); |
102
|
|
|
|
|
|
|
} |
103
|
1195
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
104
|
1195
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
105
|
1195
|
|
|
|
|
|
stack_index++; |
106
|
1195
|
|
|
|
|
|
break; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
109
|
164
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
110
|
30
|
|
|
|
|
|
SPVM_CONSTANT* constant = arg->op_optional_arg_default->uv.constant; |
111
|
30
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_SHORT); |
112
|
30
|
|
|
|
|
|
opcode.operand1 = (uint16_t)constant->value.sval; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
else { |
115
|
134
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_SHORT); |
116
|
|
|
|
|
|
|
} |
117
|
164
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
118
|
164
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
119
|
164
|
|
|
|
|
|
stack_index++; |
120
|
164
|
|
|
|
|
|
break; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
123
|
177495
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
124
|
54451
|
|
|
|
|
|
SPVM_CONSTANT* constant = arg->op_optional_arg_default->uv.constant; |
125
|
54451
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_INT); |
126
|
54451
|
|
|
|
|
|
opcode.operand1 = (uint32_t)constant->value.ival; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
else { |
129
|
123044
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_INT); |
130
|
|
|
|
|
|
|
} |
131
|
177495
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
132
|
177495
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
133
|
177495
|
|
|
|
|
|
stack_index++; |
134
|
177495
|
|
|
|
|
|
break; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
137
|
9403
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
138
|
32
|
|
|
|
|
|
SPVM_CONSTANT* constant = arg->op_optional_arg_default->uv.constant; |
139
|
32
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_LONG); |
140
|
32
|
|
|
|
|
|
*(int64_t*)&opcode.operand1 = constant->value.lval; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
else { |
143
|
9371
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_LONG); |
144
|
|
|
|
|
|
|
} |
145
|
9403
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
146
|
9403
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
147
|
9403
|
|
|
|
|
|
stack_index++; |
148
|
9403
|
|
|
|
|
|
break; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
151
|
5892
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
152
|
26
|
|
|
|
|
|
SPVM_CONSTANT* constant = arg->op_optional_arg_default->uv.constant; |
153
|
26
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_FLOAT); |
154
|
26
|
|
|
|
|
|
opcode.operand1 = (uint32_t)constant->value.ival; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
else { |
157
|
5866
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_FLOAT); |
158
|
|
|
|
|
|
|
} |
159
|
5892
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
160
|
5892
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
161
|
5892
|
|
|
|
|
|
stack_index++; |
162
|
5892
|
|
|
|
|
|
break; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
165
|
6922
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
166
|
26
|
|
|
|
|
|
SPVM_CONSTANT* constant = arg->op_optional_arg_default->uv.constant; |
167
|
26
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_DOUBLE); |
168
|
26
|
|
|
|
|
|
*(double*)&opcode.operand1 = constant->value.dval; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
else { |
171
|
6896
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_DOUBLE); |
172
|
|
|
|
|
|
|
} |
173
|
6922
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
174
|
6922
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
175
|
6922
|
|
|
|
|
|
stack_index++; |
176
|
6922
|
|
|
|
|
|
break; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
default: { |
179
|
0
|
|
|
|
|
|
assert(0); |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
201071
|
|
|
|
|
|
break; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM: |
185
|
|
|
|
|
|
|
{ |
186
|
140
|
|
|
|
|
|
SPVM_FIELD* arg_mulnum_field = SPVM_LIST_get(arg_basic_type->fields, 0); |
187
|
140
|
|
|
|
|
|
SPVM_TYPE* arg_mulnum_field_type = arg_mulnum_field->type; |
188
|
140
|
|
|
|
|
|
SPVM_BASIC_TYPE* arg_mulnum_field_basic_type = arg_mulnum_field_type->basic_type; |
189
|
|
|
|
|
|
|
|
190
|
140
|
|
|
|
|
|
switch (arg_mulnum_field_basic_type->id) { |
191
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
192
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_BYTE); |
193
|
18
|
|
|
|
|
|
break; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
196
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_SHORT); |
197
|
18
|
|
|
|
|
|
break; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
200
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_INT); |
201
|
18
|
|
|
|
|
|
break; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
204
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_LONG); |
205
|
18
|
|
|
|
|
|
break; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
208
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_FLOAT); |
209
|
18
|
|
|
|
|
|
break; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
212
|
50
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_DOUBLE); |
213
|
50
|
|
|
|
|
|
break; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
} |
216
|
140
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
217
|
140
|
50
|
|
|
|
|
assert(args_width < 0xFFFF); |
218
|
140
|
|
|
|
|
|
opcode.operand3 = args_width << 8 | stack_index & 0xFF; |
219
|
140
|
|
|
|
|
|
stack_index += args_width; |
220
|
140
|
|
|
|
|
|
break; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_STRING: |
223
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS: |
224
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE: |
225
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_ANY_OBJECT: |
226
|
|
|
|
|
|
|
{ |
227
|
198472
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
228
|
1942
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_OBJECT); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
else { |
231
|
196530
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OBJECT); |
232
|
|
|
|
|
|
|
} |
233
|
198472
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
234
|
198472
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
235
|
198472
|
|
|
|
|
|
stack_index++; |
236
|
198472
|
|
|
|
|
|
break; |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
default: { |
239
|
402509
|
|
|
|
|
|
assert(0); |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
} |
244
|
84218
|
100
|
|
|
|
|
else if (arg_type_dimension == 1) { |
245
|
84188
|
50
|
|
|
|
|
switch (arg_basic_type_category) { |
246
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_NUMERIC: |
247
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM: |
248
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_STRING: |
249
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS: |
250
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE: |
251
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_ANY_OBJECT: |
252
|
|
|
|
|
|
|
{ |
253
|
84188
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
254
|
2155
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_OBJECT); |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
else { |
257
|
82033
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OBJECT); |
258
|
|
|
|
|
|
|
} |
259
|
84188
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
260
|
84188
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
261
|
84188
|
|
|
|
|
|
stack_index++; |
262
|
84188
|
|
|
|
|
|
break; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
default: { |
265
|
84188
|
|
|
|
|
|
assert(0); |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
} |
269
|
30
|
50
|
|
|
|
|
else if (arg_type_dimension == 2) { |
270
|
30
|
100
|
|
|
|
|
if (arg->op_optional_arg_default) { |
271
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OPTIONAL_OBJECT); |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
else { |
274
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_STACK_OBJECT); |
275
|
|
|
|
|
|
|
} |
276
|
30
|
|
|
|
|
|
opcode.operand0 = arg->runtime_var_index; |
277
|
30
|
|
|
|
|
|
opcode.operand3 = stack_index & 0xFF; |
278
|
30
|
|
|
|
|
|
stack_index++; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
else { |
281
|
0
|
|
|
|
|
|
assert(0); |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
486727
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
{ |
288
|
284473
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
289
|
284473
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_END_ARGS); |
290
|
284473
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
284473
|
100
|
|
|
|
|
if (method->is_native) { |
294
|
64471
|
|
|
|
|
|
goto END_OF_FUNCTION; |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
220002
|
|
|
|
|
|
SPVM_LIST* block_stack_runtime_var_index_top = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
298
|
|
|
|
|
|
|
|
299
|
220002
|
|
|
|
|
|
SPVM_LIST* if_block_stack_goto_end_opcode_index = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
300
|
|
|
|
|
|
|
|
301
|
220002
|
|
|
|
|
|
SPVM_LIST* loop_block_stack_goto_opcode_index = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
302
|
|
|
|
|
|
|
|
303
|
220002
|
|
|
|
|
|
SPVM_LIST* loop_block_stack_next_base = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
304
|
|
|
|
|
|
|
|
305
|
220002
|
|
|
|
|
|
SPVM_LIST* loop_block_stack_last_base = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
306
|
|
|
|
|
|
|
|
307
|
220002
|
|
|
|
|
|
SPVM_LIST* switch_stack_switch_info = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
308
|
|
|
|
|
|
|
|
309
|
220002
|
|
|
|
|
|
SPVM_LIST* switch_block_stack_break_base = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
310
|
|
|
|
|
|
|
|
311
|
220002
|
|
|
|
|
|
SPVM_LIST* eval_block_stack_goto_opcode_index = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
312
|
|
|
|
|
|
|
|
313
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_if_eq_or_if_ne_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
314
|
|
|
|
|
|
|
|
315
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_last_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
316
|
|
|
|
|
|
|
|
317
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_break_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
318
|
|
|
|
|
|
|
|
319
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_next_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
320
|
|
|
|
|
|
|
|
321
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_return_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
322
|
|
|
|
|
|
|
|
323
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_goto_end_of_eval_on_exception_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
324
|
|
|
|
|
|
|
|
325
|
220002
|
|
|
|
|
|
SPVM_LIST* unresolved_goto_end_of_method_on_exception_opcode_index_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
326
|
|
|
|
|
|
|
|
327
|
220002
|
|
|
|
|
|
SPVM_LIST* mortal_stack = SPVM_LIST_new(compiler->current_each_compile_allocator, 0, SPVM_ALLOCATOR_C_ALLOC_TYPE_TMP); |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
// Run OPs |
330
|
220002
|
|
|
|
|
|
SPVM_OP* op_base = method->op_block; |
331
|
220002
|
|
|
|
|
|
SPVM_OP* op_cur = op_base; |
332
|
220002
|
|
|
|
|
|
int32_t finish = 0; |
333
|
|
|
|
|
|
|
|
334
|
220002
|
|
|
|
|
|
int32_t mortal_stack_top = 0; |
335
|
|
|
|
|
|
|
|
336
|
21826446
|
100
|
|
|
|
|
while (op_cur) { |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
// [START]Preorder traversal position |
339
|
21820761
|
|
|
|
|
|
switch (op_cur->id) { |
340
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BLOCK: { // Preorder |
341
|
|
|
|
|
|
|
|
342
|
1519401
|
|
|
|
|
|
SPVM_BLOCK* block = op_cur->uv.block; |
343
|
|
|
|
|
|
|
|
344
|
1519401
|
100
|
|
|
|
|
if (block->id == SPVM_BLOCK_C_ID_LOOP_INIT) { |
345
|
|
|
|
|
|
|
// Push last block base stack |
346
|
67619
|
|
|
|
|
|
int32_t last_block_base = unresolved_last_opcode_index_stack->length; |
347
|
67619
|
|
|
|
|
|
SPVM_LIST_push(loop_block_stack_last_base, (void*)(intptr_t)last_block_base); |
348
|
|
|
|
|
|
|
} |
349
|
1451782
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_LOOP_STATEMENTS) { |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
// Push next block base stack |
352
|
67619
|
|
|
|
|
|
int32_t next_block_base = unresolved_next_opcode_index_stack->length; |
353
|
67619
|
|
|
|
|
|
SPVM_LIST_push(loop_block_stack_next_base, (void*)(intptr_t)next_block_base); |
354
|
|
|
|
|
|
|
|
355
|
67619
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
// Add goto |
358
|
67619
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO); |
359
|
67619
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
360
|
|
|
|
|
|
|
|
361
|
67619
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length - 1; |
362
|
|
|
|
|
|
|
|
363
|
67619
|
|
|
|
|
|
SPVM_LIST_push(loop_block_stack_goto_opcode_index, (void*)(intptr_t)opcode_index); |
364
|
|
|
|
|
|
|
} |
365
|
1384163
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_SWITCH) { |
366
|
|
|
|
|
|
|
// Push break block base stack |
367
|
1618
|
|
|
|
|
|
int32_t break_block_base = unresolved_break_opcode_index_stack->length; |
368
|
1618
|
|
|
|
|
|
SPVM_LIST_push(switch_block_stack_break_base, (void*)(intptr_t)break_block_base); |
369
|
|
|
|
|
|
|
} |
370
|
1382545
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_EVAL) { |
371
|
2152
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length; |
372
|
|
|
|
|
|
|
|
373
|
2152
|
|
|
|
|
|
SPVM_LIST_push(eval_block_stack_goto_opcode_index, (void*)(intptr_t)opcode_index); |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
// Set exception var to undef in eval block start |
376
|
|
|
|
|
|
|
{ |
377
|
2152
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
378
|
2152
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CLEAR_EVAL_ERROR_ID); |
379
|
2152
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
{ |
382
|
2152
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
383
|
2152
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_EXCEPTION_VAR_UNDEF); |
384
|
2152
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
1519401
|
|
|
|
|
|
int32_t runtime_var_indexs_top = mortal_stack->length; |
389
|
1519401
|
|
|
|
|
|
SPVM_LIST_push(block_stack_runtime_var_index_top, (void*)(intptr_t)runtime_var_indexs_top); |
390
|
|
|
|
|
|
|
|
391
|
1519401
|
|
|
|
|
|
break; |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
case SPVM_OP_C_ID_SWITCH: { |
394
|
1618
|
|
|
|
|
|
SPVM_SWITCH_INFO* switch_info = op_cur->uv.switch_info; |
395
|
1618
|
|
|
|
|
|
SPVM_LIST_push(switch_stack_switch_info, switch_info); |
396
|
1618
|
|
|
|
|
|
break; |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CASE: { |
399
|
9405
|
50
|
|
|
|
|
if (switch_stack_switch_info->length > 0) { |
400
|
9405
|
|
|
|
|
|
SPVM_SWITCH_INFO* switch_info = SPVM_LIST_get(switch_stack_switch_info, switch_stack_switch_info->length - 1); |
401
|
9405
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length; |
402
|
9405
|
|
|
|
|
|
op_cur->uv.case_info->goto_opcode_index = opcode_index; |
403
|
|
|
|
|
|
|
} |
404
|
9405
|
|
|
|
|
|
break; |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DEFAULT: { |
407
|
1618
|
50
|
|
|
|
|
if (switch_stack_switch_info->length > 0) { |
408
|
1618
|
|
|
|
|
|
SPVM_SWITCH_INFO* switch_info = SPVM_LIST_get(switch_stack_switch_info, switch_stack_switch_info->length - 1); |
409
|
1618
|
|
|
|
|
|
switch_info->default_opcode_index = opcode_list->length; |
410
|
|
|
|
|
|
|
} |
411
|
1618
|
|
|
|
|
|
break; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
// [END]Preorder traversal position |
416
|
|
|
|
|
|
|
|
417
|
21820761
|
100
|
|
|
|
|
if (op_cur->first) { |
418
|
12228986
|
|
|
|
|
|
op_cur = op_cur->first; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
else { |
421
|
|
|
|
|
|
|
while (1) { |
422
|
|
|
|
|
|
|
// [START]Postorder traversal position |
423
|
21820761
|
|
|
|
|
|
switch (op_cur->id) { |
424
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BLOCK: { // Postorder |
425
|
1519401
|
|
|
|
|
|
SPVM_BLOCK* block = op_cur->uv.block; |
426
|
|
|
|
|
|
|
|
427
|
1519401
|
100
|
|
|
|
|
if (block->id == SPVM_BLOCK_C_ID_IF) { |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
{ |
430
|
430048
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
431
|
|
|
|
|
|
|
|
432
|
430048
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO); |
433
|
430048
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
434
|
|
|
|
|
|
|
|
435
|
430048
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length - 1; |
436
|
430048
|
|
|
|
|
|
SPVM_LIST_push(if_block_stack_goto_end_opcode_index, (void*)(intptr_t)opcode_index); |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
|
439
|
430048
|
|
|
|
|
|
int32_t if_eq_or_if_ne_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_if_eq_or_if_ne_opcode_index_stack); |
440
|
|
|
|
|
|
|
|
441
|
430048
|
|
|
|
|
|
SPVM_OPCODE* if_eq_or_if_ne_goto = (opcode_list->values + if_eq_or_if_ne_goto_opcode_index); |
442
|
430048
|
|
|
|
|
|
int32_t if_eq_or_if_ne_goto_opcode_base_index = opcode_list->length; |
443
|
430048
|
|
|
|
|
|
if_eq_or_if_ne_goto->operand0 = if_eq_or_if_ne_goto_opcode_base_index; |
444
|
|
|
|
|
|
|
} |
445
|
1089353
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_ELSE) { |
446
|
|
|
|
|
|
|
|
447
|
430048
|
50
|
|
|
|
|
assert(if_block_stack_goto_end_opcode_index->length > 0); |
448
|
|
|
|
|
|
|
|
449
|
430048
|
|
|
|
|
|
int32_t if_block_end_goto_opcode_index = (intptr_t)SPVM_LIST_pop(if_block_stack_goto_end_opcode_index); |
450
|
|
|
|
|
|
|
|
451
|
430048
|
|
|
|
|
|
SPVM_OPCODE* if_block_end_goto = (opcode_list->values + if_block_end_goto_opcode_index); |
452
|
430048
|
|
|
|
|
|
int32_t if_block_end_goto_opcode_base_index = opcode_list->length; |
453
|
430048
|
|
|
|
|
|
if_block_end_goto->operand0 = if_block_end_goto_opcode_base_index; |
454
|
|
|
|
|
|
|
} |
455
|
659305
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_LOOP_INIT) { |
456
|
|
|
|
|
|
|
// last block base |
457
|
67619
|
|
|
|
|
|
int32_t last_block_base = (intptr_t)SPVM_LIST_pop(loop_block_stack_last_base); |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
// Set last position |
460
|
67619
|
|
|
|
|
|
int32_t unresolved_last_opcode_index_stack_pop_count = unresolved_last_opcode_index_stack->length - last_block_base; |
461
|
79468
|
100
|
|
|
|
|
for (int32_t i = 0; i < unresolved_last_opcode_index_stack_pop_count; i++) { |
462
|
11849
|
|
|
|
|
|
int32_t last_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_last_opcode_index_stack); |
463
|
|
|
|
|
|
|
|
464
|
11849
|
|
|
|
|
|
SPVM_OPCODE* last_goto = (opcode_list->values + last_goto_opcode_index); |
465
|
11849
|
|
|
|
|
|
int32_t last_goto_opcode_base_index = opcode_list->length; |
466
|
11849
|
|
|
|
|
|
last_goto->operand0 = last_goto_opcode_base_index; |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
} |
469
|
591686
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_LOOP_STATEMENTS) { |
470
|
|
|
|
|
|
|
// next block base |
471
|
67619
|
|
|
|
|
|
int32_t next_block_base = (intptr_t)SPVM_LIST_pop(loop_block_stack_next_base); |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
// Set next position |
474
|
67619
|
|
|
|
|
|
int32_t unresolved_next_opcode_index_stack_pop_count = unresolved_next_opcode_index_stack->length - next_block_base; |
475
|
67640
|
100
|
|
|
|
|
for (int32_t i = 0; i < unresolved_next_opcode_index_stack_pop_count; i++) { |
476
|
21
|
|
|
|
|
|
int32_t next_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_next_opcode_index_stack); |
477
|
|
|
|
|
|
|
|
478
|
21
|
|
|
|
|
|
SPVM_OPCODE* next_goto = (opcode_list->values + next_goto_opcode_index); |
479
|
21
|
|
|
|
|
|
int32_t next_goto_opcode_base_index = opcode_list->length; |
480
|
21
|
|
|
|
|
|
next_goto->operand0 = next_goto_opcode_base_index; |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
} |
483
|
524067
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_SWITCH) { |
484
|
|
|
|
|
|
|
// break block base |
485
|
1618
|
|
|
|
|
|
int32_t break_block_base = (intptr_t)SPVM_LIST_pop(switch_block_stack_break_base); |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
// Set break position |
488
|
1618
|
|
|
|
|
|
int32_t unresolved_break_opcode_index_stack_pop_count = unresolved_break_opcode_index_stack->length - break_block_base; |
489
|
9489
|
100
|
|
|
|
|
for (int32_t i = 0; i < unresolved_break_opcode_index_stack_pop_count; i++) { |
490
|
7871
|
|
|
|
|
|
int32_t break_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_break_opcode_index_stack); |
491
|
|
|
|
|
|
|
|
492
|
7871
|
|
|
|
|
|
SPVM_OPCODE* break_goto = (opcode_list->values + break_goto_opcode_index); |
493
|
7871
|
|
|
|
|
|
int32_t break_goto_opcode_base_index = opcode_list->length; |
494
|
7871
|
|
|
|
|
|
break_goto->operand0 = break_goto_opcode_base_index; |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
} |
497
|
522449
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_EVAL) { |
498
|
|
|
|
|
|
|
// Set IF_EXCEPTION_CATCH opcode index |
499
|
4996
|
100
|
|
|
|
|
while (unresolved_goto_end_of_eval_on_exception_opcode_index_stack->length > 0) { |
500
|
2844
|
|
|
|
|
|
int32_t goto_end_of_eval_on_exception_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_goto_end_of_eval_on_exception_opcode_index_stack); |
501
|
|
|
|
|
|
|
|
502
|
2844
|
|
|
|
|
|
SPVM_OPCODE* goto_end_of_eval_on_exception_goto = (opcode_list->values + goto_end_of_eval_on_exception_goto_opcode_index); |
503
|
2844
|
|
|
|
|
|
int32_t goto_end_of_eval_on_exception_goto_opcode_base_index = opcode_list->length; |
504
|
2844
|
|
|
|
|
|
goto_end_of_eval_on_exception_goto->operand0 = goto_end_of_eval_on_exception_goto_opcode_base_index; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
2152
|
|
|
|
|
|
SPVM_LIST_pop(eval_block_stack_goto_opcode_index); |
508
|
|
|
|
|
|
|
} |
509
|
520297
|
100
|
|
|
|
|
else if (block->id == SPVM_BLOCK_C_ID_METHOD) { |
510
|
613936
|
100
|
|
|
|
|
while (unresolved_return_opcode_index_stack->length > 0) { |
511
|
|
|
|
|
|
|
|
512
|
399619
|
|
|
|
|
|
int32_t return_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_return_opcode_index_stack); |
513
|
|
|
|
|
|
|
|
514
|
399619
|
|
|
|
|
|
SPVM_OPCODE* return_goto = (opcode_list->values + return_goto_opcode_index); |
515
|
399619
|
|
|
|
|
|
int32_t return_goto_opcode_base_index = opcode_list->length; |
516
|
399619
|
|
|
|
|
|
return_goto->operand1 = return_goto_opcode_base_index; |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
|
519
|
1110932
|
100
|
|
|
|
|
while (unresolved_goto_end_of_method_on_exception_opcode_index_stack->length > 0) { |
520
|
896615
|
|
|
|
|
|
int32_t goto_end_of_method_on_exception_goto_opcode_index = (intptr_t)SPVM_LIST_pop(unresolved_goto_end_of_method_on_exception_opcode_index_stack); |
521
|
|
|
|
|
|
|
|
522
|
896615
|
|
|
|
|
|
SPVM_OPCODE* goto_end_of_method_on_exception_goto = (opcode_list->values + goto_end_of_method_on_exception_goto_opcode_index); |
523
|
896615
|
|
|
|
|
|
int32_t goto_end_of_method_on_exception_goto_opcode_base_index = opcode_list->length; |
524
|
896615
|
|
|
|
|
|
goto_end_of_method_on_exception_goto->operand0 = goto_end_of_method_on_exception_goto_opcode_base_index; |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
} |
527
|
|
|
|
|
|
|
|
528
|
1519401
|
|
|
|
|
|
int32_t runtime_var_indexs_top = (intptr_t)SPVM_LIST_get(block_stack_runtime_var_index_top, block_stack_runtime_var_index_top->length - 1); |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
// Leave scope |
531
|
1519401
|
100
|
|
|
|
|
if (block->need_leave_scope) { |
532
|
|
|
|
|
|
|
|
533
|
603642
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
534
|
|
|
|
|
|
|
|
535
|
603642
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LEAVE_SCOPE); |
536
|
603642
|
|
|
|
|
|
opcode.operand0 = runtime_var_indexs_top; |
537
|
|
|
|
|
|
|
|
538
|
603642
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
539
|
|
|
|
|
|
|
} |
540
|
|
|
|
|
|
|
|
541
|
2271716
|
100
|
|
|
|
|
while (mortal_stack->length > runtime_var_indexs_top) { |
542
|
752315
|
|
|
|
|
|
SPVM_LIST_pop(mortal_stack); |
543
|
|
|
|
|
|
|
} |
544
|
|
|
|
|
|
|
|
545
|
1519401
|
|
|
|
|
|
SPVM_LIST_pop(block_stack_runtime_var_index_top); |
546
|
|
|
|
|
|
|
|
547
|
1519401
|
|
|
|
|
|
break; |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
case SPVM_OP_C_ID_LOOP_INCREMENT: { |
550
|
|
|
|
|
|
|
// Set loop first GOTO opcode |
551
|
67619
|
|
|
|
|
|
int32_t loop_first_goto_opcode_index = (intptr_t)SPVM_LIST_get(loop_block_stack_goto_opcode_index, loop_block_stack_goto_opcode_index->length - 1); |
552
|
|
|
|
|
|
|
|
553
|
67619
|
|
|
|
|
|
SPVM_OPCODE* loop_first_goto = (opcode_list->values + loop_first_goto_opcode_index); |
554
|
67619
|
|
|
|
|
|
int32_t loop_first_goto_opcode_base_index = opcode_list->length; |
555
|
67619
|
|
|
|
|
|
loop_first_goto->operand0 = loop_first_goto_opcode_base_index; |
556
|
|
|
|
|
|
|
|
557
|
67619
|
|
|
|
|
|
break; |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CONDITION: |
560
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CONDITION_NOT: |
561
|
|
|
|
|
|
|
{ |
562
|
|
|
|
|
|
|
|
563
|
497667
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length; |
564
|
|
|
|
|
|
|
|
565
|
497667
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
|
568
|
497667
|
100
|
|
|
|
|
if (op_cur->id == SPVM_OP_C_ID_CONDITION) { |
569
|
275560
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IF_EQ_ZERO); |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
else { |
572
|
222107
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IF_NE_ZERO); |
573
|
|
|
|
|
|
|
} |
574
|
|
|
|
|
|
|
|
575
|
497667
|
100
|
|
|
|
|
if (op_cur->flag & SPVM_OP_C_FLAG_CONDITION_IF) { |
576
|
430048
|
|
|
|
|
|
SPVM_LIST_push(unresolved_if_eq_or_if_ne_opcode_index_stack, (void*)(intptr_t)opcode_index); |
577
|
|
|
|
|
|
|
} |
578
|
67619
|
50
|
|
|
|
|
else if (op_cur->flag & SPVM_OP_C_FLAG_CONDITION_LOOP) { |
579
|
67619
|
50
|
|
|
|
|
assert(loop_block_stack_goto_opcode_index->length > 0); |
580
|
|
|
|
|
|
|
|
581
|
67619
|
|
|
|
|
|
int32_t loop_first_goto_opcode_index = (intptr_t)SPVM_LIST_pop(loop_block_stack_goto_opcode_index); |
582
|
|
|
|
|
|
|
|
583
|
67619
|
|
|
|
|
|
opcode.operand0 = loop_first_goto_opcode_index + 1; |
584
|
|
|
|
|
|
|
} |
585
|
|
|
|
|
|
|
|
586
|
497667
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
587
|
|
|
|
|
|
|
|
588
|
497667
|
|
|
|
|
|
break; |
589
|
|
|
|
|
|
|
} |
590
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NEXT: { |
591
|
|
|
|
|
|
|
// GOTO increment statement |
592
|
21
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
593
|
|
|
|
|
|
|
|
594
|
21
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO); |
595
|
21
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
596
|
|
|
|
|
|
|
|
597
|
21
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length - 1; |
598
|
|
|
|
|
|
|
|
599
|
21
|
|
|
|
|
|
SPVM_LIST_push(unresolved_next_opcode_index_stack, (void*)(intptr_t)opcode_index); |
600
|
|
|
|
|
|
|
|
601
|
21
|
|
|
|
|
|
break; |
602
|
|
|
|
|
|
|
} |
603
|
|
|
|
|
|
|
case SPVM_OP_C_ID_LAST: { |
604
|
|
|
|
|
|
|
// GOTO end of loop init block |
605
|
11849
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
606
|
|
|
|
|
|
|
|
607
|
11849
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO); |
608
|
11849
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
609
|
|
|
|
|
|
|
|
610
|
11849
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length - 1; |
611
|
|
|
|
|
|
|
|
612
|
11849
|
|
|
|
|
|
SPVM_LIST_push(unresolved_last_opcode_index_stack, (void*)(intptr_t)opcode_index); |
613
|
|
|
|
|
|
|
|
614
|
11849
|
|
|
|
|
|
break; |
615
|
|
|
|
|
|
|
} |
616
|
|
|
|
|
|
|
case SPVM_OP_C_ID_SWITCH: { |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
// Pop switch information |
619
|
1618
|
|
|
|
|
|
SPVM_SWITCH_INFO* switch_info = SPVM_LIST_pop(switch_stack_switch_info); |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
// Set the information of switch opcodes |
622
|
1618
|
|
|
|
|
|
int32_t opcode_index = switch_info->opcode_index; |
623
|
1618
|
|
|
|
|
|
SPVM_OPCODE* opcode = opcode_list->values + opcode_index; |
624
|
1618
|
|
|
|
|
|
opcode->operand1 = switch_info->default_opcode_index; |
625
|
1618
|
|
|
|
|
|
opcode->operand2 = switch_info->case_infos->length; |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
// Set case info operands |
628
|
1618
|
|
|
|
|
|
SPVM_LIST* case_infos = switch_info->case_infos; |
629
|
11023
|
100
|
|
|
|
|
for (int32_t i = 0; i < switch_info->case_infos->length; i++) { |
630
|
9405
|
|
|
|
|
|
SPVM_OPCODE* opcode_case_info = opcode_list->values + opcode_index + 1 + i; |
631
|
9405
|
|
|
|
|
|
SPVM_CASE_INFO* case_info = SPVM_LIST_get(case_infos, i); |
632
|
9405
|
|
|
|
|
|
opcode_case_info->operand1 = case_info->case_value; |
633
|
9405
|
|
|
|
|
|
opcode_case_info->operand2 = case_info->goto_opcode_index; |
634
|
|
|
|
|
|
|
} |
635
|
|
|
|
|
|
|
|
636
|
1618
|
|
|
|
|
|
break; |
637
|
|
|
|
|
|
|
} |
638
|
|
|
|
|
|
|
case SPVM_OP_C_ID_SWITCH_CONDITION: { |
639
|
1618
|
50
|
|
|
|
|
assert(switch_stack_switch_info->length > 0); |
640
|
|
|
|
|
|
|
|
641
|
1618
|
|
|
|
|
|
SPVM_SWITCH_INFO* switch_info = SPVM_LIST_get(switch_stack_switch_info, switch_stack_switch_info->length - 1); |
642
|
|
|
|
|
|
|
|
643
|
1618
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
644
|
|
|
|
|
|
|
|
645
|
1618
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length; |
646
|
1618
|
|
|
|
|
|
switch_info->opcode_index = opcode_index; |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
// Add switch opcode |
649
|
|
|
|
|
|
|
SPVM_OPCODE opcode_switch_info; |
650
|
1618
|
|
|
|
|
|
memset(&opcode_switch_info, 0, sizeof(SPVM_OPCODE)); |
651
|
1618
|
|
|
|
|
|
opcode_switch_info.id = SPVM_OPCODE_C_ID_LOOKUP_SWITCH; |
652
|
1618
|
|
|
|
|
|
opcode_switch_info.operand0 = runtime_var_index_in; |
653
|
1618
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode_switch_info); |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
// Match values and branchs |
656
|
11023
|
100
|
|
|
|
|
for (int32_t i = 0; i < switch_info->case_infos->length; i++) { |
657
|
9405
|
|
|
|
|
|
SPVM_CASE_INFO* case_info = SPVM_LIST_get(switch_info->case_infos, i); |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
// Branch |
660
|
9405
|
|
|
|
|
|
SPVM_CASE_INFO* branch_opcode_index_case_info = switch_info->case_infos->values[i]; |
661
|
9405
|
|
|
|
|
|
branch_opcode_index_case_info->goto_opcode_index = case_info->goto_opcode_index; |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
// Add case info |
664
|
|
|
|
|
|
|
SPVM_OPCODE opcode_case_info; |
665
|
9405
|
|
|
|
|
|
memset(&opcode_case_info, 0, sizeof(SPVM_OPCODE)); |
666
|
9405
|
|
|
|
|
|
opcode_case_info.id = SPVM_OPCODE_C_ID_CASE_INFO; |
667
|
9405
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode_case_info); |
668
|
|
|
|
|
|
|
} |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
// Default branch |
671
|
1618
|
|
|
|
|
|
int32_t default_opcode_index = switch_info->default_opcode_index; |
672
|
1618
|
50
|
|
|
|
|
if (default_opcode_index == 0) { |
673
|
1618
|
|
|
|
|
|
default_opcode_index = opcode_list->length + 1; |
674
|
|
|
|
|
|
|
} |
675
|
1618
|
|
|
|
|
|
switch_info->default_opcode_index = default_opcode_index; |
676
|
|
|
|
|
|
|
|
677
|
1618
|
|
|
|
|
|
break; |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BREAK: { |
680
|
|
|
|
|
|
|
// GOTO end of switch block |
681
|
7871
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
682
|
|
|
|
|
|
|
|
683
|
7871
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO); |
684
|
7871
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
685
|
|
|
|
|
|
|
|
686
|
7871
|
|
|
|
|
|
int32_t opcode_index = opcode_list->length - 1; |
687
|
|
|
|
|
|
|
|
688
|
7871
|
|
|
|
|
|
SPVM_LIST_push(unresolved_break_opcode_index_stack, (void*)(intptr_t)opcode_index); |
689
|
|
|
|
|
|
|
|
690
|
7871
|
|
|
|
|
|
break; |
691
|
|
|
|
|
|
|
} |
692
|
|
|
|
|
|
|
case SPVM_OP_C_ID_RETURN: { |
693
|
399619
|
100
|
|
|
|
|
if (op_cur->first) { |
694
|
305659
|
|
|
|
|
|
SPVM_TYPE* return_type = SPVM_CHECK_get_type(compiler, op_cur->first); |
695
|
|
|
|
|
|
|
|
696
|
305659
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, return_type->basic_type->id, return_type->dimension, return_type->flag)) { |
697
|
2087
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
|
700
|
2087
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_UNDEF); |
701
|
|
|
|
|
|
|
|
702
|
2087
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
else { |
705
|
303572
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
710
|
303572
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, method->return_type->basic_type->id, method->return_type->dimension, method->return_type->flag)) { |
711
|
192590
|
|
|
|
|
|
switch (method->return_type->basic_type->id) { |
712
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
713
|
192
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_BYTE); |
714
|
192
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
715
|
192590
|
|
|
|
|
|
break; |
716
|
|
|
|
|
|
|
} |
717
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
718
|
194
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_SHORT); |
719
|
194
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
720
|
194
|
|
|
|
|
|
break; |
721
|
|
|
|
|
|
|
} |
722
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
723
|
165460
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_INT); |
724
|
165460
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
725
|
165460
|
|
|
|
|
|
break; |
726
|
|
|
|
|
|
|
} |
727
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
728
|
15768
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_LONG); |
729
|
15768
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
730
|
15768
|
|
|
|
|
|
break; |
731
|
|
|
|
|
|
|
} |
732
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
733
|
4452
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_FLOAT); |
734
|
4452
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
735
|
4452
|
|
|
|
|
|
break; |
736
|
|
|
|
|
|
|
} |
737
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
738
|
6524
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_DOUBLE); |
739
|
6524
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
740
|
6524
|
|
|
|
|
|
break; |
741
|
|
|
|
|
|
|
} |
742
|
|
|
|
|
|
|
default: |
743
|
0
|
|
|
|
|
|
assert(0); |
744
|
|
|
|
|
|
|
} |
745
|
|
|
|
|
|
|
} |
746
|
110982
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, method->return_type->basic_type->id, method->return_type->dimension, method->return_type->flag)) { |
747
|
110804
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_OBJECT); |
748
|
110804
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
749
|
|
|
|
|
|
|
} |
750
|
178
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, method->return_type->basic_type->id, method->return_type->dimension, method->return_type->flag)) { |
751
|
178
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(return_type->basic_type->fields, 0); |
752
|
178
|
50
|
|
|
|
|
assert(first_field); |
753
|
|
|
|
|
|
|
|
754
|
178
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
755
|
178
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
756
|
|
|
|
|
|
|
|
757
|
178
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
758
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
759
|
32
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
760
|
32
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_MULNUM_BYTE); |
761
|
178
|
|
|
|
|
|
break; |
762
|
|
|
|
|
|
|
} |
763
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
764
|
28
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
765
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_MULNUM_SHORT); |
766
|
28
|
|
|
|
|
|
break; |
767
|
|
|
|
|
|
|
} |
768
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
769
|
28
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
770
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_MULNUM_INT); |
771
|
28
|
|
|
|
|
|
break; |
772
|
|
|
|
|
|
|
} |
773
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
774
|
28
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
775
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_MULNUM_LONG); |
776
|
28
|
|
|
|
|
|
break; |
777
|
|
|
|
|
|
|
} |
778
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
779
|
28
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
780
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_MULNUM_FLOAT); |
781
|
28
|
|
|
|
|
|
break; |
782
|
|
|
|
|
|
|
} |
783
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
784
|
34
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur->first); |
785
|
34
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_MULNUM_DOUBLE); |
786
|
34
|
|
|
|
|
|
break; |
787
|
|
|
|
|
|
|
} |
788
|
|
|
|
|
|
|
default: |
789
|
0
|
|
|
|
|
|
assert(0); |
790
|
|
|
|
|
|
|
} |
791
|
|
|
|
|
|
|
} |
792
|
|
|
|
|
|
|
else { |
793
|
0
|
|
|
|
|
|
assert(0); |
794
|
|
|
|
|
|
|
} |
795
|
|
|
|
|
|
|
|
796
|
303572
|
|
|
|
|
|
int32_t method_return_width = SPVM_TYPE_get_width(compiler, method->return_type->basic_type->id, method->return_type->dimension, method->return_type->flag); |
797
|
|
|
|
|
|
|
|
798
|
303572
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
799
|
303572
|
|
|
|
|
|
opcode.operand2 = method_return_width; |
800
|
|
|
|
|
|
|
|
801
|
305659
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
802
|
|
|
|
|
|
|
} |
803
|
|
|
|
|
|
|
} |
804
|
|
|
|
|
|
|
else { |
805
|
93960
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
806
|
|
|
|
|
|
|
|
807
|
93960
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RETURN_VOID); |
808
|
93960
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
|
811
|
399619
|
|
|
|
|
|
int32_t return_opcode_index = opcode_list->length - 1; |
812
|
|
|
|
|
|
|
|
813
|
399619
|
|
|
|
|
|
SPVM_LIST_push(unresolved_return_opcode_index_stack, (void*)(intptr_t)return_opcode_index); |
814
|
|
|
|
|
|
|
|
815
|
399619
|
|
|
|
|
|
break; |
816
|
|
|
|
|
|
|
} |
817
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DIE: { |
818
|
|
|
|
|
|
|
|
819
|
138154
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_cur->last); |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
// SET_ERROR_ID |
822
|
|
|
|
|
|
|
{ |
823
|
138154
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
824
|
|
|
|
|
|
|
|
825
|
138154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ERROR_ID); |
826
|
138154
|
|
|
|
|
|
opcode.operand0 = type->basic_type->id; |
827
|
|
|
|
|
|
|
|
828
|
138154
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
829
|
|
|
|
|
|
|
} |
830
|
|
|
|
|
|
|
|
831
|
138154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
832
|
|
|
|
|
|
|
|
833
|
138154
|
|
|
|
|
|
break; |
834
|
|
|
|
|
|
|
} |
835
|
|
|
|
|
|
|
case SPVM_OP_C_ID_VAR: { |
836
|
6184694
|
100
|
|
|
|
|
if (op_cur->uv.var->is_declaration) { |
837
|
|
|
|
|
|
|
|
838
|
2646353
|
|
|
|
|
|
SPVM_VAR_DECL* var_decl = op_cur->uv.var->var_decl; |
839
|
|
|
|
|
|
|
|
840
|
2646353
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, var_decl->op_var_decl); |
841
|
2646353
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
842
|
|
|
|
|
|
|
|
843
|
752315
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
844
|
|
|
|
|
|
|
|
845
|
752315
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_PUSH_MORTAL); |
846
|
752315
|
|
|
|
|
|
int32_t runtime_var_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
847
|
752315
|
|
|
|
|
|
opcode.operand0 = runtime_var_index; |
848
|
|
|
|
|
|
|
|
849
|
752315
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
850
|
|
|
|
|
|
|
|
851
|
752315
|
|
|
|
|
|
SPVM_LIST_push(mortal_stack, (void*)(intptr_t)runtime_var_index); |
852
|
|
|
|
|
|
|
|
853
|
752315
|
|
|
|
|
|
mortal_stack_top++; |
854
|
|
|
|
|
|
|
} |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
// Initialized not initialized variable |
857
|
2646353
|
100
|
|
|
|
|
if (!op_cur->uv.var->is_initialized && !op_cur->uv.var->var_decl->is_arg) { |
|
|
100
|
|
|
|
|
|
858
|
|
|
|
|
|
|
// Multi numeric type |
859
|
353569
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
860
|
350
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(type->basic_type->fields, 0); |
861
|
350
|
50
|
|
|
|
|
assert(first_field); |
862
|
|
|
|
|
|
|
|
863
|
350
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
864
|
350
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
865
|
|
|
|
|
|
|
|
866
|
350
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
870
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
871
|
350
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
872
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
873
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_BYTE_ZERO); |
874
|
48
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
875
|
48
|
|
|
|
|
|
break; |
876
|
|
|
|
|
|
|
} |
877
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
878
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_SHORT_ZERO); |
879
|
44
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
880
|
44
|
|
|
|
|
|
break; |
881
|
|
|
|
|
|
|
} |
882
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
883
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_INT_ZERO); |
884
|
44
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
885
|
44
|
|
|
|
|
|
break; |
886
|
|
|
|
|
|
|
} |
887
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
888
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_LONG_ZERO); |
889
|
44
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
890
|
44
|
|
|
|
|
|
break; |
891
|
|
|
|
|
|
|
} |
892
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
893
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_FLOAT_ZERO); |
894
|
44
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
895
|
44
|
|
|
|
|
|
break; |
896
|
|
|
|
|
|
|
} |
897
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
898
|
126
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_DOUBLE_ZERO); |
899
|
126
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
900
|
126
|
|
|
|
|
|
break; |
901
|
|
|
|
|
|
|
} |
902
|
|
|
|
|
|
|
default: |
903
|
0
|
|
|
|
|
|
assert(0); |
904
|
|
|
|
|
|
|
} |
905
|
|
|
|
|
|
|
|
906
|
350
|
|
|
|
|
|
int32_t fields_length = type->basic_type->fields->length; |
907
|
|
|
|
|
|
|
|
908
|
350
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
909
|
350
|
|
|
|
|
|
opcode.operand2 = fields_length; |
910
|
|
|
|
|
|
|
|
911
|
350
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
912
|
|
|
|
|
|
|
} |
913
|
|
|
|
|
|
|
// Object type |
914
|
353219
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
915
|
55998
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
916
|
|
|
|
|
|
|
|
917
|
55998
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_UNDEF); |
918
|
55998
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
919
|
|
|
|
|
|
|
|
920
|
55998
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
921
|
|
|
|
|
|
|
|
922
|
55998
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
} |
925
|
|
|
|
|
|
|
// Numeric type |
926
|
297221
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
927
|
297211
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
928
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
931
|
297211
|
|
|
|
|
|
switch (type->basic_type->id) { |
932
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
933
|
137
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_BYTE_ZERO); |
934
|
137
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
935
|
137
|
|
|
|
|
|
break; |
936
|
|
|
|
|
|
|
} |
937
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
938
|
138
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_SHORT_ZERO); |
939
|
138
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
940
|
138
|
|
|
|
|
|
break; |
941
|
|
|
|
|
|
|
} |
942
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
943
|
282465
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_INT_ZERO); |
944
|
282465
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
945
|
282465
|
|
|
|
|
|
break; |
946
|
|
|
|
|
|
|
} |
947
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
948
|
7888
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_LONG_ZERO); |
949
|
7888
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
950
|
7888
|
|
|
|
|
|
break; |
951
|
|
|
|
|
|
|
} |
952
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
953
|
2256
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_FLOAT_ZERO); |
954
|
2256
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
955
|
2256
|
|
|
|
|
|
break; |
956
|
|
|
|
|
|
|
} |
957
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
958
|
4327
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_DOUBLE_ZERO); |
959
|
4327
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_cur); |
960
|
4327
|
|
|
|
|
|
break; |
961
|
|
|
|
|
|
|
} |
962
|
|
|
|
|
|
|
default: { |
963
|
0
|
|
|
|
|
|
assert(0); |
964
|
|
|
|
|
|
|
} |
965
|
|
|
|
|
|
|
} |
966
|
|
|
|
|
|
|
|
967
|
297211
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
968
|
|
|
|
|
|
|
|
969
|
297211
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
970
|
|
|
|
|
|
|
} |
971
|
|
|
|
|
|
|
else { |
972
|
|
|
|
|
|
|
// TODO ref type which is not sub arg is invalid |
973
|
|
|
|
|
|
|
// assert(0); |
974
|
|
|
|
|
|
|
} |
975
|
|
|
|
|
|
|
} |
976
|
|
|
|
|
|
|
} |
977
|
|
|
|
|
|
|
|
978
|
6184694
|
|
|
|
|
|
break; |
979
|
|
|
|
|
|
|
} |
980
|
|
|
|
|
|
|
// all operators are assigned to variables by SPVM_CHECK_traverse_ast_assign_unassigned_op_to_var. |
981
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ASSIGN: { |
982
|
3478887
|
|
|
|
|
|
SPVM_OP* op_assign = op_cur; |
983
|
|
|
|
|
|
|
|
984
|
3478887
|
|
|
|
|
|
SPVM_OP* op_assign_dist = op_assign->last; |
985
|
3478887
|
|
|
|
|
|
SPVM_OP* op_assign_src = op_assign->first; |
986
|
|
|
|
|
|
|
|
987
|
3478887
|
100
|
|
|
|
|
if (op_assign_src->id == SPVM_OP_C_ID_SEQUENCE) { |
988
|
1852
|
|
|
|
|
|
op_assign_src = op_assign_src->last; |
989
|
|
|
|
|
|
|
} |
990
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
// $var = OPERATOR |
992
|
3478887
|
100
|
|
|
|
|
if (op_assign_dist->id == SPVM_OP_C_ID_VAR) { |
993
|
3213824
|
|
|
|
|
|
SPVM_TYPE* type_dist = SPVM_CHECK_get_type(compiler, op_assign_dist); |
994
|
|
|
|
|
|
|
|
995
|
3213824
|
|
|
|
|
|
switch (op_assign_src->id) { |
996
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CONCAT: { |
997
|
35888
|
|
|
|
|
|
SPVM_TYPE* first_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
998
|
|
|
|
|
|
|
|
999
|
35888
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_string_or_byte_array_type(compiler, first_type->basic_type->id, first_type->dimension, first_type->flag)); |
1000
|
|
|
|
|
|
|
|
1001
|
35888
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1002
|
|
|
|
|
|
|
|
1003
|
35888
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CONCAT); |
1004
|
|
|
|
|
|
|
|
1005
|
35888
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1006
|
35888
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1007
|
35888
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
1008
|
|
|
|
|
|
|
|
1009
|
35888
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1010
|
35888
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
1011
|
35888
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
1012
|
|
|
|
|
|
|
|
1013
|
35888
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1014
|
|
|
|
|
|
|
|
1015
|
35888
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1016
|
35888
|
|
|
|
|
|
break; |
1017
|
|
|
|
|
|
|
} |
1018
|
|
|
|
|
|
|
case SPVM_OP_C_ID_TYPE_NAME : { |
1019
|
|
|
|
|
|
|
|
1020
|
2067
|
|
|
|
|
|
SPVM_TYPE* first_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
1021
|
|
|
|
|
|
|
|
1022
|
2067
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1023
|
|
|
|
|
|
|
|
1024
|
2067
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_NAME); |
1025
|
|
|
|
|
|
|
|
1026
|
2067
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1027
|
2067
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1028
|
|
|
|
|
|
|
|
1029
|
2067
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1030
|
2067
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1031
|
|
|
|
|
|
|
|
1032
|
2067
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1033
|
|
|
|
|
|
|
|
1034
|
2067
|
|
|
|
|
|
break; |
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DUMP : { |
1037
|
|
|
|
|
|
|
|
1038
|
57
|
|
|
|
|
|
SPVM_TYPE* first_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
1039
|
|
|
|
|
|
|
|
1040
|
57
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1041
|
|
|
|
|
|
|
|
1042
|
57
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DUMP); |
1043
|
|
|
|
|
|
|
|
1044
|
57
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1045
|
57
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1046
|
|
|
|
|
|
|
|
1047
|
57
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1048
|
57
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1049
|
|
|
|
|
|
|
|
1050
|
57
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1051
|
|
|
|
|
|
|
|
1052
|
57
|
|
|
|
|
|
break; |
1053
|
|
|
|
|
|
|
} |
1054
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NEW_STRING_LEN : { |
1055
|
|
|
|
|
|
|
|
1056
|
4643
|
|
|
|
|
|
SPVM_TYPE* first_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
1057
|
|
|
|
|
|
|
|
1058
|
4643
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1059
|
|
|
|
|
|
|
|
1060
|
4643
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_STRING_LEN); |
1061
|
|
|
|
|
|
|
|
1062
|
4643
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1063
|
4643
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1064
|
|
|
|
|
|
|
|
1065
|
4643
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1066
|
4643
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1067
|
|
|
|
|
|
|
|
1068
|
4643
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1069
|
|
|
|
|
|
|
|
1070
|
4643
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1071
|
|
|
|
|
|
|
|
1072
|
4643
|
|
|
|
|
|
break; |
1073
|
|
|
|
|
|
|
} |
1074
|
|
|
|
|
|
|
case SPVM_OP_C_ID_IS_READ_ONLY : { |
1075
|
|
|
|
|
|
|
|
1076
|
1038
|
|
|
|
|
|
SPVM_TYPE* first_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
1077
|
|
|
|
|
|
|
|
1078
|
1038
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1079
|
|
|
|
|
|
|
|
1080
|
1038
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IS_READ_ONLY); |
1081
|
|
|
|
|
|
|
|
1082
|
1038
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1083
|
1038
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1084
|
|
|
|
|
|
|
|
1085
|
1038
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1086
|
1038
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1087
|
|
|
|
|
|
|
|
1088
|
1038
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1089
|
1038
|
|
|
|
|
|
break; |
1090
|
|
|
|
|
|
|
} |
1091
|
|
|
|
|
|
|
case SPVM_OP_C_ID_UNDEF : { |
1092
|
|
|
|
|
|
|
|
1093
|
611
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1094
|
|
|
|
|
|
|
|
1095
|
611
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_UNDEF); |
1096
|
|
|
|
|
|
|
|
1097
|
611
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1098
|
611
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1099
|
|
|
|
|
|
|
|
1100
|
611
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1101
|
611
|
|
|
|
|
|
break; |
1102
|
|
|
|
|
|
|
} |
1103
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CALL_METHOD: { |
1104
|
|
|
|
|
|
|
|
1105
|
241999
|
|
|
|
|
|
SPVM_CALL_METHOD* call_method = op_assign_src->uv.call_method; |
1106
|
241999
|
|
|
|
|
|
const char* call_method_method_name = call_method->method->name; |
1107
|
|
|
|
|
|
|
|
1108
|
241999
|
|
|
|
|
|
SPVM_METHOD* method_call_method = SPVM_HASH_get(call_method->method->current_basic_type->method_symtable, call_method_method_name, strlen(call_method_method_name)); |
1109
|
|
|
|
|
|
|
|
1110
|
241999
|
|
|
|
|
|
int32_t first_arg_runtime_var_index = -1; |
1111
|
241999
|
|
|
|
|
|
SPVM_OP* op_term_args = op_assign_src->first; |
1112
|
241999
|
|
|
|
|
|
SPVM_OP* op_term_arg = op_term_args->first; |
1113
|
|
|
|
|
|
|
|
1114
|
241999
|
|
|
|
|
|
SPVM_LIST* args = method_call_method->var_decls; |
1115
|
241999
|
|
|
|
|
|
int32_t args_width = 0; |
1116
|
|
|
|
|
|
|
|
1117
|
821199
|
100
|
|
|
|
|
for (int32_t arg_index = 0; arg_index < method_call_method->args_length; arg_index++) { |
1118
|
605236
|
|
|
|
|
|
SPVM_VAR_DECL* arg_var_decl = SPVM_LIST_get(args, arg_index); |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
// Argument type |
1121
|
605236
|
|
|
|
|
|
SPVM_TYPE* arg_type = arg_var_decl->type; |
1122
|
605236
|
|
|
|
|
|
int32_t arg_width = SPVM_TYPE_get_width(compiler, arg_type->basic_type->id, arg_type->dimension, arg_type->flag); |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
// Term argment type |
1125
|
605236
|
|
|
|
|
|
op_term_arg = SPVM_OP_sibling(compiler, op_term_arg); |
1126
|
605236
|
100
|
|
|
|
|
if (!op_term_arg) { |
1127
|
26036
|
|
|
|
|
|
break; |
1128
|
|
|
|
|
|
|
} |
1129
|
|
|
|
|
|
|
|
1130
|
579200
|
|
|
|
|
|
SPVM_TYPE* term_arg_type = SPVM_CHECK_get_type(compiler, op_term_arg); |
1131
|
|
|
|
|
|
|
|
1132
|
579200
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1133
|
|
|
|
|
|
|
|
1134
|
579200
|
|
|
|
|
|
opcode.operand3 = args_width; |
1135
|
|
|
|
|
|
|
|
1136
|
579200
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, term_arg_type->basic_type->id, term_arg_type->dimension, term_arg_type->flag)) { |
1137
|
2967
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_UNDEF); |
1138
|
2967
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1139
|
|
|
|
|
|
|
} |
1140
|
|
|
|
|
|
|
else { |
1141
|
576233
|
100
|
|
|
|
|
if (SPVM_TYPE_is_ref_type(compiler, arg_type->basic_type->id, arg_type->dimension, arg_type->flag)) { |
1142
|
5856
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_REF); |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
// Term of argument |
1145
|
5856
|
|
|
|
|
|
int32_t runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1146
|
|
|
|
|
|
|
|
1147
|
5856
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_arg; |
1148
|
|
|
|
|
|
|
|
1149
|
5856
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1150
|
|
|
|
|
|
|
} |
1151
|
570377
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, arg_type->basic_type->id, arg_type->dimension, arg_type->flag)) { |
1152
|
|
|
|
|
|
|
|
1153
|
92
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(arg_type->basic_type->fields, 0); |
1154
|
92
|
50
|
|
|
|
|
assert(first_field); |
1155
|
|
|
|
|
|
|
|
1156
|
92
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
1157
|
92
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
int32_t runtime_var_index_arg; |
1160
|
92
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
1161
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1162
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_MULNUM_BYTE); |
1163
|
6
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1164
|
6
|
|
|
|
|
|
break; |
1165
|
|
|
|
|
|
|
} |
1166
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1167
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_MULNUM_SHORT); |
1168
|
6
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1169
|
6
|
|
|
|
|
|
break; |
1170
|
|
|
|
|
|
|
} |
1171
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1172
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_MULNUM_INT); |
1173
|
6
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1174
|
6
|
|
|
|
|
|
break; |
1175
|
|
|
|
|
|
|
} |
1176
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1177
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_MULNUM_LONG); |
1178
|
6
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1179
|
6
|
|
|
|
|
|
break; |
1180
|
|
|
|
|
|
|
} |
1181
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1182
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_MULNUM_FLOAT); |
1183
|
6
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1184
|
6
|
|
|
|
|
|
break; |
1185
|
|
|
|
|
|
|
} |
1186
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1187
|
62
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_MULNUM_DOUBLE); |
1188
|
62
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1189
|
62
|
|
|
|
|
|
break; |
1190
|
|
|
|
|
|
|
} |
1191
|
|
|
|
|
|
|
default: |
1192
|
0
|
|
|
|
|
|
assert(0); |
1193
|
|
|
|
|
|
|
} |
1194
|
|
|
|
|
|
|
|
1195
|
92
|
|
|
|
|
|
int32_t fields_length = arg_type->basic_type->fields->length; |
1196
|
92
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_arg; |
1197
|
92
|
|
|
|
|
|
opcode.operand1 = fields_length; |
1198
|
|
|
|
|
|
|
|
1199
|
92
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1200
|
|
|
|
|
|
|
} |
1201
|
|
|
|
|
|
|
// Object type |
1202
|
570285
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, arg_type->basic_type->id, arg_type->dimension, arg_type->flag)) { |
1203
|
317072
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_OBJECT); |
1204
|
317072
|
|
|
|
|
|
int32_t runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1205
|
|
|
|
|
|
|
|
1206
|
317072
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_arg; |
1207
|
|
|
|
|
|
|
|
1208
|
317072
|
100
|
|
|
|
|
if (arg_index == 0) { |
1209
|
182350
|
|
|
|
|
|
first_arg_runtime_var_index = runtime_var_index_arg; |
1210
|
|
|
|
|
|
|
} |
1211
|
317072
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1212
|
|
|
|
|
|
|
} |
1213
|
|
|
|
|
|
|
// Numeric type |
1214
|
253213
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, arg_type->basic_type->id, arg_type->dimension, arg_type->flag)) { |
1215
|
|
|
|
|
|
|
int32_t runtime_var_index_arg; |
1216
|
253213
|
|
|
|
|
|
switch (arg_type->basic_type->id) { |
1217
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1218
|
7276
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_BYTE); |
1219
|
7276
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1220
|
7276
|
|
|
|
|
|
break; |
1221
|
|
|
|
|
|
|
} |
1222
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1223
|
80
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_SHORT); |
1224
|
80
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1225
|
80
|
|
|
|
|
|
break; |
1226
|
|
|
|
|
|
|
} |
1227
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1228
|
237436
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_INT); |
1229
|
237436
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1230
|
237436
|
|
|
|
|
|
break; |
1231
|
|
|
|
|
|
|
} |
1232
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1233
|
3830
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_LONG); |
1234
|
3830
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1235
|
3830
|
|
|
|
|
|
break; |
1236
|
|
|
|
|
|
|
} |
1237
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1238
|
1780
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_FLOAT); |
1239
|
1780
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1240
|
1780
|
|
|
|
|
|
break; |
1241
|
|
|
|
|
|
|
} |
1242
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1243
|
2811
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_STACK_DOUBLE); |
1244
|
2811
|
|
|
|
|
|
runtime_var_index_arg = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_arg); |
1245
|
2811
|
|
|
|
|
|
break; |
1246
|
|
|
|
|
|
|
} |
1247
|
|
|
|
|
|
|
default: |
1248
|
0
|
|
|
|
|
|
assert(0); |
1249
|
|
|
|
|
|
|
} |
1250
|
|
|
|
|
|
|
|
1251
|
253213
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_arg; |
1252
|
|
|
|
|
|
|
|
1253
|
253213
|
100
|
|
|
|
|
if (arg_index == 0) { |
1254
|
17496
|
|
|
|
|
|
first_arg_runtime_var_index = runtime_var_index_arg; |
1255
|
|
|
|
|
|
|
} |
1256
|
253213
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1257
|
|
|
|
|
|
|
} |
1258
|
|
|
|
|
|
|
else { |
1259
|
0
|
|
|
|
|
|
assert(0); |
1260
|
|
|
|
|
|
|
} |
1261
|
|
|
|
|
|
|
} |
1262
|
579200
|
|
|
|
|
|
args_width += arg_width; |
1263
|
|
|
|
|
|
|
} |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
// Return |
1268
|
241999
|
|
|
|
|
|
SPVM_TYPE* call_method_return_type = call_method->method->return_type; |
1269
|
|
|
|
|
|
|
// Call method |
1270
|
241999
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1271
|
|
|
|
|
|
|
|
1272
|
241999
|
100
|
|
|
|
|
if (call_method->is_class_method) { |
1273
|
156636
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CALL_CLASS_METHOD); |
1274
|
|
|
|
|
|
|
} |
1275
|
|
|
|
|
|
|
else { |
1276
|
85363
|
100
|
|
|
|
|
if (call_method->is_class_method_instance_method_call) { |
1277
|
112
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CALL_INSTANCE_METHOD_STATIC); |
1278
|
|
|
|
|
|
|
} |
1279
|
|
|
|
|
|
|
else { |
1280
|
85251
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CALL_INSTANCE_METHOD); |
1281
|
|
|
|
|
|
|
} |
1282
|
|
|
|
|
|
|
} |
1283
|
241999
|
|
|
|
|
|
opcode.operand0 = call_method->method->current_basic_type->id; |
1284
|
241999
|
|
|
|
|
|
opcode.operand1 = call_method->method->index; |
1285
|
241999
|
|
|
|
|
|
opcode.operand2 = args_width; |
1286
|
|
|
|
|
|
|
|
1287
|
241999
|
|
|
|
|
|
SPVM_OPCODE opcode_return = {0}; |
1288
|
|
|
|
|
|
|
{ |
1289
|
241999
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1290
|
241999
|
|
|
|
|
|
opcode_return.operand0 = runtime_var_index_out; |
1291
|
241999
|
|
|
|
|
|
opcode_return.operand3 = 0; |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
// Numeric type |
1294
|
241999
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, call_method_return_type->basic_type->id, call_method_return_type->dimension, call_method_return_type->flag)) { |
1295
|
52256
|
|
|
|
|
|
switch (call_method_return_type->basic_type->id) { |
1296
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1297
|
167
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_BYTE); |
1298
|
52256
|
|
|
|
|
|
break; |
1299
|
|
|
|
|
|
|
} |
1300
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1301
|
172
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_SHORT); |
1302
|
172
|
|
|
|
|
|
break; |
1303
|
|
|
|
|
|
|
} |
1304
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1305
|
43585
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_INT); |
1306
|
43585
|
|
|
|
|
|
break; |
1307
|
|
|
|
|
|
|
} |
1308
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1309
|
2685
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_LONG); |
1310
|
2685
|
|
|
|
|
|
break; |
1311
|
|
|
|
|
|
|
} |
1312
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1313
|
2533
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_FLOAT); |
1314
|
2533
|
|
|
|
|
|
break; |
1315
|
|
|
|
|
|
|
} |
1316
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1317
|
3114
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_DOUBLE); |
1318
|
3114
|
|
|
|
|
|
break; |
1319
|
|
|
|
|
|
|
} |
1320
|
|
|
|
|
|
|
default: |
1321
|
0
|
|
|
|
|
|
assert(0); |
1322
|
|
|
|
|
|
|
} |
1323
|
|
|
|
|
|
|
} |
1324
|
|
|
|
|
|
|
// void type |
1325
|
189743
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_void_type(compiler, call_method_return_type->basic_type->id, call_method_return_type->dimension, call_method_return_type->flag)) { |
1326
|
|
|
|
|
|
|
} |
1327
|
|
|
|
|
|
|
// Object type |
1328
|
66938
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, call_method_return_type->basic_type->id, call_method_return_type->dimension, call_method_return_type->flag)) { |
1329
|
66911
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_OBJECT); |
1330
|
|
|
|
|
|
|
} |
1331
|
|
|
|
|
|
|
// Multi numeric type |
1332
|
27
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, call_method_return_type->basic_type->id, call_method_return_type->dimension, call_method_return_type->flag)) { |
1333
|
|
|
|
|
|
|
|
1334
|
27
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(call_method_return_type->basic_type->fields, 0); |
1335
|
27
|
50
|
|
|
|
|
assert(first_field); |
1336
|
|
|
|
|
|
|
|
1337
|
27
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
1338
|
27
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
1339
|
|
|
|
|
|
|
|
1340
|
27
|
|
|
|
|
|
int32_t call_method_return_width = SPVM_TYPE_get_width(compiler, call_method_return_type->basic_type->id, call_method_return_type->dimension, call_method_return_type->flag); |
1341
|
27
|
50
|
|
|
|
|
assert(call_method_return_width < 0xFFFF); |
1342
|
27
|
|
|
|
|
|
opcode_return.operand3 = call_method_return_width << 8 | 0; |
1343
|
|
|
|
|
|
|
|
1344
|
27
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
1345
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1346
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_BYTE); |
1347
|
27
|
|
|
|
|
|
break; |
1348
|
|
|
|
|
|
|
} |
1349
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1350
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_SHORT); |
1351
|
4
|
|
|
|
|
|
break; |
1352
|
|
|
|
|
|
|
} |
1353
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1354
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_INT); |
1355
|
4
|
|
|
|
|
|
break; |
1356
|
|
|
|
|
|
|
} |
1357
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1358
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_LONG); |
1359
|
4
|
|
|
|
|
|
break; |
1360
|
|
|
|
|
|
|
} |
1361
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1362
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_FLOAT); |
1363
|
4
|
|
|
|
|
|
break; |
1364
|
|
|
|
|
|
|
} |
1365
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1366
|
5
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode_return, SPVM_OPCODE_C_ID_GET_STACK_MULNUM_DOUBLE); |
1367
|
5
|
|
|
|
|
|
break; |
1368
|
|
|
|
|
|
|
} |
1369
|
|
|
|
|
|
|
default: { |
1370
|
0
|
|
|
|
|
|
assert(0); |
1371
|
|
|
|
|
|
|
} |
1372
|
|
|
|
|
|
|
} |
1373
|
|
|
|
|
|
|
} |
1374
|
|
|
|
|
|
|
else { |
1375
|
0
|
|
|
|
|
|
assert(0); |
1376
|
|
|
|
|
|
|
} |
1377
|
|
|
|
|
|
|
} |
1378
|
|
|
|
|
|
|
|
1379
|
241999
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1380
|
|
|
|
|
|
|
|
1381
|
241999
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1382
|
|
|
|
|
|
|
|
1383
|
241999
|
100
|
|
|
|
|
if (!SPVM_TYPE_is_void_type(compiler, call_method_return_type->basic_type->id, call_method_return_type->dimension, call_method_return_type->flag)) { |
1384
|
119194
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode_return); |
1385
|
|
|
|
|
|
|
} |
1386
|
241999
|
|
|
|
|
|
break; |
1387
|
|
|
|
|
|
|
} |
1388
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LENGTH : { |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
// String length logic is same as ARRAY_LENGTH opcode |
1391
|
20082
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1392
|
|
|
|
|
|
|
|
1393
|
20082
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ARRAY_LENGTH); |
1394
|
|
|
|
|
|
|
|
1395
|
20082
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1396
|
20082
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1397
|
|
|
|
|
|
|
|
1398
|
20082
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1399
|
20082
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1400
|
|
|
|
|
|
|
|
1401
|
20082
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1402
|
|
|
|
|
|
|
|
1403
|
20082
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1404
|
20082
|
|
|
|
|
|
break; |
1405
|
|
|
|
|
|
|
} |
1406
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ARRAY_LENGTH : { |
1407
|
54891
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1408
|
|
|
|
|
|
|
|
1409
|
54891
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ARRAY_LENGTH); |
1410
|
|
|
|
|
|
|
|
1411
|
54891
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1412
|
54891
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
1413
|
|
|
|
|
|
|
|
1414
|
54891
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1415
|
54891
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1416
|
|
|
|
|
|
|
|
1417
|
54891
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1418
|
|
|
|
|
|
|
|
1419
|
54891
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1420
|
54891
|
|
|
|
|
|
break; |
1421
|
|
|
|
|
|
|
} |
1422
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ARRAY_FIELD_ACCESS : { |
1423
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
// $VAR = $VAR_OBJECT->[INDEX]{NAME} |
1425
|
1315
|
|
|
|
|
|
SPVM_OP* op_array_field_access = op_assign_src; |
1426
|
1315
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_array_field_access->first; |
1427
|
1315
|
|
|
|
|
|
SPVM_OP* op_term_index = op_array_field_access->last; |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
// Call field |
1430
|
1315
|
|
|
|
|
|
SPVM_ARRAY_FIELD_ACCESS* array_field_access = op_array_field_access->uv.array_field_access; |
1431
|
|
|
|
|
|
|
|
1432
|
1315
|
|
|
|
|
|
SPVM_FIELD* field = array_field_access->field; |
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
// Array type |
1435
|
1315
|
|
|
|
|
|
SPVM_TYPE* array_type = SPVM_CHECK_get_type(compiler, op_array_field_access->first); |
1436
|
1315
|
|
|
|
|
|
SPVM_BASIC_TYPE* array_basic_type = array_type->basic_type; |
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
// Element type |
1439
|
1315
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, op_array_field_access); |
1440
|
|
|
|
|
|
|
|
1441
|
1315
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1444
|
1315
|
|
|
|
|
|
switch (element_type->basic_type->id) { |
1445
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1446
|
207
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FIELD_BYTE); |
1447
|
207
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1448
|
207
|
|
|
|
|
|
break; |
1449
|
|
|
|
|
|
|
} |
1450
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1451
|
207
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FIELD_SHORT); |
1452
|
207
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1453
|
207
|
|
|
|
|
|
break; |
1454
|
|
|
|
|
|
|
} |
1455
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1456
|
239
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FIELD_INT); |
1457
|
239
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1458
|
239
|
|
|
|
|
|
break; |
1459
|
|
|
|
|
|
|
} |
1460
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1461
|
207
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FIELD_LONG); |
1462
|
207
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1463
|
207
|
|
|
|
|
|
break; |
1464
|
|
|
|
|
|
|
} |
1465
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1466
|
207
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FIELD_FLOAT); |
1467
|
207
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1468
|
207
|
|
|
|
|
|
break; |
1469
|
|
|
|
|
|
|
} |
1470
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1471
|
248
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FIELD_DOUBLE); |
1472
|
248
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1473
|
248
|
|
|
|
|
|
break; |
1474
|
|
|
|
|
|
|
} |
1475
|
|
|
|
|
|
|
default: { |
1476
|
0
|
|
|
|
|
|
assert(0); |
1477
|
|
|
|
|
|
|
} |
1478
|
|
|
|
|
|
|
} |
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
// Field absolute name symbol |
1481
|
1315
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1482
|
1315
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
1483
|
|
|
|
|
|
|
|
1484
|
1315
|
|
|
|
|
|
int32_t fields_length = array_basic_type->fields->length; |
1485
|
1315
|
|
|
|
|
|
int32_t field_offset = field->index; |
1486
|
|
|
|
|
|
|
|
1487
|
1315
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1488
|
1315
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_invocant; |
1489
|
1315
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_index; |
1490
|
1315
|
|
|
|
|
|
int32_t operand3 = (field_offset << 8) + (fields_length - 1); |
1491
|
1315
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
1492
|
1315
|
|
|
|
|
|
opcode.operand3 = operand3; |
1493
|
|
|
|
|
|
|
|
1494
|
1315
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1495
|
|
|
|
|
|
|
|
1496
|
1315
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1497
|
1315
|
|
|
|
|
|
break; |
1498
|
|
|
|
|
|
|
} |
1499
|
|
|
|
|
|
|
case SPVM_OP_C_ID_FIELD_ACCESS : { |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
// Weaken field |
1502
|
116780
|
100
|
|
|
|
|
if (op_assign_src->flag & SPVM_OP_C_FLAG_FIELD_ACCESS_WEAKEN) { |
1503
|
43
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1504
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
|
1506
|
43
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_WEAKEN_FIELD); |
1507
|
|
|
|
|
|
|
|
1508
|
43
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_assign_src->first; |
1509
|
43
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1510
|
|
|
|
|
|
|
|
1511
|
43
|
|
|
|
|
|
SPVM_FIELD* field = op_assign_src->uv.field_access->field; |
1512
|
|
|
|
|
|
|
|
1513
|
43
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_invocant; |
1514
|
43
|
|
|
|
|
|
opcode.operand2 = field->current_basic_type->id; |
1515
|
43
|
|
|
|
|
|
opcode.operand3 = (uint16_t)field->index; |
1516
|
43
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1517
|
|
|
|
|
|
|
|
1518
|
43
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign_src->line); |
1519
|
|
|
|
|
|
|
} |
1520
|
116737
|
100
|
|
|
|
|
else if (op_assign_src->flag & SPVM_OP_C_FLAG_FIELD_ACCESS_UNWEAKEN) { |
1521
|
2
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
|
1524
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_UNWEAKEN_FIELD); |
1525
|
|
|
|
|
|
|
|
1526
|
2
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_assign_src->first; |
1527
|
2
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1528
|
|
|
|
|
|
|
|
1529
|
2
|
|
|
|
|
|
SPVM_FIELD* field = op_assign_src->uv.field_access->field; |
1530
|
|
|
|
|
|
|
|
1531
|
2
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_invocant; |
1532
|
2
|
|
|
|
|
|
opcode.operand2 = field->current_basic_type->id; |
1533
|
2
|
|
|
|
|
|
opcode.operand3 = (uint16_t)field->index; |
1534
|
2
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1535
|
|
|
|
|
|
|
|
1536
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign_src->line); |
1537
|
|
|
|
|
|
|
} |
1538
|
116735
|
100
|
|
|
|
|
else if (op_assign_src->flag & SPVM_OP_C_FLAG_FIELD_ACCESS_ISWEAK) { |
1539
|
6
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1540
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
|
1542
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ISWEAK_FIELD); |
1543
|
|
|
|
|
|
|
|
1544
|
6
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_assign_src->first; |
1545
|
6
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1546
|
|
|
|
|
|
|
|
1547
|
6
|
|
|
|
|
|
SPVM_FIELD* field = op_assign_src->uv.field_access->field; |
1548
|
|
|
|
|
|
|
|
1549
|
6
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_invocant; |
1550
|
6
|
|
|
|
|
|
opcode.operand2 = field->current_basic_type->id; |
1551
|
6
|
|
|
|
|
|
opcode.operand3 = (uint16_t)field->index; |
1552
|
6
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1553
|
|
|
|
|
|
|
|
1554
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign_src->line); |
1555
|
|
|
|
|
|
|
} |
1556
|
|
|
|
|
|
|
else { |
1557
|
|
|
|
|
|
|
// $VAR = $VAR_OBJECT->{NAME} |
1558
|
116729
|
|
|
|
|
|
SPVM_OP* op_field_access = op_assign_src; |
1559
|
116729
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_field_access->first; |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
// Call field |
1562
|
116729
|
|
|
|
|
|
SPVM_FIELD_ACCESS* field_access = op_field_access->uv.field_access; |
1563
|
|
|
|
|
|
|
|
1564
|
116729
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, op_field_access); |
1565
|
|
|
|
|
|
|
|
1566
|
116729
|
|
|
|
|
|
SPVM_TYPE* invocant_type = SPVM_CHECK_get_type(compiler, op_term_invocant); |
1567
|
|
|
|
|
|
|
|
1568
|
|
|
|
|
|
|
// Value field dereference access |
1569
|
116729
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_ref_type(compiler, invocant_type->basic_type->id, invocant_type->dimension, invocant_type->flag)) { |
1570
|
134
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
1571
|
|
|
|
|
|
|
|
1572
|
134
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1575
|
134
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
1576
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1577
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DEREF_BYTE); |
1578
|
18
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1579
|
18
|
|
|
|
|
|
break; |
1580
|
|
|
|
|
|
|
} |
1581
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1582
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DEREF_SHORT); |
1583
|
18
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1584
|
18
|
|
|
|
|
|
break; |
1585
|
|
|
|
|
|
|
} |
1586
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1587
|
42
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DEREF_INT); |
1588
|
42
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1589
|
42
|
|
|
|
|
|
break; |
1590
|
|
|
|
|
|
|
} |
1591
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1592
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DEREF_LONG); |
1593
|
18
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1594
|
18
|
|
|
|
|
|
break; |
1595
|
|
|
|
|
|
|
} |
1596
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1597
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DEREF_FLOAT); |
1598
|
18
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1599
|
18
|
|
|
|
|
|
break; |
1600
|
|
|
|
|
|
|
} |
1601
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1602
|
20
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DEREF_DOUBLE); |
1603
|
20
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1604
|
20
|
|
|
|
|
|
break; |
1605
|
|
|
|
|
|
|
} |
1606
|
|
|
|
|
|
|
default: { |
1607
|
0
|
|
|
|
|
|
assert(0); |
1608
|
|
|
|
|
|
|
} |
1609
|
|
|
|
|
|
|
} |
1610
|
|
|
|
|
|
|
|
1611
|
134
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1612
|
134
|
|
|
|
|
|
int32_t field_offset = field->index; |
1613
|
|
|
|
|
|
|
|
1614
|
134
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1615
|
134
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_invocant; |
1616
|
134
|
|
|
|
|
|
opcode.operand2 = field_offset; |
1617
|
|
|
|
|
|
|
|
1618
|
134
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1619
|
|
|
|
|
|
|
} |
1620
|
|
|
|
|
|
|
// Mulnum field access |
1621
|
116595
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, invocant_type->basic_type->id, invocant_type->dimension, invocant_type->flag)) { |
1622
|
1067
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1623
|
|
|
|
|
|
|
|
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1626
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
1627
|
1067
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
1628
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1629
|
178
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_BYTE); |
1630
|
178
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1631
|
178
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1632
|
178
|
|
|
|
|
|
break; |
1633
|
|
|
|
|
|
|
} |
1634
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1635
|
170
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_SHORT); |
1636
|
170
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1637
|
170
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1638
|
170
|
|
|
|
|
|
break; |
1639
|
|
|
|
|
|
|
} |
1640
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1641
|
170
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_INT); |
1642
|
170
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1643
|
170
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1644
|
170
|
|
|
|
|
|
break; |
1645
|
|
|
|
|
|
|
} |
1646
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1647
|
170
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_LONG); |
1648
|
170
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1649
|
170
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1650
|
170
|
|
|
|
|
|
break; |
1651
|
|
|
|
|
|
|
} |
1652
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1653
|
170
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_FLOAT); |
1654
|
170
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1655
|
170
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1656
|
170
|
|
|
|
|
|
break; |
1657
|
|
|
|
|
|
|
} |
1658
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1659
|
209
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_FIELD_DOUBLE); |
1660
|
209
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1661
|
209
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1662
|
209
|
|
|
|
|
|
break; |
1663
|
|
|
|
|
|
|
} |
1664
|
|
|
|
|
|
|
default: { |
1665
|
0
|
|
|
|
|
|
assert(0); |
1666
|
|
|
|
|
|
|
} |
1667
|
|
|
|
|
|
|
} |
1668
|
|
|
|
|
|
|
|
1669
|
1067
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
1670
|
|
|
|
|
|
|
|
1671
|
1067
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1672
|
1067
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1673
|
1067
|
|
|
|
|
|
opcode.operand2 = field->index; |
1674
|
|
|
|
|
|
|
|
1675
|
1067
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1676
|
|
|
|
|
|
|
} |
1677
|
|
|
|
|
|
|
// Field access |
1678
|
|
|
|
|
|
|
else { |
1679
|
115528
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1680
|
|
|
|
|
|
|
|
1681
|
115528
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
1682
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1683
|
115528
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)) { |
1684
|
61444
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_OBJECT); |
1685
|
61444
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1686
|
|
|
|
|
|
|
} |
1687
|
|
|
|
|
|
|
else { |
1688
|
54084
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
1689
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1690
|
1121
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_BYTE); |
1691
|
1121
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1692
|
1121
|
|
|
|
|
|
break; |
1693
|
|
|
|
|
|
|
} |
1694
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1695
|
1119
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_SHORT); |
1696
|
1119
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1697
|
1119
|
|
|
|
|
|
break; |
1698
|
|
|
|
|
|
|
} |
1699
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1700
|
48487
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_INT); |
1701
|
48487
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1702
|
48487
|
|
|
|
|
|
break; |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1705
|
1119
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_LONG); |
1706
|
1119
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1707
|
1119
|
|
|
|
|
|
break; |
1708
|
|
|
|
|
|
|
} |
1709
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1710
|
1119
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_FLOAT); |
1711
|
1119
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1712
|
1119
|
|
|
|
|
|
break; |
1713
|
|
|
|
|
|
|
} |
1714
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1715
|
1119
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_FIELD_DOUBLE); |
1716
|
1119
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1717
|
1119
|
|
|
|
|
|
break; |
1718
|
|
|
|
|
|
|
} |
1719
|
|
|
|
|
|
|
default: { |
1720
|
0
|
|
|
|
|
|
assert(0); |
1721
|
|
|
|
|
|
|
} |
1722
|
|
|
|
|
|
|
} |
1723
|
|
|
|
|
|
|
} |
1724
|
|
|
|
|
|
|
|
1725
|
115528
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
1726
|
|
|
|
|
|
|
|
1727
|
115528
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1728
|
115528
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_invocant; |
1729
|
115528
|
|
|
|
|
|
opcode.operand2 = field->current_basic_type->id; |
1730
|
115528
|
|
|
|
|
|
opcode.operand3 = (uint16_t)field->index; |
1731
|
|
|
|
|
|
|
|
1732
|
115528
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1733
|
|
|
|
|
|
|
|
1734
|
115528
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1735
|
|
|
|
|
|
|
} |
1736
|
|
|
|
|
|
|
} |
1737
|
116780
|
|
|
|
|
|
break; |
1738
|
|
|
|
|
|
|
} |
1739
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ARRAY_ACCESS : { |
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
// $VAR = $VAR_ARRAY->[$VAR_INDEX] |
1742
|
103604
|
|
|
|
|
|
SPVM_OP* op_array_access = op_assign_src; |
1743
|
103604
|
|
|
|
|
|
SPVM_OP* op_term_array = op_array_access->first; |
1744
|
103604
|
|
|
|
|
|
SPVM_OP* op_term_index = op_array_access->last; |
1745
|
|
|
|
|
|
|
|
1746
|
103604
|
|
|
|
|
|
SPVM_TYPE* array_type = SPVM_CHECK_get_type(compiler, op_term_array); |
1747
|
|
|
|
|
|
|
|
1748
|
103604
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_array_type(compiler, array_type->basic_type->id, array_type->dimension, array_type->flag)) { |
1749
|
13
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(array_type->basic_type->fields, 0); |
1750
|
|
|
|
|
|
|
|
1751
|
13
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
1752
|
|
|
|
|
|
|
|
1753
|
13
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1754
|
|
|
|
|
|
|
|
1755
|
13
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, element_type->basic_type->id, element_type->dimension, element_type->flag)); |
1756
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1757
|
13
|
|
|
|
|
|
switch (element_type->basic_type->id) { |
1758
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1759
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_BYTE); |
1760
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1761
|
2
|
|
|
|
|
|
break; |
1762
|
|
|
|
|
|
|
} |
1763
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1764
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_SHORT); |
1765
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1766
|
2
|
|
|
|
|
|
break; |
1767
|
|
|
|
|
|
|
} |
1768
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1769
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_INT); |
1770
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1771
|
2
|
|
|
|
|
|
break; |
1772
|
|
|
|
|
|
|
} |
1773
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1774
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_LONG); |
1775
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1776
|
2
|
|
|
|
|
|
break; |
1777
|
|
|
|
|
|
|
} |
1778
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1779
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_FLOAT); |
1780
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1781
|
2
|
|
|
|
|
|
break; |
1782
|
|
|
|
|
|
|
} |
1783
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1784
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_MULNUM_ARRAY_DOUBLE); |
1785
|
3
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1786
|
3
|
|
|
|
|
|
break; |
1787
|
|
|
|
|
|
|
} |
1788
|
|
|
|
|
|
|
default: { |
1789
|
0
|
|
|
|
|
|
assert(0); |
1790
|
|
|
|
|
|
|
} |
1791
|
|
|
|
|
|
|
} |
1792
|
13
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
1793
|
13
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
1794
|
13
|
|
|
|
|
|
int32_t fields_length = array_type->basic_type->fields->length; |
1795
|
|
|
|
|
|
|
|
1796
|
13
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1797
|
13
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_array; |
1798
|
13
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_index; |
1799
|
13
|
|
|
|
|
|
int32_t operand3 = fields_length; |
1800
|
13
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
1801
|
13
|
|
|
|
|
|
opcode.operand3 = operand3; |
1802
|
|
|
|
|
|
|
|
1803
|
13
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1804
|
|
|
|
|
|
|
|
1805
|
13
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1806
|
|
|
|
|
|
|
} |
1807
|
|
|
|
|
|
|
else { |
1808
|
103591
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, op_array_access); |
1809
|
|
|
|
|
|
|
|
1810
|
103591
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1813
|
103591
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, element_type->basic_type->id, element_type->dimension, element_type->flag)) { |
1814
|
43637
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_OBJECT); |
1815
|
43637
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1816
|
|
|
|
|
|
|
} |
1817
|
|
|
|
|
|
|
else { |
1818
|
59954
|
|
|
|
|
|
switch (element_type->basic_type->id) { |
1819
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1820
|
25398
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_BYTE); |
1821
|
25398
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1822
|
25398
|
|
|
|
|
|
break; |
1823
|
|
|
|
|
|
|
} |
1824
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1825
|
6362
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_SHORT); |
1826
|
6362
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1827
|
6362
|
|
|
|
|
|
break; |
1828
|
|
|
|
|
|
|
} |
1829
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1830
|
10131
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_INT); |
1831
|
10131
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1832
|
10131
|
|
|
|
|
|
break; |
1833
|
|
|
|
|
|
|
} |
1834
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1835
|
6366
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_LONG); |
1836
|
6366
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1837
|
6366
|
|
|
|
|
|
break; |
1838
|
|
|
|
|
|
|
} |
1839
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1840
|
5848
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_FLOAT); |
1841
|
5848
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1842
|
5848
|
|
|
|
|
|
break; |
1843
|
|
|
|
|
|
|
} |
1844
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1845
|
5849
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_ARRAY_ELEMENT_DOUBLE); |
1846
|
5849
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1847
|
5849
|
|
|
|
|
|
break; |
1848
|
|
|
|
|
|
|
} |
1849
|
|
|
|
|
|
|
default: { |
1850
|
0
|
|
|
|
|
|
assert(0); |
1851
|
|
|
|
|
|
|
} |
1852
|
|
|
|
|
|
|
} |
1853
|
|
|
|
|
|
|
} |
1854
|
|
|
|
|
|
|
|
1855
|
103591
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
1856
|
103591
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
1857
|
|
|
|
|
|
|
|
1858
|
103591
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1859
|
103591
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_array; |
1860
|
103591
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_index; |
1861
|
|
|
|
|
|
|
|
1862
|
103591
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1863
|
|
|
|
|
|
|
|
1864
|
103591
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
1865
|
|
|
|
|
|
|
} |
1866
|
103604
|
|
|
|
|
|
break; |
1867
|
|
|
|
|
|
|
} |
1868
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CLASS_VAR_ACCESS : { |
1869
|
7391
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_assign_src); |
1870
|
|
|
|
|
|
|
|
1871
|
7391
|
|
|
|
|
|
SPVM_CLASS_VAR_ACCESS* class_var_access = op_assign_src->uv.class_var_access; |
1872
|
|
|
|
|
|
|
|
1873
|
7391
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1877
|
7391
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
1878
|
5760
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_OBJECT); |
1879
|
5760
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1880
|
|
|
|
|
|
|
} |
1881
|
|
|
|
|
|
|
else { |
1882
|
1631
|
|
|
|
|
|
switch (type->basic_type->id) { |
1883
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1884
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_BYTE); |
1885
|
48
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1886
|
48
|
|
|
|
|
|
break; |
1887
|
|
|
|
|
|
|
} |
1888
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1889
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_SHORT); |
1890
|
48
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1891
|
48
|
|
|
|
|
|
break; |
1892
|
|
|
|
|
|
|
} |
1893
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1894
|
422
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_INT); |
1895
|
422
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1896
|
422
|
|
|
|
|
|
break; |
1897
|
|
|
|
|
|
|
} |
1898
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
1899
|
1017
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_LONG); |
1900
|
1017
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1901
|
1017
|
|
|
|
|
|
break; |
1902
|
|
|
|
|
|
|
} |
1903
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
1904
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_FLOAT); |
1905
|
48
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1906
|
48
|
|
|
|
|
|
break; |
1907
|
|
|
|
|
|
|
} |
1908
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
1909
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_CLASS_VAR_DOUBLE); |
1910
|
48
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1911
|
48
|
|
|
|
|
|
break; |
1912
|
|
|
|
|
|
|
} |
1913
|
|
|
|
|
|
|
default: { |
1914
|
0
|
|
|
|
|
|
assert(0); |
1915
|
|
|
|
|
|
|
} |
1916
|
|
|
|
|
|
|
} |
1917
|
|
|
|
|
|
|
} |
1918
|
|
|
|
|
|
|
|
1919
|
7391
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1920
|
7391
|
|
|
|
|
|
opcode.operand1 = class_var_access->class_var->current_basic_type->id; |
1921
|
7391
|
|
|
|
|
|
opcode.operand2 = class_var_access->class_var->index; |
1922
|
|
|
|
|
|
|
|
1923
|
7391
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1924
|
7391
|
|
|
|
|
|
break; |
1925
|
|
|
|
|
|
|
} |
1926
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DEREF : { |
1927
|
1887
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
1928
|
|
|
|
|
|
|
|
1929
|
1887
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
1930
|
16
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(src_type->basic_type->fields, 0); |
1931
|
|
|
|
|
|
|
|
1932
|
16
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
1933
|
|
|
|
|
|
|
|
1934
|
16
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
|
1937
|
16
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, element_type->basic_type->id, element_type->dimension, element_type->flag)); |
1938
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1939
|
16
|
100
|
|
|
|
|
if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
1940
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DEREF_MULNUM_BYTE); |
1941
|
4
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1942
|
|
|
|
|
|
|
} |
1943
|
12
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
1944
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DEREF_MULNUM_SHORT); |
1945
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1946
|
|
|
|
|
|
|
} |
1947
|
10
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
1948
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DEREF_MULNUM_INT); |
1949
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1950
|
|
|
|
|
|
|
} |
1951
|
8
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
1952
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DEREF_MULNUM_LONG); |
1953
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1954
|
|
|
|
|
|
|
} |
1955
|
6
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
1956
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DEREF_MULNUM_FLOAT); |
1957
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1958
|
|
|
|
|
|
|
} |
1959
|
4
|
50
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
1960
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DEREF_MULNUM_DOUBLE); |
1961
|
4
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1962
|
|
|
|
|
|
|
} |
1963
|
|
|
|
|
|
|
else { |
1964
|
0
|
|
|
|
|
|
assert(0); |
1965
|
|
|
|
|
|
|
} |
1966
|
|
|
|
|
|
|
|
1967
|
16
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
1968
|
16
|
|
|
|
|
|
int32_t fields_length = src_type->basic_type->fields->length; |
1969
|
|
|
|
|
|
|
|
1970
|
16
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
1971
|
16
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
1972
|
16
|
|
|
|
|
|
int32_t operand3 = fields_length; |
1973
|
16
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
1974
|
16
|
|
|
|
|
|
opcode.operand3 = operand3; |
1975
|
|
|
|
|
|
|
|
1976
|
16
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
1977
|
|
|
|
|
|
|
} |
1978
|
1871
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
1979
|
|
|
|
|
|
|
|
1980
|
1871
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
1981
|
|
|
|
|
|
|
|
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
1984
|
1871
|
|
|
|
|
|
switch (src_type->basic_type->id) { |
1985
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
1986
|
52
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_DEREF_BYTE); |
1987
|
52
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1988
|
52
|
|
|
|
|
|
break; |
1989
|
|
|
|
|
|
|
} |
1990
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
1991
|
50
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_DEREF_SHORT); |
1992
|
50
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1993
|
50
|
|
|
|
|
|
break; |
1994
|
|
|
|
|
|
|
} |
1995
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
1996
|
1617
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_DEREF_INT); |
1997
|
1617
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
1998
|
1617
|
|
|
|
|
|
break; |
1999
|
|
|
|
|
|
|
} |
2000
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
2001
|
50
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_DEREF_LONG); |
2002
|
50
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2003
|
50
|
|
|
|
|
|
break; |
2004
|
|
|
|
|
|
|
} |
2005
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
2006
|
50
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_DEREF_FLOAT); |
2007
|
50
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2008
|
50
|
|
|
|
|
|
break; |
2009
|
|
|
|
|
|
|
} |
2010
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
2011
|
52
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_DEREF_DOUBLE); |
2012
|
52
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2013
|
52
|
|
|
|
|
|
break; |
2014
|
|
|
|
|
|
|
} |
2015
|
|
|
|
|
|
|
default: { |
2016
|
0
|
|
|
|
|
|
assert(0); |
2017
|
|
|
|
|
|
|
} |
2018
|
|
|
|
|
|
|
} |
2019
|
|
|
|
|
|
|
|
2020
|
1871
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2021
|
|
|
|
|
|
|
|
2022
|
1871
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2023
|
1871
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
2024
|
|
|
|
|
|
|
|
2025
|
1871
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2026
|
|
|
|
|
|
|
} |
2027
|
|
|
|
|
|
|
else { |
2028
|
0
|
|
|
|
|
|
assert(0); |
2029
|
|
|
|
|
|
|
} |
2030
|
1887
|
|
|
|
|
|
break; |
2031
|
|
|
|
|
|
|
} |
2032
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CREATE_REF : { |
2033
|
|
|
|
|
|
|
|
2034
|
4970
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2035
|
|
|
|
|
|
|
|
2036
|
|
|
|
|
|
|
|
2037
|
4970
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2038
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
2039
|
4970
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
2040
|
4970
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2041
|
|
|
|
|
|
|
|
2042
|
54
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(src_type->basic_type->fields, 0); |
2043
|
54
|
50
|
|
|
|
|
assert(first_field); |
2044
|
|
|
|
|
|
|
|
2045
|
54
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
2046
|
54
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
2047
|
|
|
|
|
|
|
|
2048
|
54
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
2049
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: |
2050
|
10
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_BYTE); |
2051
|
10
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2052
|
54
|
|
|
|
|
|
break; |
2053
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: |
2054
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_SHORT); |
2055
|
8
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2056
|
8
|
|
|
|
|
|
break; |
2057
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2058
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_INT); |
2059
|
8
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2060
|
8
|
|
|
|
|
|
break; |
2061
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2062
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_LONG); |
2063
|
8
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2064
|
8
|
|
|
|
|
|
break; |
2065
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2066
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_FLOAT); |
2067
|
8
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2068
|
8
|
|
|
|
|
|
break; |
2069
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2070
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_DOUBLE); |
2071
|
12
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2072
|
12
|
|
|
|
|
|
break; |
2073
|
|
|
|
|
|
|
default: |
2074
|
0
|
|
|
|
|
|
assert(0); |
2075
|
|
|
|
|
|
|
} |
2076
|
|
|
|
|
|
|
} |
2077
|
4916
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2078
|
4916
|
|
|
|
|
|
switch (src_type->basic_type->id) { |
2079
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: |
2080
|
38
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_BYTE); |
2081
|
38
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2082
|
4916
|
|
|
|
|
|
break; |
2083
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: |
2084
|
36
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_SHORT); |
2085
|
36
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2086
|
36
|
|
|
|
|
|
break; |
2087
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2088
|
4731
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_INT); |
2089
|
4731
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2090
|
4731
|
|
|
|
|
|
break; |
2091
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2092
|
36
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_LONG); |
2093
|
36
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2094
|
36
|
|
|
|
|
|
break; |
2095
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2096
|
36
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_FLOAT); |
2097
|
36
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2098
|
36
|
|
|
|
|
|
break; |
2099
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2100
|
39
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REF_DOUBLE); |
2101
|
39
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
2102
|
39
|
|
|
|
|
|
break; |
2103
|
|
|
|
|
|
|
default: |
2104
|
0
|
|
|
|
|
|
assert(0); |
2105
|
|
|
|
|
|
|
} |
2106
|
|
|
|
|
|
|
} |
2107
|
|
|
|
|
|
|
else { |
2108
|
0
|
|
|
|
|
|
assert(0); |
2109
|
|
|
|
|
|
|
} |
2110
|
|
|
|
|
|
|
|
2111
|
4970
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2112
|
4970
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
2113
|
|
|
|
|
|
|
|
2114
|
4970
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2115
|
4970
|
|
|
|
|
|
break; |
2116
|
|
|
|
|
|
|
} |
2117
|
|
|
|
|
|
|
case SPVM_OP_C_ID_EXCEPTION_VAR : { |
2118
|
|
|
|
|
|
|
// VAR = EXCEPTION_VAR |
2119
|
2132
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
|
2122
|
2132
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_EXCEPTION_VAR); |
2123
|
|
|
|
|
|
|
|
2124
|
2132
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2125
|
|
|
|
|
|
|
|
2126
|
2132
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2127
|
|
|
|
|
|
|
|
2128
|
2132
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2129
|
2132
|
|
|
|
|
|
break; |
2130
|
|
|
|
|
|
|
} |
2131
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ADD : { |
2132
|
|
|
|
|
|
|
|
2133
|
184120
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2134
|
|
|
|
|
|
|
|
2135
|
|
|
|
|
|
|
|
2136
|
184120
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2137
|
|
|
|
|
|
|
|
2138
|
184120
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2139
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2140
|
182579
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ADD_INT); |
2141
|
182579
|
|
|
|
|
|
break; |
2142
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2143
|
342
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ADD_LONG); |
2144
|
342
|
|
|
|
|
|
break; |
2145
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2146
|
324
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ADD_FLOAT); |
2147
|
324
|
|
|
|
|
|
break; |
2148
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2149
|
875
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ADD_DOUBLE); |
2150
|
875
|
|
|
|
|
|
break; |
2151
|
|
|
|
|
|
|
default: |
2152
|
0
|
|
|
|
|
|
assert(0); |
2153
|
|
|
|
|
|
|
} |
2154
|
|
|
|
|
|
|
|
2155
|
184120
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2156
|
184120
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2157
|
184120
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2158
|
|
|
|
|
|
|
|
2159
|
184120
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2160
|
184120
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2161
|
184120
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2162
|
|
|
|
|
|
|
|
2163
|
184120
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2164
|
184120
|
|
|
|
|
|
break; |
2165
|
|
|
|
|
|
|
} |
2166
|
|
|
|
|
|
|
case SPVM_OP_C_ID_SUBTRACT : { |
2167
|
|
|
|
|
|
|
|
2168
|
69336
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2169
|
|
|
|
|
|
|
|
2170
|
|
|
|
|
|
|
|
2171
|
69336
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2172
|
69336
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2173
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2174
|
69076
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SUBTRACT_INT); |
2175
|
69076
|
|
|
|
|
|
break; |
2176
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2177
|
92
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SUBTRACT_LONG); |
2178
|
92
|
|
|
|
|
|
break; |
2179
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2180
|
83
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SUBTRACT_FLOAT); |
2181
|
83
|
|
|
|
|
|
break; |
2182
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2183
|
85
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SUBTRACT_DOUBLE); |
2184
|
85
|
|
|
|
|
|
break; |
2185
|
|
|
|
|
|
|
default: |
2186
|
0
|
|
|
|
|
|
assert(0); |
2187
|
|
|
|
|
|
|
} |
2188
|
|
|
|
|
|
|
|
2189
|
69336
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2190
|
69336
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2191
|
69336
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2192
|
|
|
|
|
|
|
|
2193
|
69336
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2194
|
69336
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2195
|
69336
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2196
|
|
|
|
|
|
|
|
2197
|
69336
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2198
|
69336
|
|
|
|
|
|
break; |
2199
|
|
|
|
|
|
|
} |
2200
|
|
|
|
|
|
|
case SPVM_OP_C_ID_MULTIPLY : { |
2201
|
|
|
|
|
|
|
|
2202
|
7473
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2203
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
|
2205
|
7473
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2206
|
7473
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2207
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2208
|
6337
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MULTIPLY_INT); |
2209
|
6337
|
|
|
|
|
|
break; |
2210
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2211
|
532
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MULTIPLY_LONG); |
2212
|
532
|
|
|
|
|
|
break; |
2213
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2214
|
39
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MULTIPLY_FLOAT); |
2215
|
39
|
|
|
|
|
|
break; |
2216
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2217
|
565
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MULTIPLY_DOUBLE); |
2218
|
565
|
|
|
|
|
|
break; |
2219
|
|
|
|
|
|
|
default: |
2220
|
0
|
|
|
|
|
|
assert(0); |
2221
|
|
|
|
|
|
|
} |
2222
|
|
|
|
|
|
|
|
2223
|
7473
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2224
|
7473
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2225
|
7473
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2226
|
|
|
|
|
|
|
|
2227
|
7473
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2228
|
7473
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2229
|
7473
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2230
|
|
|
|
|
|
|
|
2231
|
7473
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2232
|
7473
|
|
|
|
|
|
break; |
2233
|
|
|
|
|
|
|
} |
2234
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DIVIDE : { |
2235
|
|
|
|
|
|
|
|
2236
|
5318
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
|
2239
|
5318
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2240
|
5318
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2241
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2242
|
4194
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DIVIDE_INT); |
2243
|
4194
|
|
|
|
|
|
break; |
2244
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2245
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DIVIDE_LONG); |
2246
|
8
|
|
|
|
|
|
break; |
2247
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2248
|
39
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DIVIDE_FLOAT); |
2249
|
39
|
|
|
|
|
|
break; |
2250
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2251
|
1077
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DIVIDE_DOUBLE); |
2252
|
1077
|
|
|
|
|
|
break; |
2253
|
|
|
|
|
|
|
default: |
2254
|
0
|
|
|
|
|
|
assert(0); |
2255
|
|
|
|
|
|
|
} |
2256
|
|
|
|
|
|
|
|
2257
|
5318
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2258
|
5318
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2259
|
5318
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2260
|
|
|
|
|
|
|
|
2261
|
5318
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2262
|
5318
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2263
|
5318
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2264
|
|
|
|
|
|
|
|
2265
|
5318
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2266
|
|
|
|
|
|
|
|
2267
|
|
|
|
|
|
|
// Check die |
2268
|
5318
|
100
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2269
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2270
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2271
|
4202
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2272
|
4202
|
|
|
|
|
|
break; |
2273
|
|
|
|
|
|
|
} |
2274
|
|
|
|
|
|
|
|
2275
|
5318
|
|
|
|
|
|
break; |
2276
|
|
|
|
|
|
|
} |
2277
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DIVIDE_UNSIGNED_INT : { |
2278
|
|
|
|
|
|
|
|
2279
|
3
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2280
|
|
|
|
|
|
|
|
2281
|
|
|
|
|
|
|
|
2282
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DIVIDE_UNSIGNED_INT); |
2283
|
|
|
|
|
|
|
|
2284
|
3
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2285
|
3
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2286
|
3
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2287
|
|
|
|
|
|
|
|
2288
|
3
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2289
|
3
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2290
|
3
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2291
|
|
|
|
|
|
|
|
2292
|
3
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
// Check die |
2295
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2296
|
3
|
|
|
|
|
|
break; |
2297
|
|
|
|
|
|
|
} |
2298
|
|
|
|
|
|
|
case SPVM_OP_C_ID_DIVIDE_UNSIGNED_LONG : { |
2299
|
|
|
|
|
|
|
|
2300
|
3
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
|
2303
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_DIVIDE_UNSIGNED_LONG); |
2304
|
|
|
|
|
|
|
|
2305
|
3
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2306
|
3
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2307
|
3
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2308
|
|
|
|
|
|
|
|
2309
|
3
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2310
|
3
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2311
|
3
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2312
|
|
|
|
|
|
|
|
2313
|
3
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2314
|
|
|
|
|
|
|
|
2315
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2316
|
|
|
|
|
|
|
|
2317
|
3
|
|
|
|
|
|
break; |
2318
|
|
|
|
|
|
|
} |
2319
|
|
|
|
|
|
|
case SPVM_OP_C_ID_REMAINDER : { |
2320
|
2140
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
|
2323
|
2140
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2324
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2325
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2326
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
2327
|
2140
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2328
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2329
|
2124
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REMAINDER_INT); |
2330
|
2124
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2331
|
2124
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2332
|
2124
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2333
|
2124
|
|
|
|
|
|
break; |
2334
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2335
|
16
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REMAINDER_LONG); |
2336
|
16
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2337
|
16
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2338
|
16
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2339
|
16
|
|
|
|
|
|
break; |
2340
|
|
|
|
|
|
|
default: |
2341
|
0
|
|
|
|
|
|
assert(0); |
2342
|
|
|
|
|
|
|
} |
2343
|
|
|
|
|
|
|
|
2344
|
2140
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2345
|
2140
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2346
|
2140
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2347
|
|
|
|
|
|
|
|
2348
|
2140
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
// Check die |
2351
|
2140
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2352
|
2140
|
50
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2353
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2354
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2355
|
2140
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2356
|
2140
|
|
|
|
|
|
break; |
2357
|
|
|
|
|
|
|
} |
2358
|
2140
|
|
|
|
|
|
break; |
2359
|
|
|
|
|
|
|
} |
2360
|
|
|
|
|
|
|
case SPVM_OP_C_ID_REMAINDER_UNSIGNED_INT : { |
2361
|
|
|
|
|
|
|
|
2362
|
3
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2363
|
|
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
|
2365
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REMAINDER_UNSIGNED_INT); |
2366
|
|
|
|
|
|
|
|
2367
|
3
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2368
|
3
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2369
|
3
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2370
|
|
|
|
|
|
|
|
2371
|
3
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2372
|
3
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2373
|
3
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2374
|
|
|
|
|
|
|
|
2375
|
3
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2376
|
|
|
|
|
|
|
|
2377
|
|
|
|
|
|
|
// Check die |
2378
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2379
|
3
|
|
|
|
|
|
break; |
2380
|
|
|
|
|
|
|
} |
2381
|
|
|
|
|
|
|
case SPVM_OP_C_ID_REMAINDER_UNSIGNED_LONG : { |
2382
|
|
|
|
|
|
|
|
2383
|
517
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2384
|
|
|
|
|
|
|
|
2385
|
|
|
|
|
|
|
|
2386
|
517
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_REMAINDER_UNSIGNED_LONG); |
2387
|
|
|
|
|
|
|
|
2388
|
517
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2389
|
517
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2390
|
517
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2391
|
|
|
|
|
|
|
|
2392
|
517
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2393
|
517
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2394
|
517
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2395
|
|
|
|
|
|
|
|
2396
|
517
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2397
|
|
|
|
|
|
|
|
2398
|
517
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2399
|
|
|
|
|
|
|
|
2400
|
517
|
|
|
|
|
|
break; |
2401
|
|
|
|
|
|
|
} |
2402
|
|
|
|
|
|
|
case SPVM_OP_C_ID_LEFT_SHIFT : { |
2403
|
51
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2404
|
|
|
|
|
|
|
|
2405
|
|
|
|
|
|
|
|
2406
|
51
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2407
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2408
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2409
|
51
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2410
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2411
|
39
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LEFT_SHIFT_INT); |
2412
|
39
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2413
|
39
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2414
|
39
|
|
|
|
|
|
break; |
2415
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2416
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LEFT_SHIFT_LONG); |
2417
|
12
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2418
|
12
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2419
|
12
|
|
|
|
|
|
break; |
2420
|
|
|
|
|
|
|
default: |
2421
|
0
|
|
|
|
|
|
assert(0); |
2422
|
|
|
|
|
|
|
} |
2423
|
|
|
|
|
|
|
|
2424
|
51
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2425
|
|
|
|
|
|
|
|
2426
|
51
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2427
|
51
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2428
|
51
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2429
|
|
|
|
|
|
|
|
2430
|
51
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2431
|
51
|
|
|
|
|
|
break; |
2432
|
|
|
|
|
|
|
} |
2433
|
|
|
|
|
|
|
case SPVM_OP_C_ID_RIGHT_ARITHMETIC_SHIFT : { |
2434
|
35
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2435
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
|
2437
|
35
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2438
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2439
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2440
|
35
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2441
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2442
|
25
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RIGHT_ARITHMETIC_SHIFT_INT); |
2443
|
25
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2444
|
25
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2445
|
25
|
|
|
|
|
|
break; |
2446
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2447
|
10
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RIGHT_ARITHMETIC_SHIFT_LONG); |
2448
|
10
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2449
|
10
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2450
|
10
|
|
|
|
|
|
break; |
2451
|
|
|
|
|
|
|
default: |
2452
|
0
|
|
|
|
|
|
assert(0); |
2453
|
|
|
|
|
|
|
} |
2454
|
|
|
|
|
|
|
|
2455
|
35
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2456
|
|
|
|
|
|
|
|
2457
|
35
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2458
|
35
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2459
|
35
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2460
|
|
|
|
|
|
|
|
2461
|
35
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2462
|
35
|
|
|
|
|
|
break; |
2463
|
|
|
|
|
|
|
} |
2464
|
|
|
|
|
|
|
case SPVM_OP_C_ID_RIGHT_LOGICAL_SHIFT : { |
2465
|
35
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2466
|
|
|
|
|
|
|
|
2467
|
|
|
|
|
|
|
|
2468
|
35
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2469
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2470
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2471
|
35
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2472
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2473
|
25
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RIGHT_LOGICAL_SHIFT_INT); |
2474
|
25
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2475
|
25
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2476
|
25
|
|
|
|
|
|
break; |
2477
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2478
|
10
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_RIGHT_LOGICAL_SHIFT_LONG); |
2479
|
10
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2480
|
10
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2481
|
10
|
|
|
|
|
|
break; |
2482
|
|
|
|
|
|
|
default: |
2483
|
0
|
|
|
|
|
|
assert(0); |
2484
|
|
|
|
|
|
|
} |
2485
|
|
|
|
|
|
|
|
2486
|
35
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2487
|
|
|
|
|
|
|
|
2488
|
35
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2489
|
35
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2490
|
35
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2491
|
|
|
|
|
|
|
|
2492
|
35
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2493
|
35
|
|
|
|
|
|
break; |
2494
|
|
|
|
|
|
|
} |
2495
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BIT_AND : { |
2496
|
1094
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2497
|
|
|
|
|
|
|
|
2498
|
|
|
|
|
|
|
|
2499
|
1094
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2500
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2501
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2502
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
2503
|
1094
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2504
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2505
|
1089
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_AND_INT); |
2506
|
1089
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2507
|
1089
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2508
|
1089
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2509
|
1089
|
|
|
|
|
|
break; |
2510
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2511
|
5
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_AND_LONG); |
2512
|
5
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2513
|
5
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2514
|
5
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2515
|
5
|
|
|
|
|
|
break; |
2516
|
|
|
|
|
|
|
default: |
2517
|
0
|
|
|
|
|
|
assert(0); |
2518
|
|
|
|
|
|
|
} |
2519
|
|
|
|
|
|
|
|
2520
|
|
|
|
|
|
|
|
2521
|
1094
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2522
|
1094
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2523
|
1094
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2524
|
|
|
|
|
|
|
|
2525
|
1094
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2526
|
1094
|
|
|
|
|
|
break; |
2527
|
|
|
|
|
|
|
} |
2528
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BIT_OR : { |
2529
|
|
|
|
|
|
|
|
2530
|
44
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
|
2533
|
44
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2534
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2535
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2536
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
2537
|
44
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2538
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2539
|
39
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_OR_INT); |
2540
|
39
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2541
|
39
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2542
|
39
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2543
|
39
|
|
|
|
|
|
break; |
2544
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2545
|
5
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_OR_LONG); |
2546
|
5
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2547
|
5
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2548
|
5
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2549
|
5
|
|
|
|
|
|
break; |
2550
|
|
|
|
|
|
|
default: |
2551
|
0
|
|
|
|
|
|
assert(0); |
2552
|
|
|
|
|
|
|
} |
2553
|
|
|
|
|
|
|
|
2554
|
44
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2555
|
44
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2556
|
44
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2557
|
|
|
|
|
|
|
|
2558
|
44
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2559
|
44
|
|
|
|
|
|
break; |
2560
|
|
|
|
|
|
|
} |
2561
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BIT_XOR : { |
2562
|
|
|
|
|
|
|
|
2563
|
44
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2564
|
|
|
|
|
|
|
|
2565
|
|
|
|
|
|
|
|
2566
|
44
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2567
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2568
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
2569
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
2570
|
44
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2571
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2572
|
39
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_XOR_INT); |
2573
|
39
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2574
|
39
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2575
|
39
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2576
|
39
|
|
|
|
|
|
break; |
2577
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2578
|
5
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_XOR_LONG); |
2579
|
5
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2580
|
5
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2581
|
5
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
2582
|
5
|
|
|
|
|
|
break; |
2583
|
|
|
|
|
|
|
default: |
2584
|
0
|
|
|
|
|
|
assert(0); |
2585
|
|
|
|
|
|
|
} |
2586
|
|
|
|
|
|
|
|
2587
|
44
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2588
|
44
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
2589
|
44
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
2590
|
|
|
|
|
|
|
|
2591
|
44
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2592
|
44
|
|
|
|
|
|
break; |
2593
|
|
|
|
|
|
|
} |
2594
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BIT_NOT : { |
2595
|
|
|
|
|
|
|
|
2596
|
37
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2597
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
|
2599
|
37
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2600
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2601
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
2602
|
37
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2603
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2604
|
29
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_NOT_INT); |
2605
|
29
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2606
|
29
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2607
|
29
|
|
|
|
|
|
break; |
2608
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2609
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BIT_NOT_LONG); |
2610
|
8
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2611
|
8
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2612
|
8
|
|
|
|
|
|
break; |
2613
|
|
|
|
|
|
|
default: |
2614
|
0
|
|
|
|
|
|
assert(0); |
2615
|
|
|
|
|
|
|
} |
2616
|
|
|
|
|
|
|
|
2617
|
37
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2618
|
37
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
2619
|
|
|
|
|
|
|
|
2620
|
37
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2621
|
37
|
|
|
|
|
|
break; |
2622
|
|
|
|
|
|
|
} |
2623
|
|
|
|
|
|
|
case SPVM_OP_C_ID_PLUS : { |
2624
|
|
|
|
|
|
|
|
2625
|
38
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2626
|
|
|
|
|
|
|
|
2627
|
|
|
|
|
|
|
|
2628
|
38
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2629
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2630
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
2631
|
38
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2632
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2633
|
21
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_INT); |
2634
|
21
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2635
|
21
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2636
|
21
|
|
|
|
|
|
break; |
2637
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2638
|
5
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_LONG); |
2639
|
5
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2640
|
5
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2641
|
5
|
|
|
|
|
|
break; |
2642
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2643
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_FLOAT); |
2644
|
4
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2645
|
4
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2646
|
4
|
|
|
|
|
|
break; |
2647
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2648
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_DOUBLE); |
2649
|
8
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2650
|
8
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2651
|
8
|
|
|
|
|
|
break; |
2652
|
|
|
|
|
|
|
default: |
2653
|
0
|
|
|
|
|
|
assert(0); |
2654
|
|
|
|
|
|
|
} |
2655
|
|
|
|
|
|
|
|
2656
|
38
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2657
|
38
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
2658
|
|
|
|
|
|
|
|
2659
|
38
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2660
|
38
|
|
|
|
|
|
break; |
2661
|
|
|
|
|
|
|
} |
2662
|
|
|
|
|
|
|
case SPVM_OP_C_ID_COPY : { |
2663
|
|
|
|
|
|
|
|
2664
|
1605
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
|
2667
|
1605
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_COPY); |
2668
|
1605
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2669
|
1605
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2670
|
|
|
|
|
|
|
|
2671
|
1605
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2672
|
1605
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
2673
|
|
|
|
|
|
|
|
2674
|
1605
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2675
|
|
|
|
|
|
|
|
2676
|
1605
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
2677
|
1605
|
|
|
|
|
|
break; |
2678
|
|
|
|
|
|
|
} |
2679
|
|
|
|
|
|
|
case SPVM_OP_C_ID_MINUS : { |
2680
|
|
|
|
|
|
|
|
2681
|
1068
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2682
|
|
|
|
|
|
|
|
2683
|
|
|
|
|
|
|
|
2684
|
1068
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
2685
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2686
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
2687
|
1068
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2688
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2689
|
536
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEGATE_INT); |
2690
|
536
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2691
|
536
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2692
|
536
|
|
|
|
|
|
break; |
2693
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2694
|
520
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEGATE_LONG); |
2695
|
520
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2696
|
520
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2697
|
520
|
|
|
|
|
|
break; |
2698
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2699
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEGATE_FLOAT); |
2700
|
6
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2701
|
6
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2702
|
6
|
|
|
|
|
|
break; |
2703
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2704
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEGATE_DOUBLE); |
2705
|
6
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2706
|
6
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
2707
|
6
|
|
|
|
|
|
break; |
2708
|
|
|
|
|
|
|
default: |
2709
|
0
|
|
|
|
|
|
assert(0); |
2710
|
|
|
|
|
|
|
} |
2711
|
|
|
|
|
|
|
|
2712
|
1068
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2713
|
1068
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
2714
|
|
|
|
|
|
|
|
2715
|
1068
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2716
|
1068
|
|
|
|
|
|
break; |
2717
|
|
|
|
|
|
|
} |
2718
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CONSTANT : { |
2719
|
920195
|
|
|
|
|
|
SPVM_CONSTANT* constant = op_assign_src->uv.constant; |
2720
|
|
|
|
|
|
|
|
2721
|
920195
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
2722
|
727920
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2723
|
|
|
|
|
|
|
|
2724
|
|
|
|
|
|
|
|
2725
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2726
|
727920
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
2727
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: |
2728
|
42120
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_CONSTANT_BYTE); |
2729
|
42120
|
|
|
|
|
|
opcode.operand1 = (uint16_t)(uint8_t)constant->value.bval; |
2730
|
42120
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2731
|
42120
|
|
|
|
|
|
break; |
2732
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
2733
|
677049
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_CONSTANT_INT); |
2734
|
677049
|
|
|
|
|
|
opcode.operand1 = (uint32_t)constant->value.ival; |
2735
|
677049
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2736
|
677049
|
|
|
|
|
|
break; |
2737
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
2738
|
5345
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_CONSTANT_LONG); |
2739
|
5345
|
|
|
|
|
|
*(int64_t*)&opcode.operand1 = constant->value.lval; |
2740
|
5345
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2741
|
5345
|
|
|
|
|
|
break; |
2742
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
2743
|
1328
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_CONSTANT_FLOAT); |
2744
|
1328
|
|
|
|
|
|
opcode.operand1 = (uint32_t)constant->value.ival; |
2745
|
1328
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2746
|
1328
|
|
|
|
|
|
break; |
2747
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
2748
|
2078
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_CONSTANT_DOUBLE); |
2749
|
2078
|
|
|
|
|
|
*(double*)&opcode.operand1 = constant->value.dval; |
2750
|
2078
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2751
|
2078
|
|
|
|
|
|
break; |
2752
|
|
|
|
|
|
|
default: |
2753
|
0
|
|
|
|
|
|
assert(0); |
2754
|
|
|
|
|
|
|
} |
2755
|
|
|
|
|
|
|
|
2756
|
727920
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2757
|
|
|
|
|
|
|
|
2758
|
727920
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2759
|
|
|
|
|
|
|
} |
2760
|
192275
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_string_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
2761
|
192275
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2762
|
|
|
|
|
|
|
|
2763
|
|
|
|
|
|
|
|
2764
|
192275
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_STRING); |
2765
|
|
|
|
|
|
|
|
2766
|
192275
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
2767
|
192275
|
|
|
|
|
|
SPVM_CONSTANT* constant = op_assign_src->uv.constant; |
2768
|
|
|
|
|
|
|
|
2769
|
192275
|
|
|
|
|
|
const char* constant_string_value = constant->value.oval; |
2770
|
192275
|
|
|
|
|
|
int32_t constant_string_length = constant->string_length; |
2771
|
192275
|
|
|
|
|
|
SPVM_STRING* global_constant_string = SPVM_HASH_get(compiler->constant_string_symtable, constant_string_value, constant_string_length); |
2772
|
192275
|
50
|
|
|
|
|
assert(global_constant_string); |
2773
|
|
|
|
|
|
|
|
2774
|
192275
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2775
|
|
|
|
|
|
|
|
2776
|
192275
|
|
|
|
|
|
SPVM_STRING* constant_string = SPVM_HASH_get(basic_type->constant_string_symtable, constant_string_value, constant_string_length); |
2777
|
192275
|
50
|
|
|
|
|
assert(constant_string); |
2778
|
|
|
|
|
|
|
|
2779
|
192275
|
50
|
|
|
|
|
assert(constant_string->index >= 0); |
2780
|
192275
|
|
|
|
|
|
opcode.operand1 = constant_string->index; |
2781
|
|
|
|
|
|
|
|
2782
|
192275
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2783
|
|
|
|
|
|
|
|
2784
|
|
|
|
|
|
|
} |
2785
|
|
|
|
|
|
|
else { |
2786
|
0
|
|
|
|
|
|
assert(0); |
2787
|
|
|
|
|
|
|
} |
2788
|
920195
|
|
|
|
|
|
break; |
2789
|
|
|
|
|
|
|
} |
2790
|
|
|
|
|
|
|
case SPVM_OP_C_ID_TYPE_CAST : { |
2791
|
|
|
|
|
|
|
|
2792
|
149581
|
|
|
|
|
|
SPVM_OP* op_dist_term = op_assign_dist; |
2793
|
149581
|
|
|
|
|
|
SPVM_OP* op_src_term = op_assign_src->first; |
2794
|
149581
|
|
|
|
|
|
SPVM_OP* op_cast_type = op_assign_src->last; |
2795
|
|
|
|
|
|
|
|
2796
|
149581
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_src_term); |
2797
|
149581
|
|
|
|
|
|
SPVM_TYPE* cast_type = SPVM_CHECK_get_type(compiler, op_cast_type); |
2798
|
|
|
|
|
|
|
|
2799
|
|
|
|
|
|
|
// Source is undef type |
2800
|
149581
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2801
|
2208
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2802
|
2208
|
50
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2803
|
|
|
|
|
|
|
|
2804
|
2208
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_UNDEF); |
2805
|
|
|
|
|
|
|
|
2806
|
2208
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_dist_term); |
2807
|
2208
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
2808
|
|
|
|
|
|
|
|
2809
|
2208
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
2810
|
|
|
|
|
|
|
} |
2811
|
|
|
|
|
|
|
else { |
2812
|
0
|
|
|
|
|
|
assert(0); |
2813
|
|
|
|
|
|
|
} |
2814
|
|
|
|
|
|
|
} |
2815
|
|
|
|
|
|
|
else { |
2816
|
147373
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
2817
|
147373
|
|
|
|
|
|
int32_t throw_exception = 0; |
2818
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
2819
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
2820
|
|
|
|
|
|
|
|
2821
|
147373
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_dist_term); |
2822
|
147373
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_src_term); |
2823
|
|
|
|
|
|
|
|
2824
|
|
|
|
|
|
|
// To byte |
2825
|
147373
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2826
|
9430
|
50
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2827
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_BYTE); |
2828
|
|
|
|
|
|
|
} |
2829
|
9430
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2830
|
5
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_BYTE); |
2831
|
|
|
|
|
|
|
} |
2832
|
9425
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2833
|
8882
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_BYTE); |
2834
|
|
|
|
|
|
|
} |
2835
|
543
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2836
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_BYTE); |
2837
|
|
|
|
|
|
|
} |
2838
|
539
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2839
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_BYTE); |
2840
|
|
|
|
|
|
|
} |
2841
|
535
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2842
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_BYTE); |
2843
|
|
|
|
|
|
|
} |
2844
|
531
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2845
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_OBJECT_TO_BYTE); |
2846
|
8
|
|
|
|
|
|
throw_exception = 1; |
2847
|
|
|
|
|
|
|
} |
2848
|
523
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2849
|
523
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_OBJECT_TO_BYTE); |
2850
|
523
|
|
|
|
|
|
throw_exception = 1; |
2851
|
|
|
|
|
|
|
} |
2852
|
|
|
|
|
|
|
else { |
2853
|
0
|
|
|
|
|
|
assert(0); |
2854
|
|
|
|
|
|
|
} |
2855
|
|
|
|
|
|
|
} |
2856
|
|
|
|
|
|
|
// To short |
2857
|
137943
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2858
|
5657
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2859
|
11
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_SHORT); |
2860
|
|
|
|
|
|
|
} |
2861
|
5646
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2862
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_SHORT); |
2863
|
|
|
|
|
|
|
} |
2864
|
5646
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2865
|
5104
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_SHORT); |
2866
|
|
|
|
|
|
|
} |
2867
|
542
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2868
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_SHORT); |
2869
|
|
|
|
|
|
|
} |
2870
|
538
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2871
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_SHORT); |
2872
|
|
|
|
|
|
|
} |
2873
|
534
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2874
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_SHORT); |
2875
|
|
|
|
|
|
|
} |
2876
|
530
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2877
|
7
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_OBJECT_TO_SHORT); |
2878
|
7
|
|
|
|
|
|
throw_exception = 1; |
2879
|
|
|
|
|
|
|
} |
2880
|
523
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2881
|
523
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_OBJECT_TO_SHORT); |
2882
|
523
|
|
|
|
|
|
throw_exception = 1; |
2883
|
|
|
|
|
|
|
} |
2884
|
|
|
|
|
|
|
else { |
2885
|
0
|
|
|
|
|
|
assert(0); |
2886
|
|
|
|
|
|
|
} |
2887
|
|
|
|
|
|
|
} |
2888
|
|
|
|
|
|
|
// To int |
2889
|
132286
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2890
|
85992
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2891
|
76010
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_INT); |
2892
|
|
|
|
|
|
|
} |
2893
|
9982
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2894
|
6745
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_INT); |
2895
|
|
|
|
|
|
|
} |
2896
|
3237
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2897
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_INT); |
2898
|
|
|
|
|
|
|
} |
2899
|
3237
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2900
|
523
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_INT); |
2901
|
|
|
|
|
|
|
} |
2902
|
2714
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2903
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_INT); |
2904
|
|
|
|
|
|
|
} |
2905
|
2710
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2906
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_INT); |
2907
|
|
|
|
|
|
|
} |
2908
|
2702
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2909
|
2117
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_OBJECT_TO_INT); |
2910
|
2117
|
|
|
|
|
|
throw_exception = 1; |
2911
|
|
|
|
|
|
|
} |
2912
|
585
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2913
|
585
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_OBJECT_TO_INT); |
2914
|
585
|
|
|
|
|
|
throw_exception = 1; |
2915
|
|
|
|
|
|
|
} |
2916
|
|
|
|
|
|
|
else { |
2917
|
0
|
|
|
|
|
|
assert(0); |
2918
|
|
|
|
|
|
|
} |
2919
|
|
|
|
|
|
|
} |
2920
|
|
|
|
|
|
|
// To long |
2921
|
46294
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2922
|
8118
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2923
|
11
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_LONG); |
2924
|
|
|
|
|
|
|
} |
2925
|
8107
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2926
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_LONG); |
2927
|
|
|
|
|
|
|
} |
2928
|
8101
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2929
|
5507
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_LONG); |
2930
|
|
|
|
|
|
|
} |
2931
|
2594
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2932
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_LONG); |
2933
|
|
|
|
|
|
|
} |
2934
|
2594
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2935
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_LONG); |
2936
|
|
|
|
|
|
|
} |
2937
|
2590
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2938
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_LONG); |
2939
|
|
|
|
|
|
|
} |
2940
|
2586
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2941
|
2063
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_OBJECT_TO_LONG); |
2942
|
2063
|
|
|
|
|
|
throw_exception = 1; |
2943
|
|
|
|
|
|
|
} |
2944
|
523
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2945
|
523
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_OBJECT_TO_LONG); |
2946
|
523
|
|
|
|
|
|
throw_exception = 1; |
2947
|
|
|
|
|
|
|
} |
2948
|
|
|
|
|
|
|
else { |
2949
|
0
|
|
|
|
|
|
assert(0); |
2950
|
|
|
|
|
|
|
} |
2951
|
|
|
|
|
|
|
} |
2952
|
|
|
|
|
|
|
// To float |
2953
|
38176
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2954
|
2626
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2955
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_FLOAT); |
2956
|
|
|
|
|
|
|
} |
2957
|
2598
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2958
|
24
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_FLOAT); |
2959
|
|
|
|
|
|
|
} |
2960
|
2574
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2961
|
2025
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_FLOAT); |
2962
|
|
|
|
|
|
|
} |
2963
|
549
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2964
|
7
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_FLOAT); |
2965
|
|
|
|
|
|
|
} |
2966
|
542
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2967
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_FLOAT); |
2968
|
|
|
|
|
|
|
} |
2969
|
542
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2970
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_FLOAT); |
2971
|
|
|
|
|
|
|
} |
2972
|
530
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2973
|
7
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_OBJECT_TO_FLOAT); |
2974
|
7
|
|
|
|
|
|
throw_exception = 1; |
2975
|
|
|
|
|
|
|
} |
2976
|
523
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2977
|
523
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_OBJECT_TO_FLOAT); |
2978
|
523
|
|
|
|
|
|
throw_exception = 1; |
2979
|
|
|
|
|
|
|
} |
2980
|
|
|
|
|
|
|
else { |
2981
|
0
|
|
|
|
|
|
assert(0); |
2982
|
|
|
|
|
|
|
} |
2983
|
|
|
|
|
|
|
} |
2984
|
|
|
|
|
|
|
// To double |
2985
|
35550
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
2986
|
6981
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2987
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_DOUBLE); |
2988
|
|
|
|
|
|
|
} |
2989
|
6953
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2990
|
25
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_DOUBLE); |
2991
|
|
|
|
|
|
|
} |
2992
|
6928
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2993
|
5255
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_DOUBLE); |
2994
|
|
|
|
|
|
|
} |
2995
|
1673
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2996
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_DOUBLE); |
2997
|
|
|
|
|
|
|
} |
2998
|
1669
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
2999
|
1137
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_DOUBLE); |
3000
|
|
|
|
|
|
|
} |
3001
|
532
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3002
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_DOUBLE); |
3003
|
|
|
|
|
|
|
} |
3004
|
532
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3005
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_OBJECT_TO_DOUBLE); |
3006
|
8
|
|
|
|
|
|
throw_exception = 1; |
3007
|
|
|
|
|
|
|
} |
3008
|
524
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3009
|
524
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_OBJECT_TO_DOUBLE); |
3010
|
524
|
|
|
|
|
|
throw_exception = 1; |
3011
|
|
|
|
|
|
|
} |
3012
|
|
|
|
|
|
|
else { |
3013
|
0
|
|
|
|
|
|
assert(0); |
3014
|
|
|
|
|
|
|
} |
3015
|
|
|
|
|
|
|
} |
3016
|
|
|
|
|
|
|
// To mulnum |
3017
|
28569
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3018
|
|
|
|
|
|
|
// Not yet implemented |
3019
|
0
|
|
|
|
|
|
assert(0); |
3020
|
|
|
|
|
|
|
} |
3021
|
|
|
|
|
|
|
// To Byte object |
3022
|
28569
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3023
|
525
|
50
|
|
|
|
|
if (SPVM_TYPE_is_byte_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3024
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3025
|
|
|
|
|
|
|
} |
3026
|
525
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3027
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_BYTE_OBJECT); |
3028
|
|
|
|
|
|
|
} |
3029
|
519
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3030
|
519
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3031
|
519
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3032
|
519
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3033
|
519
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3034
|
519
|
|
|
|
|
|
opcode.operand3 = operand3; |
3035
|
519
|
|
|
|
|
|
throw_exception = 1; |
3036
|
|
|
|
|
|
|
} |
3037
|
|
|
|
|
|
|
else { |
3038
|
0
|
|
|
|
|
|
assert(0); |
3039
|
|
|
|
|
|
|
} |
3040
|
|
|
|
|
|
|
} |
3041
|
|
|
|
|
|
|
// To Short object |
3042
|
28044
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3043
|
10
|
50
|
|
|
|
|
if (SPVM_TYPE_is_short_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3044
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3045
|
|
|
|
|
|
|
} |
3046
|
10
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3047
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_SHORT_OBJECT); |
3048
|
|
|
|
|
|
|
} |
3049
|
4
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3050
|
4
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3051
|
4
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3052
|
4
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3053
|
4
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3054
|
4
|
|
|
|
|
|
opcode.operand3 = operand3; |
3055
|
4
|
|
|
|
|
|
throw_exception = 1; |
3056
|
|
|
|
|
|
|
} |
3057
|
|
|
|
|
|
|
else { |
3058
|
0
|
|
|
|
|
|
assert(0); |
3059
|
|
|
|
|
|
|
} |
3060
|
|
|
|
|
|
|
} |
3061
|
|
|
|
|
|
|
// To Int object |
3062
|
28034
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3063
|
2660
|
50
|
|
|
|
|
if (SPVM_TYPE_is_int_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3064
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3065
|
|
|
|
|
|
|
} |
3066
|
2660
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3067
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_INT_OBJECT); |
3068
|
|
|
|
|
|
|
} |
3069
|
2642
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3070
|
2642
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3071
|
2642
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3072
|
2642
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3073
|
2642
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3074
|
2642
|
|
|
|
|
|
opcode.operand3 = operand3; |
3075
|
2642
|
|
|
|
|
|
throw_exception = 1; |
3076
|
|
|
|
|
|
|
} |
3077
|
|
|
|
|
|
|
else { |
3078
|
0
|
|
|
|
|
|
assert(0); |
3079
|
|
|
|
|
|
|
} |
3080
|
|
|
|
|
|
|
} |
3081
|
|
|
|
|
|
|
// To Long object |
3082
|
25374
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3083
|
2068
|
50
|
|
|
|
|
if (SPVM_TYPE_is_long_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3084
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3085
|
|
|
|
|
|
|
} |
3086
|
2068
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3087
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_LONG_OBJECT); |
3088
|
|
|
|
|
|
|
} |
3089
|
2062
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3090
|
2062
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3091
|
2062
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3092
|
2062
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3093
|
2062
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3094
|
2062
|
|
|
|
|
|
opcode.operand3 = operand3; |
3095
|
2062
|
|
|
|
|
|
throw_exception = 1; |
3096
|
|
|
|
|
|
|
} |
3097
|
|
|
|
|
|
|
else { |
3098
|
0
|
|
|
|
|
|
assert(0); |
3099
|
|
|
|
|
|
|
} |
3100
|
|
|
|
|
|
|
} |
3101
|
|
|
|
|
|
|
// To Float object |
3102
|
23306
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3103
|
1038
|
50
|
|
|
|
|
if (SPVM_TYPE_is_float_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3104
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3105
|
|
|
|
|
|
|
} |
3106
|
1038
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3107
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_FLOAT_OBJECT); |
3108
|
|
|
|
|
|
|
} |
3109
|
1032
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3110
|
1032
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3111
|
1032
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3112
|
1032
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3113
|
1032
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3114
|
1032
|
|
|
|
|
|
opcode.operand3 = operand3; |
3115
|
1032
|
|
|
|
|
|
throw_exception = 1; |
3116
|
|
|
|
|
|
|
} |
3117
|
|
|
|
|
|
|
else { |
3118
|
0
|
|
|
|
|
|
assert(0); |
3119
|
|
|
|
|
|
|
} |
3120
|
|
|
|
|
|
|
} |
3121
|
|
|
|
|
|
|
// To Double object |
3122
|
22268
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3123
|
1044
|
50
|
|
|
|
|
if (SPVM_TYPE_is_double_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3124
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3125
|
|
|
|
|
|
|
} |
3126
|
1044
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3127
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_DOUBLE_OBJECT); |
3128
|
|
|
|
|
|
|
} |
3129
|
1038
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3130
|
1038
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3131
|
1038
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3132
|
1038
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3133
|
1038
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3134
|
1038
|
|
|
|
|
|
opcode.operand3 = operand3; |
3135
|
1038
|
|
|
|
|
|
throw_exception = 1; |
3136
|
|
|
|
|
|
|
} |
3137
|
|
|
|
|
|
|
else { |
3138
|
0
|
|
|
|
|
|
assert(0); |
3139
|
|
|
|
|
|
|
} |
3140
|
|
|
|
|
|
|
} |
3141
|
|
|
|
|
|
|
// To String |
3142
|
21224
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_string_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3143
|
13503
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3144
|
5226
|
100
|
|
|
|
|
if (cast_type->flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE && !(src_type->flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE)) { |
|
|
50
|
|
|
|
|
|
3145
|
5225
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_CHECK_READ_ONLY); |
3146
|
5225
|
|
|
|
|
|
throw_exception = 1; |
3147
|
|
|
|
|
|
|
} |
3148
|
|
|
|
|
|
|
else { |
3149
|
5226
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3150
|
|
|
|
|
|
|
} |
3151
|
|
|
|
|
|
|
} |
3152
|
8277
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_array_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3153
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_ARRAY_TO_STRING); |
3154
|
|
|
|
|
|
|
} |
3155
|
8249
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3156
|
4196
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3157
|
4196
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3158
|
4196
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3159
|
4196
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3160
|
4196
|
|
|
|
|
|
opcode.operand3 = operand3; |
3161
|
4196
|
|
|
|
|
|
throw_exception = 1; |
3162
|
|
|
|
|
|
|
} |
3163
|
4053
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3164
|
16
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_STRING); |
3165
|
|
|
|
|
|
|
} |
3166
|
4037
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3167
|
10
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_STRING); |
3168
|
|
|
|
|
|
|
} |
3169
|
4027
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3170
|
3804
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_STRING); |
3171
|
|
|
|
|
|
|
} |
3172
|
223
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3173
|
49
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_STRING); |
3174
|
|
|
|
|
|
|
} |
3175
|
174
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3176
|
79
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_STRING); |
3177
|
|
|
|
|
|
|
} |
3178
|
95
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3179
|
95
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_STRING); |
3180
|
|
|
|
|
|
|
} |
3181
|
|
|
|
|
|
|
else { |
3182
|
0
|
|
|
|
|
|
assert(0); |
3183
|
|
|
|
|
|
|
} |
3184
|
|
|
|
|
|
|
} |
3185
|
|
|
|
|
|
|
// To byte[] |
3186
|
7721
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_array_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3187
|
72
|
50
|
|
|
|
|
if (SPVM_TYPE_is_byte_array_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3188
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3189
|
|
|
|
|
|
|
} |
3190
|
72
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_string_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3191
|
64
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_STRING_TO_BYTE_ARRAY); |
3192
|
|
|
|
|
|
|
} |
3193
|
8
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3194
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3195
|
8
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3196
|
8
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3197
|
8
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3198
|
8
|
|
|
|
|
|
opcode.operand3 = operand3; |
3199
|
8
|
|
|
|
|
|
throw_exception = 1; |
3200
|
|
|
|
|
|
|
} |
3201
|
|
|
|
|
|
|
else { |
3202
|
0
|
|
|
|
|
|
assert(0); |
3203
|
|
|
|
|
|
|
} |
3204
|
|
|
|
|
|
|
} |
3205
|
|
|
|
|
|
|
// To any object |
3206
|
7649
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3207
|
5291
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3208
|
2739
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3209
|
|
|
|
|
|
|
} |
3210
|
2552
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3211
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_BYTE_TO_BYTE_OBJECT); |
3212
|
|
|
|
|
|
|
} |
3213
|
2524
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3214
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_SHORT_TO_SHORT_OBJECT); |
3215
|
|
|
|
|
|
|
} |
3216
|
2512
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3217
|
1874
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_INT_TO_INT_OBJECT); |
3218
|
|
|
|
|
|
|
} |
3219
|
638
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3220
|
578
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_LONG_TO_LONG_OBJECT); |
3221
|
|
|
|
|
|
|
} |
3222
|
60
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3223
|
16
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_FLOAT_TO_FLOAT_OBJECT); |
3224
|
|
|
|
|
|
|
} |
3225
|
44
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3226
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_TYPE_CONVERSION_DOUBLE_TO_DOUBLE_OBJECT); |
3227
|
|
|
|
|
|
|
} |
3228
|
|
|
|
|
|
|
else { |
3229
|
0
|
|
|
|
|
|
assert(0); |
3230
|
|
|
|
|
|
|
} |
3231
|
|
|
|
|
|
|
} |
3232
|
|
|
|
|
|
|
// To object type |
3233
|
2358
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, cast_type->basic_type->id, cast_type->dimension, cast_type->flag)) { |
3234
|
2358
|
50
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
3235
|
2358
|
|
|
|
|
|
int32_t cast_type_basic_type_id = op_cast_type->uv.type->basic_type->id; |
3236
|
2358
|
|
|
|
|
|
int32_t cast_type_dimension = op_cast_type->uv.type->dimension; |
3237
|
2358
|
|
|
|
|
|
int32_t cast_type_flag = op_cast_type->uv.type->flag; |
3238
|
|
|
|
|
|
|
|
3239
|
2358
|
|
|
|
|
|
int32_t src_type_basic_type_id = src_type->basic_type->id; |
3240
|
2358
|
|
|
|
|
|
int32_t src_type_dimension = src_type->dimension; |
3241
|
2358
|
|
|
|
|
|
int32_t src_type_flag = src_type->flag; |
3242
|
|
|
|
|
|
|
|
3243
|
2358
|
|
|
|
|
|
int32_t need_implicite_conversion = 0; |
3244
|
2358
|
|
|
|
|
|
int32_t allow_narrowing_conversion = 0; |
3245
|
|
|
|
|
|
|
|
3246
|
2358
|
|
|
|
|
|
int32_t runtime_assignability = SPVM_TYPE_can_assign( |
3247
|
|
|
|
|
|
|
compiler, |
3248
|
|
|
|
|
|
|
cast_type_basic_type_id, cast_type_dimension, cast_type_flag, |
3249
|
|
|
|
|
|
|
src_type_basic_type_id, src_type_dimension, src_type_flag, |
3250
|
|
|
|
|
|
|
&need_implicite_conversion, allow_narrowing_conversion |
3251
|
|
|
|
|
|
|
); |
3252
|
2358
|
50
|
|
|
|
|
assert(need_implicite_conversion == 0); |
3253
|
|
|
|
|
|
|
|
3254
|
2358
|
100
|
|
|
|
|
if (runtime_assignability) { |
3255
|
64
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3256
|
|
|
|
|
|
|
} |
3257
|
|
|
|
|
|
|
else { |
3258
|
2294
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT_WITH_TYPE_CHECKING); |
3259
|
2294
|
|
|
|
|
|
opcode.operand2 = op_cast_type->uv.type->basic_type->id; |
3260
|
2294
|
|
|
|
|
|
int32_t operand3 = op_cast_type->uv.type->dimension; |
3261
|
2294
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3262
|
2294
|
|
|
|
|
|
opcode.operand3 = operand3; |
3263
|
2358
|
|
|
|
|
|
throw_exception = 1; |
3264
|
|
|
|
|
|
|
} |
3265
|
|
|
|
|
|
|
} |
3266
|
|
|
|
|
|
|
else { |
3267
|
0
|
|
|
|
|
|
assert(0); |
3268
|
|
|
|
|
|
|
} |
3269
|
|
|
|
|
|
|
} |
3270
|
|
|
|
|
|
|
|
3271
|
147373
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3272
|
147373
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3273
|
|
|
|
|
|
|
|
3274
|
147373
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3275
|
|
|
|
|
|
|
|
3276
|
147373
|
100
|
|
|
|
|
if (throw_exception) { |
3277
|
147373
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3278
|
|
|
|
|
|
|
} |
3279
|
|
|
|
|
|
|
} |
3280
|
|
|
|
|
|
|
|
3281
|
|
|
|
|
|
|
|
3282
|
149581
|
|
|
|
|
|
break; |
3283
|
|
|
|
|
|
|
} |
3284
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NEW : { |
3285
|
|
|
|
|
|
|
|
3286
|
100694
|
100
|
|
|
|
|
if (op_assign_src->first->id == SPVM_OP_C_ID_TYPE || op_assign_src->first->id == SPVM_OP_C_ID_VAR) { |
|
|
50
|
|
|
|
|
|
3287
|
|
|
|
|
|
|
|
3288
|
50347
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_assign_src); |
3289
|
|
|
|
|
|
|
|
3290
|
|
|
|
|
|
|
// Runtime type |
3291
|
50347
|
|
|
|
|
|
int32_t basic_type_id = type->basic_type->id; |
3292
|
50347
|
|
|
|
|
|
int32_t type_dimension = type->dimension; |
3293
|
|
|
|
|
|
|
|
3294
|
50347
|
100
|
|
|
|
|
if (type_dimension > 0) { |
3295
|
|
|
|
|
|
|
/* |
3296
|
|
|
|
|
|
|
NEW op_assign_src |
3297
|
|
|
|
|
|
|
TYPE op_assign_src->first |
3298
|
|
|
|
|
|
|
ELEMENT_TYPE op_assign_src->first->first |
3299
|
|
|
|
|
|
|
INDEX op_assign_src->last |
3300
|
|
|
|
|
|
|
*/ |
3301
|
|
|
|
|
|
|
|
3302
|
29477
|
100
|
|
|
|
|
if (type_dimension == 1) { |
3303
|
29420
|
|
|
|
|
|
switch (basic_type_id) { |
3304
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
3305
|
2143
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3306
|
|
|
|
|
|
|
|
3307
|
2143
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_BYTE_ARRAY); |
3308
|
|
|
|
|
|
|
|
3309
|
2143
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3310
|
2143
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3311
|
|
|
|
|
|
|
|
3312
|
2143
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3313
|
2143
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
3314
|
|
|
|
|
|
|
|
3315
|
2143
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3316
|
|
|
|
|
|
|
|
3317
|
2143
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3318
|
|
|
|
|
|
|
|
3319
|
2143
|
|
|
|
|
|
break; |
3320
|
|
|
|
|
|
|
} |
3321
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
3322
|
2017
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3323
|
|
|
|
|
|
|
|
3324
|
2017
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_SHORT_ARRAY); |
3325
|
|
|
|
|
|
|
|
3326
|
2017
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3327
|
2017
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3328
|
|
|
|
|
|
|
|
3329
|
2017
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3330
|
2017
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
3331
|
|
|
|
|
|
|
|
3332
|
2017
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3333
|
|
|
|
|
|
|
|
3334
|
2017
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3335
|
|
|
|
|
|
|
|
3336
|
2017
|
|
|
|
|
|
break; |
3337
|
|
|
|
|
|
|
} |
3338
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
3339
|
4761
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3340
|
|
|
|
|
|
|
|
3341
|
|
|
|
|
|
|
|
3342
|
4761
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_INT_ARRAY); |
3343
|
|
|
|
|
|
|
|
3344
|
4761
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3345
|
4761
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3346
|
|
|
|
|
|
|
|
3347
|
4761
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3348
|
4761
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
3349
|
|
|
|
|
|
|
|
3350
|
4761
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3351
|
|
|
|
|
|
|
|
3352
|
4761
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3353
|
|
|
|
|
|
|
|
3354
|
4761
|
|
|
|
|
|
break; |
3355
|
|
|
|
|
|
|
} |
3356
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
3357
|
2008
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3358
|
|
|
|
|
|
|
|
3359
|
|
|
|
|
|
|
|
3360
|
2008
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_LONG_ARRAY); |
3361
|
|
|
|
|
|
|
|
3362
|
2008
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3363
|
2008
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3364
|
|
|
|
|
|
|
|
3365
|
2008
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3366
|
2008
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
3367
|
|
|
|
|
|
|
|
3368
|
2008
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3369
|
|
|
|
|
|
|
|
3370
|
2008
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3371
|
|
|
|
|
|
|
|
3372
|
2008
|
|
|
|
|
|
break; |
3373
|
|
|
|
|
|
|
} |
3374
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
3375
|
2009
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3376
|
|
|
|
|
|
|
|
3377
|
|
|
|
|
|
|
|
3378
|
2009
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_FLOAT_ARRAY); |
3379
|
|
|
|
|
|
|
|
3380
|
2009
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3381
|
2009
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3382
|
|
|
|
|
|
|
|
3383
|
2009
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3384
|
2009
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
3385
|
|
|
|
|
|
|
|
3386
|
2009
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3387
|
|
|
|
|
|
|
|
3388
|
2009
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3389
|
|
|
|
|
|
|
|
3390
|
2009
|
|
|
|
|
|
break; |
3391
|
|
|
|
|
|
|
} |
3392
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
3393
|
2026
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3394
|
|
|
|
|
|
|
|
3395
|
|
|
|
|
|
|
|
3396
|
2026
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_DOUBLE_ARRAY); |
3397
|
|
|
|
|
|
|
|
3398
|
2026
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3399
|
2026
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3400
|
|
|
|
|
|
|
|
3401
|
2026
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3402
|
2026
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
3403
|
|
|
|
|
|
|
|
3404
|
2026
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3405
|
|
|
|
|
|
|
|
3406
|
2026
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3407
|
|
|
|
|
|
|
|
3408
|
2026
|
|
|
|
|
|
break; |
3409
|
|
|
|
|
|
|
} |
3410
|
|
|
|
|
|
|
default: { |
3411
|
14456
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_array_type(compiler, basic_type_id, type_dimension, type->flag)) { |
3412
|
181
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3413
|
|
|
|
|
|
|
|
3414
|
|
|
|
|
|
|
|
3415
|
181
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_MULNUM_ARRAY); |
3416
|
|
|
|
|
|
|
|
3417
|
181
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3418
|
181
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3419
|
|
|
|
|
|
|
|
3420
|
181
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3421
|
181
|
|
|
|
|
|
opcode.operand1 = type->basic_type->id; |
3422
|
181
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_index; |
3423
|
|
|
|
|
|
|
|
3424
|
181
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3425
|
|
|
|
|
|
|
|
3426
|
181
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3427
|
|
|
|
|
|
|
} |
3428
|
|
|
|
|
|
|
else { |
3429
|
14275
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3430
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
|
3432
|
14275
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_OBJECT_ARRAY); |
3433
|
|
|
|
|
|
|
|
3434
|
14275
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3435
|
14275
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3436
|
|
|
|
|
|
|
|
3437
|
14275
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3438
|
14275
|
|
|
|
|
|
opcode.operand1 = type->basic_type->id; |
3439
|
14275
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_index; |
3440
|
|
|
|
|
|
|
|
3441
|
14275
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3442
|
|
|
|
|
|
|
|
3443
|
29420
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3444
|
|
|
|
|
|
|
} |
3445
|
|
|
|
|
|
|
} |
3446
|
|
|
|
|
|
|
} |
3447
|
|
|
|
|
|
|
} |
3448
|
57
|
50
|
|
|
|
|
else if (type_dimension > 1) { |
3449
|
57
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3450
|
|
|
|
|
|
|
|
3451
|
|
|
|
|
|
|
|
3452
|
57
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_MULDIM_ARRAY); |
3453
|
|
|
|
|
|
|
|
3454
|
57
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3455
|
57
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3456
|
|
|
|
|
|
|
|
3457
|
57
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3458
|
57
|
|
|
|
|
|
opcode.operand1 = type->basic_type->id; |
3459
|
57
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_index; |
3460
|
57
|
|
|
|
|
|
int32_t operand3 = type->dimension; |
3461
|
57
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
3462
|
57
|
|
|
|
|
|
opcode.operand3 = operand3; |
3463
|
|
|
|
|
|
|
|
3464
|
57
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3465
|
|
|
|
|
|
|
|
3466
|
57
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3467
|
|
|
|
|
|
|
} |
3468
|
|
|
|
|
|
|
else { |
3469
|
0
|
|
|
|
|
|
assert(0); |
3470
|
|
|
|
|
|
|
} |
3471
|
|
|
|
|
|
|
} |
3472
|
|
|
|
|
|
|
else { |
3473
|
20870
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3474
|
|
|
|
|
|
|
|
3475
|
|
|
|
|
|
|
|
3476
|
20870
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NEW_OBJECT); |
3477
|
|
|
|
|
|
|
|
3478
|
20870
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3479
|
|
|
|
|
|
|
|
3480
|
20870
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3481
|
20870
|
|
|
|
|
|
opcode.operand1 = type->basic_type->id; |
3482
|
20870
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3483
|
|
|
|
|
|
|
} |
3484
|
|
|
|
|
|
|
} |
3485
|
|
|
|
|
|
|
else { |
3486
|
0
|
|
|
|
|
|
assert(0); |
3487
|
|
|
|
|
|
|
} |
3488
|
50347
|
|
|
|
|
|
break; |
3489
|
|
|
|
|
|
|
} |
3490
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BASIC_TYPE_ID : { |
3491
|
|
|
|
|
|
|
|
3492
|
64
|
|
|
|
|
|
SPVM_OP* op_type = op_assign_src->first; |
3493
|
|
|
|
|
|
|
|
3494
|
64
|
|
|
|
|
|
int32_t basic_type_id = op_type->uv.type->basic_type->id; |
3495
|
|
|
|
|
|
|
|
3496
|
64
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3497
|
64
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_BASIC_TYPE_ID); |
3498
|
|
|
|
|
|
|
|
3499
|
64
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3500
|
64
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3501
|
64
|
|
|
|
|
|
opcode.operand1 = basic_type_id; |
3502
|
64
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3503
|
|
|
|
|
|
|
|
3504
|
64
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_assign->line); |
3505
|
|
|
|
|
|
|
|
3506
|
64
|
|
|
|
|
|
break; |
3507
|
|
|
|
|
|
|
} |
3508
|
|
|
|
|
|
|
case SPVM_OP_C_ID_EVAL_ERROR_ID : { |
3509
|
|
|
|
|
|
|
|
3510
|
10
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3511
|
10
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GET_EVAL_ERROR_ID); |
3512
|
|
|
|
|
|
|
|
3513
|
10
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3514
|
10
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3515
|
10
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3516
|
|
|
|
|
|
|
|
3517
|
10
|
|
|
|
|
|
break; |
3518
|
|
|
|
|
|
|
} |
3519
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ARGS_WIDTH : { |
3520
|
|
|
|
|
|
|
|
3521
|
11
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3522
|
11
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ARGS_WIDTH); |
3523
|
|
|
|
|
|
|
|
3524
|
11
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3525
|
11
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3526
|
11
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3527
|
|
|
|
|
|
|
|
3528
|
11
|
|
|
|
|
|
break; |
3529
|
|
|
|
|
|
|
} |
3530
|
|
|
|
|
|
|
case SPVM_OP_C_ID_VAR : { |
3531
|
|
|
|
|
|
|
// Multi numeric type |
3532
|
134886
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
3533
|
|
|
|
|
|
|
|
3534
|
7
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(type_dist->basic_type->fields, 0); |
3535
|
7
|
50
|
|
|
|
|
assert(first_field); |
3536
|
|
|
|
|
|
|
|
3537
|
7
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
3538
|
7
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
3539
|
|
|
|
|
|
|
|
3540
|
7
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3541
|
|
|
|
|
|
|
|
3542
|
|
|
|
|
|
|
|
3543
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
3544
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
3545
|
7
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
3546
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
3547
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_BYTE); |
3548
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3549
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3550
|
0
|
|
|
|
|
|
break; |
3551
|
|
|
|
|
|
|
} |
3552
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
3553
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_SHORT); |
3554
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3555
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3556
|
0
|
|
|
|
|
|
break; |
3557
|
|
|
|
|
|
|
} |
3558
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
3559
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_INT); |
3560
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3561
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3562
|
0
|
|
|
|
|
|
break; |
3563
|
|
|
|
|
|
|
} |
3564
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
3565
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_LONG); |
3566
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3567
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3568
|
0
|
|
|
|
|
|
break; |
3569
|
|
|
|
|
|
|
} |
3570
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
3571
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_FLOAT); |
3572
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3573
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3574
|
0
|
|
|
|
|
|
break; |
3575
|
|
|
|
|
|
|
} |
3576
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
3577
|
7
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_DOUBLE); |
3578
|
7
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3579
|
7
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3580
|
7
|
|
|
|
|
|
break; |
3581
|
|
|
|
|
|
|
} |
3582
|
|
|
|
|
|
|
default: |
3583
|
0
|
|
|
|
|
|
assert(0); |
3584
|
|
|
|
|
|
|
} |
3585
|
|
|
|
|
|
|
|
3586
|
7
|
|
|
|
|
|
int32_t fields_length = type_dist->basic_type->fields->length; |
3587
|
7
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3588
|
7
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3589
|
7
|
|
|
|
|
|
opcode.operand2 = fields_length; |
3590
|
|
|
|
|
|
|
|
3591
|
7
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3592
|
|
|
|
|
|
|
} |
3593
|
|
|
|
|
|
|
// Object type |
3594
|
134879
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
3595
|
21378
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3596
|
|
|
|
|
|
|
|
3597
|
21378
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
3598
|
21378
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3599
|
21378
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3600
|
|
|
|
|
|
|
|
3601
|
21378
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3602
|
21378
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3603
|
|
|
|
|
|
|
|
3604
|
21378
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3605
|
|
|
|
|
|
|
|
3606
|
|
|
|
|
|
|
} |
3607
|
113501
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
3608
|
10
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3609
|
|
|
|
|
|
|
|
3610
|
10
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_REF); |
3611
|
10
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3612
|
10
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3613
|
|
|
|
|
|
|
|
3614
|
10
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3615
|
10
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3616
|
|
|
|
|
|
|
|
3617
|
10
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3618
|
|
|
|
|
|
|
|
3619
|
|
|
|
|
|
|
} |
3620
|
|
|
|
|
|
|
// Numeric type |
3621
|
|
|
|
|
|
|
else { |
3622
|
113491
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3623
|
|
|
|
|
|
|
|
3624
|
|
|
|
|
|
|
|
3625
|
113491
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)); |
3626
|
|
|
|
|
|
|
|
3627
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
3628
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
3629
|
113491
|
|
|
|
|
|
switch (type_dist->basic_type->id) { |
3630
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
3631
|
68
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_BYTE); |
3632
|
68
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3633
|
68
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3634
|
68
|
|
|
|
|
|
break; |
3635
|
|
|
|
|
|
|
} |
3636
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
3637
|
68
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_SHORT); |
3638
|
68
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3639
|
68
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3640
|
68
|
|
|
|
|
|
break; |
3641
|
|
|
|
|
|
|
} |
3642
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
3643
|
110616
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_INT); |
3644
|
110616
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3645
|
110616
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3646
|
110616
|
|
|
|
|
|
break; |
3647
|
|
|
|
|
|
|
} |
3648
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
3649
|
1091
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_LONG); |
3650
|
1091
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3651
|
1091
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3652
|
1091
|
|
|
|
|
|
break; |
3653
|
|
|
|
|
|
|
} |
3654
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
3655
|
567
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_FLOAT); |
3656
|
567
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3657
|
567
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3658
|
567
|
|
|
|
|
|
break; |
3659
|
|
|
|
|
|
|
} |
3660
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
3661
|
1081
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_DOUBLE); |
3662
|
1081
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
3663
|
1081
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
3664
|
1081
|
|
|
|
|
|
break; |
3665
|
|
|
|
|
|
|
} |
3666
|
|
|
|
|
|
|
default: { |
3667
|
0
|
|
|
|
|
|
assert(0); |
3668
|
|
|
|
|
|
|
} |
3669
|
|
|
|
|
|
|
} |
3670
|
|
|
|
|
|
|
|
3671
|
113491
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
3672
|
113491
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3673
|
|
|
|
|
|
|
|
3674
|
113491
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3675
|
|
|
|
|
|
|
} |
3676
|
134886
|
|
|
|
|
|
break; |
3677
|
|
|
|
|
|
|
} |
3678
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_EQ : { |
3679
|
84183
|
100
|
|
|
|
|
if (op_assign_src->first->id == SPVM_OP_C_ID_UNDEF || op_assign_src->last->id == SPVM_OP_C_ID_UNDEF) { |
|
|
100
|
|
|
|
|
|
3680
|
16679
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3681
|
|
|
|
|
|
|
|
3682
|
|
|
|
|
|
|
|
3683
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
3684
|
|
|
|
|
|
|
|
3685
|
16679
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IS_UNDEF); |
3686
|
16679
|
100
|
|
|
|
|
if (op_assign_src->first->id == SPVM_OP_C_ID_UNDEF) { |
3687
|
5
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3688
|
|
|
|
|
|
|
|
3689
|
5
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3690
|
|
|
|
|
|
|
|
3691
|
5
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3692
|
|
|
|
|
|
|
} |
3693
|
|
|
|
|
|
|
else { |
3694
|
16674
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3695
|
|
|
|
|
|
|
|
3696
|
16674
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3697
|
|
|
|
|
|
|
|
3698
|
16674
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3699
|
|
|
|
|
|
|
} |
3700
|
|
|
|
|
|
|
} |
3701
|
|
|
|
|
|
|
else { |
3702
|
50825
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
3703
|
|
|
|
|
|
|
|
3704
|
50825
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3705
|
|
|
|
|
|
|
|
3706
|
|
|
|
|
|
|
|
3707
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
3708
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
3709
|
50825
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, operand_type->basic_type->id, operand_type->dimension, operand_type->flag)) { |
3710
|
50041
|
50
|
|
|
|
|
if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
3711
|
0
|
|
|
|
|
|
assert(0); |
3712
|
|
|
|
|
|
|
} |
3713
|
50041
|
50
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
3714
|
0
|
|
|
|
|
|
assert(0); |
3715
|
|
|
|
|
|
|
} |
3716
|
50041
|
100
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
3717
|
46604
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_EQ_INT); |
3718
|
46604
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3719
|
46604
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3720
|
|
|
|
|
|
|
} |
3721
|
3437
|
100
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
3722
|
1551
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_EQ_LONG); |
3723
|
1551
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3724
|
1551
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3725
|
|
|
|
|
|
|
} |
3726
|
1886
|
100
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
3727
|
868
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_EQ_FLOAT); |
3728
|
868
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3729
|
868
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3730
|
|
|
|
|
|
|
} |
3731
|
1018
|
50
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
3732
|
1018
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_EQ_DOUBLE); |
3733
|
1018
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3734
|
1018
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3735
|
|
|
|
|
|
|
} |
3736
|
|
|
|
|
|
|
else { |
3737
|
0
|
|
|
|
|
|
assert(0); |
3738
|
|
|
|
|
|
|
} |
3739
|
|
|
|
|
|
|
} |
3740
|
784
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, operand_type->basic_type->id, operand_type->dimension, operand_type->flag)) { |
3741
|
784
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_EQ_OBJECT); |
3742
|
784
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3743
|
784
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3744
|
|
|
|
|
|
|
} |
3745
|
0
|
0
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, operand_type->basic_type->id, operand_type->dimension, operand_type->flag)) { |
3746
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_EQ_REF); |
3747
|
0
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3748
|
0
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3749
|
|
|
|
|
|
|
} |
3750
|
|
|
|
|
|
|
else { |
3751
|
0
|
|
|
|
|
|
assert(0); |
3752
|
|
|
|
|
|
|
} |
3753
|
|
|
|
|
|
|
|
3754
|
50825
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
3755
|
50825
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
3756
|
|
|
|
|
|
|
|
3757
|
50825
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3758
|
|
|
|
|
|
|
} |
3759
|
67504
|
|
|
|
|
|
break; |
3760
|
|
|
|
|
|
|
} |
3761
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_NE : { |
3762
|
25966
|
100
|
|
|
|
|
if (op_assign_src->first->id == SPVM_OP_C_ID_UNDEF ||op_assign_src->last->id == SPVM_OP_C_ID_UNDEF) { |
|
|
100
|
|
|
|
|
|
3763
|
8234
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3764
|
|
|
|
|
|
|
|
3765
|
|
|
|
|
|
|
|
3766
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
3767
|
|
|
|
|
|
|
|
3768
|
8234
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IS_NOT_UNDEF); |
3769
|
8234
|
100
|
|
|
|
|
if (op_assign_src->first->id == SPVM_OP_C_ID_UNDEF) { |
3770
|
4
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3771
|
|
|
|
|
|
|
|
3772
|
4
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3773
|
|
|
|
|
|
|
} |
3774
|
|
|
|
|
|
|
else { |
3775
|
8230
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3776
|
|
|
|
|
|
|
|
3777
|
8230
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
3778
|
|
|
|
|
|
|
} |
3779
|
8234
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3780
|
|
|
|
|
|
|
} |
3781
|
|
|
|
|
|
|
else { |
3782
|
9498
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
3783
|
|
|
|
|
|
|
|
3784
|
9498
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3785
|
|
|
|
|
|
|
|
3786
|
|
|
|
|
|
|
|
3787
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
3788
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
3789
|
9498
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, operand_type->basic_type->id, operand_type->dimension, operand_type->flag)) { |
3790
|
9460
|
50
|
|
|
|
|
if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
3791
|
0
|
|
|
|
|
|
assert(0); |
3792
|
|
|
|
|
|
|
} |
3793
|
9460
|
50
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
3794
|
0
|
|
|
|
|
|
assert(0); |
3795
|
|
|
|
|
|
|
} |
3796
|
9460
|
100
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
3797
|
7378
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NE_INT); |
3798
|
7378
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3799
|
7378
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3800
|
|
|
|
|
|
|
} |
3801
|
2082
|
100
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
3802
|
1037
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NE_LONG); |
3803
|
1037
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3804
|
1037
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3805
|
|
|
|
|
|
|
} |
3806
|
1045
|
100
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
3807
|
522
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NE_FLOAT); |
3808
|
522
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3809
|
522
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3810
|
|
|
|
|
|
|
} |
3811
|
523
|
50
|
|
|
|
|
else if (operand_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
3812
|
523
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NE_DOUBLE); |
3813
|
523
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3814
|
523
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3815
|
|
|
|
|
|
|
} |
3816
|
|
|
|
|
|
|
else { |
3817
|
0
|
|
|
|
|
|
assert(0); |
3818
|
|
|
|
|
|
|
} |
3819
|
|
|
|
|
|
|
} |
3820
|
38
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, operand_type->basic_type->id, operand_type->dimension, operand_type->flag)) { |
3821
|
30
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NE_OBJECT); |
3822
|
30
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3823
|
30
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3824
|
|
|
|
|
|
|
} |
3825
|
8
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, operand_type->basic_type->id, operand_type->dimension, operand_type->flag)) { |
3826
|
8
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_NE_REF); |
3827
|
8
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3828
|
8
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3829
|
|
|
|
|
|
|
} |
3830
|
|
|
|
|
|
|
else { |
3831
|
0
|
|
|
|
|
|
assert(0); |
3832
|
|
|
|
|
|
|
} |
3833
|
|
|
|
|
|
|
|
3834
|
9498
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
3835
|
9498
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
3836
|
|
|
|
|
|
|
|
3837
|
9498
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3838
|
|
|
|
|
|
|
} |
3839
|
17732
|
|
|
|
|
|
break; |
3840
|
|
|
|
|
|
|
} |
3841
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_GT : { |
3842
|
|
|
|
|
|
|
|
3843
|
20777
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3844
|
|
|
|
|
|
|
|
3845
|
|
|
|
|
|
|
|
3846
|
20777
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
3847
|
|
|
|
|
|
|
|
3848
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
3849
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
3850
|
20777
|
|
|
|
|
|
switch (operand_type->basic_type->id) { |
3851
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
3852
|
19700
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GT_INT); |
3853
|
19700
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3854
|
19700
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3855
|
19700
|
|
|
|
|
|
break; |
3856
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
3857
|
536
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GT_LONG); |
3858
|
536
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3859
|
536
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3860
|
536
|
|
|
|
|
|
break; |
3861
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
3862
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GT_FLOAT); |
3863
|
12
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3864
|
12
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3865
|
12
|
|
|
|
|
|
break; |
3866
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
3867
|
529
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GT_DOUBLE); |
3868
|
529
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3869
|
529
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3870
|
529
|
|
|
|
|
|
break; |
3871
|
|
|
|
|
|
|
default: |
3872
|
0
|
|
|
|
|
|
assert(0); |
3873
|
|
|
|
|
|
|
} |
3874
|
|
|
|
|
|
|
|
3875
|
20777
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
3876
|
20777
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
3877
|
|
|
|
|
|
|
|
3878
|
20777
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3879
|
20777
|
|
|
|
|
|
break; |
3880
|
|
|
|
|
|
|
} |
3881
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_GE : { |
3882
|
|
|
|
|
|
|
|
3883
|
68543
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3884
|
|
|
|
|
|
|
|
3885
|
|
|
|
|
|
|
|
3886
|
68543
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
3887
|
|
|
|
|
|
|
|
3888
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
3889
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
3890
|
68543
|
|
|
|
|
|
switch (operand_type->basic_type->id) { |
3891
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
3892
|
67989
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GE_INT); |
3893
|
67989
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3894
|
67989
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3895
|
67989
|
|
|
|
|
|
break; |
3896
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
3897
|
527
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GE_LONG); |
3898
|
527
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3899
|
527
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3900
|
527
|
|
|
|
|
|
break; |
3901
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
3902
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GE_FLOAT); |
3903
|
12
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3904
|
12
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3905
|
12
|
|
|
|
|
|
break; |
3906
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
3907
|
15
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GE_DOUBLE); |
3908
|
15
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3909
|
15
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3910
|
15
|
|
|
|
|
|
break; |
3911
|
|
|
|
|
|
|
default: |
3912
|
0
|
|
|
|
|
|
assert(0); |
3913
|
|
|
|
|
|
|
} |
3914
|
|
|
|
|
|
|
|
3915
|
68543
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
3916
|
68543
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
3917
|
|
|
|
|
|
|
|
3918
|
68543
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3919
|
68543
|
|
|
|
|
|
break; |
3920
|
|
|
|
|
|
|
} |
3921
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_LT : { |
3922
|
|
|
|
|
|
|
|
3923
|
79628
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3924
|
|
|
|
|
|
|
|
3925
|
|
|
|
|
|
|
|
3926
|
79628
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
3927
|
|
|
|
|
|
|
|
3928
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
3929
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
3930
|
79628
|
|
|
|
|
|
switch (operand_type->basic_type->id) { |
3931
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
3932
|
79074
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LT_INT); |
3933
|
79074
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3934
|
79074
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3935
|
79074
|
|
|
|
|
|
break; |
3936
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
3937
|
527
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LT_LONG); |
3938
|
527
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3939
|
527
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3940
|
527
|
|
|
|
|
|
break; |
3941
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
3942
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LT_FLOAT); |
3943
|
12
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3944
|
12
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3945
|
12
|
|
|
|
|
|
break; |
3946
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
3947
|
15
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LT_DOUBLE); |
3948
|
15
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3949
|
15
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3950
|
15
|
|
|
|
|
|
break; |
3951
|
|
|
|
|
|
|
default: |
3952
|
0
|
|
|
|
|
|
assert(0); |
3953
|
|
|
|
|
|
|
} |
3954
|
|
|
|
|
|
|
|
3955
|
79628
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
3956
|
79628
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
3957
|
|
|
|
|
|
|
|
3958
|
79628
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3959
|
79628
|
|
|
|
|
|
break; |
3960
|
|
|
|
|
|
|
} |
3961
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_LE : { |
3962
|
|
|
|
|
|
|
|
3963
|
73515
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
3964
|
|
|
|
|
|
|
|
3965
|
|
|
|
|
|
|
|
3966
|
73515
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
3967
|
|
|
|
|
|
|
|
3968
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
3969
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
3970
|
73515
|
|
|
|
|
|
switch (operand_type->basic_type->id) { |
3971
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
3972
|
73477
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LE_INT); |
3973
|
73477
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3974
|
73477
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3975
|
73477
|
|
|
|
|
|
break; |
3976
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
3977
|
13
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LE_LONG); |
3978
|
13
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3979
|
13
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3980
|
13
|
|
|
|
|
|
break; |
3981
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
3982
|
12
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LE_FLOAT); |
3983
|
12
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3984
|
12
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3985
|
12
|
|
|
|
|
|
break; |
3986
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
3987
|
13
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_LE_DOUBLE); |
3988
|
13
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
3989
|
13
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
3990
|
13
|
|
|
|
|
|
break; |
3991
|
|
|
|
|
|
|
default: |
3992
|
0
|
|
|
|
|
|
assert(0); |
3993
|
|
|
|
|
|
|
} |
3994
|
|
|
|
|
|
|
|
3995
|
73515
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
3996
|
73515
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
3997
|
|
|
|
|
|
|
|
3998
|
73515
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
3999
|
73515
|
|
|
|
|
|
break; |
4000
|
|
|
|
|
|
|
} |
4001
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_CMP : { |
4002
|
|
|
|
|
|
|
|
4003
|
6378
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4004
|
|
|
|
|
|
|
|
4005
|
|
|
|
|
|
|
|
4006
|
6378
|
|
|
|
|
|
SPVM_TYPE* operand_type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
4007
|
|
|
|
|
|
|
|
4008
|
|
|
|
|
|
|
int32_t runtime_var_index_in1; |
4009
|
|
|
|
|
|
|
int32_t runtime_var_index_in2; |
4010
|
6378
|
|
|
|
|
|
switch (operand_type->basic_type->id) { |
4011
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: |
4012
|
3200
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CMP_INT); |
4013
|
3200
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4014
|
3200
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
4015
|
3200
|
|
|
|
|
|
break; |
4016
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: |
4017
|
1058
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CMP_LONG); |
4018
|
1058
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4019
|
1058
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
4020
|
1058
|
|
|
|
|
|
break; |
4021
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: |
4022
|
1060
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CMP_FLOAT); |
4023
|
1060
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4024
|
1060
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
4025
|
1060
|
|
|
|
|
|
break; |
4026
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: |
4027
|
1060
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CMP_DOUBLE); |
4028
|
1060
|
|
|
|
|
|
runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4029
|
1060
|
|
|
|
|
|
runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
4030
|
1060
|
|
|
|
|
|
break; |
4031
|
|
|
|
|
|
|
default: |
4032
|
0
|
|
|
|
|
|
assert(0); |
4033
|
|
|
|
|
|
|
} |
4034
|
|
|
|
|
|
|
|
4035
|
6378
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
4036
|
6378
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
4037
|
|
|
|
|
|
|
|
4038
|
6378
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4039
|
6378
|
|
|
|
|
|
break; |
4040
|
|
|
|
|
|
|
} |
4041
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_EQ: |
4042
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_NE: |
4043
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_GT: |
4044
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_GE: |
4045
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LT: |
4046
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LE: |
4047
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_CMP: |
4048
|
|
|
|
|
|
|
{ |
4049
|
12632
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4050
|
|
|
|
|
|
|
|
4051
|
|
|
|
|
|
|
|
4052
|
12632
|
|
|
|
|
|
switch (op_assign_src->id) { |
4053
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_EQ: { |
4054
|
10293
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_EQ); |
4055
|
10293
|
|
|
|
|
|
break; |
4056
|
|
|
|
|
|
|
} |
4057
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_NE: { |
4058
|
559
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_NE); |
4059
|
559
|
|
|
|
|
|
break; |
4060
|
|
|
|
|
|
|
} |
4061
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_GT: { |
4062
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_GT); |
4063
|
44
|
|
|
|
|
|
break; |
4064
|
|
|
|
|
|
|
} |
4065
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_GE: { |
4066
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_GE); |
4067
|
44
|
|
|
|
|
|
break; |
4068
|
|
|
|
|
|
|
} |
4069
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LT: { |
4070
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_LT); |
4071
|
44
|
|
|
|
|
|
break; |
4072
|
|
|
|
|
|
|
} |
4073
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LE: { |
4074
|
44
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_LE); |
4075
|
44
|
|
|
|
|
|
break; |
4076
|
|
|
|
|
|
|
} |
4077
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_CMP: { |
4078
|
1604
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_STRING_CMP); |
4079
|
1604
|
|
|
|
|
|
break; |
4080
|
|
|
|
|
|
|
} |
4081
|
|
|
|
|
|
|
default: { |
4082
|
0
|
|
|
|
|
|
assert(0); |
4083
|
|
|
|
|
|
|
} |
4084
|
|
|
|
|
|
|
} |
4085
|
|
|
|
|
|
|
|
4086
|
12632
|
|
|
|
|
|
int32_t runtime_var_index_in1 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4087
|
12632
|
|
|
|
|
|
int32_t runtime_var_index_in2 = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->last); |
4088
|
|
|
|
|
|
|
|
4089
|
12632
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in1; |
4090
|
12632
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in2; |
4091
|
|
|
|
|
|
|
|
4092
|
12632
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4093
|
|
|
|
|
|
|
|
4094
|
12632
|
|
|
|
|
|
break; |
4095
|
|
|
|
|
|
|
} |
4096
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BOOL: { |
4097
|
670573
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_assign_src->first); |
4098
|
|
|
|
|
|
|
|
4099
|
670573
|
50
|
|
|
|
|
if (op_assign_src->first->id != SPVM_OP_C_ID_IF) { |
4100
|
|
|
|
|
|
|
|
4101
|
670573
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4102
|
|
|
|
|
|
|
|
4103
|
|
|
|
|
|
|
|
4104
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4105
|
670573
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
4106
|
598624
|
50
|
|
|
|
|
if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4107
|
0
|
|
|
|
|
|
assert(0); |
4108
|
|
|
|
|
|
|
} |
4109
|
598624
|
50
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4110
|
0
|
|
|
|
|
|
assert(0); |
4111
|
|
|
|
|
|
|
} |
4112
|
598624
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4113
|
598483
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_INT); |
4114
|
598483
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4115
|
|
|
|
|
|
|
} |
4116
|
141
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4117
|
26
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_LONG); |
4118
|
26
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4119
|
|
|
|
|
|
|
} |
4120
|
115
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4121
|
20
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_FLOAT); |
4122
|
20
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4123
|
|
|
|
|
|
|
} |
4124
|
95
|
50
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4125
|
95
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_DOUBLE); |
4126
|
95
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4127
|
|
|
|
|
|
|
} |
4128
|
|
|
|
|
|
|
else { |
4129
|
0
|
|
|
|
|
|
assert(0); |
4130
|
|
|
|
|
|
|
} |
4131
|
|
|
|
|
|
|
} |
4132
|
71949
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_bool_object_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
4133
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_BOOL_OBJECT); |
4134
|
28
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4135
|
|
|
|
|
|
|
} |
4136
|
71921
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
4137
|
71915
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_OBJECT); |
4138
|
71915
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4139
|
|
|
|
|
|
|
} |
4140
|
6
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
4141
|
6
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_BOOL_CONVERSION_REF); |
4142
|
6
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4143
|
|
|
|
|
|
|
} |
4144
|
|
|
|
|
|
|
else { |
4145
|
0
|
|
|
|
|
|
assert(0); |
4146
|
|
|
|
|
|
|
} |
4147
|
670573
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4148
|
|
|
|
|
|
|
|
4149
|
670573
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4150
|
|
|
|
|
|
|
} |
4151
|
|
|
|
|
|
|
|
4152
|
670573
|
|
|
|
|
|
break; |
4153
|
|
|
|
|
|
|
} |
4154
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ISA: |
4155
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ISA_ERROR: |
4156
|
|
|
|
|
|
|
case SPVM_OP_C_ID_IS_TYPE: |
4157
|
|
|
|
|
|
|
case SPVM_OP_C_ID_IS_ERROR: |
4158
|
|
|
|
|
|
|
{ |
4159
|
7723
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4160
|
|
|
|
|
|
|
|
4161
|
7723
|
|
|
|
|
|
SPVM_OP* op_type = op_assign_src->last; |
4162
|
7723
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_type); |
4163
|
|
|
|
|
|
|
|
4164
|
7723
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4165
|
|
|
|
|
|
|
|
4166
|
7723
|
100
|
|
|
|
|
if (op_assign_src->id == SPVM_OP_C_ID_ISA) { |
4167
|
4006
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ISA); |
4168
|
|
|
|
|
|
|
} |
4169
|
3717
|
100
|
|
|
|
|
else if (op_assign_src->id == SPVM_OP_C_ID_ISA_ERROR) { |
4170
|
17
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_ISA_ERROR); |
4171
|
|
|
|
|
|
|
} |
4172
|
3700
|
100
|
|
|
|
|
else if (op_assign_src->id == SPVM_OP_C_ID_IS_TYPE) { |
4173
|
3685
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IS_TYPE); |
4174
|
|
|
|
|
|
|
} |
4175
|
15
|
50
|
|
|
|
|
else if (op_assign_src->id == SPVM_OP_C_ID_IS_ERROR) { |
4176
|
15
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_IS_ERROR); |
4177
|
|
|
|
|
|
|
} |
4178
|
|
|
|
|
|
|
|
4179
|
7723
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4180
|
|
|
|
|
|
|
|
4181
|
7723
|
|
|
|
|
|
opcode.operand2 = type->basic_type->id; |
4182
|
7723
|
|
|
|
|
|
int32_t operand3 = type->dimension; |
4183
|
7723
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
4184
|
7723
|
|
|
|
|
|
opcode.operand3 = operand3; |
4185
|
|
|
|
|
|
|
|
4186
|
7723
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4187
|
|
|
|
|
|
|
|
4188
|
7723
|
|
|
|
|
|
break; |
4189
|
|
|
|
|
|
|
} |
4190
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CAN: { |
4191
|
15
|
|
|
|
|
|
SPVM_OP* op_var = op_assign_src->first; |
4192
|
15
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var); |
4193
|
|
|
|
|
|
|
|
4194
|
15
|
|
|
|
|
|
SPVM_TYPE* invocant_decl_type = SPVM_CHECK_get_type(compiler, op_var); |
4195
|
15
|
|
|
|
|
|
SPVM_BASIC_TYPE* invocant_decl_basic_type = invocant_decl_type->basic_type; |
4196
|
15
|
|
|
|
|
|
SPVM_OP* op_name_decl_method = op_assign_src->last; |
4197
|
|
|
|
|
|
|
|
4198
|
15
|
|
|
|
|
|
const char* decl_method_name = op_name_decl_method->uv.name; |
4199
|
15
|
|
|
|
|
|
SPVM_METHOD* decl_method = SPVM_HASH_get(invocant_decl_basic_type->method_symtable, decl_method_name, strlen(decl_method_name)); |
4200
|
|
|
|
|
|
|
|
4201
|
15
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4202
|
|
|
|
|
|
|
|
4203
|
|
|
|
|
|
|
|
4204
|
15
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_CAN); |
4205
|
|
|
|
|
|
|
|
4206
|
15
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
4207
|
15
|
|
|
|
|
|
opcode.operand1 = invocant_decl_basic_type->id; |
4208
|
15
|
|
|
|
|
|
opcode.operand2 = decl_method->index; |
4209
|
|
|
|
|
|
|
|
4210
|
15
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4211
|
|
|
|
|
|
|
|
4212
|
15
|
|
|
|
|
|
break; |
4213
|
|
|
|
|
|
|
} |
4214
|
|
|
|
|
|
|
case SPVM_OP_C_ID_WARN: { |
4215
|
|
|
|
|
|
|
|
4216
|
261
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4217
|
|
|
|
|
|
|
|
4218
|
|
|
|
|
|
|
|
4219
|
261
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_WARN); |
4220
|
|
|
|
|
|
|
|
4221
|
261
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4222
|
261
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
4223
|
261
|
|
|
|
|
|
opcode.operand1 = op_assign->line; |
4224
|
|
|
|
|
|
|
|
4225
|
261
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4226
|
|
|
|
|
|
|
|
4227
|
261
|
|
|
|
|
|
break; |
4228
|
|
|
|
|
|
|
} |
4229
|
|
|
|
|
|
|
case SPVM_OP_C_ID_PRINT: { |
4230
|
|
|
|
|
|
|
|
4231
|
202
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4232
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
|
4234
|
202
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_PRINT); |
4235
|
|
|
|
|
|
|
|
4236
|
202
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4237
|
202
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
4238
|
|
|
|
|
|
|
|
4239
|
202
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4240
|
|
|
|
|
|
|
|
4241
|
202
|
|
|
|
|
|
break; |
4242
|
|
|
|
|
|
|
} |
4243
|
|
|
|
|
|
|
case SPVM_OP_C_ID_SAY: { |
4244
|
|
|
|
|
|
|
|
4245
|
60
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4246
|
|
|
|
|
|
|
|
4247
|
|
|
|
|
|
|
|
4248
|
60
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SAY); |
4249
|
|
|
|
|
|
|
|
4250
|
60
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4251
|
60
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
4252
|
|
|
|
|
|
|
|
4253
|
60
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4254
|
|
|
|
|
|
|
|
4255
|
60
|
|
|
|
|
|
break; |
4256
|
|
|
|
|
|
|
} |
4257
|
|
|
|
|
|
|
case SPVM_OP_C_ID_MAKE_READ_ONLY: { |
4258
|
|
|
|
|
|
|
|
4259
|
1033
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4260
|
|
|
|
|
|
|
|
4261
|
|
|
|
|
|
|
|
4262
|
1033
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MAKE_READ_ONLY); |
4263
|
|
|
|
|
|
|
|
4264
|
1033
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src->first); |
4265
|
1033
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
4266
|
|
|
|
|
|
|
|
4267
|
1033
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4268
|
|
|
|
|
|
|
|
4269
|
1033
|
|
|
|
|
|
break; |
4270
|
|
|
|
|
|
|
} |
4271
|
|
|
|
|
|
|
// $var_dist = ($var_src = ASSIGN) |
4272
|
|
|
|
|
|
|
// $var_dist = (ASSIGN = $var_src) |
4273
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ASSIGN: { |
4274
|
|
|
|
|
|
|
SPVM_OP* op_var_src; |
4275
|
1163
|
100
|
|
|
|
|
if (op_assign_src->first->id == SPVM_OP_C_ID_VAR || op_assign_src->first->id == SPVM_OP_C_ID_ASSIGN) { |
|
|
100
|
|
|
|
|
|
4276
|
257
|
|
|
|
|
|
op_var_src = op_assign_src->first; |
4277
|
|
|
|
|
|
|
} |
4278
|
906
|
50
|
|
|
|
|
else if (op_assign_src->last->id == SPVM_OP_C_ID_VAR || op_assign_src->last->id == SPVM_OP_C_ID_ASSIGN) { |
|
|
0
|
|
|
|
|
|
4279
|
906
|
|
|
|
|
|
op_var_src = op_assign_src->last; |
4280
|
|
|
|
|
|
|
} |
4281
|
|
|
|
|
|
|
else { |
4282
|
0
|
|
|
|
|
|
assert(0); |
4283
|
|
|
|
|
|
|
} |
4284
|
|
|
|
|
|
|
|
4285
|
1163
|
|
|
|
|
|
SPVM_OP* op_var_dist = op_assign->last; |
4286
|
|
|
|
|
|
|
|
4287
|
1163
|
100
|
|
|
|
|
if (SPVM_TYPE_is_byte_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4288
|
65
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4289
|
|
|
|
|
|
|
|
4290
|
65
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_BYTE); |
4291
|
|
|
|
|
|
|
|
4292
|
65
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4293
|
65
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4294
|
|
|
|
|
|
|
|
4295
|
65
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4296
|
65
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4297
|
|
|
|
|
|
|
|
4298
|
65
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4299
|
|
|
|
|
|
|
} |
4300
|
1098
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_short_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4301
|
65
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4302
|
|
|
|
|
|
|
|
4303
|
65
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_SHORT); |
4304
|
|
|
|
|
|
|
|
4305
|
65
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4306
|
65
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4307
|
|
|
|
|
|
|
|
4308
|
65
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4309
|
65
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4310
|
|
|
|
|
|
|
|
4311
|
65
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4312
|
|
|
|
|
|
|
} |
4313
|
1033
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_int_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4314
|
866
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4315
|
|
|
|
|
|
|
|
4316
|
866
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_INT); |
4317
|
|
|
|
|
|
|
|
4318
|
866
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4319
|
866
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4320
|
|
|
|
|
|
|
|
4321
|
866
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4322
|
866
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4323
|
|
|
|
|
|
|
|
4324
|
866
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4325
|
|
|
|
|
|
|
} |
4326
|
167
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_long_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4327
|
57
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4328
|
|
|
|
|
|
|
|
4329
|
57
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_LONG); |
4330
|
|
|
|
|
|
|
|
4331
|
57
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4332
|
57
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4333
|
|
|
|
|
|
|
|
4334
|
57
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4335
|
57
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4336
|
|
|
|
|
|
|
|
4337
|
57
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4338
|
|
|
|
|
|
|
} |
4339
|
110
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_float_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4340
|
51
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4341
|
|
|
|
|
|
|
|
4342
|
51
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_FLOAT); |
4343
|
|
|
|
|
|
|
|
4344
|
51
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4345
|
51
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4346
|
|
|
|
|
|
|
|
4347
|
51
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4348
|
51
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4349
|
|
|
|
|
|
|
|
4350
|
51
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4351
|
|
|
|
|
|
|
} |
4352
|
59
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_double_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4353
|
53
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4354
|
|
|
|
|
|
|
|
4355
|
53
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_DOUBLE); |
4356
|
|
|
|
|
|
|
|
4357
|
53
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4358
|
53
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4359
|
|
|
|
|
|
|
|
4360
|
53
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4361
|
53
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4362
|
|
|
|
|
|
|
|
4363
|
53
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4364
|
|
|
|
|
|
|
} |
4365
|
6
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4366
|
2
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4367
|
|
|
|
|
|
|
|
4368
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_OBJECT); |
4369
|
|
|
|
|
|
|
|
4370
|
2
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4371
|
2
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4372
|
|
|
|
|
|
|
|
4373
|
2
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4374
|
2
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4375
|
|
|
|
|
|
|
|
4376
|
2
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4377
|
|
|
|
|
|
|
} |
4378
|
4
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4379
|
2
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4380
|
|
|
|
|
|
|
|
4381
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_REF); |
4382
|
|
|
|
|
|
|
|
4383
|
2
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_dist); |
4384
|
2
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_var_src); |
4385
|
|
|
|
|
|
|
|
4386
|
2
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4387
|
2
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4388
|
|
|
|
|
|
|
|
4389
|
2
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4390
|
|
|
|
|
|
|
} |
4391
|
2
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, type_dist->basic_type->id, type_dist->dimension, type_dist->flag)) { |
4392
|
2
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(type_dist->basic_type->fields, 0); |
4393
|
2
|
50
|
|
|
|
|
assert(first_field); |
4394
|
|
|
|
|
|
|
|
4395
|
2
|
|
|
|
|
|
SPVM_TYPE* field_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
4396
|
2
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)); |
4397
|
|
|
|
|
|
|
|
4398
|
2
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4399
|
|
|
|
|
|
|
|
4400
|
|
|
|
|
|
|
|
4401
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
4402
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4403
|
2
|
|
|
|
|
|
switch (field_type->basic_type->id) { |
4404
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
4405
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_BYTE); |
4406
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4407
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4408
|
0
|
|
|
|
|
|
break; |
4409
|
|
|
|
|
|
|
} |
4410
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
4411
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_SHORT); |
4412
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4413
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4414
|
0
|
|
|
|
|
|
break; |
4415
|
|
|
|
|
|
|
} |
4416
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
4417
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_INT); |
4418
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4419
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4420
|
0
|
|
|
|
|
|
break; |
4421
|
|
|
|
|
|
|
} |
4422
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
4423
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_LONG); |
4424
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4425
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4426
|
0
|
|
|
|
|
|
break; |
4427
|
|
|
|
|
|
|
} |
4428
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
4429
|
0
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_FLOAT); |
4430
|
0
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4431
|
0
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4432
|
0
|
|
|
|
|
|
break; |
4433
|
|
|
|
|
|
|
} |
4434
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
4435
|
2
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4436
|
2
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4437
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_MOVE_MULNUM_DOUBLE); |
4438
|
2
|
|
|
|
|
|
break; |
4439
|
|
|
|
|
|
|
} |
4440
|
|
|
|
|
|
|
default: { |
4441
|
0
|
|
|
|
|
|
assert(0); |
4442
|
|
|
|
|
|
|
} |
4443
|
|
|
|
|
|
|
} |
4444
|
|
|
|
|
|
|
|
4445
|
2
|
|
|
|
|
|
int32_t fields_length = type_dist->basic_type->fields->length; |
4446
|
2
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4447
|
2
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4448
|
2
|
|
|
|
|
|
opcode.operand2 = fields_length; |
4449
|
|
|
|
|
|
|
|
4450
|
2
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4451
|
|
|
|
|
|
|
} |
4452
|
|
|
|
|
|
|
else { |
4453
|
0
|
|
|
|
|
|
assert(0); |
4454
|
|
|
|
|
|
|
} |
4455
|
3213824
|
|
|
|
|
|
break; |
4456
|
|
|
|
|
|
|
} |
4457
|
|
|
|
|
|
|
} |
4458
|
|
|
|
|
|
|
} |
4459
|
|
|
|
|
|
|
// $VAR = $var |
4460
|
265063
|
100
|
|
|
|
|
else if (op_assign_dist->id == SPVM_OP_C_ID_CLASS_VAR_ACCESS) { |
4461
|
2630
|
|
|
|
|
|
SPVM_OP* op_class_var_access = op_assign_dist; |
4462
|
2630
|
|
|
|
|
|
SPVM_CLASS_VAR_ACCESS* class_var_access = op_class_var_access->uv.class_var_access; |
4463
|
|
|
|
|
|
|
|
4464
|
2630
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
4465
|
|
|
|
|
|
|
|
4466
|
|
|
|
|
|
|
// CLASS_VAR_ACCESS = UNDEF |
4467
|
2630
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
4468
|
112
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4469
|
|
|
|
|
|
|
|
4470
|
112
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_UNDEF); |
4471
|
112
|
|
|
|
|
|
opcode.operand0 = class_var_access->class_var->current_basic_type->id; |
4472
|
112
|
|
|
|
|
|
opcode.operand1 = class_var_access->class_var->index; |
4473
|
112
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4474
|
|
|
|
|
|
|
} |
4475
|
|
|
|
|
|
|
// CLASS_VAR_ACCESS = $var |
4476
|
|
|
|
|
|
|
else { |
4477
|
2518
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_class_var_access); |
4478
|
|
|
|
|
|
|
|
4479
|
2518
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4480
|
|
|
|
|
|
|
|
4481
|
|
|
|
|
|
|
|
4482
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4483
|
2518
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, type->basic_type->id, type->dimension, type->flag)) { |
4484
|
1946
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_OBJECT); |
4485
|
1946
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4486
|
|
|
|
|
|
|
} |
4487
|
|
|
|
|
|
|
else { |
4488
|
572
|
100
|
|
|
|
|
if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4489
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_BYTE); |
4490
|
48
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4491
|
|
|
|
|
|
|
} |
4492
|
524
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4493
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_SHORT); |
4494
|
48
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4495
|
|
|
|
|
|
|
} |
4496
|
476
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4497
|
294
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_INT); |
4498
|
294
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4499
|
|
|
|
|
|
|
} |
4500
|
182
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4501
|
86
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_LONG); |
4502
|
86
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4503
|
|
|
|
|
|
|
} |
4504
|
96
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4505
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_FLOAT); |
4506
|
48
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4507
|
|
|
|
|
|
|
} |
4508
|
48
|
50
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4509
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_CLASS_VAR_DOUBLE); |
4510
|
48
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4511
|
|
|
|
|
|
|
} |
4512
|
|
|
|
|
|
|
else { |
4513
|
0
|
|
|
|
|
|
assert(0); |
4514
|
|
|
|
|
|
|
} |
4515
|
|
|
|
|
|
|
} |
4516
|
|
|
|
|
|
|
|
4517
|
2518
|
|
|
|
|
|
opcode.operand0 = class_var_access->class_var->current_basic_type->id; |
4518
|
2518
|
|
|
|
|
|
opcode.operand1 = class_var_access->class_var->index; |
4519
|
2518
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in; |
4520
|
|
|
|
|
|
|
|
4521
|
2630
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4522
|
|
|
|
|
|
|
} |
4523
|
|
|
|
|
|
|
} |
4524
|
|
|
|
|
|
|
// $$var_ref = $var |
4525
|
262433
|
100
|
|
|
|
|
else if (op_assign_dist->id == SPVM_OP_C_ID_DEREF) { |
4526
|
1660
|
|
|
|
|
|
SPVM_OP* op_deref = op_assign_dist; |
4527
|
|
|
|
|
|
|
|
4528
|
1660
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_CHECK_get_type(compiler, op_deref->first); |
4529
|
|
|
|
|
|
|
|
4530
|
1660
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4531
|
|
|
|
|
|
|
|
4532
|
|
|
|
|
|
|
|
4533
|
1660
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_ref_type(compiler, type->basic_type->id, type->dimension, type->flag)); |
4534
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4535
|
1660
|
100
|
|
|
|
|
if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4536
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_DEREF_BYTE); |
4537
|
18
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4538
|
|
|
|
|
|
|
} |
4539
|
1642
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4540
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_DEREF_SHORT); |
4541
|
18
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4542
|
|
|
|
|
|
|
} |
4543
|
1624
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4544
|
1569
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_DEREF_INT); |
4545
|
1569
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4546
|
|
|
|
|
|
|
} |
4547
|
55
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4548
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_DEREF_LONG); |
4549
|
18
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4550
|
|
|
|
|
|
|
} |
4551
|
37
|
100
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4552
|
18
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_DEREF_FLOAT); |
4553
|
18
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4554
|
|
|
|
|
|
|
} |
4555
|
19
|
50
|
|
|
|
|
else if (type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4556
|
19
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_DEREF_DOUBLE); |
4557
|
19
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4558
|
|
|
|
|
|
|
} |
4559
|
|
|
|
|
|
|
else { |
4560
|
0
|
|
|
|
|
|
assert(0); |
4561
|
|
|
|
|
|
|
} |
4562
|
|
|
|
|
|
|
|
4563
|
1660
|
|
|
|
|
|
int32_t runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_dist); |
4564
|
|
|
|
|
|
|
|
4565
|
1660
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4566
|
1660
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4567
|
1660
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4568
|
|
|
|
|
|
|
} |
4569
|
|
|
|
|
|
|
// $@ = $var |
4570
|
260773
|
100
|
|
|
|
|
else if (op_assign_dist->id == SPVM_OP_C_ID_EXCEPTION_VAR) { |
4571
|
|
|
|
|
|
|
|
4572
|
139243
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
4573
|
|
|
|
|
|
|
|
4574
|
139243
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
4575
|
|
|
|
|
|
|
// EXCEPTION_VAR = undef |
4576
|
1053
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4577
|
|
|
|
|
|
|
|
4578
|
1053
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_EXCEPTION_VAR_UNDEF); |
4579
|
1053
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4580
|
|
|
|
|
|
|
} |
4581
|
|
|
|
|
|
|
else { |
4582
|
|
|
|
|
|
|
// EXCEPTION_VAR = $var |
4583
|
138190
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4584
|
|
|
|
|
|
|
|
4585
|
138190
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_EXCEPTION_VAR); |
4586
|
138190
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4587
|
138190
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_in; |
4588
|
139243
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4589
|
|
|
|
|
|
|
} |
4590
|
|
|
|
|
|
|
} |
4591
|
|
|
|
|
|
|
// $array->[$index] = $var |
4592
|
121530
|
100
|
|
|
|
|
else if (op_assign_dist->id == SPVM_OP_C_ID_ARRAY_ACCESS) { |
4593
|
|
|
|
|
|
|
|
4594
|
|
|
|
|
|
|
// $VAR_ARRAY->[$VAR_INDEX] = $VAR_TERM |
4595
|
|
|
|
|
|
|
|
4596
|
72157
|
|
|
|
|
|
SPVM_OP* op_array_access = op_assign_dist; |
4597
|
72157
|
|
|
|
|
|
SPVM_OP* op_term_array = op_array_access->first; |
4598
|
72157
|
|
|
|
|
|
SPVM_OP* op_term_index = op_array_access->last; |
4599
|
|
|
|
|
|
|
|
4600
|
72157
|
|
|
|
|
|
SPVM_TYPE* array_type = SPVM_CHECK_get_type(compiler, op_term_array); |
4601
|
72157
|
|
|
|
|
|
int32_t array_type_dimension = array_type->dimension; |
4602
|
72157
|
|
|
|
|
|
int32_t array_basic_type_id = array_type->basic_type->id; |
4603
|
72157
|
|
|
|
|
|
int32_t array_basic_type_category = array_type->basic_type->category; |
4604
|
|
|
|
|
|
|
|
4605
|
72157
|
100
|
|
|
|
|
if (SPVM_TYPE_is_any_object_array_type(compiler, array_type->basic_type->id, array_type->dimension, array_type->flag)) { |
4606
|
18183
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
4607
|
|
|
|
|
|
|
|
4608
|
18183
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
4609
|
1542
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4610
|
|
|
|
|
|
|
|
4611
|
|
|
|
|
|
|
|
4612
|
1542
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_UNDEF); |
4613
|
|
|
|
|
|
|
|
4614
|
1542
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
4615
|
1542
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
4616
|
|
|
|
|
|
|
|
4617
|
1542
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_array; |
4618
|
1542
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
4619
|
1542
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4620
|
|
|
|
|
|
|
} |
4621
|
|
|
|
|
|
|
else { |
4622
|
16641
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4623
|
|
|
|
|
|
|
|
4624
|
|
|
|
|
|
|
|
4625
|
16641
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_OBJECT_CHECK_TYPE); |
4626
|
16641
|
|
|
|
|
|
int32_t runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4627
|
|
|
|
|
|
|
|
4628
|
16641
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
4629
|
16641
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
4630
|
|
|
|
|
|
|
|
4631
|
16641
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_array; |
4632
|
16641
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
4633
|
16641
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in; |
4634
|
16641
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4635
|
|
|
|
|
|
|
|
4636
|
18183
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
4637
|
|
|
|
|
|
|
} |
4638
|
|
|
|
|
|
|
} |
4639
|
53974
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_array_type(compiler, array_type->basic_type->id, array_type->dimension, array_type->flag)) { |
4640
|
13
|
|
|
|
|
|
SPVM_FIELD* first_field = SPVM_LIST_get(array_type->basic_type->fields, 0); |
4641
|
|
|
|
|
|
|
|
4642
|
13
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, first_field->op_field); |
4643
|
|
|
|
|
|
|
|
4644
|
13
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4645
|
|
|
|
|
|
|
|
4646
|
|
|
|
|
|
|
|
4647
|
13
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, element_type->basic_type->id, element_type->dimension, element_type->flag)); |
4648
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4649
|
13
|
100
|
|
|
|
|
if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4650
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_BYTE); |
4651
|
2
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4652
|
|
|
|
|
|
|
} |
4653
|
11
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4654
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_SHORT); |
4655
|
2
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4656
|
|
|
|
|
|
|
} |
4657
|
9
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4658
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_INT); |
4659
|
2
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4660
|
|
|
|
|
|
|
} |
4661
|
7
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4662
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_LONG); |
4663
|
2
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4664
|
|
|
|
|
|
|
} |
4665
|
5
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4666
|
2
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FLOAT); |
4667
|
2
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4668
|
|
|
|
|
|
|
} |
4669
|
3
|
50
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4670
|
3
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_DOUBLE); |
4671
|
3
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4672
|
|
|
|
|
|
|
} |
4673
|
|
|
|
|
|
|
else { |
4674
|
0
|
|
|
|
|
|
assert(0); |
4675
|
|
|
|
|
|
|
} |
4676
|
|
|
|
|
|
|
|
4677
|
13
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
4678
|
13
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
4679
|
13
|
|
|
|
|
|
int32_t fields_length = array_type->basic_type->fields->length; |
4680
|
|
|
|
|
|
|
|
4681
|
13
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_array; |
4682
|
13
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
4683
|
13
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in; |
4684
|
13
|
|
|
|
|
|
int32_t operand3 = fields_length; |
4685
|
13
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
4686
|
13
|
|
|
|
|
|
opcode.operand3 = operand3; |
4687
|
|
|
|
|
|
|
|
4688
|
13
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4689
|
|
|
|
|
|
|
|
4690
|
13
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
4691
|
|
|
|
|
|
|
} |
4692
|
|
|
|
|
|
|
else { |
4693
|
|
|
|
|
|
|
|
4694
|
53961
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
4695
|
|
|
|
|
|
|
|
4696
|
53961
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, element_type->basic_type->id, element_type->dimension, element_type->flag)) { |
4697
|
43
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4698
|
|
|
|
|
|
|
|
4699
|
|
|
|
|
|
|
|
4700
|
43
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_UNDEF); |
4701
|
|
|
|
|
|
|
|
4702
|
43
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
4703
|
43
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
4704
|
|
|
|
|
|
|
|
4705
|
43
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_array; |
4706
|
43
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
4707
|
43
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4708
|
|
|
|
|
|
|
|
4709
|
43
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
4710
|
|
|
|
|
|
|
} |
4711
|
|
|
|
|
|
|
else { |
4712
|
53918
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4713
|
|
|
|
|
|
|
|
4714
|
|
|
|
|
|
|
|
4715
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4716
|
53918
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, element_type->basic_type->id, element_type->dimension, element_type->flag)) { |
4717
|
42699
|
100
|
|
|
|
|
if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4718
|
11271
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_BYTE); |
4719
|
11271
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4720
|
|
|
|
|
|
|
} |
4721
|
31428
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4722
|
5372
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_SHORT); |
4723
|
5372
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4724
|
|
|
|
|
|
|
} |
4725
|
26056
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4726
|
9947
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_INT); |
4727
|
9947
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4728
|
|
|
|
|
|
|
} |
4729
|
16109
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4730
|
5360
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_LONG); |
4731
|
5360
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4732
|
|
|
|
|
|
|
} |
4733
|
10749
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4734
|
5346
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_FLOAT); |
4735
|
5346
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4736
|
|
|
|
|
|
|
} |
4737
|
5403
|
50
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4738
|
5403
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_DOUBLE); |
4739
|
5403
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4740
|
|
|
|
|
|
|
} |
4741
|
|
|
|
|
|
|
else { |
4742
|
0
|
|
|
|
|
|
assert(0); |
4743
|
|
|
|
|
|
|
} |
4744
|
|
|
|
|
|
|
} |
4745
|
|
|
|
|
|
|
else { |
4746
|
|
|
|
|
|
|
int32_t is_check_type; |
4747
|
11219
|
100
|
|
|
|
|
if (array_type_dimension == 1) { |
4748
|
11168
|
100
|
|
|
|
|
switch (array_basic_type_category) { |
4749
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE: |
4750
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_ANY_OBJECT: |
4751
|
|
|
|
|
|
|
{ |
4752
|
14
|
|
|
|
|
|
is_check_type = 1; |
4753
|
14
|
|
|
|
|
|
break; |
4754
|
|
|
|
|
|
|
} |
4755
|
|
|
|
|
|
|
default: { |
4756
|
11154
|
|
|
|
|
|
is_check_type = 0; |
4757
|
11154
|
|
|
|
|
|
break; |
4758
|
|
|
|
|
|
|
} |
4759
|
|
|
|
|
|
|
} |
4760
|
|
|
|
|
|
|
} |
4761
|
|
|
|
|
|
|
|
4762
|
11219
|
100
|
|
|
|
|
if (is_check_type) { |
4763
|
28
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_OBJECT_CHECK_TYPE); |
4764
|
|
|
|
|
|
|
} |
4765
|
|
|
|
|
|
|
else { |
4766
|
11191
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_ARRAY_ELEMENT_OBJECT); |
4767
|
|
|
|
|
|
|
} |
4768
|
11219
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4769
|
|
|
|
|
|
|
} |
4770
|
|
|
|
|
|
|
|
4771
|
53918
|
|
|
|
|
|
int32_t runtime_var_index_array = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_array); |
4772
|
53918
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
4773
|
|
|
|
|
|
|
|
4774
|
53918
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_array; |
4775
|
53918
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
4776
|
53918
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in; |
4777
|
53918
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4778
|
|
|
|
|
|
|
|
4779
|
72157
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
4780
|
|
|
|
|
|
|
} |
4781
|
|
|
|
|
|
|
} |
4782
|
|
|
|
|
|
|
} |
4783
|
|
|
|
|
|
|
// $invocant->{FIELD_NAME} = $var |
4784
|
49373
|
100
|
|
|
|
|
else if (op_assign_dist->id == SPVM_OP_C_ID_FIELD_ACCESS) { |
4785
|
|
|
|
|
|
|
|
4786
|
48405
|
|
|
|
|
|
SPVM_OP* op_field_access = op_assign_dist; |
4787
|
48405
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_field_access->first; |
4788
|
|
|
|
|
|
|
|
4789
|
|
|
|
|
|
|
// Call field |
4790
|
48405
|
|
|
|
|
|
SPVM_FIELD_ACCESS* field_access = op_field_access->uv.field_access; |
4791
|
|
|
|
|
|
|
|
4792
|
48405
|
|
|
|
|
|
SPVM_TYPE* src_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
4793
|
|
|
|
|
|
|
|
4794
|
48405
|
|
|
|
|
|
SPVM_TYPE* invocant_type = SPVM_CHECK_get_type(compiler, op_term_invocant); |
4795
|
|
|
|
|
|
|
|
4796
|
48405
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_ref_type(compiler, invocant_type->basic_type->id, invocant_type->dimension, invocant_type->flag)) { |
4797
|
182
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
4798
|
|
|
|
|
|
|
|
4799
|
182
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4800
|
|
|
|
|
|
|
|
4801
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4802
|
182
|
|
|
|
|
|
switch (src_type->basic_type->id) { |
4803
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE: { |
4804
|
24
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DEREF_BYTE); |
4805
|
24
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4806
|
24
|
|
|
|
|
|
break; |
4807
|
|
|
|
|
|
|
} |
4808
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT: { |
4809
|
24
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DEREF_SHORT); |
4810
|
24
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4811
|
24
|
|
|
|
|
|
break; |
4812
|
|
|
|
|
|
|
} |
4813
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_INT: { |
4814
|
48
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DEREF_INT); |
4815
|
48
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4816
|
48
|
|
|
|
|
|
break; |
4817
|
|
|
|
|
|
|
} |
4818
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_LONG: { |
4819
|
24
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DEREF_LONG); |
4820
|
24
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4821
|
24
|
|
|
|
|
|
break; |
4822
|
|
|
|
|
|
|
} |
4823
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT: { |
4824
|
30
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DEREF_FLOAT); |
4825
|
30
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4826
|
30
|
|
|
|
|
|
break; |
4827
|
|
|
|
|
|
|
} |
4828
|
|
|
|
|
|
|
case SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE: { |
4829
|
32
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DEREF_DOUBLE); |
4830
|
32
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4831
|
32
|
|
|
|
|
|
break; |
4832
|
|
|
|
|
|
|
} |
4833
|
|
|
|
|
|
|
default: { |
4834
|
0
|
|
|
|
|
|
assert(0); |
4835
|
|
|
|
|
|
|
} |
4836
|
|
|
|
|
|
|
} |
4837
|
|
|
|
|
|
|
|
4838
|
182
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4839
|
182
|
|
|
|
|
|
int32_t field_offset = field->index; |
4840
|
|
|
|
|
|
|
|
4841
|
182
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_invocant; |
4842
|
182
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4843
|
182
|
|
|
|
|
|
opcode.operand2 = field_offset; |
4844
|
|
|
|
|
|
|
|
4845
|
182
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4846
|
|
|
|
|
|
|
} |
4847
|
48223
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, invocant_type->basic_type->id, invocant_type->dimension, invocant_type->flag)) { |
4848
|
947
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4849
|
|
|
|
|
|
|
|
4850
|
|
|
|
|
|
|
|
4851
|
947
|
50
|
|
|
|
|
assert(SPVM_TYPE_is_numeric_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)); |
4852
|
|
|
|
|
|
|
int32_t runtime_var_index_out; |
4853
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4854
|
947
|
100
|
|
|
|
|
if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4855
|
158
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_BYTE); |
4856
|
158
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4857
|
158
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4858
|
|
|
|
|
|
|
} |
4859
|
789
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4860
|
154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_SHORT); |
4861
|
154
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4862
|
154
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4863
|
|
|
|
|
|
|
} |
4864
|
635
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4865
|
154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_INT); |
4866
|
154
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4867
|
154
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4868
|
|
|
|
|
|
|
} |
4869
|
481
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4870
|
154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_LONG); |
4871
|
154
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4872
|
154
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4873
|
|
|
|
|
|
|
} |
4874
|
327
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4875
|
148
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_FLOAT); |
4876
|
148
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4877
|
148
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4878
|
|
|
|
|
|
|
} |
4879
|
179
|
50
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4880
|
179
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_FIELD_DOUBLE); |
4881
|
179
|
|
|
|
|
|
runtime_var_index_out = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4882
|
179
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4883
|
|
|
|
|
|
|
} |
4884
|
|
|
|
|
|
|
else { |
4885
|
0
|
|
|
|
|
|
assert(0); |
4886
|
|
|
|
|
|
|
} |
4887
|
|
|
|
|
|
|
|
4888
|
947
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
4889
|
947
|
|
|
|
|
|
int32_t field_offset = field->index; |
4890
|
|
|
|
|
|
|
|
4891
|
947
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_out; |
4892
|
947
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4893
|
947
|
|
|
|
|
|
opcode.operand2 = field_offset; |
4894
|
|
|
|
|
|
|
|
4895
|
947
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4896
|
|
|
|
|
|
|
} |
4897
|
|
|
|
|
|
|
else { |
4898
|
47276
|
100
|
|
|
|
|
if (SPVM_TYPE_is_undef_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
4899
|
1037
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4900
|
|
|
|
|
|
|
|
4901
|
1037
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_UNDEF); |
4902
|
|
|
|
|
|
|
|
4903
|
1037
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4904
|
|
|
|
|
|
|
|
4905
|
1037
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
4906
|
|
|
|
|
|
|
|
4907
|
1037
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_invocant; |
4908
|
1037
|
|
|
|
|
|
opcode.operand2 = field->current_basic_type->id; |
4909
|
1037
|
|
|
|
|
|
opcode.operand3 = (uint16_t)field->index; |
4910
|
1037
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4911
|
|
|
|
|
|
|
|
4912
|
1037
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
4913
|
|
|
|
|
|
|
} |
4914
|
|
|
|
|
|
|
else { |
4915
|
46239
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4916
|
|
|
|
|
|
|
|
4917
|
|
|
|
|
|
|
|
4918
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4919
|
46239
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
4920
|
34291
|
100
|
|
|
|
|
if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4921
|
1135
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_BYTE); |
4922
|
1135
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4923
|
|
|
|
|
|
|
} |
4924
|
33156
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4925
|
1135
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_SHORT); |
4926
|
1135
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4927
|
|
|
|
|
|
|
} |
4928
|
32021
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
4929
|
28616
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_INT); |
4930
|
28616
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4931
|
|
|
|
|
|
|
} |
4932
|
3405
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
4933
|
1135
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_LONG); |
4934
|
1135
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4935
|
|
|
|
|
|
|
} |
4936
|
2270
|
100
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
4937
|
1135
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_FLOAT); |
4938
|
1135
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4939
|
|
|
|
|
|
|
} |
4940
|
1135
|
50
|
|
|
|
|
else if (src_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
4941
|
1135
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_DOUBLE); |
4942
|
1135
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4943
|
|
|
|
|
|
|
} |
4944
|
|
|
|
|
|
|
else { |
4945
|
0
|
|
|
|
|
|
assert(0); |
4946
|
|
|
|
|
|
|
} |
4947
|
|
|
|
|
|
|
} |
4948
|
11948
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, src_type->basic_type->id, src_type->dimension, src_type->flag)) { |
4949
|
11948
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_FIELD_OBJECT); |
4950
|
11948
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4951
|
|
|
|
|
|
|
} |
4952
|
|
|
|
|
|
|
else { |
4953
|
0
|
|
|
|
|
|
assert(0); |
4954
|
|
|
|
|
|
|
} |
4955
|
|
|
|
|
|
|
|
4956
|
46239
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
4957
|
|
|
|
|
|
|
|
4958
|
46239
|
|
|
|
|
|
SPVM_FIELD* field = field_access->field; |
4959
|
|
|
|
|
|
|
|
4960
|
46239
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_invocant; |
4961
|
46239
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_in; |
4962
|
46239
|
|
|
|
|
|
opcode.operand2 = field->current_basic_type->id; |
4963
|
46239
|
|
|
|
|
|
opcode.operand3 = (uint16_t)field->index; |
4964
|
46239
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
4965
|
|
|
|
|
|
|
|
4966
|
48405
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
4967
|
|
|
|
|
|
|
} |
4968
|
|
|
|
|
|
|
} |
4969
|
|
|
|
|
|
|
} |
4970
|
|
|
|
|
|
|
// $mulnum_array->[$index]{FIELD_NAME} = $var |
4971
|
968
|
50
|
|
|
|
|
else if (op_assign_dist->id == SPVM_OP_C_ID_ARRAY_FIELD_ACCESS) { |
4972
|
|
|
|
|
|
|
|
4973
|
968
|
|
|
|
|
|
SPVM_OP* op_array_field_access = op_assign_dist; |
4974
|
968
|
|
|
|
|
|
SPVM_OP* op_term_invocant = op_array_field_access->first; |
4975
|
968
|
|
|
|
|
|
SPVM_OP* op_term_index = op_array_field_access->last; |
4976
|
|
|
|
|
|
|
|
4977
|
|
|
|
|
|
|
// Call field |
4978
|
968
|
|
|
|
|
|
SPVM_ARRAY_FIELD_ACCESS* array_field_access = op_array_field_access->uv.array_field_access; |
4979
|
968
|
|
|
|
|
|
SPVM_FIELD* field = array_field_access->field; |
4980
|
|
|
|
|
|
|
|
4981
|
|
|
|
|
|
|
// Array type |
4982
|
968
|
|
|
|
|
|
SPVM_TYPE* array_type = SPVM_CHECK_get_type(compiler, op_array_field_access->first); |
4983
|
968
|
|
|
|
|
|
SPVM_BASIC_TYPE* array_basic_type = array_type->basic_type; |
4984
|
|
|
|
|
|
|
|
4985
|
|
|
|
|
|
|
// Element type |
4986
|
968
|
|
|
|
|
|
SPVM_TYPE* element_type = SPVM_CHECK_get_type(compiler, op_assign_src); |
4987
|
|
|
|
|
|
|
|
4988
|
968
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
4989
|
|
|
|
|
|
|
|
4990
|
|
|
|
|
|
|
|
4991
|
|
|
|
|
|
|
int32_t runtime_var_index_in; |
4992
|
968
|
100
|
|
|
|
|
if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) { |
4993
|
154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FIELD_BYTE); |
4994
|
154
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4995
|
|
|
|
|
|
|
} |
4996
|
814
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) { |
4997
|
154
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FIELD_SHORT); |
4998
|
154
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
4999
|
|
|
|
|
|
|
} |
5000
|
660
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) { |
5001
|
172
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FIELD_INT); |
5002
|
172
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
5003
|
|
|
|
|
|
|
} |
5004
|
488
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) { |
5005
|
148
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FIELD_LONG); |
5006
|
148
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
5007
|
|
|
|
|
|
|
} |
5008
|
340
|
100
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) { |
5009
|
160
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FIELD_FLOAT); |
5010
|
160
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
5011
|
|
|
|
|
|
|
} |
5012
|
180
|
50
|
|
|
|
|
else if (element_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) { |
5013
|
180
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_SET_MULNUM_ARRAY_FIELD_DOUBLE); |
5014
|
180
|
|
|
|
|
|
runtime_var_index_in = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_assign_src); |
5015
|
|
|
|
|
|
|
} |
5016
|
|
|
|
|
|
|
else { |
5017
|
0
|
|
|
|
|
|
assert(0); |
5018
|
|
|
|
|
|
|
} |
5019
|
|
|
|
|
|
|
|
5020
|
968
|
|
|
|
|
|
int32_t runtime_var_index_invocant = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_invocant); |
5021
|
968
|
|
|
|
|
|
int32_t runtime_var_index_index = SPVM_OPCODE_BUILDER_get_runtime_var_index(compiler, op_term_index); |
5022
|
|
|
|
|
|
|
|
5023
|
968
|
|
|
|
|
|
int32_t fields_length = array_basic_type->fields->length; |
5024
|
968
|
|
|
|
|
|
int32_t field_offset = field->index; |
5025
|
|
|
|
|
|
|
|
5026
|
968
|
|
|
|
|
|
opcode.operand0 = runtime_var_index_invocant; |
5027
|
968
|
|
|
|
|
|
opcode.operand1 = runtime_var_index_index; |
5028
|
968
|
|
|
|
|
|
opcode.operand2 = runtime_var_index_in; |
5029
|
968
|
|
|
|
|
|
int32_t operand3 = (field_offset << 8) + (fields_length - 1); |
5030
|
968
|
50
|
|
|
|
|
assert(operand3 < 0xFFFF); |
5031
|
968
|
|
|
|
|
|
opcode.operand3 = operand3; |
5032
|
|
|
|
|
|
|
|
5033
|
968
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
5034
|
|
|
|
|
|
|
|
5035
|
968
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception(compiler, opcode_list, eval_block_stack_goto_opcode_index->length, unresolved_goto_end_of_eval_on_exception_opcode_index_stack, unresolved_goto_end_of_method_on_exception_opcode_index_stack, method->op_method, op_cur->line); |
5036
|
|
|
|
|
|
|
} |
5037
|
|
|
|
|
|
|
else { |
5038
|
0
|
|
|
|
|
|
assert(0); |
5039
|
|
|
|
|
|
|
} |
5040
|
|
|
|
|
|
|
|
5041
|
3478887
|
|
|
|
|
|
break; |
5042
|
|
|
|
|
|
|
} |
5043
|
|
|
|
|
|
|
} |
5044
|
|
|
|
|
|
|
|
5045
|
|
|
|
|
|
|
// [END]Postorder traversal position |
5046
|
|
|
|
|
|
|
|
5047
|
21820761
|
100
|
|
|
|
|
if (op_cur == op_base) { |
5048
|
214317
|
|
|
|
|
|
finish = 1; |
5049
|
214317
|
|
|
|
|
|
break; |
5050
|
|
|
|
|
|
|
} |
5051
|
|
|
|
|
|
|
|
5052
|
|
|
|
|
|
|
// Next sibling |
5053
|
21606444
|
100
|
|
|
|
|
if (op_cur->moresib) { |
5054
|
9377458
|
|
|
|
|
|
op_cur = SPVM_OP_sibling(compiler, op_cur); |
5055
|
9377458
|
|
|
|
|
|
break; |
5056
|
|
|
|
|
|
|
} |
5057
|
|
|
|
|
|
|
// Next is parent |
5058
|
|
|
|
|
|
|
else { |
5059
|
12228986
|
|
|
|
|
|
op_cur = op_cur->sibparent; |
5060
|
|
|
|
|
|
|
} |
5061
|
12228986
|
|
|
|
|
|
} |
5062
|
9591775
|
100
|
|
|
|
|
if (finish) { |
5063
|
214317
|
|
|
|
|
|
break; |
5064
|
|
|
|
|
|
|
} |
5065
|
|
|
|
|
|
|
} |
5066
|
|
|
|
|
|
|
} |
5067
|
|
|
|
|
|
|
|
5068
|
|
|
|
|
|
|
// Free list |
5069
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_if_eq_or_if_ne_opcode_index_stack); |
5070
|
220002
|
|
|
|
|
|
SPVM_LIST_free(if_block_stack_goto_end_opcode_index); |
5071
|
220002
|
|
|
|
|
|
SPVM_LIST_free(loop_block_stack_goto_opcode_index); |
5072
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_last_opcode_index_stack); |
5073
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_break_opcode_index_stack); |
5074
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_next_opcode_index_stack); |
5075
|
220002
|
|
|
|
|
|
SPVM_LIST_free(eval_block_stack_goto_opcode_index); |
5076
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_goto_end_of_eval_on_exception_opcode_index_stack); |
5077
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_goto_end_of_method_on_exception_opcode_index_stack); |
5078
|
220002
|
|
|
|
|
|
SPVM_LIST_free(unresolved_return_opcode_index_stack); |
5079
|
220002
|
|
|
|
|
|
SPVM_LIST_free(switch_stack_switch_info); |
5080
|
220002
|
|
|
|
|
|
SPVM_LIST_free(loop_block_stack_next_base); |
5081
|
220002
|
|
|
|
|
|
SPVM_LIST_free(loop_block_stack_last_base); |
5082
|
220002
|
|
|
|
|
|
SPVM_LIST_free(switch_block_stack_break_base); |
5083
|
220002
|
|
|
|
|
|
SPVM_LIST_free(mortal_stack); |
5084
|
220002
|
|
|
|
|
|
SPVM_LIST_free(block_stack_runtime_var_index_top); |
5085
|
|
|
|
|
|
|
|
5086
|
|
|
|
|
|
|
END_OF_FUNCTION: { |
5087
|
|
|
|
|
|
|
|
5088
|
284473
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
5089
|
|
|
|
|
|
|
|
5090
|
284473
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_END_METHOD); |
5091
|
284473
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
5092
|
|
|
|
|
|
|
|
5093
|
284473
|
|
|
|
|
|
method->mortal_stack_length = mortal_stack_top + 1; |
5094
|
|
|
|
|
|
|
} |
5095
|
|
|
|
|
|
|
} |
5096
|
|
|
|
|
|
|
} |
5097
|
|
|
|
|
|
|
|
5098
|
|
|
|
|
|
|
#ifdef SPVM_DEBUG_COMPILE |
5099
|
|
|
|
|
|
|
fprintf(stderr, "\n[Opcodes]\n"); |
5100
|
|
|
|
|
|
|
SPVM_DUMPER_dump_basic_types_opcode_list(compiler, compiler->basic_types); |
5101
|
|
|
|
|
|
|
#endif |
5102
|
|
|
|
|
|
|
|
5103
|
3041
|
|
|
|
|
|
} |
5104
|
|
|
|
|
|
|
|
5105
|
9340409
|
|
|
|
|
|
void SPVM_OPCODE_BUILDER_set_opcode_id(SPVM_COMPILER* compiler, SPVM_OPCODE* opcode, int32_t opcode_id) { |
5106
|
9340409
|
|
|
|
|
|
opcode->id = opcode_id; |
5107
|
9340409
|
|
|
|
|
|
} |
5108
|
|
|
|
|
|
|
|
5109
|
899459
|
|
|
|
|
|
void SPVM_OPCODE_BUILDER_push_unresolved_goto_end_of_eval_or_end_of_method_on_exception( |
5110
|
|
|
|
|
|
|
SPVM_COMPILER* compiler, |
5111
|
|
|
|
|
|
|
SPVM_OPCODE_LIST* opcode_list, |
5112
|
|
|
|
|
|
|
int32_t in_eval_block, |
5113
|
|
|
|
|
|
|
SPVM_LIST* unresolved_goto_end_of_eval_on_exception_opcode_index_stack, |
5114
|
|
|
|
|
|
|
SPVM_LIST* unresolved_goto_end_of_method_on_exception_opcode_index_stack, |
5115
|
|
|
|
|
|
|
SPVM_OP* op_method, |
5116
|
|
|
|
|
|
|
int32_t line |
5117
|
|
|
|
|
|
|
) |
5118
|
|
|
|
|
|
|
{ |
5119
|
899459
|
|
|
|
|
|
SPVM_METHOD* method = op_method->uv.method; |
5120
|
899459
|
|
|
|
|
|
int32_t method_opcodes_base_address_id = 0; |
5121
|
|
|
|
|
|
|
|
5122
|
899459
|
100
|
|
|
|
|
if (in_eval_block) { |
5123
|
2844
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
5124
|
|
|
|
|
|
|
|
5125
|
2844
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO_END_OF_EVAL_ON_EXCEPTION); |
5126
|
|
|
|
|
|
|
|
5127
|
2844
|
|
|
|
|
|
opcode.operand2 = line; |
5128
|
|
|
|
|
|
|
|
5129
|
2844
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
5130
|
|
|
|
|
|
|
|
5131
|
2844
|
|
|
|
|
|
int32_t goto_end_of_eval_on_exception_opcode_index = opcode_list->length - 1; |
5132
|
|
|
|
|
|
|
|
5133
|
2844
|
|
|
|
|
|
SPVM_LIST_push(unresolved_goto_end_of_eval_on_exception_opcode_index_stack, (void*)(intptr_t)goto_end_of_eval_on_exception_opcode_index); |
5134
|
|
|
|
|
|
|
} |
5135
|
|
|
|
|
|
|
else { |
5136
|
896615
|
|
|
|
|
|
SPVM_OPCODE opcode = {0}; |
5137
|
|
|
|
|
|
|
|
5138
|
896615
|
|
|
|
|
|
SPVM_OPCODE_BUILDER_set_opcode_id(compiler, &opcode, SPVM_OPCODE_C_ID_GOTO_END_OF_METHOD_ON_EXCEPTION); |
5139
|
896615
|
|
|
|
|
|
opcode.operand2 = line; |
5140
|
896615
|
|
|
|
|
|
SPVM_OPCODE_LIST_push_opcode(compiler, opcode_list, &opcode); |
5141
|
|
|
|
|
|
|
|
5142
|
896615
|
|
|
|
|
|
int32_t goto_end_of_method_on_exception_opcode_index = opcode_list->length - 1; |
5143
|
|
|
|
|
|
|
|
5144
|
896615
|
|
|
|
|
|
SPVM_LIST_push(unresolved_goto_end_of_method_on_exception_opcode_index_stack, (void*)(intptr_t)(goto_end_of_method_on_exception_opcode_index)); |
5145
|
|
|
|
|
|
|
} |
5146
|
899459
|
|
|
|
|
|
} |
5147
|
|
|
|
|
|
|
|
5148
|
7265893
|
|
|
|
|
|
int32_t SPVM_OPCODE_BUILDER_get_runtime_var_index(SPVM_COMPILER* compiler, SPVM_OP* op) { |
5149
|
|
|
|
|
|
|
(void)compiler; |
5150
|
|
|
|
|
|
|
|
5151
|
7265893
|
50
|
|
|
|
|
switch (op->id) { |
5152
|
|
|
|
|
|
|
case SPVM_OP_C_ID_BOOL: |
5153
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_EQ: |
5154
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_NE: |
5155
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_GT: |
5156
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_GE: |
5157
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_LT: |
5158
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_LE: |
5159
|
|
|
|
|
|
|
case SPVM_OP_C_ID_NUMERIC_CMP: |
5160
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_EQ: |
5161
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_NE: |
5162
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_GT: |
5163
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_GE: |
5164
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LT: |
5165
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_LE: |
5166
|
|
|
|
|
|
|
case SPVM_OP_C_ID_STRING_CMP: |
5167
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ISA: |
5168
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ISA_ERROR: |
5169
|
|
|
|
|
|
|
case SPVM_OP_C_ID_IS_TYPE: |
5170
|
|
|
|
|
|
|
case SPVM_OP_C_ID_IS_ERROR: |
5171
|
|
|
|
|
|
|
case SPVM_OP_C_ID_IS_COMPILE_TYPE: |
5172
|
|
|
|
|
|
|
case SPVM_OP_C_ID_ISWEAK_FIELD: |
5173
|
|
|
|
|
|
|
case SPVM_OP_C_ID_CAN: |
5174
|
|
|
|
|
|
|
{ |
5175
|
0
|
|
|
|
|
|
return 0; |
5176
|
|
|
|
|
|
|
} |
5177
|
|
|
|
|
|
|
default: { |
5178
|
|
|
|
|
|
|
SPVM_OP* op_var; |
5179
|
7265893
|
100
|
|
|
|
|
if (op->id == SPVM_OP_C_ID_VAR) { |
5180
|
5512804
|
|
|
|
|
|
op_var = op; |
5181
|
|
|
|
|
|
|
} |
5182
|
1753089
|
100
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_ASSIGN) { |
5183
|
1735845
|
100
|
|
|
|
|
if (op->first->id == SPVM_OP_C_ID_VAR || op->first->id == SPVM_OP_C_ID_ASSIGN) { |
|
|
100
|
|
|
|
|
|
5184
|
8
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->first); |
5185
|
|
|
|
|
|
|
} |
5186
|
1735837
|
50
|
|
|
|
|
else if (op->last->id == SPVM_OP_C_ID_VAR || op->last->id == SPVM_OP_C_ID_ASSIGN) { |
|
|
0
|
|
|
|
|
|
5187
|
1735837
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->last); |
5188
|
|
|
|
|
|
|
} |
5189
|
|
|
|
|
|
|
else { |
5190
|
1735845
|
|
|
|
|
|
assert(0); |
5191
|
|
|
|
|
|
|
} |
5192
|
|
|
|
|
|
|
} |
5193
|
17244
|
100
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_SEQUENCE) { |
5194
|
8727
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->last); |
5195
|
|
|
|
|
|
|
} |
5196
|
8517
|
100
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_CREATE_REF) { |
5197
|
4970
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->first); |
5198
|
|
|
|
|
|
|
} |
5199
|
3547
|
50
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_DEREF) { |
5200
|
3547
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->first); |
5201
|
|
|
|
|
|
|
} |
5202
|
|
|
|
|
|
|
else { |
5203
|
0
|
|
|
|
|
|
spvm_warn("Unexpcted op:%s", SPVM_OP_get_op_name(compiler, op->id)); |
5204
|
0
|
|
|
|
|
|
assert(0); |
5205
|
|
|
|
|
|
|
} |
5206
|
|
|
|
|
|
|
|
5207
|
7265893
|
|
|
|
|
|
return op_var->uv.var->var_decl->runtime_var_index; |
5208
|
|
|
|
|
|
|
} |
5209
|
|
|
|
|
|
|
} |
5210
|
|
|
|
|
|
|
|
5211
|
|
|
|
|
|
|
return -1; |
5212
|
|
|
|
|
|
|
} |
5213
|
|
|
|
|
|
|
|
5214
|
1753103
|
|
|
|
|
|
SPVM_OP* SPVM_OPCODE_BUILDER_get_returned_op_var(SPVM_COMPILER* compiler, SPVM_OP* op) { |
5215
|
|
|
|
|
|
|
(void)compiler; |
5216
|
|
|
|
|
|
|
|
5217
|
|
|
|
|
|
|
SPVM_OP* op_var; |
5218
|
1753103
|
100
|
|
|
|
|
if (op->id == SPVM_OP_C_ID_VAR) { |
5219
|
1753089
|
|
|
|
|
|
op_var = op; |
5220
|
|
|
|
|
|
|
} |
5221
|
14
|
50
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_ASSIGN) { |
5222
|
14
|
50
|
|
|
|
|
if (op->first->id == SPVM_OP_C_ID_VAR || op->first->id == SPVM_OP_C_ID_ASSIGN) { |
|
|
50
|
|
|
|
|
|
5223
|
0
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->first); |
5224
|
|
|
|
|
|
|
} |
5225
|
14
|
50
|
|
|
|
|
else if (op->last->id == SPVM_OP_C_ID_VAR || op->last->id == SPVM_OP_C_ID_ASSIGN) { |
|
|
0
|
|
|
|
|
|
5226
|
14
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->last); |
5227
|
|
|
|
|
|
|
} |
5228
|
|
|
|
|
|
|
else { |
5229
|
14
|
|
|
|
|
|
assert(0); |
5230
|
|
|
|
|
|
|
} |
5231
|
|
|
|
|
|
|
} |
5232
|
0
|
0
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_SEQUENCE) { |
5233
|
0
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->last); |
5234
|
|
|
|
|
|
|
} |
5235
|
0
|
0
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_CREATE_REF) { |
5236
|
0
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->first); |
5237
|
|
|
|
|
|
|
} |
5238
|
0
|
0
|
|
|
|
|
else if (op->id == SPVM_OP_C_ID_DEREF) { |
5239
|
0
|
|
|
|
|
|
op_var = SPVM_OPCODE_BUILDER_get_returned_op_var(compiler, op->first); |
5240
|
|
|
|
|
|
|
} |
5241
|
|
|
|
|
|
|
else { |
5242
|
0
|
|
|
|
|
|
spvm_warn("Unexpcted op:%s", SPVM_OP_get_op_name(compiler, op->id)); |
5243
|
0
|
|
|
|
|
|
assert(0); |
5244
|
|
|
|
|
|
|
} |
5245
|
|
|
|
|
|
|
|
5246
|
1753103
|
|
|
|
|
|
return op_var; |
5247
|
|
|
|
|
|
|
} |
5248
|
|
|
|
|
|
|
|