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
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "spvm_compiler.h" |
9
|
|
|
|
|
|
|
#include "spvm_type.h" |
10
|
|
|
|
|
|
|
#include "spvm_list.h" |
11
|
|
|
|
|
|
|
#include "spvm_op.h" |
12
|
|
|
|
|
|
|
#include "spvm_allocator.h" |
13
|
|
|
|
|
|
|
#include "spvm_hash.h" |
14
|
|
|
|
|
|
|
#include "spvm_yacc_util.h" |
15
|
|
|
|
|
|
|
#include "spvm_basic_type.h" |
16
|
|
|
|
|
|
|
#include "spvm_field.h" |
17
|
|
|
|
|
|
|
#include "spvm_method.h" |
18
|
|
|
|
|
|
|
#include "spvm_constant.h" |
19
|
|
|
|
|
|
|
|
20
|
7399882
|
|
|
|
|
|
int32_t SPVM_TYPE_is_ref_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
21
|
|
|
|
|
|
|
|
22
|
7399882
|
|
|
|
|
|
return flag & SPVM_NATIVE_C_TYPE_FLAG_REF; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
325085
|
|
|
|
|
|
int32_t SPVM_TYPE_is_byte_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
26
|
|
|
|
|
|
|
|
27
|
325085
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
28
|
97489
|
|
|
|
|
|
return 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
227596
|
|
|
|
|
|
return 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
4193956
|
|
|
|
|
|
int32_t SPVM_TYPE_is_void_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
36
|
|
|
|
|
|
|
|
37
|
4193956
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_VOID) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
38
|
566506
|
|
|
|
|
|
return 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
3627450
|
|
|
|
|
|
return 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
227872
|
|
|
|
|
|
int32_t SPVM_TYPE_is_short_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
46
|
|
|
|
|
|
|
|
47
|
227872
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
48
|
15764
|
|
|
|
|
|
return 1; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
else { |
51
|
212108
|
|
|
|
|
|
return 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
204421
|
|
|
|
|
|
int32_t SPVM_TYPE_is_int_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
56
|
|
|
|
|
|
|
|
57
|
204421
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
58
|
132228
|
|
|
|
|
|
return 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
72193
|
|
|
|
|
|
return 0; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
84156
|
|
|
|
|
|
int32_t SPVM_TYPE_is_long_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
66
|
|
|
|
|
|
|
|
67
|
84156
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
68
|
11914
|
|
|
|
|
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
72242
|
|
|
|
|
|
return 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
71194
|
|
|
|
|
|
int32_t SPVM_TYPE_is_float_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
76
|
|
|
|
|
|
|
|
77
|
71194
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
78
|
5369
|
|
|
|
|
|
return 1; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
else { |
81
|
65825
|
|
|
|
|
|
return 0; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
70079
|
|
|
|
|
|
int32_t SPVM_TYPE_is_double_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
86
|
|
|
|
|
|
|
|
87
|
70079
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
88
|
8697
|
|
|
|
|
|
return 1; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else { |
91
|
61382
|
|
|
|
|
|
return 0; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
17883605
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
96
|
|
|
|
|
|
|
|
97
|
17883605
|
|
|
|
|
|
int32_t basic_type_is_numeric_type = SPVM_BASIC_TYPE_is_numeric_type(compiler, basic_type_id); |
98
|
17883605
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_numeric_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
99
|
15182825
|
|
|
|
|
|
return 1; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
2700780
|
|
|
|
|
|
return 0; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
540060
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
107
|
|
|
|
|
|
|
|
108
|
540060
|
|
|
|
|
|
int32_t basic_type_is_numeric_object_type = SPVM_BASIC_TYPE_is_numeric_object_type(compiler, basic_type_id); |
109
|
540060
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_numeric_object_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
110
|
73284
|
|
|
|
|
|
return 1; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
466776
|
|
|
|
|
|
return 0; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
30009
|
|
|
|
|
|
int32_t SPVM_TYPE_is_byte_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
118
|
|
|
|
|
|
|
|
119
|
30009
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
120
|
541
|
|
|
|
|
|
return 1; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
else { |
123
|
29468
|
|
|
|
|
|
return 0; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
28952
|
|
|
|
|
|
int32_t SPVM_TYPE_is_short_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
128
|
|
|
|
|
|
|
|
129
|
28952
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
130
|
17
|
|
|
|
|
|
return 1; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
else { |
133
|
28935
|
|
|
|
|
|
return 0; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
33836
|
|
|
|
|
|
int32_t SPVM_TYPE_is_int_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
138
|
|
|
|
|
|
|
|
139
|
33836
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
140
|
4849
|
|
|
|
|
|
return 1; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
else { |
143
|
28987
|
|
|
|
|
|
return 0; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
30420
|
|
|
|
|
|
int32_t SPVM_TYPE_is_long_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
148
|
|
|
|
|
|
|
|
149
|
30420
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
150
|
4195
|
|
|
|
|
|
return 1; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
else { |
153
|
26225
|
|
|
|
|
|
return 0; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
25186
|
|
|
|
|
|
int32_t SPVM_TYPE_is_float_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
158
|
|
|
|
|
|
|
|
159
|
25186
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
160
|
1061
|
|
|
|
|
|
return 1; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
else { |
163
|
24125
|
|
|
|
|
|
return 0; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
24140
|
|
|
|
|
|
int32_t SPVM_TYPE_is_double_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
168
|
|
|
|
|
|
|
|
169
|
24140
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
170
|
1068
|
|
|
|
|
|
return 1; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
else { |
173
|
23072
|
|
|
|
|
|
return 0; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
72963
|
|
|
|
|
|
int32_t SPVM_TYPE_is_bool_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
178
|
|
|
|
|
|
|
|
179
|
72963
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_BOOL_CLASS) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
180
|
28
|
|
|
|
|
|
return 1; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
else { |
183
|
72935
|
|
|
|
|
|
return 0; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
9330
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_ref_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
188
|
|
|
|
|
|
|
|
189
|
9330
|
|
|
|
|
|
int32_t basic_type_is_numeric_type = SPVM_BASIC_TYPE_is_numeric_type(compiler, basic_type_id); |
190
|
9330
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_numeric_type && (flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
191
|
9218
|
|
|
|
|
|
return 1; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
else { |
194
|
112
|
|
|
|
|
|
return 0; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
7053
|
|
|
|
|
|
int32_t SPVM_TYPE_is_integer_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
199
|
|
|
|
|
|
|
|
200
|
7053
|
|
|
|
|
|
int32_t basic_type_is_integer_type = SPVM_BASIC_TYPE_is_integer_type(compiler, basic_type_id); |
201
|
7053
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_integer_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
202
|
7034
|
|
|
|
|
|
return 1; |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
else { |
205
|
19
|
|
|
|
|
|
return 0; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
36258
|
|
|
|
|
|
int32_t SPVM_TYPE_is_integer_type_within_int(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
210
|
|
|
|
|
|
|
|
211
|
36258
|
|
|
|
|
|
int32_t basic_type_is_integer_type_within_int = SPVM_BASIC_TYPE_is_integer_type_within_int(compiler, basic_type_id); |
212
|
36258
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_integer_type_within_int && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
213
|
36253
|
|
|
|
|
|
return 1; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
else { |
216
|
5
|
|
|
|
|
|
return 0; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
9989167
|
|
|
|
|
|
int32_t SPVM_TYPE_is_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
222
|
|
|
|
|
|
|
|
223
|
9989167
|
100
|
|
|
|
|
if (SPVM_TYPE_is_array_type(compiler, basic_type_id, dimension, flag)) { |
224
|
872988
|
|
|
|
|
|
return 1; |
225
|
|
|
|
|
|
|
} |
226
|
9116179
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_basic_object_type(compiler, basic_type_id, dimension, flag)) { |
227
|
2517954
|
|
|
|
|
|
return 1; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
else { |
230
|
6598225
|
|
|
|
|
|
return 0; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
9116179
|
|
|
|
|
|
int32_t SPVM_TYPE_is_basic_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
235
|
|
|
|
|
|
|
|
236
|
9116179
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, basic_type_id, dimension, flag)) { |
237
|
1330232
|
|
|
|
|
|
return 1; |
238
|
|
|
|
|
|
|
} |
239
|
7785947
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_type(compiler, basic_type_id, dimension, flag)) { |
240
|
745726
|
|
|
|
|
|
return 1; |
241
|
|
|
|
|
|
|
} |
242
|
7040221
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_type(compiler, basic_type_id, dimension, flag)) { |
243
|
82740
|
|
|
|
|
|
return 1; |
244
|
|
|
|
|
|
|
} |
245
|
6957481
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, basic_type_id, dimension, flag)) { |
246
|
359256
|
|
|
|
|
|
return 1; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
else { |
249
|
6598225
|
|
|
|
|
|
return 0; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
0
|
|
|
|
|
|
int32_t SPVM_TYPE_is_basic_object_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
254
|
|
|
|
|
|
|
|
255
|
0
|
0
|
|
|
|
|
if (SPVM_TYPE_is_array_type(compiler, basic_type_id, dimension, flag)) { |
256
|
0
|
0
|
|
|
|
|
if (SPVM_TYPE_is_basic_object_type(compiler, basic_type_id, dimension - 1, flag)) { |
257
|
0
|
|
|
|
|
|
return 1; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
else { |
260
|
0
|
|
|
|
|
|
return 0; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
else { |
264
|
0
|
|
|
|
|
|
return 0; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
57904
|
|
|
|
|
|
int32_t SPVM_TYPE_is_object_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
269
|
|
|
|
|
|
|
|
270
|
57904
|
100
|
|
|
|
|
if (SPVM_TYPE_is_array_type(compiler, basic_type_id, dimension, flag)) { |
271
|
55758
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, basic_type_id, dimension - 1, flag)) { |
272
|
55755
|
|
|
|
|
|
return 1; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
else { |
275
|
3
|
|
|
|
|
|
return 0; |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
else { |
279
|
2146
|
|
|
|
|
|
return 0; |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
7345802
|
|
|
|
|
|
int32_t SPVM_TYPE_is_any_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
284
|
|
|
|
|
|
|
|
285
|
7345802
|
100
|
|
|
|
|
return dimension == 0 && basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF); |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
8811836
|
|
|
|
|
|
int32_t SPVM_TYPE_is_class_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
int32_t is_class_type; |
291
|
8811836
|
|
|
|
|
|
int32_t basic_type_is_class_type = SPVM_BASIC_TYPE_is_class_type(compiler, basic_type_id); |
292
|
8811836
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_class_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
293
|
1446487
|
|
|
|
|
|
is_class_type = 1; |
294
|
|
|
|
|
|
|
} |
295
|
|
|
|
|
|
|
// Array |
296
|
|
|
|
|
|
|
else { |
297
|
7365349
|
|
|
|
|
|
is_class_type = 0; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
8811836
|
|
|
|
|
|
return is_class_type; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
7392970
|
|
|
|
|
|
int32_t SPVM_TYPE_is_interface_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
int32_t is_interface_type; |
306
|
7392970
|
|
|
|
|
|
int32_t basic_type_is_interface_type = SPVM_BASIC_TYPE_is_interface_type(compiler, basic_type_id); |
307
|
7392970
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_interface_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
308
|
141860
|
|
|
|
|
|
is_interface_type = 1; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
// Array |
311
|
|
|
|
|
|
|
else { |
312
|
7251110
|
|
|
|
|
|
is_interface_type = 0; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
7392970
|
|
|
|
|
|
return is_interface_type; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
12398835
|
|
|
|
|
|
int32_t SPVM_TYPE_is_string_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
319
|
|
|
|
|
|
|
|
320
|
12398835
|
100
|
|
|
|
|
return dimension == 0 && basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_STRING && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF); |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
24714
|
|
|
|
|
|
int32_t SPVM_TYPE_is_byte_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
324
|
|
|
|
|
|
|
|
325
|
24714
|
100
|
|
|
|
|
return dimension == 1 && basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF); |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
133148
|
|
|
|
|
|
int32_t SPVM_TYPE_is_string_or_byte_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
int32_t is_string_or_byte_array; |
331
|
133148
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, basic_type_id, dimension, flag) || SPVM_TYPE_is_byte_array_type(compiler, basic_type_id, dimension, flag)) { |
|
|
100
|
|
|
|
|
|
332
|
133133
|
|
|
|
|
|
is_string_or_byte_array = 1; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
else { |
335
|
15
|
|
|
|
|
|
is_string_or_byte_array = 0; |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
133148
|
|
|
|
|
|
return is_string_or_byte_array; |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
10337383
|
|
|
|
|
|
int32_t SPVM_TYPE_is_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
342
|
|
|
|
|
|
|
|
343
|
10337383
|
100
|
|
|
|
|
return dimension > 0 && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF); |
|
|
50
|
|
|
|
|
|
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
|
346
|
156215
|
|
|
|
|
|
int32_t SPVM_TYPE_is_string_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
int32_t is_string_array_type; |
349
|
156215
|
|
|
|
|
|
int32_t basic_type_is_string_type = SPVM_BASIC_TYPE_is_string_type(compiler, basic_type_id); |
350
|
156215
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_string_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
351
|
91678
|
|
|
|
|
|
is_string_array_type = 1; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
// Array |
354
|
|
|
|
|
|
|
else { |
355
|
64537
|
|
|
|
|
|
is_string_array_type = 0; |
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
|
358
|
156215
|
|
|
|
|
|
return is_string_array_type; |
359
|
|
|
|
|
|
|
} |
360
|
|
|
|
|
|
|
|
361
|
68769
|
|
|
|
|
|
int32_t SPVM_TYPE_is_class_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
int32_t is_class_array_type; |
364
|
68769
|
|
|
|
|
|
int32_t basic_type_is_class_type = SPVM_BASIC_TYPE_is_class_type(compiler, basic_type_id); |
365
|
68769
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_class_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
366
|
8469
|
|
|
|
|
|
is_class_array_type = 1; |
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
// Array |
369
|
|
|
|
|
|
|
else { |
370
|
60300
|
|
|
|
|
|
is_class_array_type = 0; |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
|
373
|
68769
|
|
|
|
|
|
return is_class_array_type; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
60295
|
|
|
|
|
|
int32_t SPVM_TYPE_is_interface_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
int32_t is_interface_array_type; |
379
|
60295
|
|
|
|
|
|
int32_t basic_type_is_interface_type = SPVM_BASIC_TYPE_is_interface_type(compiler, basic_type_id); |
380
|
60295
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_interface_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
381
|
105
|
|
|
|
|
|
is_interface_array_type = 1; |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
// Array |
384
|
|
|
|
|
|
|
else { |
385
|
60190
|
|
|
|
|
|
is_interface_array_type = 0; |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
60295
|
|
|
|
|
|
return is_interface_array_type; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
266
|
|
|
|
|
|
int32_t SPVM_TYPE_is_muldim_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
392
|
|
|
|
|
|
|
|
393
|
266
|
100
|
|
|
|
|
return dimension > 1 && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF); |
|
|
50
|
|
|
|
|
|
394
|
|
|
|
|
|
|
} |
395
|
|
|
|
|
|
|
|
396
|
660910
|
|
|
|
|
|
int32_t SPVM_TYPE_is_any_object_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
397
|
|
|
|
|
|
|
|
398
|
660910
|
100
|
|
|
|
|
if (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT && dimension == 1 && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
399
|
214968
|
|
|
|
|
|
return 1; |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
else { |
402
|
445942
|
|
|
|
|
|
return 0; |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
296969
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
int32_t is_numeric_array_type; |
409
|
296969
|
|
|
|
|
|
int32_t basic_type_is_numeric_type = SPVM_BASIC_TYPE_is_numeric_type(compiler, basic_type_id); |
410
|
296969
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_numeric_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
411
|
186099
|
|
|
|
|
|
is_numeric_array_type = 1; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
// Array |
414
|
|
|
|
|
|
|
else { |
415
|
110870
|
|
|
|
|
|
is_numeric_array_type = 0; |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
296969
|
|
|
|
|
|
return is_numeric_array_type; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
|
421
|
4321093
|
|
|
|
|
|
int32_t SPVM_TYPE_is_undef_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
422
|
|
|
|
|
|
|
|
423
|
4321093
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_UNDEF && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
424
|
48244
|
|
|
|
|
|
return 1; |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
else { |
427
|
4272849
|
|
|
|
|
|
return 0; |
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
|
int32_t SPVM_TYPE_is_unknown_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
432
|
|
|
|
|
|
|
|
433
|
0
|
0
|
|
|
|
|
if (dimension == 0 && basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_UNKNOWN && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
434
|
0
|
|
|
|
|
|
return 1; |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
else { |
437
|
0
|
|
|
|
|
|
return 0; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
8624515
|
|
|
|
|
|
int32_t SPVM_TYPE_is_mulnum_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
442
|
|
|
|
|
|
|
|
443
|
8624515
|
|
|
|
|
|
int32_t basic_type_is_mulnum_type = SPVM_BASIC_TYPE_is_mulnum_type(compiler, basic_type_id); |
444
|
8624515
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_mulnum_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
445
|
9536
|
|
|
|
|
|
return 1; |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
else { |
448
|
8614979
|
|
|
|
|
|
return 0; |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
|
452
|
167895
|
|
|
|
|
|
int32_t SPVM_TYPE_is_mulnum_ref_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
453
|
|
|
|
|
|
|
|
454
|
167895
|
|
|
|
|
|
int32_t basic_type_is_mulnum_type = SPVM_BASIC_TYPE_is_mulnum_type(compiler, basic_type_id); |
455
|
167895
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_mulnum_type && (flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
456
|
805
|
|
|
|
|
|
return 1; |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
else { |
459
|
167090
|
|
|
|
|
|
return 0; |
460
|
|
|
|
|
|
|
} |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
285384
|
|
|
|
|
|
int32_t SPVM_TYPE_is_mulnum_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
int32_t is_mulnum_array_type; |
466
|
285384
|
|
|
|
|
|
int32_t basic_type_is_mulnum_type = SPVM_BASIC_TYPE_is_mulnum_type(compiler, basic_type_id); |
467
|
285384
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_mulnum_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
468
|
793
|
|
|
|
|
|
is_mulnum_array_type = 1; |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
// Array |
471
|
|
|
|
|
|
|
else { |
472
|
284591
|
|
|
|
|
|
is_mulnum_array_type = 0; |
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
|
475
|
285384
|
|
|
|
|
|
return is_mulnum_array_type; |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
|
478
|
5941733
|
|
|
|
|
|
int32_t SPVM_TYPE_get_type_name_length(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
479
|
5941733
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
480
|
5941733
|
50
|
|
|
|
|
assert(basic_type); |
481
|
|
|
|
|
|
|
|
482
|
5941733
|
|
|
|
|
|
int32_t length = 0; |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
// * |
485
|
5941733
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE) { |
486
|
29435
|
|
|
|
|
|
length += strlen("mutable "); |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
// Basic type |
490
|
5941733
|
|
|
|
|
|
length += strlen(basic_type->name); |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
// [] |
493
|
5941733
|
|
|
|
|
|
length += dimension * 2; |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
// * |
496
|
5941733
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_REF) { |
497
|
12451
|
|
|
|
|
|
length += 1; |
498
|
|
|
|
|
|
|
} |
499
|
|
|
|
|
|
|
|
500
|
5941733
|
|
|
|
|
|
return length; |
501
|
|
|
|
|
|
|
} |
502
|
|
|
|
|
|
|
|
503
|
5941733
|
|
|
|
|
|
const char* SPVM_TYPE_new_type_name_with_eternal_flag(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag, int32_t is_permanent) { |
504
|
5941733
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
505
|
5941733
|
50
|
|
|
|
|
assert(basic_type); |
506
|
|
|
|
|
|
|
|
507
|
5941733
|
|
|
|
|
|
int32_t type_name_length = SPVM_TYPE_get_type_name_length(compiler, basic_type_id, dimension, flag); |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
char* type_name; |
510
|
5941733
|
50
|
|
|
|
|
if (is_permanent) { |
511
|
5941733
|
|
|
|
|
|
type_name = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, type_name_length + 1); |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
else { |
514
|
0
|
|
|
|
|
|
type_name = SPVM_ALLOCATOR_alloc_memory_block_tmp(compiler->current_each_compile_allocator, type_name_length + 1); |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
5941733
|
|
|
|
|
|
char* cur = type_name; |
518
|
|
|
|
|
|
|
|
519
|
5941733
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE) { |
520
|
29435
|
|
|
|
|
|
sprintf(cur, "mutable "); |
521
|
29435
|
|
|
|
|
|
cur += strlen("mutable "); |
522
|
|
|
|
|
|
|
} |
523
|
|
|
|
|
|
|
|
524
|
5941733
|
|
|
|
|
|
sprintf(cur, "%s", basic_type->name); |
525
|
5941733
|
|
|
|
|
|
cur += strlen(basic_type->name); |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
int32_t dim_index; |
528
|
6341013
|
100
|
|
|
|
|
for (dim_index = 0; dim_index < dimension; dim_index++) { |
529
|
399280
|
|
|
|
|
|
sprintf(cur, "[]"); |
530
|
399280
|
|
|
|
|
|
cur += 2; |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
// Reference |
534
|
5941733
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_REF) { |
535
|
12451
|
|
|
|
|
|
sprintf(cur, "*"); |
536
|
12451
|
|
|
|
|
|
cur += 1; |
537
|
|
|
|
|
|
|
} |
538
|
|
|
|
|
|
|
|
539
|
5941733
|
|
|
|
|
|
*cur = '\0'; |
540
|
5941733
|
|
|
|
|
|
cur++; |
541
|
|
|
|
|
|
|
|
542
|
5941733
|
|
|
|
|
|
return type_name; |
543
|
|
|
|
|
|
|
} |
544
|
|
|
|
|
|
|
|
545
|
0
|
|
|
|
|
|
const char* SPVM_TYPE_new_type_name_tmp(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
546
|
0
|
|
|
|
|
|
int32_t is_permanent = 0; |
547
|
0
|
|
|
|
|
|
return SPVM_TYPE_new_type_name_with_eternal_flag(compiler, basic_type_id, dimension, flag, is_permanent); |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
|
550
|
5941733
|
|
|
|
|
|
const char* SPVM_TYPE_new_type_name(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
551
|
5941733
|
|
|
|
|
|
int32_t is_permanent = 1; |
552
|
5941733
|
|
|
|
|
|
return SPVM_TYPE_new_type_name_with_eternal_flag(compiler, basic_type_id, dimension, flag, is_permanent); |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
|
555
|
7578266
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
556
|
|
|
|
|
|
|
|
557
|
7578266
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_TYPE)); |
558
|
7578266
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
559
|
7578266
|
100
|
|
|
|
|
if (basic_type_id > 0) { |
560
|
7574877
|
|
|
|
|
|
type->unresolved_basic_type_name = basic_type->name; |
561
|
|
|
|
|
|
|
} |
562
|
7578266
|
|
|
|
|
|
type->basic_type = basic_type; |
563
|
7578266
|
|
|
|
|
|
type->dimension = dimension; |
564
|
7578266
|
|
|
|
|
|
type->flag = flag; |
565
|
|
|
|
|
|
|
|
566
|
7578266
|
|
|
|
|
|
return type; |
567
|
|
|
|
|
|
|
} |
568
|
|
|
|
|
|
|
|
569
|
4559157
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_uninitialized(SPVM_COMPILER* compiler) { |
570
|
|
|
|
|
|
|
|
571
|
4559157
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_TYPE)); |
572
|
|
|
|
|
|
|
|
573
|
4559157
|
|
|
|
|
|
return type; |
574
|
|
|
|
|
|
|
} |
575
|
|
|
|
|
|
|
|
576
|
258835
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_unresolved_type(SPVM_COMPILER* compiler, const char* unresolved_basic_type_name, int32_t dimension, int32_t flag) { |
577
|
|
|
|
|
|
|
|
578
|
258835
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_TYPE)); |
579
|
258835
|
|
|
|
|
|
type->unresolved_basic_type_name = unresolved_basic_type_name; |
580
|
258835
|
|
|
|
|
|
type->basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_UNKNOWN); |
581
|
258835
|
|
|
|
|
|
type->dimension = dimension; |
582
|
258835
|
|
|
|
|
|
type->flag = flag; |
583
|
|
|
|
|
|
|
|
584
|
258835
|
|
|
|
|
|
return type; |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
|
587
|
107748
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_void_type(SPVM_COMPILER* compiler) { |
588
|
|
|
|
|
|
|
|
589
|
107748
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_VOID); |
590
|
107748
|
|
|
|
|
|
int32_t type_dimension = 0; |
591
|
107748
|
|
|
|
|
|
int32_t type_flag = 0; |
592
|
107748
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
593
|
|
|
|
|
|
|
|
594
|
107748
|
|
|
|
|
|
return type; |
595
|
|
|
|
|
|
|
} |
596
|
|
|
|
|
|
|
|
597
|
51
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_any_object_array_type(SPVM_COMPILER* compiler) { |
598
|
|
|
|
|
|
|
|
599
|
51
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT); |
600
|
51
|
|
|
|
|
|
int32_t type_dimension = 1; |
601
|
51
|
|
|
|
|
|
int32_t type_flag = 0; |
602
|
51
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
603
|
|
|
|
|
|
|
|
604
|
51
|
|
|
|
|
|
return type; |
605
|
|
|
|
|
|
|
} |
606
|
|
|
|
|
|
|
|
607
|
57742
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_undef_type(SPVM_COMPILER* compiler) { |
608
|
|
|
|
|
|
|
|
609
|
57742
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_UNDEF); |
610
|
|
|
|
|
|
|
|
611
|
57742
|
|
|
|
|
|
int32_t type_dimension = 0; |
612
|
57742
|
|
|
|
|
|
int32_t type_flag = 0; |
613
|
57742
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
614
|
|
|
|
|
|
|
|
615
|
57742
|
|
|
|
|
|
return type; |
616
|
|
|
|
|
|
|
} |
617
|
|
|
|
|
|
|
|
618
|
164384
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_byte_type(SPVM_COMPILER* compiler) { |
619
|
|
|
|
|
|
|
|
620
|
164384
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE); |
621
|
164384
|
|
|
|
|
|
int32_t type_dimension = 0; |
622
|
164384
|
|
|
|
|
|
int32_t type_flag = 0; |
623
|
164384
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
624
|
|
|
|
|
|
|
|
625
|
164384
|
|
|
|
|
|
return type; |
626
|
|
|
|
|
|
|
} |
627
|
|
|
|
|
|
|
|
628
|
20004
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_short_type(SPVM_COMPILER* compiler) { |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
|
631
|
20004
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT); |
632
|
20004
|
|
|
|
|
|
int32_t type_dimension = 0; |
633
|
20004
|
|
|
|
|
|
int32_t type_flag = 0; |
634
|
20004
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
635
|
|
|
|
|
|
|
|
636
|
20004
|
|
|
|
|
|
return type; |
637
|
|
|
|
|
|
|
} |
638
|
|
|
|
|
|
|
|
639
|
5666506
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_int_type(SPVM_COMPILER* compiler) { |
640
|
|
|
|
|
|
|
|
641
|
5666506
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_INT); |
642
|
5666506
|
|
|
|
|
|
int32_t type_dimension = 0; |
643
|
5666506
|
|
|
|
|
|
int32_t type_flag = 0; |
644
|
5666506
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
645
|
|
|
|
|
|
|
|
646
|
5666506
|
|
|
|
|
|
return type; |
647
|
|
|
|
|
|
|
} |
648
|
|
|
|
|
|
|
|
649
|
53879
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_long_type(SPVM_COMPILER* compiler) { |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
|
652
|
53879
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG); |
653
|
53879
|
|
|
|
|
|
int32_t type_dimension = 0; |
654
|
53879
|
|
|
|
|
|
int32_t type_flag = 0; |
655
|
53879
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
656
|
|
|
|
|
|
|
|
657
|
53879
|
|
|
|
|
|
return type; |
658
|
|
|
|
|
|
|
} |
659
|
|
|
|
|
|
|
|
660
|
31572
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_float_type(SPVM_COMPILER* compiler) { |
661
|
|
|
|
|
|
|
|
662
|
31572
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT); |
663
|
31572
|
|
|
|
|
|
int32_t type_dimension = 0; |
664
|
31572
|
|
|
|
|
|
int32_t type_flag = 0; |
665
|
31572
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
666
|
|
|
|
|
|
|
|
667
|
31572
|
|
|
|
|
|
return type; |
668
|
|
|
|
|
|
|
} |
669
|
|
|
|
|
|
|
|
670
|
42037
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_double_type(SPVM_COMPILER* compiler) { |
671
|
|
|
|
|
|
|
|
672
|
42037
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE); |
673
|
42037
|
|
|
|
|
|
int32_t type_dimension = 0; |
674
|
42037
|
|
|
|
|
|
int32_t type_flag = 0; |
675
|
42037
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
676
|
|
|
|
|
|
|
|
677
|
42037
|
|
|
|
|
|
return type; |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
|
680
|
703485
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_string_type(SPVM_COMPILER* compiler) { |
681
|
|
|
|
|
|
|
|
682
|
703485
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_STRING); |
683
|
703485
|
|
|
|
|
|
int32_t type_dimension = 0; |
684
|
703485
|
|
|
|
|
|
int32_t type_flag = 0; |
685
|
703485
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
686
|
|
|
|
|
|
|
|
687
|
703485
|
|
|
|
|
|
return type; |
688
|
|
|
|
|
|
|
} |
689
|
|
|
|
|
|
|
|
690
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_object_type(SPVM_COMPILER* compiler) { |
691
|
|
|
|
|
|
|
|
692
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT); |
693
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
694
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
695
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
696
|
|
|
|
|
|
|
|
697
|
0
|
|
|
|
|
|
return type; |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
|
700
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_byte_object_type(SPVM_COMPILER* compiler) { |
701
|
|
|
|
|
|
|
|
702
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE_CLASS); |
703
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
704
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
705
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
706
|
|
|
|
|
|
|
|
707
|
0
|
|
|
|
|
|
return type; |
708
|
|
|
|
|
|
|
} |
709
|
|
|
|
|
|
|
|
710
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_short_object_type(SPVM_COMPILER* compiler) { |
711
|
|
|
|
|
|
|
|
712
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT_CLASS); |
713
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
714
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
715
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
716
|
|
|
|
|
|
|
|
717
|
0
|
|
|
|
|
|
return type; |
718
|
|
|
|
|
|
|
} |
719
|
|
|
|
|
|
|
|
720
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_int_object_type(SPVM_COMPILER* compiler) { |
721
|
|
|
|
|
|
|
|
722
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_INT_CLASS); |
723
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
724
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
725
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
726
|
|
|
|
|
|
|
|
727
|
0
|
|
|
|
|
|
return type; |
728
|
|
|
|
|
|
|
} |
729
|
|
|
|
|
|
|
|
730
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_long_object_type(SPVM_COMPILER* compiler) { |
731
|
|
|
|
|
|
|
|
732
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG_CLASS); |
733
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
734
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
735
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
736
|
|
|
|
|
|
|
|
737
|
0
|
|
|
|
|
|
return type; |
738
|
|
|
|
|
|
|
} |
739
|
|
|
|
|
|
|
|
740
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_float_object_type(SPVM_COMPILER* compiler) { |
741
|
|
|
|
|
|
|
|
742
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT_CLASS); |
743
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
744
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
745
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
746
|
|
|
|
|
|
|
|
747
|
0
|
|
|
|
|
|
return type; |
748
|
|
|
|
|
|
|
} |
749
|
|
|
|
|
|
|
|
750
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_double_object_type(SPVM_COMPILER* compiler) { |
751
|
|
|
|
|
|
|
|
752
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE_CLASS); |
753
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
754
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
755
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
756
|
|
|
|
|
|
|
|
757
|
0
|
|
|
|
|
|
return type; |
758
|
|
|
|
|
|
|
} |
759
|
|
|
|
|
|
|
|
760
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_bool_object_type(SPVM_COMPILER* compiler) { |
761
|
|
|
|
|
|
|
|
762
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_BOOL_CLASS); |
763
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
764
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
765
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
766
|
|
|
|
|
|
|
|
767
|
0
|
|
|
|
|
|
return type; |
768
|
|
|
|
|
|
|
} |
769
|
|
|
|
|
|
|
|
770
|
108
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_byte_ref_type(SPVM_COMPILER* compiler) { |
771
|
|
|
|
|
|
|
|
772
|
108
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE); |
773
|
108
|
|
|
|
|
|
int32_t type_dimension = 0; |
774
|
108
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
775
|
108
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
776
|
|
|
|
|
|
|
|
777
|
108
|
|
|
|
|
|
return type; |
778
|
|
|
|
|
|
|
} |
779
|
|
|
|
|
|
|
|
780
|
102
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_short_ref_type(SPVM_COMPILER* compiler) { |
781
|
|
|
|
|
|
|
|
782
|
102
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT); |
783
|
102
|
|
|
|
|
|
int32_t type_dimension = 0; |
784
|
102
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
785
|
102
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
786
|
|
|
|
|
|
|
|
787
|
102
|
|
|
|
|
|
return type; |
788
|
|
|
|
|
|
|
} |
789
|
|
|
|
|
|
|
|
790
|
14398
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_int_ref_type(SPVM_COMPILER* compiler) { |
791
|
|
|
|
|
|
|
|
792
|
14398
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_INT); |
793
|
14398
|
|
|
|
|
|
int32_t type_dimension = 0; |
794
|
14398
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
795
|
14398
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
796
|
|
|
|
|
|
|
|
797
|
14398
|
|
|
|
|
|
return type; |
798
|
|
|
|
|
|
|
} |
799
|
|
|
|
|
|
|
|
800
|
102
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_long_ref_type(SPVM_COMPILER* compiler) { |
801
|
|
|
|
|
|
|
|
802
|
102
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG); |
803
|
102
|
|
|
|
|
|
int32_t type_dimension = 0; |
804
|
102
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
805
|
102
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
806
|
|
|
|
|
|
|
|
807
|
102
|
|
|
|
|
|
return type; |
808
|
|
|
|
|
|
|
} |
809
|
|
|
|
|
|
|
|
810
|
102
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_float_ref_type(SPVM_COMPILER* compiler) { |
811
|
|
|
|
|
|
|
|
812
|
102
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT); |
813
|
102
|
|
|
|
|
|
int32_t type_dimension = 0; |
814
|
102
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
815
|
102
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
816
|
|
|
|
|
|
|
|
817
|
102
|
|
|
|
|
|
return type; |
818
|
|
|
|
|
|
|
} |
819
|
|
|
|
|
|
|
|
820
|
111
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_double_ref_type(SPVM_COMPILER* compiler) { |
821
|
|
|
|
|
|
|
|
822
|
111
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE); |
823
|
111
|
|
|
|
|
|
int32_t type_dimension = 0; |
824
|
111
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
825
|
111
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
826
|
|
|
|
|
|
|
|
827
|
111
|
|
|
|
|
|
return type; |
828
|
|
|
|
|
|
|
} |
829
|
|
|
|
|
|
|
|
830
|
188704
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_any_object_type(SPVM_COMPILER* compiler) { |
831
|
|
|
|
|
|
|
|
832
|
188704
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT); |
833
|
188704
|
|
|
|
|
|
int32_t type_dimension = 0; |
834
|
188704
|
|
|
|
|
|
int32_t type_flag = 0; |
835
|
188704
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
836
|
|
|
|
|
|
|
|
837
|
188704
|
|
|
|
|
|
return type; |
838
|
|
|
|
|
|
|
} |
839
|
|
|
|
|
|
|
|
840
|
0
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_element_type(SPVM_COMPILER* compiler) { |
841
|
|
|
|
|
|
|
|
842
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT); |
843
|
0
|
|
|
|
|
|
int32_t type_dimension = 0; |
844
|
0
|
|
|
|
|
|
int32_t type_flag = 0; |
845
|
0
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
846
|
|
|
|
|
|
|
|
847
|
0
|
|
|
|
|
|
return type; |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
|
850
|
4003735
|
|
|
|
|
|
int32_t SPVM_TYPE_get_width(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
851
|
|
|
|
|
|
|
|
852
|
4003735
|
|
|
|
|
|
int32_t is_mulnum_type = SPVM_TYPE_is_mulnum_type(compiler, basic_type_id, dimension, flag); |
853
|
|
|
|
|
|
|
|
854
|
4003735
|
|
|
|
|
|
int32_t type_width = -1; |
855
|
4003735
|
100
|
|
|
|
|
if (is_mulnum_type) { |
856
|
|
|
|
|
|
|
|
857
|
954
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
858
|
954
|
50
|
|
|
|
|
assert(basic_type); |
859
|
|
|
|
|
|
|
|
860
|
954
|
|
|
|
|
|
type_width = basic_type->fields->length; |
861
|
|
|
|
|
|
|
} |
862
|
|
|
|
|
|
|
else { |
863
|
4002781
|
|
|
|
|
|
type_width = 1; |
864
|
|
|
|
|
|
|
} |
865
|
|
|
|
|
|
|
|
866
|
4003735
|
|
|
|
|
|
return type_width; |
867
|
|
|
|
|
|
|
} |
868
|
|
|
|
|
|
|
|
869
|
0
|
|
|
|
|
|
int32_t SPVM_TYPE_get_mulnum_field_basic_type_id(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
int32_t mulnum_field_basic_type_id; |
872
|
0
|
0
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, basic_type_id, dimension, flag) || SPVM_TYPE_is_mulnum_ref_type(compiler, basic_type_id, dimension, flag)) { |
|
|
0
|
|
|
|
|
|
873
|
|
|
|
|
|
|
|
874
|
0
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
875
|
0
|
0
|
|
|
|
|
assert(basic_type); |
876
|
|
|
|
|
|
|
|
877
|
0
|
0
|
|
|
|
|
assert(basic_type->fields->length > 0); |
878
|
|
|
|
|
|
|
|
879
|
0
|
|
|
|
|
|
SPVM_FIELD* mulnum_field = SPVM_LIST_get(basic_type->fields, 0); |
880
|
|
|
|
|
|
|
|
881
|
0
|
|
|
|
|
|
SPVM_TYPE* mulnum_field_type = mulnum_field->type; |
882
|
|
|
|
|
|
|
|
883
|
0
|
|
|
|
|
|
mulnum_field_basic_type_id = mulnum_field_type->basic_type->id; |
884
|
|
|
|
|
|
|
} |
885
|
|
|
|
|
|
|
else { |
886
|
0
|
|
|
|
|
|
mulnum_field_basic_type_id = -1; |
887
|
|
|
|
|
|
|
} |
888
|
|
|
|
|
|
|
|
889
|
0
|
|
|
|
|
|
return mulnum_field_basic_type_id; |
890
|
|
|
|
|
|
|
} |
891
|
|
|
|
|
|
|
|
892
|
3029598
|
|
|
|
|
|
int32_t SPVM_TYPE_can_assign( |
893
|
|
|
|
|
|
|
SPVM_COMPILER* compiler, |
894
|
|
|
|
|
|
|
int32_t dist_type_basic_type_id, int32_t dist_type_dimension, int32_t dist_type_flag, |
895
|
|
|
|
|
|
|
int32_t src_type_basic_type_id, int32_t src_type_dimension, int32_t src_type_flag, |
896
|
|
|
|
|
|
|
int32_t* need_implicite_conversion, int32_t allow_narrowing_conversion) |
897
|
|
|
|
|
|
|
{ |
898
|
|
|
|
|
|
|
// Dist type is numeric type |
899
|
3029598
|
|
|
|
|
|
int32_t assignability = 0; |
900
|
3029598
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
901
|
|
|
|
|
|
|
// Soruce type is numeric type |
902
|
2204509
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
903
|
|
|
|
|
|
|
// Dist type is same as source type |
904
|
2200281
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
905
|
2182670
|
|
|
|
|
|
assignability = 1; |
906
|
|
|
|
|
|
|
} |
907
|
|
|
|
|
|
|
// Dist type is more wide than source type |
908
|
17611
|
100
|
|
|
|
|
else if (dist_type_basic_type_id > src_type_basic_type_id) { |
909
|
15096
|
|
|
|
|
|
assignability = 1; |
910
|
15096
|
|
|
|
|
|
*need_implicite_conversion = 1; |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
// Dist type is narrow than source type |
913
|
2515
|
50
|
|
|
|
|
else if (dist_type_basic_type_id < src_type_basic_type_id) { |
914
|
2515
|
100
|
|
|
|
|
if (allow_narrowing_conversion) { |
915
|
2500
|
|
|
|
|
|
assignability = 1; |
916
|
2500
|
|
|
|
|
|
*need_implicite_conversion = 1; |
917
|
|
|
|
|
|
|
} |
918
|
|
|
|
|
|
|
else { |
919
|
2200281
|
|
|
|
|
|
assignability = 0; |
920
|
|
|
|
|
|
|
} |
921
|
|
|
|
|
|
|
} |
922
|
|
|
|
|
|
|
} |
923
|
|
|
|
|
|
|
// Source type is object type |
924
|
4228
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
925
|
|
|
|
|
|
|
// Source type is the corresponding numeric object type |
926
|
4224
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
927
|
4201
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id + SPVM_BASIC_TYPE_C_NUMERIC_OBJECT_UPGRADE_SHIFT) { |
928
|
4194
|
|
|
|
|
|
assignability = 1; |
929
|
4194
|
|
|
|
|
|
*need_implicite_conversion = 1; |
930
|
|
|
|
|
|
|
} |
931
|
|
|
|
|
|
|
else { |
932
|
4201
|
|
|
|
|
|
assignability = 0; |
933
|
|
|
|
|
|
|
} |
934
|
|
|
|
|
|
|
} |
935
|
|
|
|
|
|
|
// Source type is any object type |
936
|
23
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
937
|
18
|
|
|
|
|
|
assignability = 1; |
938
|
18
|
|
|
|
|
|
*need_implicite_conversion = 1; |
939
|
|
|
|
|
|
|
} |
940
|
|
|
|
|
|
|
else { |
941
|
4224
|
|
|
|
|
|
assignability = 0; |
942
|
|
|
|
|
|
|
} |
943
|
|
|
|
|
|
|
} |
944
|
|
|
|
|
|
|
// Source type is other type |
945
|
|
|
|
|
|
|
else { |
946
|
2204509
|
|
|
|
|
|
assignability = 0; |
947
|
|
|
|
|
|
|
} |
948
|
|
|
|
|
|
|
} |
949
|
|
|
|
|
|
|
// Dist type is multi numeric type |
950
|
825089
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
951
|
|
|
|
|
|
|
// Source type is multi numeric type |
952
|
331
|
50
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
953
|
331
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
954
|
330
|
|
|
|
|
|
assignability = 1; |
955
|
|
|
|
|
|
|
} |
956
|
|
|
|
|
|
|
else { |
957
|
331
|
|
|
|
|
|
assignability = 0; |
958
|
|
|
|
|
|
|
} |
959
|
|
|
|
|
|
|
} |
960
|
|
|
|
|
|
|
// Source type is other type |
961
|
|
|
|
|
|
|
else { |
962
|
331
|
|
|
|
|
|
assignability = 0; |
963
|
|
|
|
|
|
|
} |
964
|
|
|
|
|
|
|
} |
965
|
|
|
|
|
|
|
// Dist type is referece type |
966
|
824758
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
967
|
|
|
|
|
|
|
// Source type is referece type |
968
|
6220
|
50
|
|
|
|
|
if (SPVM_TYPE_is_ref_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
969
|
6220
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
970
|
6219
|
|
|
|
|
|
assignability = 1; |
971
|
|
|
|
|
|
|
} |
972
|
|
|
|
|
|
|
else { |
973
|
6220
|
|
|
|
|
|
assignability = 0; |
974
|
|
|
|
|
|
|
} |
975
|
|
|
|
|
|
|
} |
976
|
|
|
|
|
|
|
// Source type is other type |
977
|
|
|
|
|
|
|
else { |
978
|
6220
|
|
|
|
|
|
assignability = 0; |
979
|
|
|
|
|
|
|
} |
980
|
|
|
|
|
|
|
} |
981
|
|
|
|
|
|
|
// Dist type is string type |
982
|
818538
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_string_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
983
|
|
|
|
|
|
|
// Source type is string |
984
|
332738
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
985
|
|
|
|
|
|
|
// Mutable check |
986
|
328676
|
100
|
|
|
|
|
if(dist_type_flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE && !(src_type_flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE)) { |
|
|
100
|
|
|
|
|
|
987
|
6
|
|
|
|
|
|
assignability = 0; |
988
|
|
|
|
|
|
|
} |
989
|
|
|
|
|
|
|
else { |
990
|
328676
|
|
|
|
|
|
assignability = 1; |
991
|
|
|
|
|
|
|
} |
992
|
|
|
|
|
|
|
} |
993
|
|
|
|
|
|
|
// Source type is numeric type |
994
|
4062
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
995
|
1889
|
|
|
|
|
|
assignability = 1; |
996
|
1889
|
|
|
|
|
|
*need_implicite_conversion = 1; |
997
|
|
|
|
|
|
|
} |
998
|
|
|
|
|
|
|
// Source type is undef type |
999
|
2173
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1000
|
2169
|
|
|
|
|
|
assignability = 1; |
1001
|
|
|
|
|
|
|
} |
1002
|
|
|
|
|
|
|
// Source type is other type |
1003
|
|
|
|
|
|
|
else { |
1004
|
332738
|
|
|
|
|
|
assignability = 0; |
1005
|
|
|
|
|
|
|
} |
1006
|
|
|
|
|
|
|
} |
1007
|
|
|
|
|
|
|
// Dist type is numeric object type |
1008
|
485800
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_object_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1009
|
|
|
|
|
|
|
// Source type is numeric type |
1010
|
30807
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1011
|
33
|
100
|
|
|
|
|
if (dist_type_basic_type_id == src_type_basic_type_id + SPVM_BASIC_TYPE_C_NUMERIC_OBJECT_UPGRADE_SHIFT) { |
1012
|
26
|
|
|
|
|
|
assignability = 1; |
1013
|
26
|
|
|
|
|
|
*need_implicite_conversion = 1; |
1014
|
|
|
|
|
|
|
} |
1015
|
|
|
|
|
|
|
else { |
1016
|
33
|
|
|
|
|
|
assignability = 0; |
1017
|
|
|
|
|
|
|
} |
1018
|
|
|
|
|
|
|
} |
1019
|
|
|
|
|
|
|
// Source type is numeric object type |
1020
|
30774
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1021
|
30753
|
50
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1022
|
30753
|
|
|
|
|
|
assignability = 1; |
1023
|
|
|
|
|
|
|
} |
1024
|
|
|
|
|
|
|
else { |
1025
|
30753
|
|
|
|
|
|
assignability = 0; |
1026
|
|
|
|
|
|
|
} |
1027
|
|
|
|
|
|
|
} |
1028
|
|
|
|
|
|
|
// Source type is undef type |
1029
|
21
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1030
|
18
|
|
|
|
|
|
assignability = 1; |
1031
|
|
|
|
|
|
|
} |
1032
|
|
|
|
|
|
|
// Source type is other type |
1033
|
|
|
|
|
|
|
else { |
1034
|
30807
|
|
|
|
|
|
assignability = 0; |
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
} |
1037
|
|
|
|
|
|
|
// Dist type is class |
1038
|
454993
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1039
|
|
|
|
|
|
|
// Source type is class type |
1040
|
151156
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1041
|
149332
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1042
|
148952
|
|
|
|
|
|
assignability = 1; |
1043
|
|
|
|
|
|
|
} |
1044
|
380
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id)) { |
1045
|
369
|
|
|
|
|
|
assignability = 1; |
1046
|
|
|
|
|
|
|
} |
1047
|
|
|
|
|
|
|
else { |
1048
|
149332
|
|
|
|
|
|
assignability = 0; |
1049
|
|
|
|
|
|
|
} |
1050
|
|
|
|
|
|
|
} |
1051
|
|
|
|
|
|
|
// Source type is undef type |
1052
|
1824
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1053
|
1717
|
|
|
|
|
|
assignability = 1; |
1054
|
|
|
|
|
|
|
} |
1055
|
|
|
|
|
|
|
// Source type is other type |
1056
|
|
|
|
|
|
|
else { |
1057
|
151156
|
|
|
|
|
|
assignability = 0; |
1058
|
|
|
|
|
|
|
} |
1059
|
|
|
|
|
|
|
} |
1060
|
|
|
|
|
|
|
// Dist type is interface type |
1061
|
303837
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1062
|
|
|
|
|
|
|
// Source type is isinterface type |
1063
|
31416
|
100
|
|
|
|
|
if (SPVM_TYPE_is_interface_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1064
|
22199
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1065
|
22195
|
|
|
|
|
|
assignability = 1; |
1066
|
|
|
|
|
|
|
} |
1067
|
|
|
|
|
|
|
else { |
1068
|
22199
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1069
|
|
|
|
|
|
|
} |
1070
|
|
|
|
|
|
|
} |
1071
|
|
|
|
|
|
|
// Source type is class type |
1072
|
9217
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1073
|
8123
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1074
|
|
|
|
|
|
|
} |
1075
|
|
|
|
|
|
|
// Source type is undef type |
1076
|
1094
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1077
|
1084
|
|
|
|
|
|
assignability = 1; |
1078
|
|
|
|
|
|
|
} |
1079
|
|
|
|
|
|
|
// Source type is other type |
1080
|
|
|
|
|
|
|
else { |
1081
|
31416
|
|
|
|
|
|
assignability = 0; |
1082
|
|
|
|
|
|
|
} |
1083
|
|
|
|
|
|
|
} |
1084
|
|
|
|
|
|
|
// Dist type is any object type |
1085
|
272421
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1086
|
|
|
|
|
|
|
// Source type is numeric type |
1087
|
70887
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1088
|
234
|
|
|
|
|
|
assignability = 1; |
1089
|
234
|
|
|
|
|
|
*need_implicite_conversion = 1; |
1090
|
|
|
|
|
|
|
} |
1091
|
|
|
|
|
|
|
// Source type is object type |
1092
|
70653
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1093
|
66416
|
|
|
|
|
|
assignability = 1; |
1094
|
|
|
|
|
|
|
} |
1095
|
|
|
|
|
|
|
// Source type is undef type |
1096
|
4237
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1097
|
4235
|
|
|
|
|
|
assignability = 1; |
1098
|
|
|
|
|
|
|
} |
1099
|
|
|
|
|
|
|
// Source type is other type |
1100
|
|
|
|
|
|
|
else { |
1101
|
70887
|
|
|
|
|
|
assignability = 0; |
1102
|
|
|
|
|
|
|
} |
1103
|
|
|
|
|
|
|
} |
1104
|
|
|
|
|
|
|
// Dist type is undef type |
1105
|
201534
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1106
|
0
|
|
|
|
|
|
assignability = 0; |
1107
|
|
|
|
|
|
|
} |
1108
|
|
|
|
|
|
|
// Dist type is numeric array type |
1109
|
201534
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1110
|
|
|
|
|
|
|
// Source type is numeric array type |
1111
|
93122
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1112
|
92890
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1113
|
92889
|
|
|
|
|
|
assignability = 1; |
1114
|
|
|
|
|
|
|
} |
1115
|
|
|
|
|
|
|
else { |
1116
|
92890
|
|
|
|
|
|
assignability = 0; |
1117
|
|
|
|
|
|
|
} |
1118
|
|
|
|
|
|
|
} |
1119
|
|
|
|
|
|
|
// Source type is undef type |
1120
|
232
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1121
|
199
|
|
|
|
|
|
assignability = 1; |
1122
|
|
|
|
|
|
|
} |
1123
|
|
|
|
|
|
|
// Source type is other type |
1124
|
|
|
|
|
|
|
else { |
1125
|
93122
|
|
|
|
|
|
assignability = 0; |
1126
|
|
|
|
|
|
|
} |
1127
|
|
|
|
|
|
|
} |
1128
|
|
|
|
|
|
|
// Dist type is multi-numeric array type |
1129
|
108412
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1130
|
|
|
|
|
|
|
// Source type is mulnum array type |
1131
|
294
|
100
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1132
|
288
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1133
|
287
|
|
|
|
|
|
assignability = 1; |
1134
|
|
|
|
|
|
|
} |
1135
|
|
|
|
|
|
|
else { |
1136
|
288
|
|
|
|
|
|
assignability = 0; |
1137
|
|
|
|
|
|
|
} |
1138
|
|
|
|
|
|
|
} |
1139
|
|
|
|
|
|
|
// Source type is undef type |
1140
|
6
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1141
|
5
|
|
|
|
|
|
assignability = 1; |
1142
|
|
|
|
|
|
|
} |
1143
|
|
|
|
|
|
|
// Source type is other type |
1144
|
|
|
|
|
|
|
else { |
1145
|
294
|
|
|
|
|
|
assignability = 0; |
1146
|
|
|
|
|
|
|
} |
1147
|
|
|
|
|
|
|
} |
1148
|
|
|
|
|
|
|
// Dist type is string array type |
1149
|
108118
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_string_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1150
|
|
|
|
|
|
|
// Source type is string array type |
1151
|
45850
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1152
|
45802
|
|
|
|
|
|
assignability = 1; |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
// Source type is undef type |
1155
|
48
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1156
|
31
|
|
|
|
|
|
assignability = 1; |
1157
|
|
|
|
|
|
|
} |
1158
|
|
|
|
|
|
|
// Source type is other type |
1159
|
|
|
|
|
|
|
else { |
1160
|
45850
|
|
|
|
|
|
assignability = 0; |
1161
|
|
|
|
|
|
|
} |
1162
|
|
|
|
|
|
|
} |
1163
|
|
|
|
|
|
|
// Dist type is class array type |
1164
|
62268
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1165
|
|
|
|
|
|
|
// Source type is class array type |
1166
|
4217
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1167
|
4167
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1168
|
4148
|
|
|
|
|
|
assignability = 1; |
1169
|
|
|
|
|
|
|
} |
1170
|
19
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id)) { |
1171
|
10
|
|
|
|
|
|
assignability = 1; |
1172
|
|
|
|
|
|
|
} |
1173
|
|
|
|
|
|
|
else { |
1174
|
4167
|
|
|
|
|
|
assignability = 0; |
1175
|
|
|
|
|
|
|
} |
1176
|
|
|
|
|
|
|
} |
1177
|
|
|
|
|
|
|
// Source type is undef type |
1178
|
50
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1179
|
9
|
|
|
|
|
|
assignability = 1; |
1180
|
|
|
|
|
|
|
} |
1181
|
|
|
|
|
|
|
// Source type is other type |
1182
|
|
|
|
|
|
|
else { |
1183
|
4217
|
|
|
|
|
|
assignability = 0; |
1184
|
|
|
|
|
|
|
} |
1185
|
|
|
|
|
|
|
} |
1186
|
|
|
|
|
|
|
// Dist type is interface array type |
1187
|
58051
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1188
|
|
|
|
|
|
|
// Source type is interface array type |
1189
|
52
|
100
|
|
|
|
|
if (SPVM_TYPE_is_interface_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1190
|
35
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1191
|
31
|
|
|
|
|
|
assignability = 1; |
1192
|
|
|
|
|
|
|
} |
1193
|
|
|
|
|
|
|
else { |
1194
|
35
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1195
|
|
|
|
|
|
|
} |
1196
|
|
|
|
|
|
|
} |
1197
|
|
|
|
|
|
|
// Source type is class array type |
1198
|
17
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1199
|
10
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1200
|
|
|
|
|
|
|
} |
1201
|
|
|
|
|
|
|
// Source type is undef type |
1202
|
7
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1203
|
3
|
|
|
|
|
|
assignability = 1; |
1204
|
|
|
|
|
|
|
} |
1205
|
|
|
|
|
|
|
// Source type is other type |
1206
|
|
|
|
|
|
|
else { |
1207
|
52
|
|
|
|
|
|
assignability = 0; |
1208
|
|
|
|
|
|
|
} |
1209
|
|
|
|
|
|
|
} |
1210
|
|
|
|
|
|
|
// Dist type is any object array |
1211
|
57999
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1212
|
|
|
|
|
|
|
// Source type is object array type |
1213
|
57894
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1214
|
55752
|
|
|
|
|
|
assignability = 1; |
1215
|
|
|
|
|
|
|
} |
1216
|
|
|
|
|
|
|
// Source type is undef type |
1217
|
2142
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1218
|
49
|
|
|
|
|
|
assignability = 1; |
1219
|
|
|
|
|
|
|
} |
1220
|
|
|
|
|
|
|
// Source type is other type |
1221
|
|
|
|
|
|
|
else { |
1222
|
57894
|
|
|
|
|
|
assignability = 0; |
1223
|
|
|
|
|
|
|
} |
1224
|
|
|
|
|
|
|
} |
1225
|
|
|
|
|
|
|
// Dist type is multi-dimensional array type |
1226
|
105
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_muldim_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1227
|
|
|
|
|
|
|
// Source type is multi-dimensional array type |
1228
|
105
|
100
|
|
|
|
|
if (SPVM_TYPE_is_muldim_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1229
|
|
|
|
|
|
|
// Source type dimension equals dist type dimension |
1230
|
92
|
50
|
|
|
|
|
if (src_type_dimension == dist_type_dimension) { |
1231
|
|
|
|
|
|
|
// Source base type equals dist basic type |
1232
|
92
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1233
|
75
|
|
|
|
|
|
assignability = 1; |
1234
|
|
|
|
|
|
|
} |
1235
|
|
|
|
|
|
|
// Source basic type is a sub class of dist type |
1236
|
17
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id)) { |
1237
|
4
|
|
|
|
|
|
assignability = 1; |
1238
|
|
|
|
|
|
|
} |
1239
|
|
|
|
|
|
|
else { |
1240
|
|
|
|
|
|
|
// Dist basic type is interface type |
1241
|
13
|
100
|
|
|
|
|
if (SPVM_BASIC_TYPE_is_interface_type(compiler, dist_type_basic_type_id)) { |
1242
|
|
|
|
|
|
|
// Source basic type is interface type |
1243
|
9
|
100
|
|
|
|
|
if (SPVM_BASIC_TYPE_is_interface_type(compiler, src_type_basic_type_id)) { |
1244
|
3
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1245
|
|
|
|
|
|
|
} |
1246
|
|
|
|
|
|
|
// Source basic type is class type |
1247
|
6
|
50
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_class_type(compiler, src_type_basic_type_id)) { |
1248
|
6
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1249
|
|
|
|
|
|
|
} |
1250
|
|
|
|
|
|
|
// Source basic type is other type |
1251
|
|
|
|
|
|
|
else { |
1252
|
9
|
|
|
|
|
|
assignability = 0; |
1253
|
|
|
|
|
|
|
} |
1254
|
|
|
|
|
|
|
} |
1255
|
|
|
|
|
|
|
// Dist basic type is other type |
1256
|
|
|
|
|
|
|
else { |
1257
|
92
|
|
|
|
|
|
assignability = 0; |
1258
|
|
|
|
|
|
|
} |
1259
|
|
|
|
|
|
|
} |
1260
|
|
|
|
|
|
|
} |
1261
|
|
|
|
|
|
|
// Source type dimension doesn't equal dist type dimension |
1262
|
|
|
|
|
|
|
else { |
1263
|
92
|
|
|
|
|
|
assignability = 0; |
1264
|
|
|
|
|
|
|
} |
1265
|
|
|
|
|
|
|
} |
1266
|
|
|
|
|
|
|
// Source type is undef type |
1267
|
13
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1268
|
1
|
|
|
|
|
|
assignability = 1; |
1269
|
|
|
|
|
|
|
} |
1270
|
|
|
|
|
|
|
// Source type is other type |
1271
|
|
|
|
|
|
|
else { |
1272
|
105
|
|
|
|
|
|
assignability = 0; |
1273
|
|
|
|
|
|
|
} |
1274
|
|
|
|
|
|
|
} |
1275
|
|
|
|
|
|
|
else { |
1276
|
0
|
|
|
|
|
|
fprintf(stderr, "[Unexpected Error]Basic Type ID:%d, Type Dimension:%d, Type Flag:%d", dist_type_basic_type_id, dist_type_dimension, dist_type_flag); |
1277
|
0
|
|
|
|
|
|
assert(0); |
1278
|
|
|
|
|
|
|
} |
1279
|
|
|
|
|
|
|
|
1280
|
3029598
|
|
|
|
|
|
return assignability; |
1281
|
|
|
|
|
|
|
} |
1282
|
|
|
|
|
|
|
|
1283
|
54297
|
|
|
|
|
|
int32_t SPVM_TYPE_can_assign_for_method_definition ( |
1284
|
|
|
|
|
|
|
SPVM_COMPILER* compiler, |
1285
|
|
|
|
|
|
|
int32_t dist_type_basic_type_id, int32_t dist_type_dimension, int32_t dist_type_flag, |
1286
|
|
|
|
|
|
|
int32_t src_type_basic_type_id, int32_t src_type_dimension, int32_t src_type_flag) |
1287
|
|
|
|
|
|
|
{ |
1288
|
54297
|
|
|
|
|
|
int32_t assignability = 0; |
1289
|
|
|
|
|
|
|
|
1290
|
54297
|
100
|
|
|
|
|
if (SPVM_TYPE_is_any_object_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1291
|
3879
|
50
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1292
|
3879
|
|
|
|
|
|
assignability = 1; |
1293
|
|
|
|
|
|
|
} |
1294
|
|
|
|
|
|
|
else { |
1295
|
3879
|
|
|
|
|
|
assignability = 0; |
1296
|
|
|
|
|
|
|
} |
1297
|
|
|
|
|
|
|
} |
1298
|
50418
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1299
|
0
|
0
|
|
|
|
|
if (SPVM_TYPE_is_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1300
|
0
|
|
|
|
|
|
assignability = 1; |
1301
|
|
|
|
|
|
|
} |
1302
|
|
|
|
|
|
|
else { |
1303
|
0
|
|
|
|
|
|
assignability = 0; |
1304
|
|
|
|
|
|
|
} |
1305
|
|
|
|
|
|
|
} |
1306
|
|
|
|
|
|
|
else { |
1307
|
50418
|
50
|
|
|
|
|
if (dist_type_dimension == src_type_dimension && dist_type_flag == src_type_flag) { |
|
|
50
|
|
|
|
|
|
1308
|
100836
|
100
|
|
|
|
|
if (SPVM_BASIC_TYPE_is_class_type(compiler, dist_type_basic_type_id)) { |
1309
|
|
|
|
|
|
|
|
1310
|
127
|
50
|
|
|
|
|
if (dist_type_basic_type_id == src_type_basic_type_id) { |
1311
|
0
|
|
|
|
|
|
assignability = 1; |
1312
|
|
|
|
|
|
|
} |
1313
|
|
|
|
|
|
|
else { |
1314
|
127
|
|
|
|
|
|
assignability = SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id); |
1315
|
|
|
|
|
|
|
} |
1316
|
|
|
|
|
|
|
} |
1317
|
|
|
|
|
|
|
else { |
1318
|
50291
|
100
|
|
|
|
|
if (dist_type_basic_type_id == src_type_basic_type_id) { |
1319
|
50289
|
|
|
|
|
|
assignability = 1; |
1320
|
|
|
|
|
|
|
} |
1321
|
|
|
|
|
|
|
else { |
1322
|
2
|
|
|
|
|
|
assignability = 0; |
1323
|
|
|
|
|
|
|
} |
1324
|
|
|
|
|
|
|
} |
1325
|
|
|
|
|
|
|
} |
1326
|
|
|
|
|
|
|
else { |
1327
|
0
|
|
|
|
|
|
assignability = 0; |
1328
|
|
|
|
|
|
|
} |
1329
|
|
|
|
|
|
|
} |
1330
|
|
|
|
|
|
|
|
1331
|
54297
|
|
|
|
|
|
return assignability; |
1332
|
|
|
|
|
|
|
} |
1333
|
|
|
|
|
|
|
|
1334
|
53609
|
|
|
|
|
|
int32_t SPVM_TYPE_can_cast( |
1335
|
|
|
|
|
|
|
SPVM_COMPILER* compiler, |
1336
|
|
|
|
|
|
|
int32_t dist_type_basic_type_id, int32_t dist_type_dimension, int32_t dist_type_flag, |
1337
|
|
|
|
|
|
|
int32_t src_type_basic_type_id, int32_t src_type_dimension, int32_t src_type_flag) |
1338
|
|
|
|
|
|
|
{ |
1339
|
|
|
|
|
|
|
int32_t castability; |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
// Dist type is numeric type |
1342
|
53609
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1343
|
|
|
|
|
|
|
// Source type is numeric type |
1344
|
25260
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1345
|
21943
|
|
|
|
|
|
castability = 1; |
1346
|
|
|
|
|
|
|
} |
1347
|
|
|
|
|
|
|
// Source type is numeric object type |
1348
|
3317
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1349
|
81
|
100
|
|
|
|
|
if (dist_type_basic_type_id + SPVM_BASIC_TYPE_C_NUMERIC_OBJECT_UPGRADE_SHIFT == src_type_basic_type_id) { |
1350
|
80
|
|
|
|
|
|
castability = 1; |
1351
|
|
|
|
|
|
|
} |
1352
|
|
|
|
|
|
|
else { |
1353
|
81
|
|
|
|
|
|
castability = 0; |
1354
|
|
|
|
|
|
|
} |
1355
|
|
|
|
|
|
|
} |
1356
|
|
|
|
|
|
|
// Source type is any object type |
1357
|
3236
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1358
|
3231
|
|
|
|
|
|
castability = 1; |
1359
|
|
|
|
|
|
|
} |
1360
|
|
|
|
|
|
|
// Source type is other type |
1361
|
|
|
|
|
|
|
else { |
1362
|
25260
|
|
|
|
|
|
castability = 0; |
1363
|
|
|
|
|
|
|
} |
1364
|
|
|
|
|
|
|
} |
1365
|
|
|
|
|
|
|
// Dist type is multi-numeric type |
1366
|
28349
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1367
|
|
|
|
|
|
|
// Source type equals dist type |
1368
|
4
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag) && dist_type_flag == src_type_flag) { |
|
|
50
|
|
|
|
|
|
1369
|
3
|
|
|
|
|
|
castability = 1; |
1370
|
|
|
|
|
|
|
} |
1371
|
|
|
|
|
|
|
// Source type is other type |
1372
|
|
|
|
|
|
|
else { |
1373
|
4
|
|
|
|
|
|
castability = 0; |
1374
|
|
|
|
|
|
|
} |
1375
|
|
|
|
|
|
|
} |
1376
|
|
|
|
|
|
|
// Dist type is reference type |
1377
|
28345
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_ref_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1378
|
|
|
|
|
|
|
// Source type equals dist type |
1379
|
5
|
100
|
|
|
|
|
if (SPVM_TYPE_equals(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag, src_type_basic_type_id, src_type_dimension, src_type_flag) && dist_type_flag == src_type_flag) { |
|
|
50
|
|
|
|
|
|
1380
|
4
|
|
|
|
|
|
castability = 1; |
1381
|
|
|
|
|
|
|
} |
1382
|
|
|
|
|
|
|
// Source type is other type |
1383
|
|
|
|
|
|
|
else { |
1384
|
5
|
|
|
|
|
|
castability = 0; |
1385
|
|
|
|
|
|
|
} |
1386
|
|
|
|
|
|
|
} |
1387
|
|
|
|
|
|
|
// Dist type is string type |
1388
|
28340
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_string_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1389
|
|
|
|
|
|
|
// Source type is string type |
1390
|
12395
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1391
|
5963
|
|
|
|
|
|
castability = 1; |
1392
|
|
|
|
|
|
|
} |
1393
|
|
|
|
|
|
|
// Source type is numeric type |
1394
|
6432
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1395
|
522
|
|
|
|
|
|
castability = 1; |
1396
|
|
|
|
|
|
|
} |
1397
|
|
|
|
|
|
|
// Source type is byte array type |
1398
|
5910
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1399
|
28
|
|
|
|
|
|
castability = 1; |
1400
|
|
|
|
|
|
|
} |
1401
|
|
|
|
|
|
|
// Source type is any object type |
1402
|
5882
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1403
|
4260
|
|
|
|
|
|
castability = 1; |
1404
|
|
|
|
|
|
|
} |
1405
|
|
|
|
|
|
|
// Source type is undef type |
1406
|
1622
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1407
|
1621
|
|
|
|
|
|
castability = 1; |
1408
|
|
|
|
|
|
|
} |
1409
|
|
|
|
|
|
|
// Source type is other type |
1410
|
|
|
|
|
|
|
else { |
1411
|
12395
|
|
|
|
|
|
castability = 0; |
1412
|
|
|
|
|
|
|
} |
1413
|
|
|
|
|
|
|
} |
1414
|
|
|
|
|
|
|
// Dist type is numeric object type |
1415
|
15945
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_object_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1416
|
|
|
|
|
|
|
// Source type is numeric type |
1417
|
7442
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1418
|
23
|
100
|
|
|
|
|
if (dist_type_basic_type_id == src_type_basic_type_id + SPVM_BASIC_TYPE_C_NUMERIC_OBJECT_UPGRADE_SHIFT) { |
1419
|
22
|
|
|
|
|
|
castability = 1; |
1420
|
|
|
|
|
|
|
} |
1421
|
|
|
|
|
|
|
else { |
1422
|
23
|
|
|
|
|
|
castability = 0; |
1423
|
|
|
|
|
|
|
} |
1424
|
|
|
|
|
|
|
} |
1425
|
|
|
|
|
|
|
// Source type is any object type |
1426
|
7419
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1427
|
7409
|
|
|
|
|
|
castability = 1; |
1428
|
|
|
|
|
|
|
} |
1429
|
|
|
|
|
|
|
// Source type is undef type |
1430
|
10
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1431
|
6
|
|
|
|
|
|
castability = 1; |
1432
|
|
|
|
|
|
|
} |
1433
|
|
|
|
|
|
|
// Source type is other type |
1434
|
|
|
|
|
|
|
else { |
1435
|
7442
|
|
|
|
|
|
castability = 0; |
1436
|
|
|
|
|
|
|
} |
1437
|
|
|
|
|
|
|
} |
1438
|
|
|
|
|
|
|
// Dist type is class type |
1439
|
8503
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1440
|
|
|
|
|
|
|
// Source type is class type |
1441
|
346
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1442
|
210
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1443
|
194
|
|
|
|
|
|
castability = 1; |
1444
|
|
|
|
|
|
|
} |
1445
|
16
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id)) { |
1446
|
7
|
|
|
|
|
|
castability = 1; |
1447
|
|
|
|
|
|
|
} |
1448
|
9
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, src_type_basic_type_id, dist_type_basic_type_id)) { |
1449
|
7
|
|
|
|
|
|
castability = 1; |
1450
|
|
|
|
|
|
|
} |
1451
|
|
|
|
|
|
|
else { |
1452
|
210
|
|
|
|
|
|
castability = 0; |
1453
|
|
|
|
|
|
|
} |
1454
|
|
|
|
|
|
|
} |
1455
|
|
|
|
|
|
|
// Source type is interface type |
1456
|
136
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1457
|
2
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, dist_type_basic_type_id, src_type_basic_type_id); |
1458
|
|
|
|
|
|
|
} |
1459
|
|
|
|
|
|
|
// Source type is any object type |
1460
|
134
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1461
|
106
|
|
|
|
|
|
castability = 1; |
1462
|
|
|
|
|
|
|
} |
1463
|
|
|
|
|
|
|
// Source type is undef type |
1464
|
28
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1465
|
26
|
|
|
|
|
|
castability = 1; |
1466
|
|
|
|
|
|
|
} |
1467
|
|
|
|
|
|
|
// Source type is other type |
1468
|
|
|
|
|
|
|
else { |
1469
|
346
|
|
|
|
|
|
castability = 0; |
1470
|
|
|
|
|
|
|
} |
1471
|
|
|
|
|
|
|
} |
1472
|
|
|
|
|
|
|
// Dist type is interface type |
1473
|
8157
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1474
|
|
|
|
|
|
|
// Source type is class type |
1475
|
58
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1476
|
40
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1477
|
|
|
|
|
|
|
} |
1478
|
|
|
|
|
|
|
// Source type is interface type |
1479
|
18
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1480
|
4
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1481
|
|
|
|
|
|
|
} |
1482
|
|
|
|
|
|
|
// Source type is any object type |
1483
|
14
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1484
|
10
|
|
|
|
|
|
castability = 1; |
1485
|
|
|
|
|
|
|
} |
1486
|
|
|
|
|
|
|
// Source type is undef type |
1487
|
4
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1488
|
3
|
|
|
|
|
|
castability = 1; |
1489
|
|
|
|
|
|
|
} |
1490
|
|
|
|
|
|
|
// Source type is other type |
1491
|
|
|
|
|
|
|
else { |
1492
|
58
|
|
|
|
|
|
castability = 0; |
1493
|
|
|
|
|
|
|
} |
1494
|
|
|
|
|
|
|
} |
1495
|
|
|
|
|
|
|
// Dist type is any object type |
1496
|
8099
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1497
|
|
|
|
|
|
|
// Source type is numeric type |
1498
|
5675
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1499
|
2350
|
|
|
|
|
|
castability = 1; |
1500
|
|
|
|
|
|
|
} |
1501
|
|
|
|
|
|
|
// Source type is object type |
1502
|
3325
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1503
|
2780
|
|
|
|
|
|
castability = 1; |
1504
|
|
|
|
|
|
|
} |
1505
|
|
|
|
|
|
|
// Source type is undef type |
1506
|
545
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1507
|
543
|
|
|
|
|
|
castability = 1; |
1508
|
|
|
|
|
|
|
} |
1509
|
|
|
|
|
|
|
// Source type is other type |
1510
|
|
|
|
|
|
|
else { |
1511
|
5675
|
|
|
|
|
|
castability = 0; |
1512
|
|
|
|
|
|
|
} |
1513
|
|
|
|
|
|
|
} |
1514
|
|
|
|
|
|
|
// Dist type is undef type |
1515
|
2424
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1516
|
0
|
|
|
|
|
|
assert(0); |
1517
|
|
|
|
|
|
|
} |
1518
|
|
|
|
|
|
|
// Dist type is byte array type |
1519
|
2424
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1520
|
|
|
|
|
|
|
// Source type is string type |
1521
|
111
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1522
|
64
|
|
|
|
|
|
castability = 1; |
1523
|
|
|
|
|
|
|
} |
1524
|
|
|
|
|
|
|
// Source type is byte array type |
1525
|
47
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1526
|
33
|
|
|
|
|
|
castability = 1; |
1527
|
|
|
|
|
|
|
} |
1528
|
|
|
|
|
|
|
// Source type is any object type |
1529
|
14
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1530
|
8
|
|
|
|
|
|
castability = 1; |
1531
|
|
|
|
|
|
|
} |
1532
|
|
|
|
|
|
|
// Source type is undef type |
1533
|
6
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1534
|
5
|
|
|
|
|
|
castability = 1; |
1535
|
|
|
|
|
|
|
} |
1536
|
|
|
|
|
|
|
// Source type is other type |
1537
|
|
|
|
|
|
|
else { |
1538
|
111
|
|
|
|
|
|
castability = 0; |
1539
|
|
|
|
|
|
|
} |
1540
|
|
|
|
|
|
|
} |
1541
|
|
|
|
|
|
|
// Dist type is numeric array type(except for byte array) |
1542
|
2313
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1543
|
|
|
|
|
|
|
// Source type equals dist type |
1544
|
87
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1545
|
34
|
|
|
|
|
|
castability = 1; |
1546
|
|
|
|
|
|
|
} |
1547
|
|
|
|
|
|
|
// Source type is any object type |
1548
|
53
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1549
|
31
|
|
|
|
|
|
castability = 1; |
1550
|
|
|
|
|
|
|
} |
1551
|
|
|
|
|
|
|
// Source type is undef type |
1552
|
22
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1553
|
21
|
|
|
|
|
|
castability = 1; |
1554
|
|
|
|
|
|
|
} |
1555
|
|
|
|
|
|
|
// Source type is other type |
1556
|
|
|
|
|
|
|
else { |
1557
|
87
|
|
|
|
|
|
castability = 0; |
1558
|
|
|
|
|
|
|
} |
1559
|
|
|
|
|
|
|
} |
1560
|
|
|
|
|
|
|
// Dist type is multi-numeric array |
1561
|
2226
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_mulnum_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1562
|
|
|
|
|
|
|
// Source type equals dist type |
1563
|
4
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1564
|
1
|
|
|
|
|
|
castability = 1; |
1565
|
|
|
|
|
|
|
} |
1566
|
|
|
|
|
|
|
// Source type is any object type |
1567
|
3
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1568
|
1
|
|
|
|
|
|
castability = 1; |
1569
|
|
|
|
|
|
|
} |
1570
|
|
|
|
|
|
|
// Source type is undef type |
1571
|
2
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1572
|
1
|
|
|
|
|
|
castability = 1; |
1573
|
|
|
|
|
|
|
} |
1574
|
|
|
|
|
|
|
// Source type is other type |
1575
|
|
|
|
|
|
|
else { |
1576
|
4
|
|
|
|
|
|
castability = 0; |
1577
|
|
|
|
|
|
|
} |
1578
|
|
|
|
|
|
|
} |
1579
|
|
|
|
|
|
|
// Dist type is string array |
1580
|
2222
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_string_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1581
|
|
|
|
|
|
|
// Source type is string type |
1582
|
25
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1583
|
1
|
|
|
|
|
|
castability = 1; |
1584
|
|
|
|
|
|
|
} |
1585
|
|
|
|
|
|
|
// Source type is any object type |
1586
|
24
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1587
|
1
|
|
|
|
|
|
castability = 1; |
1588
|
|
|
|
|
|
|
} |
1589
|
|
|
|
|
|
|
// Source type is any object array type |
1590
|
23
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1591
|
15
|
|
|
|
|
|
castability = 1; |
1592
|
|
|
|
|
|
|
} |
1593
|
|
|
|
|
|
|
// Source type is undef type |
1594
|
8
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1595
|
7
|
|
|
|
|
|
castability = 1; |
1596
|
|
|
|
|
|
|
} |
1597
|
|
|
|
|
|
|
// Source type is other type |
1598
|
|
|
|
|
|
|
else { |
1599
|
25
|
|
|
|
|
|
castability = 0; |
1600
|
|
|
|
|
|
|
} |
1601
|
|
|
|
|
|
|
} |
1602
|
|
|
|
|
|
|
// Dist type is class array type |
1603
|
2197
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1604
|
|
|
|
|
|
|
// Source type is class array type |
1605
|
56
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1606
|
14
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1607
|
1
|
|
|
|
|
|
castability = 1; |
1608
|
|
|
|
|
|
|
} |
1609
|
13
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id)) { |
1610
|
5
|
|
|
|
|
|
castability = 1; |
1611
|
|
|
|
|
|
|
} |
1612
|
8
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, src_type_basic_type_id, dist_type_basic_type_id)) { |
1613
|
7
|
|
|
|
|
|
castability = 1; |
1614
|
|
|
|
|
|
|
} |
1615
|
|
|
|
|
|
|
else { |
1616
|
14
|
|
|
|
|
|
castability = 0; |
1617
|
|
|
|
|
|
|
} |
1618
|
|
|
|
|
|
|
} |
1619
|
|
|
|
|
|
|
// Source type is interface array type |
1620
|
42
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_interface_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1621
|
0
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, dist_type_basic_type_id, src_type_basic_type_id); |
1622
|
|
|
|
|
|
|
} |
1623
|
|
|
|
|
|
|
// Source type is any object type |
1624
|
42
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1625
|
3
|
|
|
|
|
|
castability = 1; |
1626
|
|
|
|
|
|
|
} |
1627
|
|
|
|
|
|
|
// Source type is any object array type |
1628
|
39
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1629
|
38
|
|
|
|
|
|
castability = 1; |
1630
|
|
|
|
|
|
|
} |
1631
|
|
|
|
|
|
|
// Source type is undef type |
1632
|
1
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1633
|
1
|
|
|
|
|
|
castability = 1; |
1634
|
|
|
|
|
|
|
} |
1635
|
|
|
|
|
|
|
// Source type is other type |
1636
|
|
|
|
|
|
|
else { |
1637
|
56
|
|
|
|
|
|
castability = 0; |
1638
|
|
|
|
|
|
|
} |
1639
|
|
|
|
|
|
|
} |
1640
|
|
|
|
|
|
|
// Dist type is interface array type |
1641
|
2141
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1642
|
|
|
|
|
|
|
// Source type is class array type |
1643
|
14
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1644
|
5
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1645
|
|
|
|
|
|
|
} |
1646
|
|
|
|
|
|
|
// Source type is interface array type |
1647
|
9
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1648
|
4
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1649
|
|
|
|
|
|
|
} |
1650
|
|
|
|
|
|
|
// Source type is any object type |
1651
|
5
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1652
|
3
|
|
|
|
|
|
castability = 1; |
1653
|
|
|
|
|
|
|
} |
1654
|
|
|
|
|
|
|
// Source type is any object array type |
1655
|
2
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1656
|
1
|
|
|
|
|
|
castability = 1; |
1657
|
|
|
|
|
|
|
} |
1658
|
|
|
|
|
|
|
// Source type is undef type |
1659
|
1
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1660
|
1
|
|
|
|
|
|
castability = 1; |
1661
|
|
|
|
|
|
|
} |
1662
|
|
|
|
|
|
|
// Source type is other type |
1663
|
|
|
|
|
|
|
else { |
1664
|
14
|
|
|
|
|
|
castability = 0; |
1665
|
|
|
|
|
|
|
} |
1666
|
|
|
|
|
|
|
} |
1667
|
|
|
|
|
|
|
// Dist type is any object array type |
1668
|
2127
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1669
|
|
|
|
|
|
|
// Source type is any object type |
1670
|
2099
|
100
|
|
|
|
|
if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1671
|
2089
|
|
|
|
|
|
castability = 1; |
1672
|
|
|
|
|
|
|
} |
1673
|
|
|
|
|
|
|
// Source type is object array type |
1674
|
10
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1675
|
3
|
|
|
|
|
|
castability = 1; |
1676
|
|
|
|
|
|
|
} |
1677
|
|
|
|
|
|
|
// Source type is undef type |
1678
|
7
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1679
|
5
|
|
|
|
|
|
castability = 1; |
1680
|
|
|
|
|
|
|
} |
1681
|
|
|
|
|
|
|
// Source type is other type |
1682
|
|
|
|
|
|
|
else { |
1683
|
2099
|
|
|
|
|
|
castability = 0; |
1684
|
|
|
|
|
|
|
} |
1685
|
|
|
|
|
|
|
} |
1686
|
|
|
|
|
|
|
// Dist type is multi-dimensional array type |
1687
|
28
|
50
|
|
|
|
|
else if (SPVM_TYPE_is_muldim_array_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
1688
|
|
|
|
|
|
|
// Source type is multi-dimensional array type |
1689
|
28
|
100
|
|
|
|
|
if (SPVM_TYPE_is_muldim_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1690
|
|
|
|
|
|
|
// Source type dimension equals dist type dimension |
1691
|
12
|
50
|
|
|
|
|
if (src_type_dimension == dist_type_dimension) { |
1692
|
|
|
|
|
|
|
// Source base type equals dist basic type |
1693
|
12
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
1694
|
3
|
|
|
|
|
|
castability = 1; |
1695
|
|
|
|
|
|
|
} |
1696
|
|
|
|
|
|
|
// Source basic type is a sub class of dist type |
1697
|
9
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, dist_type_basic_type_id, src_type_basic_type_id)) { |
1698
|
3
|
|
|
|
|
|
castability = 1; |
1699
|
|
|
|
|
|
|
} |
1700
|
|
|
|
|
|
|
// Source basic type is a super class of dist type |
1701
|
6
|
100
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_super_class(compiler, src_type_basic_type_id, dist_type_basic_type_id)) { |
1702
|
3
|
|
|
|
|
|
castability = 1; |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
else { |
1705
|
|
|
|
|
|
|
// Dist basic type is class type |
1706
|
3
|
50
|
|
|
|
|
if (SPVM_BASIC_TYPE_is_class_type(compiler, dist_type_basic_type_id)) { |
1707
|
|
|
|
|
|
|
// Source basic type is interface type |
1708
|
0
|
0
|
|
|
|
|
if (SPVM_BASIC_TYPE_is_interface_type(compiler, src_type_basic_type_id)) { |
1709
|
0
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1710
|
|
|
|
|
|
|
} |
1711
|
|
|
|
|
|
|
// Source basic type is other type |
1712
|
|
|
|
|
|
|
else { |
1713
|
0
|
|
|
|
|
|
castability = 0; |
1714
|
|
|
|
|
|
|
} |
1715
|
|
|
|
|
|
|
} |
1716
|
|
|
|
|
|
|
// Dist basic type is interface type |
1717
|
3
|
50
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_interface_type(compiler, dist_type_basic_type_id)) { |
1718
|
|
|
|
|
|
|
// Source basic type is class type |
1719
|
3
|
100
|
|
|
|
|
if (SPVM_BASIC_TYPE_is_class_type(compiler, src_type_basic_type_id)) { |
1720
|
1
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1721
|
|
|
|
|
|
|
} |
1722
|
|
|
|
|
|
|
// Source basic type is interface type |
1723
|
2
|
50
|
|
|
|
|
else if (SPVM_BASIC_TYPE_is_interface_type(compiler, src_type_basic_type_id)) { |
1724
|
2
|
|
|
|
|
|
castability = SPVM_BASIC_TYPE_has_interface(compiler, src_type_basic_type_id, dist_type_basic_type_id); |
1725
|
|
|
|
|
|
|
} |
1726
|
|
|
|
|
|
|
// Source basic type is other type |
1727
|
|
|
|
|
|
|
else { |
1728
|
3
|
|
|
|
|
|
castability = 0; |
1729
|
|
|
|
|
|
|
} |
1730
|
|
|
|
|
|
|
} |
1731
|
|
|
|
|
|
|
// Dist basic type is other type |
1732
|
|
|
|
|
|
|
else { |
1733
|
12
|
|
|
|
|
|
castability = 0; |
1734
|
|
|
|
|
|
|
} |
1735
|
|
|
|
|
|
|
} |
1736
|
|
|
|
|
|
|
} |
1737
|
|
|
|
|
|
|
// Source type dimension doesn't equal dist type dimension |
1738
|
|
|
|
|
|
|
else { |
1739
|
12
|
|
|
|
|
|
castability = 0; |
1740
|
|
|
|
|
|
|
} |
1741
|
|
|
|
|
|
|
} |
1742
|
|
|
|
|
|
|
// Source type is any object type |
1743
|
16
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1744
|
1
|
|
|
|
|
|
castability = 1; |
1745
|
|
|
|
|
|
|
} |
1746
|
|
|
|
|
|
|
// Source type is any object array type |
1747
|
15
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1748
|
9
|
|
|
|
|
|
castability = 1; |
1749
|
|
|
|
|
|
|
} |
1750
|
|
|
|
|
|
|
// Source type is undef type |
1751
|
6
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
1752
|
1
|
|
|
|
|
|
castability = 1; |
1753
|
|
|
|
|
|
|
} |
1754
|
|
|
|
|
|
|
// Source type is other type |
1755
|
|
|
|
|
|
|
else { |
1756
|
28
|
|
|
|
|
|
castability = 0; |
1757
|
|
|
|
|
|
|
} |
1758
|
|
|
|
|
|
|
} |
1759
|
|
|
|
|
|
|
else { |
1760
|
0
|
|
|
|
|
|
assert(0); |
1761
|
|
|
|
|
|
|
} |
1762
|
|
|
|
|
|
|
|
1763
|
53609
|
|
|
|
|
|
return castability; |
1764
|
|
|
|
|
|
|
} |
1765
|
|
|
|
|
|
|
|
1766
|
179710
|
|
|
|
|
|
int32_t SPVM_TYPE_equals(SPVM_COMPILER* compiler, int32_t basic_type_id1, int32_t type_dimension1, int32_t type_flag1, int32_t basic_type_id2, int32_t type_dimension2, int32_t type_flag2) { |
1767
|
|
|
|
|
|
|
|
1768
|
179710
|
100
|
|
|
|
|
if (basic_type_id1 == basic_type_id2 && type_dimension1 == type_dimension2 && type_flag1 == type_flag2) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1769
|
128697
|
|
|
|
|
|
return 1; |
1770
|
|
|
|
|
|
|
} |
1771
|
|
|
|
|
|
|
else { |
1772
|
51013
|
|
|
|
|
|
return 0; |
1773
|
|
|
|
|
|
|
} |
1774
|
|
|
|
|
|
|
} |