| 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
|
7298148
|
|
|
|
|
|
int32_t SPVM_TYPE_is_ref_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
21
|
|
|
|
|
|
|
|
|
22
|
7298148
|
|
|
|
|
|
return flag & SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
321091
|
|
|
|
|
|
int32_t SPVM_TYPE_is_byte_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
26
|
|
|
|
|
|
|
|
|
27
|
321091
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
28
|
96115
|
|
|
|
|
|
return 1; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
else { |
|
31
|
224976
|
|
|
|
|
|
return 0; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
4136790
|
|
|
|
|
|
int32_t SPVM_TYPE_is_void_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
36
|
|
|
|
|
|
|
|
|
37
|
4136790
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_VOID) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
38
|
558212
|
|
|
|
|
|
return 1; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
else { |
|
41
|
3578578
|
|
|
|
|
|
return 0; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
225248
|
|
|
|
|
|
int32_t SPVM_TYPE_is_short_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
46
|
|
|
|
|
|
|
|
|
47
|
225248
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
48
|
15642
|
|
|
|
|
|
return 1; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
else { |
|
51
|
209606
|
|
|
|
|
|
return 0; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
201913
|
|
|
|
|
|
int32_t SPVM_TYPE_is_int_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
56
|
|
|
|
|
|
|
|
|
57
|
201913
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
58
|
130634
|
|
|
|
|
|
return 1; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
else { |
|
61
|
71279
|
|
|
|
|
|
return 0; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
83118
|
|
|
|
|
|
int32_t SPVM_TYPE_is_long_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
66
|
|
|
|
|
|
|
|
|
67
|
83118
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_LONG) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
68
|
11792
|
|
|
|
|
|
return 1; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
else { |
|
71
|
71326
|
|
|
|
|
|
return 0; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
70294
|
|
|
|
|
|
int32_t SPVM_TYPE_is_float_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
76
|
|
|
|
|
|
|
|
|
77
|
70294
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
78
|
5329
|
|
|
|
|
|
return 1; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
else { |
|
81
|
64965
|
|
|
|
|
|
return 0; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
69171
|
|
|
|
|
|
int32_t SPVM_TYPE_is_double_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
86
|
|
|
|
|
|
|
|
|
87
|
69171
|
100
|
|
|
|
|
if (dimension == 0 && (basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE) && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
88
|
8609
|
|
|
|
|
|
return 1; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
else { |
|
91
|
60562
|
|
|
|
|
|
return 0; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
17636483
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
96
|
|
|
|
|
|
|
|
|
97
|
17636483
|
|
|
|
|
|
int32_t basic_type_is_numeric_type = SPVM_BASIC_TYPE_is_numeric_type(compiler, basic_type_id); |
|
98
|
17636483
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_numeric_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
99
|
14974041
|
|
|
|
|
|
return 1; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
else { |
|
102
|
2662442
|
|
|
|
|
|
return 0; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
532554
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
107
|
|
|
|
|
|
|
|
|
108
|
532554
|
|
|
|
|
|
int32_t basic_type_is_numeric_object_type = SPVM_BASIC_TYPE_is_numeric_object_type(compiler, basic_type_id); |
|
109
|
532554
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_numeric_object_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
110
|
72164
|
|
|
|
|
|
return 1; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
else { |
|
113
|
460390
|
|
|
|
|
|
return 0; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
29625
|
|
|
|
|
|
int32_t SPVM_TYPE_is_byte_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
118
|
|
|
|
|
|
|
|
|
119
|
29625
|
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
|
533
|
|
|
|
|
|
return 1; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
else { |
|
123
|
29092
|
|
|
|
|
|
return 0; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
28584
|
|
|
|
|
|
int32_t SPVM_TYPE_is_short_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
128
|
|
|
|
|
|
|
|
|
129
|
28584
|
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
|
28567
|
|
|
|
|
|
return 0; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
33396
|
|
|
|
|
|
int32_t SPVM_TYPE_is_int_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
138
|
|
|
|
|
|
|
|
|
139
|
33396
|
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
|
4777
|
|
|
|
|
|
return 1; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
else { |
|
143
|
28619
|
|
|
|
|
|
return 0; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
30028
|
|
|
|
|
|
int32_t SPVM_TYPE_is_long_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
148
|
|
|
|
|
|
|
|
|
149
|
30028
|
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
|
4131
|
|
|
|
|
|
return 1; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
else { |
|
153
|
25897
|
|
|
|
|
|
return 0; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
24874
|
|
|
|
|
|
int32_t SPVM_TYPE_is_float_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
158
|
|
|
|
|
|
|
|
|
159
|
24874
|
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
|
1045
|
|
|
|
|
|
return 1; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
else { |
|
163
|
23829
|
|
|
|
|
|
return 0; |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
23844
|
|
|
|
|
|
int32_t SPVM_TYPE_is_double_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
168
|
|
|
|
|
|
|
|
|
169
|
23844
|
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
|
1052
|
|
|
|
|
|
return 1; |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
else { |
|
173
|
22792
|
|
|
|
|
|
return 0; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
71949
|
|
|
|
|
|
int32_t SPVM_TYPE_is_bool_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
178
|
|
|
|
|
|
|
|
|
179
|
71949
|
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
|
71921
|
|
|
|
|
|
return 0; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
9226
|
|
|
|
|
|
int32_t SPVM_TYPE_is_numeric_ref_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
188
|
|
|
|
|
|
|
|
|
189
|
9226
|
|
|
|
|
|
int32_t basic_type_is_numeric_type = SPVM_BASIC_TYPE_is_numeric_type(compiler, basic_type_id); |
|
190
|
9226
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_numeric_type && (flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
191
|
9114
|
|
|
|
|
|
return 1; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
else { |
|
194
|
112
|
|
|
|
|
|
return 0; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
6957
|
|
|
|
|
|
int32_t SPVM_TYPE_is_integer_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
199
|
|
|
|
|
|
|
|
|
200
|
6957
|
|
|
|
|
|
int32_t basic_type_is_integer_type = SPVM_BASIC_TYPE_is_integer_type(compiler, basic_type_id); |
|
201
|
6957
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_integer_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
202
|
6938
|
|
|
|
|
|
return 1; |
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
else { |
|
205
|
19
|
|
|
|
|
|
return 0; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
35788
|
|
|
|
|
|
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
|
35788
|
|
|
|
|
|
int32_t basic_type_is_integer_type_within_int = SPVM_BASIC_TYPE_is_integer_type_within_int(compiler, basic_type_id); |
|
212
|
35788
|
50
|
|
|
|
|
if (dimension == 0 && basic_type_is_integer_type_within_int && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
213
|
35783
|
|
|
|
|
|
return 1; |
|
214
|
|
|
|
|
|
|
} |
|
215
|
|
|
|
|
|
|
else { |
|
216
|
5
|
|
|
|
|
|
return 0; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
} |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
|
221
|
9853425
|
|
|
|
|
|
int32_t SPVM_TYPE_is_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
222
|
|
|
|
|
|
|
|
|
223
|
9853425
|
100
|
|
|
|
|
if (SPVM_TYPE_is_array_type(compiler, basic_type_id, dimension, flag)) { |
|
224
|
860146
|
|
|
|
|
|
return 1; |
|
225
|
|
|
|
|
|
|
} |
|
226
|
8993279
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_basic_object_type(compiler, basic_type_id, dimension, flag)) { |
|
227
|
2482970
|
|
|
|
|
|
return 1; |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
else { |
|
230
|
6510309
|
|
|
|
|
|
return 0; |
|
231
|
|
|
|
|
|
|
} |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
8993279
|
|
|
|
|
|
int32_t SPVM_TYPE_is_basic_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
235
|
|
|
|
|
|
|
|
|
236
|
8993279
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, basic_type_id, dimension, flag)) { |
|
237
|
1311358
|
|
|
|
|
|
return 1; |
|
238
|
|
|
|
|
|
|
} |
|
239
|
7681921
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_type(compiler, basic_type_id, dimension, flag)) { |
|
240
|
736172
|
|
|
|
|
|
return 1; |
|
241
|
|
|
|
|
|
|
} |
|
242
|
6945749
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_interface_type(compiler, basic_type_id, dimension, flag)) { |
|
243
|
81508
|
|
|
|
|
|
return 1; |
|
244
|
|
|
|
|
|
|
} |
|
245
|
6864241
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, basic_type_id, dimension, flag)) { |
|
246
|
353932
|
|
|
|
|
|
return 1; |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
else { |
|
249
|
6510309
|
|
|
|
|
|
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
|
57042
|
|
|
|
|
|
int32_t SPVM_TYPE_is_object_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
269
|
|
|
|
|
|
|
|
|
270
|
57042
|
100
|
|
|
|
|
if (SPVM_TYPE_is_array_type(compiler, basic_type_id, dimension, flag)) { |
|
271
|
54928
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, basic_type_id, dimension - 1, flag)) { |
|
272
|
54925
|
|
|
|
|
|
return 1; |
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
else { |
|
275
|
3
|
|
|
|
|
|
return 0; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
else { |
|
279
|
2114
|
|
|
|
|
|
return 0; |
|
280
|
|
|
|
|
|
|
} |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
|
|
283
|
7247092
|
|
|
|
|
|
int32_t SPVM_TYPE_is_any_object_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
284
|
|
|
|
|
|
|
|
|
285
|
7247092
|
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
|
8693858
|
|
|
|
|
|
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
|
8693858
|
|
|
|
|
|
int32_t basic_type_is_class_type = SPVM_BASIC_TYPE_is_class_type(compiler, basic_type_id); |
|
292
|
8693858
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_class_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
293
|
1427601
|
|
|
|
|
|
is_class_type = 1; |
|
294
|
|
|
|
|
|
|
} |
|
295
|
|
|
|
|
|
|
// Array |
|
296
|
|
|
|
|
|
|
else { |
|
297
|
7266257
|
|
|
|
|
|
is_class_type = 0; |
|
298
|
|
|
|
|
|
|
} |
|
299
|
|
|
|
|
|
|
|
|
300
|
8693858
|
|
|
|
|
|
return is_class_type; |
|
301
|
|
|
|
|
|
|
} |
|
302
|
|
|
|
|
|
|
|
|
303
|
7293386
|
|
|
|
|
|
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
|
7293386
|
|
|
|
|
|
int32_t basic_type_is_interface_type = SPVM_BASIC_TYPE_is_interface_type(compiler, basic_type_id); |
|
307
|
7293386
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_interface_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
308
|
139752
|
|
|
|
|
|
is_interface_type = 1; |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
// Array |
|
311
|
|
|
|
|
|
|
else { |
|
312
|
7153634
|
|
|
|
|
|
is_interface_type = 0; |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
7293386
|
|
|
|
|
|
return is_interface_type; |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
|
|
318
|
12230245
|
|
|
|
|
|
int32_t SPVM_TYPE_is_string_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
319
|
|
|
|
|
|
|
|
|
320
|
12230245
|
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
|
24424
|
|
|
|
|
|
int32_t SPVM_TYPE_is_byte_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
324
|
|
|
|
|
|
|
|
|
325
|
24424
|
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
|
131326
|
|
|
|
|
|
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
|
131326
|
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
|
131311
|
|
|
|
|
|
is_string_or_byte_array = 1; |
|
333
|
|
|
|
|
|
|
} |
|
334
|
|
|
|
|
|
|
else { |
|
335
|
15
|
|
|
|
|
|
is_string_or_byte_array = 0; |
|
336
|
|
|
|
|
|
|
} |
|
337
|
|
|
|
|
|
|
|
|
338
|
131326
|
|
|
|
|
|
return is_string_or_byte_array; |
|
339
|
|
|
|
|
|
|
} |
|
340
|
|
|
|
|
|
|
|
|
341
|
10196731
|
|
|
|
|
|
int32_t SPVM_TYPE_is_array_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
342
|
|
|
|
|
|
|
|
|
343
|
10196731
|
100
|
|
|
|
|
return dimension > 0 && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF); |
|
|
|
50
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
} |
|
345
|
|
|
|
|
|
|
|
|
346
|
153849
|
|
|
|
|
|
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
|
153849
|
|
|
|
|
|
int32_t basic_type_is_string_type = SPVM_BASIC_TYPE_is_string_type(compiler, basic_type_id); |
|
350
|
153849
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_string_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
351
|
90258
|
|
|
|
|
|
is_string_array_type = 1; |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
// Array |
|
354
|
|
|
|
|
|
|
else { |
|
355
|
63591
|
|
|
|
|
|
is_string_array_type = 0; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
153849
|
|
|
|
|
|
return is_string_array_type; |
|
359
|
|
|
|
|
|
|
} |
|
360
|
|
|
|
|
|
|
|
|
361
|
67771
|
|
|
|
|
|
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
|
67771
|
|
|
|
|
|
int32_t basic_type_is_class_type = SPVM_BASIC_TYPE_is_class_type(compiler, basic_type_id); |
|
365
|
67771
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_class_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
366
|
8365
|
|
|
|
|
|
is_class_array_type = 1; |
|
367
|
|
|
|
|
|
|
} |
|
368
|
|
|
|
|
|
|
// Array |
|
369
|
|
|
|
|
|
|
else { |
|
370
|
59406
|
|
|
|
|
|
is_class_array_type = 0; |
|
371
|
|
|
|
|
|
|
} |
|
372
|
|
|
|
|
|
|
|
|
373
|
67771
|
|
|
|
|
|
return is_class_array_type; |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
|
|
376
|
59401
|
|
|
|
|
|
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
|
59401
|
|
|
|
|
|
int32_t basic_type_is_interface_type = SPVM_BASIC_TYPE_is_interface_type(compiler, basic_type_id); |
|
380
|
59401
|
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
|
59296
|
|
|
|
|
|
is_interface_array_type = 0; |
|
386
|
|
|
|
|
|
|
} |
|
387
|
|
|
|
|
|
|
|
|
388
|
59401
|
|
|
|
|
|
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
|
651758
|
|
|
|
|
|
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
|
651758
|
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
|
211746
|
|
|
|
|
|
return 1; |
|
400
|
|
|
|
|
|
|
} |
|
401
|
|
|
|
|
|
|
else { |
|
402
|
440012
|
|
|
|
|
|
return 0; |
|
403
|
|
|
|
|
|
|
} |
|
404
|
|
|
|
|
|
|
} |
|
405
|
|
|
|
|
|
|
|
|
406
|
292779
|
|
|
|
|
|
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
|
292779
|
|
|
|
|
|
int32_t basic_type_is_numeric_type = SPVM_BASIC_TYPE_is_numeric_type(compiler, basic_type_id); |
|
410
|
292779
|
100
|
|
|
|
|
if (dimension == 1 && basic_type_is_numeric_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
411
|
183565
|
|
|
|
|
|
is_numeric_array_type = 1; |
|
412
|
|
|
|
|
|
|
} |
|
413
|
|
|
|
|
|
|
// Array |
|
414
|
|
|
|
|
|
|
else { |
|
415
|
109214
|
|
|
|
|
|
is_numeric_array_type = 0; |
|
416
|
|
|
|
|
|
|
} |
|
417
|
|
|
|
|
|
|
|
|
418
|
292779
|
|
|
|
|
|
return is_numeric_array_type; |
|
419
|
|
|
|
|
|
|
} |
|
420
|
|
|
|
|
|
|
|
|
421
|
4261153
|
|
|
|
|
|
int32_t SPVM_TYPE_is_undef_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
422
|
|
|
|
|
|
|
|
|
423
|
4261153
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_id == SPVM_NATIVE_C_BASIC_TYPE_ID_UNDEF && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
424
|
47680
|
|
|
|
|
|
return 1; |
|
425
|
|
|
|
|
|
|
} |
|
426
|
|
|
|
|
|
|
else { |
|
427
|
4213473
|
|
|
|
|
|
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
|
8506847
|
|
|
|
|
|
int32_t SPVM_TYPE_is_mulnum_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
442
|
|
|
|
|
|
|
|
|
443
|
8506847
|
|
|
|
|
|
int32_t basic_type_is_mulnum_type = SPVM_BASIC_TYPE_is_mulnum_type(compiler, basic_type_id); |
|
444
|
8506847
|
100
|
|
|
|
|
if (dimension == 0 && basic_type_is_mulnum_type && !(flag & SPVM_NATIVE_C_TYPE_FLAG_REF)) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
445
|
9568
|
|
|
|
|
|
return 1; |
|
446
|
|
|
|
|
|
|
} |
|
447
|
|
|
|
|
|
|
else { |
|
448
|
8497279
|
|
|
|
|
|
return 0; |
|
449
|
|
|
|
|
|
|
} |
|
450
|
|
|
|
|
|
|
} |
|
451
|
|
|
|
|
|
|
|
|
452
|
165627
|
|
|
|
|
|
int32_t SPVM_TYPE_is_mulnum_ref_type(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
453
|
|
|
|
|
|
|
|
|
454
|
165627
|
|
|
|
|
|
int32_t basic_type_is_mulnum_type = SPVM_BASIC_TYPE_is_mulnum_type(compiler, basic_type_id); |
|
455
|
165627
|
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
|
164822
|
|
|
|
|
|
return 0; |
|
460
|
|
|
|
|
|
|
} |
|
461
|
|
|
|
|
|
|
} |
|
462
|
|
|
|
|
|
|
|
|
463
|
281310
|
|
|
|
|
|
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
|
281310
|
|
|
|
|
|
int32_t basic_type_is_mulnum_type = SPVM_BASIC_TYPE_is_mulnum_type(compiler, basic_type_id); |
|
467
|
281310
|
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
|
280517
|
|
|
|
|
|
is_mulnum_array_type = 0; |
|
473
|
|
|
|
|
|
|
} |
|
474
|
|
|
|
|
|
|
|
|
475
|
281310
|
|
|
|
|
|
return is_mulnum_array_type; |
|
476
|
|
|
|
|
|
|
} |
|
477
|
|
|
|
|
|
|
|
|
478
|
5858757
|
|
|
|
|
|
int32_t SPVM_TYPE_get_type_name_length(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
479
|
5858757
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
|
480
|
5858757
|
50
|
|
|
|
|
assert(basic_type); |
|
481
|
|
|
|
|
|
|
|
|
482
|
5858757
|
|
|
|
|
|
int32_t length = 0; |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
// * |
|
485
|
5858757
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE) { |
|
486
|
28987
|
|
|
|
|
|
length += strlen("mutable "); |
|
487
|
|
|
|
|
|
|
} |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
// Basic type |
|
490
|
5858757
|
|
|
|
|
|
length += strlen(basic_type->name); |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
// [] |
|
493
|
5858757
|
|
|
|
|
|
length += dimension * 2; |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
// * |
|
496
|
5858757
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_REF) { |
|
497
|
12323
|
|
|
|
|
|
length += 1; |
|
498
|
|
|
|
|
|
|
} |
|
499
|
|
|
|
|
|
|
|
|
500
|
5858757
|
|
|
|
|
|
return length; |
|
501
|
|
|
|
|
|
|
} |
|
502
|
|
|
|
|
|
|
|
|
503
|
5858757
|
|
|
|
|
|
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
|
5858757
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
|
505
|
5858757
|
50
|
|
|
|
|
assert(basic_type); |
|
506
|
|
|
|
|
|
|
|
|
507
|
5858757
|
|
|
|
|
|
int32_t type_name_length = SPVM_TYPE_get_type_name_length(compiler, basic_type_id, dimension, flag); |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
char* type_name; |
|
510
|
5858757
|
50
|
|
|
|
|
if (is_permanent) { |
|
511
|
5858757
|
|
|
|
|
|
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
|
5858757
|
|
|
|
|
|
char* cur = type_name; |
|
518
|
|
|
|
|
|
|
|
|
519
|
5858757
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_MUTABLE) { |
|
520
|
28987
|
|
|
|
|
|
sprintf(cur, "mutable "); |
|
521
|
28987
|
|
|
|
|
|
cur += strlen("mutable "); |
|
522
|
|
|
|
|
|
|
} |
|
523
|
|
|
|
|
|
|
|
|
524
|
5858757
|
|
|
|
|
|
sprintf(cur, "%s", basic_type->name); |
|
525
|
5858757
|
|
|
|
|
|
cur += strlen(basic_type->name); |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
int32_t dim_index; |
|
528
|
6252313
|
100
|
|
|
|
|
for (dim_index = 0; dim_index < dimension; dim_index++) { |
|
529
|
393556
|
|
|
|
|
|
sprintf(cur, "[]"); |
|
530
|
393556
|
|
|
|
|
|
cur += 2; |
|
531
|
|
|
|
|
|
|
} |
|
532
|
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
// Reference |
|
534
|
5858757
|
100
|
|
|
|
|
if (flag & SPVM_NATIVE_C_TYPE_FLAG_REF) { |
|
535
|
12323
|
|
|
|
|
|
sprintf(cur, "*"); |
|
536
|
12323
|
|
|
|
|
|
cur += 1; |
|
537
|
|
|
|
|
|
|
} |
|
538
|
|
|
|
|
|
|
|
|
539
|
5858757
|
|
|
|
|
|
*cur = '\0'; |
|
540
|
5858757
|
|
|
|
|
|
cur++; |
|
541
|
|
|
|
|
|
|
|
|
542
|
5858757
|
|
|
|
|
|
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
|
5858757
|
|
|
|
|
|
const char* SPVM_TYPE_new_type_name(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
551
|
5858757
|
|
|
|
|
|
int32_t is_permanent = 1; |
|
552
|
5858757
|
|
|
|
|
|
return SPVM_TYPE_new_type_name_with_eternal_flag(compiler, basic_type_id, dimension, flag, is_permanent); |
|
553
|
|
|
|
|
|
|
} |
|
554
|
|
|
|
|
|
|
|
|
555
|
7473142
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
556
|
|
|
|
|
|
|
|
|
557
|
7473142
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_TYPE)); |
|
558
|
7473142
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
|
559
|
7473142
|
100
|
|
|
|
|
if (basic_type_id > 0) { |
|
560
|
7469789
|
|
|
|
|
|
type->unresolved_basic_type_name = basic_type->name; |
|
561
|
|
|
|
|
|
|
} |
|
562
|
7473142
|
|
|
|
|
|
type->basic_type = basic_type; |
|
563
|
7473142
|
|
|
|
|
|
type->dimension = dimension; |
|
564
|
7473142
|
|
|
|
|
|
type->flag = flag; |
|
565
|
|
|
|
|
|
|
|
|
566
|
7473142
|
|
|
|
|
|
return type; |
|
567
|
|
|
|
|
|
|
} |
|
568
|
|
|
|
|
|
|
|
|
569
|
4496355
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_uninitialized(SPVM_COMPILER* compiler) { |
|
570
|
|
|
|
|
|
|
|
|
571
|
4496355
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_TYPE)); |
|
572
|
|
|
|
|
|
|
|
|
573
|
4496355
|
|
|
|
|
|
return type; |
|
574
|
|
|
|
|
|
|
} |
|
575
|
|
|
|
|
|
|
|
|
576
|
254823
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_unresolved_type(SPVM_COMPILER* compiler, const char* unresolved_basic_type_name, int32_t dimension, int32_t flag) { |
|
577
|
|
|
|
|
|
|
|
|
578
|
254823
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_TYPE)); |
|
579
|
254823
|
|
|
|
|
|
type->unresolved_basic_type_name = unresolved_basic_type_name; |
|
580
|
254823
|
|
|
|
|
|
type->basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_UNKNOWN); |
|
581
|
254823
|
|
|
|
|
|
type->dimension = dimension; |
|
582
|
254823
|
|
|
|
|
|
type->flag = flag; |
|
583
|
|
|
|
|
|
|
|
|
584
|
254823
|
|
|
|
|
|
return type; |
|
585
|
|
|
|
|
|
|
} |
|
586
|
|
|
|
|
|
|
|
|
587
|
106234
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_void_type(SPVM_COMPILER* compiler) { |
|
588
|
|
|
|
|
|
|
|
|
589
|
106234
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_VOID); |
|
590
|
106234
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
591
|
106234
|
|
|
|
|
|
int32_t type_flag = 0; |
|
592
|
106234
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
593
|
|
|
|
|
|
|
|
|
594
|
106234
|
|
|
|
|
|
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
|
57110
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_undef_type(SPVM_COMPILER* compiler) { |
|
608
|
|
|
|
|
|
|
|
|
609
|
57110
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_UNDEF); |
|
610
|
|
|
|
|
|
|
|
|
611
|
57110
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
612
|
57110
|
|
|
|
|
|
int32_t type_flag = 0; |
|
613
|
57110
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
614
|
|
|
|
|
|
|
|
|
615
|
57110
|
|
|
|
|
|
return type; |
|
616
|
|
|
|
|
|
|
} |
|
617
|
|
|
|
|
|
|
|
|
618
|
162006
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_byte_type(SPVM_COMPILER* compiler) { |
|
619
|
|
|
|
|
|
|
|
|
620
|
162006
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE); |
|
621
|
162006
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
622
|
162006
|
|
|
|
|
|
int32_t type_flag = 0; |
|
623
|
162006
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
624
|
|
|
|
|
|
|
|
|
625
|
162006
|
|
|
|
|
|
return type; |
|
626
|
|
|
|
|
|
|
} |
|
627
|
|
|
|
|
|
|
|
|
628
|
19806
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_short_type(SPVM_COMPILER* compiler) { |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
|
|
631
|
19806
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT); |
|
632
|
19806
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
633
|
19806
|
|
|
|
|
|
int32_t type_flag = 0; |
|
634
|
19806
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
635
|
|
|
|
|
|
|
|
|
636
|
19806
|
|
|
|
|
|
return type; |
|
637
|
|
|
|
|
|
|
} |
|
638
|
|
|
|
|
|
|
|
|
639
|
5587590
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_int_type(SPVM_COMPILER* compiler) { |
|
640
|
|
|
|
|
|
|
|
|
641
|
5587590
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_INT); |
|
642
|
5587590
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
643
|
5587590
|
|
|
|
|
|
int32_t type_flag = 0; |
|
644
|
5587590
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
645
|
|
|
|
|
|
|
|
|
646
|
5587590
|
|
|
|
|
|
return type; |
|
647
|
|
|
|
|
|
|
} |
|
648
|
|
|
|
|
|
|
|
|
649
|
53239
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_long_type(SPVM_COMPILER* compiler) { |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
|
|
652
|
53239
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG); |
|
653
|
53239
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
654
|
53239
|
|
|
|
|
|
int32_t type_flag = 0; |
|
655
|
53239
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
656
|
|
|
|
|
|
|
|
|
657
|
53239
|
|
|
|
|
|
return type; |
|
658
|
|
|
|
|
|
|
} |
|
659
|
|
|
|
|
|
|
|
|
660
|
31274
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_float_type(SPVM_COMPILER* compiler) { |
|
661
|
|
|
|
|
|
|
|
|
662
|
31274
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT); |
|
663
|
31274
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
664
|
31274
|
|
|
|
|
|
int32_t type_flag = 0; |
|
665
|
31274
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
666
|
|
|
|
|
|
|
|
|
667
|
31274
|
|
|
|
|
|
return type; |
|
668
|
|
|
|
|
|
|
} |
|
669
|
|
|
|
|
|
|
|
|
670
|
41601
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_double_type(SPVM_COMPILER* compiler) { |
|
671
|
|
|
|
|
|
|
|
|
672
|
41601
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE); |
|
673
|
41601
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
674
|
41601
|
|
|
|
|
|
int32_t type_flag = 0; |
|
675
|
41601
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
676
|
|
|
|
|
|
|
|
|
677
|
41601
|
|
|
|
|
|
return type; |
|
678
|
|
|
|
|
|
|
} |
|
679
|
|
|
|
|
|
|
|
|
680
|
693441
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_string_type(SPVM_COMPILER* compiler) { |
|
681
|
|
|
|
|
|
|
|
|
682
|
693441
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_STRING); |
|
683
|
693441
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
684
|
693441
|
|
|
|
|
|
int32_t type_flag = 0; |
|
685
|
693441
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
686
|
|
|
|
|
|
|
|
|
687
|
693441
|
|
|
|
|
|
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
|
114
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_byte_ref_type(SPVM_COMPILER* compiler) { |
|
771
|
|
|
|
|
|
|
|
|
772
|
114
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE); |
|
773
|
114
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
774
|
114
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
775
|
114
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
776
|
|
|
|
|
|
|
|
|
777
|
114
|
|
|
|
|
|
return type; |
|
778
|
|
|
|
|
|
|
} |
|
779
|
|
|
|
|
|
|
|
|
780
|
108
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_short_ref_type(SPVM_COMPILER* compiler) { |
|
781
|
|
|
|
|
|
|
|
|
782
|
108
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT); |
|
783
|
108
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
784
|
108
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
785
|
108
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
786
|
|
|
|
|
|
|
|
|
787
|
108
|
|
|
|
|
|
return type; |
|
788
|
|
|
|
|
|
|
} |
|
789
|
|
|
|
|
|
|
|
|
790
|
14188
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_int_ref_type(SPVM_COMPILER* compiler) { |
|
791
|
|
|
|
|
|
|
|
|
792
|
14188
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_INT); |
|
793
|
14188
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
794
|
14188
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
795
|
14188
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
796
|
|
|
|
|
|
|
|
|
797
|
14188
|
|
|
|
|
|
return type; |
|
798
|
|
|
|
|
|
|
} |
|
799
|
|
|
|
|
|
|
|
|
800
|
108
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_long_ref_type(SPVM_COMPILER* compiler) { |
|
801
|
|
|
|
|
|
|
|
|
802
|
108
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG); |
|
803
|
108
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
804
|
108
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
805
|
108
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
806
|
|
|
|
|
|
|
|
|
807
|
108
|
|
|
|
|
|
return type; |
|
808
|
|
|
|
|
|
|
} |
|
809
|
|
|
|
|
|
|
|
|
810
|
108
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_float_ref_type(SPVM_COMPILER* compiler) { |
|
811
|
|
|
|
|
|
|
|
|
812
|
108
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT); |
|
813
|
108
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
814
|
108
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
815
|
108
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
816
|
|
|
|
|
|
|
|
|
817
|
108
|
|
|
|
|
|
return type; |
|
818
|
|
|
|
|
|
|
} |
|
819
|
|
|
|
|
|
|
|
|
820
|
117
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_double_ref_type(SPVM_COMPILER* compiler) { |
|
821
|
|
|
|
|
|
|
|
|
822
|
117
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE); |
|
823
|
117
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
824
|
117
|
|
|
|
|
|
int32_t type_flag = SPVM_NATIVE_C_TYPE_FLAG_REF; |
|
825
|
117
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
826
|
|
|
|
|
|
|
|
|
827
|
117
|
|
|
|
|
|
return type; |
|
828
|
|
|
|
|
|
|
} |
|
829
|
|
|
|
|
|
|
|
|
830
|
185892
|
|
|
|
|
|
SPVM_TYPE* SPVM_TYPE_new_any_object_type(SPVM_COMPILER* compiler) { |
|
831
|
|
|
|
|
|
|
|
|
832
|
185892
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, SPVM_NATIVE_C_BASIC_TYPE_ID_ANY_OBJECT); |
|
833
|
185892
|
|
|
|
|
|
int32_t type_dimension = 0; |
|
834
|
185892
|
|
|
|
|
|
int32_t type_flag = 0; |
|
835
|
185892
|
|
|
|
|
|
SPVM_TYPE* type = SPVM_TYPE_new(compiler, basic_type->id, type_dimension, type_flag); |
|
836
|
|
|
|
|
|
|
|
|
837
|
185892
|
|
|
|
|
|
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
|
3949359
|
|
|
|
|
|
int32_t SPVM_TYPE_get_width(SPVM_COMPILER* compiler, int32_t basic_type_id, int32_t dimension, int32_t flag) { |
|
851
|
|
|
|
|
|
|
|
|
852
|
3949359
|
|
|
|
|
|
int32_t is_mulnum_type = SPVM_TYPE_is_mulnum_type(compiler, basic_type_id, dimension, flag); |
|
853
|
|
|
|
|
|
|
|
|
854
|
3949359
|
|
|
|
|
|
int32_t type_width = -1; |
|
855
|
3949359
|
100
|
|
|
|
|
if (is_mulnum_type) { |
|
856
|
|
|
|
|
|
|
|
|
857
|
964
|
|
|
|
|
|
SPVM_BASIC_TYPE* basic_type = SPVM_LIST_get(compiler->basic_types, basic_type_id); |
|
858
|
964
|
50
|
|
|
|
|
assert(basic_type); |
|
859
|
|
|
|
|
|
|
|
|
860
|
964
|
|
|
|
|
|
type_width = basic_type->fields->length; |
|
861
|
|
|
|
|
|
|
} |
|
862
|
|
|
|
|
|
|
else { |
|
863
|
3948395
|
|
|
|
|
|
type_width = 1; |
|
864
|
|
|
|
|
|
|
} |
|
865
|
|
|
|
|
|
|
|
|
866
|
3949359
|
|
|
|
|
|
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
|
2987272
|
|
|
|
|
|
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
|
2987272
|
|
|
|
|
|
int32_t assignability = 0; |
|
900
|
2987272
|
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
|
2173801
|
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
|
2169637
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
|
905
|
2152170
|
|
|
|
|
|
assignability = 1; |
|
906
|
|
|
|
|
|
|
} |
|
907
|
|
|
|
|
|
|
// Dist type is more wide than source type |
|
908
|
17467
|
100
|
|
|
|
|
else if (dist_type_basic_type_id > src_type_basic_type_id) { |
|
909
|
14940
|
|
|
|
|
|
assignability = 1; |
|
910
|
14940
|
|
|
|
|
|
*need_implicite_conversion = 1; |
|
911
|
|
|
|
|
|
|
} |
|
912
|
|
|
|
|
|
|
// Dist type is narrow than source type |
|
913
|
2527
|
50
|
|
|
|
|
else if (dist_type_basic_type_id < src_type_basic_type_id) { |
|
914
|
2527
|
100
|
|
|
|
|
if (allow_narrowing_conversion) { |
|
915
|
2512
|
|
|
|
|
|
assignability = 1; |
|
916
|
2512
|
|
|
|
|
|
*need_implicite_conversion = 1; |
|
917
|
|
|
|
|
|
|
} |
|
918
|
|
|
|
|
|
|
else { |
|
919
|
2169637
|
|
|
|
|
|
assignability = 0; |
|
920
|
|
|
|
|
|
|
} |
|
921
|
|
|
|
|
|
|
} |
|
922
|
|
|
|
|
|
|
} |
|
923
|
|
|
|
|
|
|
// Source type is object type |
|
924
|
4164
|
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
|
4160
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
927
|
4137
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id + SPVM_BASIC_TYPE_C_NUMERIC_OBJECT_UPGRADE_SHIFT) { |
|
928
|
4130
|
|
|
|
|
|
assignability = 1; |
|
929
|
4130
|
|
|
|
|
|
*need_implicite_conversion = 1; |
|
930
|
|
|
|
|
|
|
} |
|
931
|
|
|
|
|
|
|
else { |
|
932
|
4137
|
|
|
|
|
|
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
|
4160
|
|
|
|
|
|
assignability = 0; |
|
942
|
|
|
|
|
|
|
} |
|
943
|
|
|
|
|
|
|
} |
|
944
|
|
|
|
|
|
|
// Source type is other type |
|
945
|
|
|
|
|
|
|
else { |
|
946
|
2173801
|
|
|
|
|
|
assignability = 0; |
|
947
|
|
|
|
|
|
|
} |
|
948
|
|
|
|
|
|
|
} |
|
949
|
|
|
|
|
|
|
// Dist type is multi numeric type |
|
950
|
813471
|
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
|
335
|
50
|
|
|
|
|
if (SPVM_TYPE_is_mulnum_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
953
|
335
|
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
|
334
|
|
|
|
|
|
assignability = 1; |
|
955
|
|
|
|
|
|
|
} |
|
956
|
|
|
|
|
|
|
else { |
|
957
|
335
|
|
|
|
|
|
assignability = 0; |
|
958
|
|
|
|
|
|
|
} |
|
959
|
|
|
|
|
|
|
} |
|
960
|
|
|
|
|
|
|
// Source type is other type |
|
961
|
|
|
|
|
|
|
else { |
|
962
|
335
|
|
|
|
|
|
assignability = 0; |
|
963
|
|
|
|
|
|
|
} |
|
964
|
|
|
|
|
|
|
} |
|
965
|
|
|
|
|
|
|
// Dist type is referece type |
|
966
|
813136
|
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
|
6156
|
50
|
|
|
|
|
if (SPVM_TYPE_is_ref_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
969
|
6156
|
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
|
6155
|
|
|
|
|
|
assignability = 1; |
|
971
|
|
|
|
|
|
|
} |
|
972
|
|
|
|
|
|
|
else { |
|
973
|
6156
|
|
|
|
|
|
assignability = 0; |
|
974
|
|
|
|
|
|
|
} |
|
975
|
|
|
|
|
|
|
} |
|
976
|
|
|
|
|
|
|
// Source type is other type |
|
977
|
|
|
|
|
|
|
else { |
|
978
|
6156
|
|
|
|
|
|
assignability = 0; |
|
979
|
|
|
|
|
|
|
} |
|
980
|
|
|
|
|
|
|
} |
|
981
|
|
|
|
|
|
|
// Dist type is string type |
|
982
|
806980
|
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
|
327890
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
985
|
|
|
|
|
|
|
// Mutable check |
|
986
|
323814
|
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
|
323814
|
|
|
|
|
|
assignability = 1; |
|
991
|
|
|
|
|
|
|
} |
|
992
|
|
|
|
|
|
|
} |
|
993
|
|
|
|
|
|
|
// Source type is numeric type |
|
994
|
4076
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
995
|
1875
|
|
|
|
|
|
assignability = 1; |
|
996
|
1875
|
|
|
|
|
|
*need_implicite_conversion = 1; |
|
997
|
|
|
|
|
|
|
} |
|
998
|
|
|
|
|
|
|
// Source type is undef type |
|
999
|
2201
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1000
|
2197
|
|
|
|
|
|
assignability = 1; |
|
1001
|
|
|
|
|
|
|
} |
|
1002
|
|
|
|
|
|
|
// Source type is other type |
|
1003
|
|
|
|
|
|
|
else { |
|
1004
|
327890
|
|
|
|
|
|
assignability = 0; |
|
1005
|
|
|
|
|
|
|
} |
|
1006
|
|
|
|
|
|
|
} |
|
1007
|
|
|
|
|
|
|
// Dist type is numeric object type |
|
1008
|
479090
|
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
|
30335
|
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
|
30302
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_numeric_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1021
|
30281
|
50
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
|
1022
|
30281
|
|
|
|
|
|
assignability = 1; |
|
1023
|
|
|
|
|
|
|
} |
|
1024
|
|
|
|
|
|
|
else { |
|
1025
|
30281
|
|
|
|
|
|
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
|
30335
|
|
|
|
|
|
assignability = 0; |
|
1035
|
|
|
|
|
|
|
} |
|
1036
|
|
|
|
|
|
|
} |
|
1037
|
|
|
|
|
|
|
// Dist type is class |
|
1038
|
448755
|
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
|
149322
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1041
|
147514
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
|
1042
|
147134
|
|
|
|
|
|
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
|
147514
|
|
|
|
|
|
assignability = 0; |
|
1049
|
|
|
|
|
|
|
} |
|
1050
|
|
|
|
|
|
|
} |
|
1051
|
|
|
|
|
|
|
// Source type is undef type |
|
1052
|
1808
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1053
|
1701
|
|
|
|
|
|
assignability = 1; |
|
1054
|
|
|
|
|
|
|
} |
|
1055
|
|
|
|
|
|
|
// Source type is other type |
|
1056
|
|
|
|
|
|
|
else { |
|
1057
|
149322
|
|
|
|
|
|
assignability = 0; |
|
1058
|
|
|
|
|
|
|
} |
|
1059
|
|
|
|
|
|
|
} |
|
1060
|
|
|
|
|
|
|
// Dist type is interface type |
|
1061
|
299433
|
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
|
30948
|
100
|
|
|
|
|
if (SPVM_TYPE_is_interface_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1064
|
21867
|
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
|
21863
|
|
|
|
|
|
assignability = 1; |
|
1066
|
|
|
|
|
|
|
} |
|
1067
|
|
|
|
|
|
|
else { |
|
1068
|
21867
|
|
|
|
|
|
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
|
9081
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1073
|
8003
|
|
|
|
|
|
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
|
1078
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1077
|
1068
|
|
|
|
|
|
assignability = 1; |
|
1078
|
|
|
|
|
|
|
} |
|
1079
|
|
|
|
|
|
|
// Source type is other type |
|
1080
|
|
|
|
|
|
|
else { |
|
1081
|
30948
|
|
|
|
|
|
assignability = 0; |
|
1082
|
|
|
|
|
|
|
} |
|
1083
|
|
|
|
|
|
|
} |
|
1084
|
|
|
|
|
|
|
// Dist type is any object type |
|
1085
|
268485
|
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
|
69843
|
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
|
69609
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1093
|
65436
|
|
|
|
|
|
assignability = 1; |
|
1094
|
|
|
|
|
|
|
} |
|
1095
|
|
|
|
|
|
|
// Source type is undef type |
|
1096
|
4173
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1097
|
4171
|
|
|
|
|
|
assignability = 1; |
|
1098
|
|
|
|
|
|
|
} |
|
1099
|
|
|
|
|
|
|
// Source type is other type |
|
1100
|
|
|
|
|
|
|
else { |
|
1101
|
69843
|
|
|
|
|
|
assignability = 0; |
|
1102
|
|
|
|
|
|
|
} |
|
1103
|
|
|
|
|
|
|
} |
|
1104
|
|
|
|
|
|
|
// Dist type is undef type |
|
1105
|
198642
|
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
|
198642
|
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
|
91854
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1112
|
91622
|
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
|
91621
|
|
|
|
|
|
assignability = 1; |
|
1114
|
|
|
|
|
|
|
} |
|
1115
|
|
|
|
|
|
|
else { |
|
1116
|
91622
|
|
|
|
|
|
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
|
91854
|
|
|
|
|
|
assignability = 0; |
|
1126
|
|
|
|
|
|
|
} |
|
1127
|
|
|
|
|
|
|
} |
|
1128
|
|
|
|
|
|
|
// Dist type is multi-numeric array type |
|
1129
|
106788
|
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
|
106494
|
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
|
45140
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1152
|
45092
|
|
|
|
|
|
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
|
45140
|
|
|
|
|
|
assignability = 0; |
|
1161
|
|
|
|
|
|
|
} |
|
1162
|
|
|
|
|
|
|
} |
|
1163
|
|
|
|
|
|
|
// Dist type is class array type |
|
1164
|
61354
|
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
|
4165
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1167
|
4115
|
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
|
4096
|
|
|
|
|
|
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
|
4115
|
|
|
|
|
|
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
|
4165
|
|
|
|
|
|
assignability = 0; |
|
1184
|
|
|
|
|
|
|
} |
|
1185
|
|
|
|
|
|
|
} |
|
1186
|
|
|
|
|
|
|
// Dist type is interface array type |
|
1187
|
57189
|
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
|
57137
|
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
|
57032
|
100
|
|
|
|
|
if (SPVM_TYPE_is_object_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1214
|
54922
|
|
|
|
|
|
assignability = 1; |
|
1215
|
|
|
|
|
|
|
} |
|
1216
|
|
|
|
|
|
|
// Source type is undef type |
|
1217
|
2110
|
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
|
57032
|
|
|
|
|
|
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
|
2987272
|
|
|
|
|
|
return assignability; |
|
1281
|
|
|
|
|
|
|
} |
|
1282
|
|
|
|
|
|
|
|
|
1283
|
53589
|
|
|
|
|
|
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
|
53589
|
|
|
|
|
|
int32_t assignability = 0; |
|
1289
|
|
|
|
|
|
|
|
|
1290
|
53589
|
100
|
|
|
|
|
if (SPVM_TYPE_is_any_object_type(compiler, dist_type_basic_type_id, dist_type_dimension, dist_type_flag)) { |
|
1291
|
3845
|
50
|
|
|
|
|
if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1292
|
3845
|
|
|
|
|
|
assignability = 1; |
|
1293
|
|
|
|
|
|
|
} |
|
1294
|
|
|
|
|
|
|
else { |
|
1295
|
3845
|
|
|
|
|
|
assignability = 0; |
|
1296
|
|
|
|
|
|
|
} |
|
1297
|
|
|
|
|
|
|
} |
|
1298
|
49744
|
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
|
49744
|
50
|
|
|
|
|
if (dist_type_dimension == src_type_dimension && dist_type_flag == src_type_flag) { |
|
|
|
50
|
|
|
|
|
|
|
1308
|
99488
|
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
|
49617
|
100
|
|
|
|
|
if (dist_type_basic_type_id == src_type_basic_type_id) { |
|
1319
|
49615
|
|
|
|
|
|
assignability = 1; |
|
1320
|
|
|
|
|
|
|
} |
|
1321
|
|
|
|
|
|
|
else { |
|
1322
|
2
|
|
|
|
|
|
assignability = 0; |
|
1323
|
|
|
|
|
|
|
} |
|
1324
|
|
|
|
|
|
|
} |
|
1325
|
|
|
|
|
|
|
} |
|
1326
|
|
|
|
|
|
|
else { |
|
1327
|
0
|
|
|
|
|
|
assignability = 0; |
|
1328
|
|
|
|
|
|
|
} |
|
1329
|
|
|
|
|
|
|
} |
|
1330
|
|
|
|
|
|
|
|
|
1331
|
53589
|
|
|
|
|
|
return assignability; |
|
1332
|
|
|
|
|
|
|
} |
|
1333
|
|
|
|
|
|
|
|
|
1334
|
53033
|
|
|
|
|
|
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
|
53033
|
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
|
25068
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1345
|
21799
|
|
|
|
|
|
castability = 1; |
|
1346
|
|
|
|
|
|
|
} |
|
1347
|
|
|
|
|
|
|
// Source type is numeric object type |
|
1348
|
3269
|
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
|
3188
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1358
|
3183
|
|
|
|
|
|
castability = 1; |
|
1359
|
|
|
|
|
|
|
} |
|
1360
|
|
|
|
|
|
|
// Source type is other type |
|
1361
|
|
|
|
|
|
|
else { |
|
1362
|
25068
|
|
|
|
|
|
castability = 0; |
|
1363
|
|
|
|
|
|
|
} |
|
1364
|
|
|
|
|
|
|
} |
|
1365
|
|
|
|
|
|
|
// Dist type is multi-numeric type |
|
1366
|
27965
|
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
|
27961
|
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
|
27956
|
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
|
12223
|
100
|
|
|
|
|
if (SPVM_TYPE_is_string_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1391
|
5879
|
|
|
|
|
|
castability = 1; |
|
1392
|
|
|
|
|
|
|
} |
|
1393
|
|
|
|
|
|
|
// Source type is numeric type |
|
1394
|
6344
|
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
|
5822
|
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
|
5794
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1403
|
4196
|
|
|
|
|
|
castability = 1; |
|
1404
|
|
|
|
|
|
|
} |
|
1405
|
|
|
|
|
|
|
// Source type is undef type |
|
1406
|
1598
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1407
|
1597
|
|
|
|
|
|
castability = 1; |
|
1408
|
|
|
|
|
|
|
} |
|
1409
|
|
|
|
|
|
|
// Source type is other type |
|
1410
|
|
|
|
|
|
|
else { |
|
1411
|
12223
|
|
|
|
|
|
castability = 0; |
|
1412
|
|
|
|
|
|
|
} |
|
1413
|
|
|
|
|
|
|
} |
|
1414
|
|
|
|
|
|
|
// Dist type is numeric object type |
|
1415
|
15733
|
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
|
7330
|
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
|
7307
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1427
|
7297
|
|
|
|
|
|
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
|
7330
|
|
|
|
|
|
castability = 0; |
|
1436
|
|
|
|
|
|
|
} |
|
1437
|
|
|
|
|
|
|
} |
|
1438
|
|
|
|
|
|
|
// Dist type is class type |
|
1439
|
8403
|
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
|
354
|
100
|
|
|
|
|
if (SPVM_TYPE_is_class_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1442
|
218
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
|
1443
|
202
|
|
|
|
|
|
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
|
218
|
|
|
|
|
|
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
|
354
|
|
|
|
|
|
castability = 0; |
|
1470
|
|
|
|
|
|
|
} |
|
1471
|
|
|
|
|
|
|
} |
|
1472
|
|
|
|
|
|
|
// Dist type is interface type |
|
1473
|
8049
|
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
|
7991
|
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
|
5595
|
100
|
|
|
|
|
if (SPVM_TYPE_is_numeric_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1499
|
2318
|
|
|
|
|
|
castability = 1; |
|
1500
|
|
|
|
|
|
|
} |
|
1501
|
|
|
|
|
|
|
// Source type is object type |
|
1502
|
3277
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1503
|
2740
|
|
|
|
|
|
castability = 1; |
|
1504
|
|
|
|
|
|
|
} |
|
1505
|
|
|
|
|
|
|
// Source type is undef type |
|
1506
|
537
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_undef_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1507
|
535
|
|
|
|
|
|
castability = 1; |
|
1508
|
|
|
|
|
|
|
} |
|
1509
|
|
|
|
|
|
|
// Source type is other type |
|
1510
|
|
|
|
|
|
|
else { |
|
1511
|
5595
|
|
|
|
|
|
castability = 0; |
|
1512
|
|
|
|
|
|
|
} |
|
1513
|
|
|
|
|
|
|
} |
|
1514
|
|
|
|
|
|
|
// Dist type is undef type |
|
1515
|
2396
|
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
|
2396
|
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
|
113
|
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
|
49
|
100
|
|
|
|
|
else if (SPVM_TYPE_is_byte_array_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1526
|
35
|
|
|
|
|
|
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
|
113
|
|
|
|
|
|
castability = 0; |
|
1539
|
|
|
|
|
|
|
} |
|
1540
|
|
|
|
|
|
|
} |
|
1541
|
|
|
|
|
|
|
// Dist type is numeric array type(except for byte array) |
|
1542
|
2283
|
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
|
89
|
100
|
|
|
|
|
if (src_type_basic_type_id == dist_type_basic_type_id) { |
|
1545
|
36
|
|
|
|
|
|
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
|
89
|
|
|
|
|
|
castability = 0; |
|
1558
|
|
|
|
|
|
|
} |
|
1559
|
|
|
|
|
|
|
} |
|
1560
|
|
|
|
|
|
|
// Dist type is multi-numeric array |
|
1561
|
2194
|
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
|
2190
|
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
|
2165
|
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
|
2109
|
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
|
2095
|
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
|
2067
|
100
|
|
|
|
|
if (SPVM_TYPE_is_any_object_type(compiler, src_type_basic_type_id, src_type_dimension, src_type_flag)) { |
|
1671
|
2057
|
|
|
|
|
|
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
|
2067
|
|
|
|
|
|
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
|
53033
|
|
|
|
|
|
return castability; |
|
1764
|
|
|
|
|
|
|
} |
|
1765
|
|
|
|
|
|
|
|
|
1766
|
177422
|
|
|
|
|
|
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
|
177422
|
100
|
|
|
|
|
if (basic_type_id1 == basic_type_id2 && type_dimension1 == type_dimension2 && type_flag1 == type_flag2) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1769
|
127029
|
|
|
|
|
|
return 1; |
|
1770
|
|
|
|
|
|
|
} |
|
1771
|
|
|
|
|
|
|
else { |
|
1772
|
50393
|
|
|
|
|
|
return 0; |
|
1773
|
|
|
|
|
|
|
} |
|
1774
|
|
|
|
|
|
|
} |