File Coverage

lib/SPVM/Builder/include/spvm_implement.h
Criterion Covered Total %
statement 1003 1354 74.0
branch 384 546 70.3
condition n/a
subroutine n/a
pod n/a
total 1387 1900 73.0


line stmt bran cond sub pod time code
1             // Copyright (c) 2023 Yuki Kimoto
2             // MIT License
3              
4             #ifndef SPVM_IMPLEMENT_H
5             #define SPVM_IMPLEMENT_H
6              
7             #include
8              
9             enum {
10             SPVM_IMPLEMENT_C_STRING_CALL_STACK_ALLOCATION_FAILED,
11             SPVM_IMPLEMENT_C_STRING_VALUE_ASSIGN_NON_ASSIGNABLE_TYPE,
12             SPVM_IMPLEMENT_C_STRING_ASSIGN_READ_ONLY_STRING_TO_MUTABLE_TYPE,
13             SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO,
14             SPVM_IMPLEMENT_C_STRING_CONCAT_LEFT_UNDEFINED,
15             SPVM_IMPLEMENT_C_STRING_CONCAT_RIGHT_UNDEFINED,
16             SPVM_IMPLEMENT_C_STRING_NEW_OBJECT_FAILED,
17             SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED,
18             SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL,
19             SPVM_IMPLEMENT_C_STRING_NEW_STRING_FAILED,
20             SPVM_IMPLEMENT_C_STRING_STRING_LENGTH_SMALL,
21             SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED,
22             SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE,
23             SPVM_IMPLEMENT_C_STRING_ELEMENT_ASSIGN_NON_ASSIGNABLE_TYPE,
24             SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED,
25             SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF,
26             SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE,
27             SPVM_IMPLEMENT_C_STRING_WEAKEN_BACK_REFERENCE_ALLOCATION_FAILED,
28             SPVM_IMPLEMENT_C_STRING_COPY_OPERAND_INVALID,
29             SPVM_IMPLEMENT_C_STRING_WARN_AT,
30             SPVM_IMPLEMENT_C_STRING_WARN_UNDEF,
31             SPVM_IMPLEMENT_C_STRING_CALL_INSTANCE_METHOD_IMPLEMENT_NOT_FOUND,
32             SPVM_IMPLEMENT_C_STRING_ERROR_BASIC_TYPE_NOT_FOUND,
33             SPVM_IMPLEMENT_C_STRING_ERROR_FIELD_NOT_FOUND,
34             SPVM_IMPLEMENT_C_STRING_ERROR_CLASS_VAR_NOT_FOUND,
35             SPVM_IMPLEMENT_C_STRING_ERROR_CLASS_NOT_FOUND,
36             SPVM_IMPLEMENT_C_STRING_ERROR_METHOD_NOT_FOUND,
37             SPVM_IMPLEMENT_C_STRING_CALL_INSTANCE_METHOD_INVOCANT_UNDEF,
38             };
39              
40             static const char* SPVM_IMPLEMENT_STRING_LITERALS[] = {
41             "The memory allocation for the call stack failed.",
42             "The value cannnot be cast to the non-assignable type.",
43             "The read-only string cannnot be cast to the mutable string type.",
44             "Integral type values cannnot be divided by 0.",
45             "The left operand of the \".\" operator must be defined.",
46             "The right operand of the \".\" operator must be defined.",
47             "The object creating failed.",
48             "The array creating failed.",
49             "The length of the array must be greater than or equal to 0.",
50             "The string creating failed.",
51             "The length of the string must be greater than or equal to 0.",
52             "The array must be defined.",
53             "The index of the array access must be greater than or equal to 0 and less than the length of the array.",
54             "The element cannnot be assigned to the non-assignable type.",
55             "The invocant of the field access must be defined.",
56             "The unboxing conversion cannnot be performed on the undefined value.",
57             "The source of the unboxing conversion must be the corresponding numeric object type.",
58             "The memory allocation for the weaken back reference failed.",
59             "The operand of the copy operator must be a string type, a numeric type, or a multi numeric type.",
60             "\n at %s%s%s line %d\n",
61             "Warning\n at %s%s%s line %d\n",
62             "The implementation of the \"%s\" method in the \"%s\" interface is not found.",
63             "The %s basic type is not found.",
64             "The %s field is not found.",
65             "The %s class variable in the %s class is not found.",
66             "The %s class is not found.",
67             "The %s method in the %s class is not found.",
68             "The invocant must be defined.",
69             };
70              
71             enum {
72             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_EQ,
73             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_NE,
74             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GT,
75             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GE,
76             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LT,
77             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LE,
78             SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_CMP,
79             };
80              
81             static inline void* SPVM_IMPLEMENT_GET_BASIC_TYPE_BY_NAME(SPVM_ENV* env, SPVM_VALUE* stack, const char* basic_type_name, char* message, int32_t* error_id) {
82              
83             void* basic_type = env->api->runtime->get_basic_type_by_name(env->runtime, basic_type_name);
84              
85             if (!basic_type) {
86             snprintf(message, 256, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ERROR_BASIC_TYPE_NOT_FOUND], basic_type_name);
87             void* exception = env->new_string_nolen_no_mortal(env, stack, message);
88             env->set_exception(env, stack, exception);
89             *error_id = 1;
90             }
91            
92             return basic_type;
93             }
94              
95             static inline void* SPVM_IMPLEMENT_GET_FIELD_STATIC_BY_NAME(SPVM_ENV* env, SPVM_VALUE* stack, const char* basic_type_name, const char* field_name, char* message, int32_t* error_id) {
96            
97             void* field = env->get_field_static(env, stack, basic_type_name, field_name);
98            
99             if (!field) {
100             snprintf(message, 256, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ERROR_FIELD_NOT_FOUND], field_name);
101             void* exception = env->new_string_nolen_no_mortal(env, stack, message);
102             env->set_exception(env, stack, exception);
103             *error_id = 1;
104             }
105            
106             return field;
107             }
108              
109             static inline int32_t SPVM_IMPLEMENT_GET_FIELD_OFFSET_BY_NAME(SPVM_ENV* env, SPVM_VALUE* stack, const char* basic_type_name, const char* field_name, char* message, int32_t* error_id) {
110            
111             void* field = env->get_field_static(env, stack, basic_type_name, field_name);
112            
113             if (!field) {
114             snprintf(message, 256, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ERROR_FIELD_NOT_FOUND], field_name);
115             void* exception = env->new_string_nolen_no_mortal(env, stack, message);
116             env->set_exception(env, stack, exception);
117             *error_id = 1;
118             return -1;
119             }
120            
121             int32_t field_offset = env->api->field->get_offset(env->runtime, field);
122            
123             return field_offset;
124             }
125              
126             static inline void* SPVM_IMPLEMENT_GET_CLASS_VAR_BY_NAME(SPVM_ENV* env, SPVM_VALUE* stack, const char* basic_type_name, const char* class_var_name, char* message, int32_t* error_id) {
127              
128             void* class_var = env->get_class_var(env, stack, basic_type_name, class_var_name);
129            
130             if (!class_var) {
131             snprintf(message, 256, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ERROR_CLASS_VAR_NOT_FOUND], class_var_name);
132             void* exception = env->new_string_nolen_no_mortal(env, stack, message);
133             env->set_exception(env, stack, exception);
134             *error_id = 1;
135             }
136            
137             return class_var;
138             }
139              
140             static inline void* SPVM_IMPLEMENT_GET_METHOD_BY_NAME(SPVM_ENV* env, SPVM_VALUE* stack, const char* basic_type_name, const char* method_name, char* message, int32_t* error_id) {
141              
142             void* method = env->get_method(env, stack, basic_type_name, method_name);
143            
144             if (!method) {
145             snprintf(message, 256, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ERROR_METHOD_NOT_FOUND], method_name);
146             void* exception = env->new_string_nolen_no_mortal(env, stack, message);
147             env->set_exception(env, stack, exception);
148             *error_id = 1;
149             }
150            
151             return method;
152             }
153              
154 1539           static inline void SPVM_IMPLEMENT_MOVE_OBJECT_UNDEF(SPVM_ENV* env, SPVM_VALUE* stack, void** dist_address) {
155 1539           env->assign_object(env, stack, dist_address, NULL);
156 1539           }
157              
158 1219881           static inline void SPVM_IMPLEMENT_LEAVE_SCOPE(SPVM_ENV* env, SPVM_VALUE* stack, void** object_vars, int32_t* mortal_stack, int32_t* mortal_stack_top_ptr, int32_t original_mortal_stack_top) {
159 1219881           env->api->internal->leave_scope_local(env, stack, object_vars, mortal_stack, mortal_stack_top_ptr, original_mortal_stack_top);
160 1219881           }
161              
162             #define SPVM_IMPLEMENT_ADD_INT(out, in1, in2) (out = in1 + in2)
163              
164             #define SPVM_IMPLEMENT_ADD_LONG(out, in1, in2) (out = in1 + in2)
165              
166             #define SPVM_IMPLEMENT_ADD_FLOAT(out, in1, in2) (out = in1 + in2)
167              
168             #define SPVM_IMPLEMENT_ADD_DOUBLE(out, in1, in2) (out = in1 + in2)
169              
170             #define SPVM_IMPLEMENT_SUBTRACT_INT(out, in1, in2) (out = in1 - in2)
171              
172             #define SPVM_IMPLEMENT_SUBTRACT_LONG(out, in1, in2) (out = in1 - in2)
173              
174             #define SPVM_IMPLEMENT_SUBTRACT_FLOAT(out, in1, in2) (out = in1 - in2)
175              
176             #define SPVM_IMPLEMENT_SUBTRACT_DOUBLE(out, in1, in2) (out = in1 - in2)
177              
178             #define SPVM_IMPLEMENT_MULTIPLY_INT(out, in1, in2) (out = in1 * in2)
179              
180             #define SPVM_IMPLEMENT_MULTIPLY_LONG(out, in1, in2) (out = in1 * in2)
181              
182             #define SPVM_IMPLEMENT_MULTIPLY_FLOAT(out, in1, in2) (out = in1 * in2)
183              
184             #define SPVM_IMPLEMENT_MULTIPLY_DOUBLE(out, in1, in2) (out = in1 * in2)
185              
186 531           static inline void SPVM_IMPLEMENT_DIVIDE_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t in1, int32_t in2, int32_t* error_id) {
187 531 100         if (__builtin_expect(in2 == 0, 0)) {
188 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
189 1           env->set_exception(env, stack, exception);
190 1           *error_id = 1;
191             }
192             else {
193 530           *out = in1 / in2;
194             }
195 531           }
196              
197 3           static inline void SPVM_IMPLEMENT_DIVIDE_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t in1, int64_t in2, int32_t* error_id) {
198 3 50         if (__builtin_expect(in2 == 0, 0)) {
199 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
200 0           env->set_exception(env, stack, exception);
201 0           *error_id = 1;
202             }
203             else {
204 3           *out = in1 / in2;
205             }
206 3           }
207              
208             #define SPVM_IMPLEMENT_DIVIDE_FLOAT(out, in1, in2) (out = in1 / in2)
209              
210             #define SPVM_IMPLEMENT_DIVIDE_DOUBLE(out, in1, in2) (out = in1 / in2)
211              
212 1           static inline void SPVM_IMPLEMENT_DIVIDE_UNSIGNED_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t in1, int32_t in2, int32_t* error_id) {
213 1 50         if (__builtin_expect(in2 == 0, 0)) {
214 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
215 0           env->set_exception(env, stack, exception);
216 0           *error_id = 1;
217             }
218             else {
219 1           *out = (uint32_t)in1 / (uint32_t)in2;
220             }
221 1           }
222              
223 1           static inline void SPVM_IMPLEMENT_DIVIDE_UNSIGNED_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t in1, int64_t in2, int32_t* error_id) {
224 1 50         if (__builtin_expect(in2 == 0, 0)) {
225 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
226 0           env->set_exception(env, stack, exception);
227 0           *error_id = 1;
228             }
229             else {
230 1           *out = (uint64_t)in1 / (uint64_t)in2;
231             }
232 1           }
233              
234 100031           static inline void SPVM_IMPLEMENT_REMAINDER_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t in1, int32_t in2, int32_t* error_id) {
235 100031 50         if (__builtin_expect(in2 == 0, 0)) {
236 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
237 0           env->set_exception(env, stack, exception);
238 0           *error_id = 1;
239             }
240             else {
241 100031           *out = in1 % in2;
242             }
243 100031           }
244              
245 7           static inline void SPVM_IMPLEMENT_REMAINDER_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t in1, int64_t in2, int32_t* error_id) {
246 7 50         if (__builtin_expect(in2 == 0, 0)) {
247 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
248 0           env->set_exception(env, stack, exception);
249 0           *error_id = 1;
250             }
251             else {
252 7           *out = in1 % in2;
253             }
254 7           }
255              
256 1           static inline void SPVM_IMPLEMENT_REMAINDER_UNSIGNED_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t in1, int32_t in2, int32_t* error_id) {
257 1 50         if (__builtin_expect(in2 == 0, 0)) {
258 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
259 0           env->set_exception(env, stack, exception);
260 0           *error_id = 1;
261             }
262             else {
263 1           *out = (uint32_t)in1 % (uint32_t)in2;
264             }
265 1           }
266              
267 599           static inline void SPVM_IMPLEMENT_REMAINDER_UNSIGNED_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t in1, int64_t in2, int32_t* error_id) {
268 599 50         if (__builtin_expect(in2 == 0, 0)) {
269 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_DIVIDE_ZERO]);
270 0           env->set_exception(env, stack, exception);
271 0           *error_id = 1;
272             }
273             else {
274 599           *out = (uint64_t)in1 % (uint64_t)in2;
275             }
276 599           }
277              
278             #define SPVM_IMPLEMENT_LEFT_SHIFT_INT(out, in1, in2) (out = in1 << in2)
279             #define SPVM_IMPLEMENT_LEFT_SHIFT_LONG(out, in1, in2) (out = in1 << in2)
280              
281             #define SPVM_IMPLEMENT_RIGHT_ARITHMETIC_SHIFT_INT(out, in1, in2) (out = in1 >> in2)
282             #define SPVM_IMPLEMENT_RIGHT_ARITHMETIC_SHIFT_LONG(out, in1, in2) (out = in1 >> in2)
283              
284             #define SPVM_IMPLEMENT_RIGHT_LOGICAL_SHIFT_INT(out, in1, in2) (out = (int32_t)((uint32_t)in1 >> in2))
285             #define SPVM_IMPLEMENT_RIGHT_LOGICAL_SHIFT_LONG(out, in1, in2) (out = (int64_t)((uint64_t)in1 >> in2))
286              
287             #define SPVM_IMPLEMENT_BIT_AND_INT(out, in1, in2) (out = in1 & in2)
288             #define SPVM_IMPLEMENT_BIT_AND_LONG(out, in1, in2) (out = in1 & in2)
289              
290             #define SPVM_IMPLEMENT_BIT_OR_INT(out, in1, in2) (out = in1 | in2)
291             #define SPVM_IMPLEMENT_BIT_OR_LONG(out, in1, in2) (out = in1 | in2)
292              
293             #define SPVM_IMPLEMENT_BIT_XOR_INT(out, in1, in2) (out = in1 ^ in2)
294             #define SPVM_IMPLEMENT_BIT_XOR_LONG(out, in1, in2) (out = in1 ^ in2)
295              
296             #define SPVM_IMPLEMENT_PUSH_MORTAL(mortal_stack, mortal_stack_top, object_vars_index) (mortal_stack[mortal_stack_top++] = object_vars_index)
297              
298             #define SPVM_IMPLEMENT_MOVE_BYTE_ZERO(out) (out = 0)
299             #define SPVM_IMPLEMENT_MOVE_SHORT_ZERO(out) (out = 0)
300             #define SPVM_IMPLEMENT_MOVE_INT_ZERO(out) (out = 0)
301             #define SPVM_IMPLEMENT_MOVE_LONG_ZERO(out) (out = 0)
302             #define SPVM_IMPLEMENT_MOVE_FLOAT_ZERO(out) (out = 0)
303             #define SPVM_IMPLEMENT_MOVE_DOUBLE_ZERO(out) (out = 0)
304              
305 15           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_BYTE_ZERO(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, int32_t fields_length) {
306 99 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
307 84           *(out + field_index) = 0;
308             }
309 15           }
310              
311 14           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_SHORT_ZERO(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, int32_t fields_length) {
312 95 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
313 81           *(out + field_index) = 0;
314             }
315 14           }
316              
317 14           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_INT_ZERO(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t fields_length) {
318 95 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
319 81           *(out + field_index) = 0;
320             }
321 14           }
322              
323 14           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_LONG_ZERO(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int32_t fields_length) {
324 95 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
325 81           *(out + field_index) = 0;
326             }
327 14           }
328              
329 14           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_FLOAT_ZERO(SPVM_ENV* env, SPVM_VALUE* stack, float* out, int32_t fields_length) {
330 95 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
331 81           *(out + field_index) = 0;
332             }
333 14           }
334              
335 26           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_DOUBLE_ZERO(SPVM_ENV* env, SPVM_VALUE* stack, double* out, int32_t fields_length) {
336 131 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
337 105           *(out + field_index) = 0;
338             }
339 26           }
340              
341             #define SPVM_IMPLEMENT_MOVE_CONSTANT_BYTE(out, in) (out = in)
342             #define SPVM_IMPLEMENT_MOVE_CONSTANT_INT(out, in) (out = in)
343             #define SPVM_IMPLEMENT_MOVE_CONSTANT_LONG(out, in) (out = in)
344             #define SPVM_IMPLEMENT_MOVE_CONSTANT_FLOAT(out, in) (out = in)
345             #define SPVM_IMPLEMENT_MOVE_CONSTANT_DOUBLE(out, in) (out = in)
346              
347             #define SPVM_IMPLEMENT_MOVE_BYTE(out, in) (out = in)
348             #define SPVM_IMPLEMENT_MOVE_SHORT(out, in) (out = in)
349             #define SPVM_IMPLEMENT_MOVE_INT(out, in) (out = in)
350             #define SPVM_IMPLEMENT_MOVE_LONG(out, in) (out = in)
351             #define SPVM_IMPLEMENT_MOVE_FLOAT(out, in) (out = in)
352             #define SPVM_IMPLEMENT_MOVE_DOUBLE(out, in) (out = in)
353             #define SPVM_IMPLEMENT_MOVE_OBJECT(env, stack, out, in) (env->assign_object(env, stack, out, in))
354              
355 336           static inline void SPVM_IMPLEMENT_MOVE_OBJECT_WITH_TYPE_CHECKING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* in, void* cast_basic_type, int32_t cast_type_dimension, int32_t* error_id) {
356 336           void* object = in;
357 336           int32_t isa = env->isa(env, stack, object, cast_basic_type, cast_type_dimension);
358 336 100         if (isa) {
359 330           env->assign_object(env, stack, out, in);
360             }
361             else {
362 6           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_VALUE_ASSIGN_NON_ASSIGNABLE_TYPE]);
363 6           env->set_exception(env, stack, exception);
364 6           *error_id = 1;
365             }
366 336           }
367              
368 2269           static inline void SPVM_IMPLEMENT_MOVE_OBJECT_CHECK_READ_ONLY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* in, int32_t* error_id) {
369 2269           void* string = in;
370 2269 100         if (env->is_read_only(env, stack, string)) {
371 3           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ASSIGN_READ_ONLY_STRING_TO_MUTABLE_TYPE]);
372 3           env->set_exception(env, stack, exception);
373 3           *error_id = 1;
374             }
375             else {
376 2266           env->assign_object(env, stack, out, string);
377             }
378 2269           }
379              
380             #define SPVM_IMPLEMENT_MOVE_REF(out, in) (out = in)
381              
382             #define SPVM_IMPLEMENT_BIT_NOT_INT(out, in) (out = ~in)
383             #define SPVM_IMPLEMENT_BIT_NOT_LONG(out, in) (out = ~in)
384             #define SPVM_IMPLEMENT_NEGATE_INT(out, in) (out = -in)
385             #define SPVM_IMPLEMENT_NEGATE_LONG(out, in) (out = -in)
386             #define SPVM_IMPLEMENT_NEGATE_FLOAT(out, in) (out = -in)
387             #define SPVM_IMPLEMENT_NEGATE_DOUBLE(out, in) (out = -in)
388              
389 695           static inline void SPVM_IMPLEMENT_CONCAT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* in1, void* in2, int32_t* error_id) {
390 695           void* string1 = in1;
391 695           void* string2 = in2;
392 695 100         if (string1 == NULL) {
393 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_CONCAT_LEFT_UNDEFINED]);
394 1           env->set_exception(env, stack, exception);
395 1           *error_id = 1;
396             }
397 694 100         else if (string2 == NULL) {
398 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_CONCAT_RIGHT_UNDEFINED]);
399 1           env->set_exception(env, stack, exception);
400 1           *error_id = 1;
401             }
402             else {
403 693           void* string3 = env->concat_no_mortal(env, stack, string1, string2);
404 693           env->assign_object(env, stack, out, string3);
405             }
406 695           }
407              
408             #define SPVM_IMPLEMENT_BOOL_CONVERSION_INT(out, in) (out = in)
409             #define SPVM_IMPLEMENT_BOOL_CONVERSION_LONG(out, in) (out = !!in)
410             #define SPVM_IMPLEMENT_BOOL_CONVERSION_FLOAT(out, in) (out = !!in)
411             #define SPVM_IMPLEMENT_BOOL_CONVERSION_DOUBLE(out, in) (out = !!in)
412             #define SPVM_IMPLEMENT_BOOL_CONVERSION_OBJECT(out, in) (out = !!in)
413             #define SPVM_IMPLEMENT_BOOL_CONVERSION_REF(out, in) (out = !!in)
414             #define SPVM_IMPLEMENT_BOOL_CONVERSION_BOOL_OBJECT(env, stack, out, in) (out = !!env->get_bool_object_value(env, stack, in))
415              
416             #define SPVM_IMPLEMENT_EQ_INT(out, in1, in2) (out = (in1 == in2))
417             #define SPVM_IMPLEMENT_EQ_LONG(out, in1, in2) (out = (in1 == in2))
418             #define SPVM_IMPLEMENT_EQ_FLOAT(out, in1, in2) (out = (in1 == in2))
419             #define SPVM_IMPLEMENT_EQ_DOUBLE(out, in1, in2) (out = (in1 == in2))
420             #define SPVM_IMPLEMENT_EQ_OBJECT(out, in1, in2) (out = (in1 == in2))
421             #define SPVM_IMPLEMENT_EQ_REF(out, in1, in2) (out = (in1 == in2))
422              
423             #define SPVM_IMPLEMENT_NE_INT(out, in1, in2) (out = (in1 != in2))
424             #define SPVM_IMPLEMENT_NE_LONG(out, in1, in2) (out = (in1 != in2))
425             #define SPVM_IMPLEMENT_NE_FLOAT(out, in1, in2) (out = (in1 != in2))
426             #define SPVM_IMPLEMENT_NE_DOUBLE(out, in1, in2) (out = (in1 != in2))
427             #define SPVM_IMPLEMENT_NE_OBJECT(out, in1, in2) (out = (in1 != in2))
428             #define SPVM_IMPLEMENT_NE_REF(out, in1, in2) (out = (in1 != in2))
429              
430             #define SPVM_IMPLEMENT_GT_INT(out, in1, in2) (out = (in1 > in2))
431             #define SPVM_IMPLEMENT_GT_LONG(out, in1, in2) (out = (in1 > in2))
432             #define SPVM_IMPLEMENT_GT_FLOAT(out, in1, in2) (out = (in1 > in2))
433             #define SPVM_IMPLEMENT_GT_DOUBLE(out, in1, in2) (out = (in1 > in2))
434              
435             #define SPVM_IMPLEMENT_GE_INT(out, in1, in2) (out = (in1 >= in2))
436             #define SPVM_IMPLEMENT_GE_LONG(out, in1, in2) (out = (in1 >= in2))
437             #define SPVM_IMPLEMENT_GE_FLOAT(out, in1, in2) (out = (in1 >= in2))
438             #define SPVM_IMPLEMENT_GE_DOUBLE(out, in1, in2) (out = (in1 >= in2))
439              
440             #define SPVM_IMPLEMENT_LT_INT(out, in1, in2) (out = (in1 < in2))
441             #define SPVM_IMPLEMENT_LT_LONG(out, in1, in2) (out = (in1 < in2))
442             #define SPVM_IMPLEMENT_LT_FLOAT(out, in1, in2) (out = (in1 < in2))
443             #define SPVM_IMPLEMENT_LT_DOUBLE(out, in1, in2) (out = (in1 < in2))
444              
445             #define SPVM_IMPLEMENT_LE_INT(out, in1, in2) (out = (in1 <= in2))
446             #define SPVM_IMPLEMENT_LE_LONG(out, in1, in2) (out = (in1 <= in2))
447             #define SPVM_IMPLEMENT_LE_FLOAT(out, in1, in2) (out = (in1 <= in2))
448             #define SPVM_IMPLEMENT_LE_DOUBLE(out, in1, in2) (out = (in1 <= in2))
449              
450             #define SPVM_IMPLEMENT_CMP_INT(out, in1, in2) (out = in1 > in2 ? 1 : in1 < in2 ? -1 : 0)
451             #define SPVM_IMPLEMENT_CMP_LONG(out, in1, in2) (out = in1 > in2 ? 1 : in1 < in2 ? -1 : 0)
452             #define SPVM_IMPLEMENT_CMP_FLOAT(out, in1, in2) (out = in1 > in2 ? 1 : in1 < in2 ? -1 : 0)
453             #define SPVM_IMPLEMENT_CMP_DOUBLE(out, in1, in2) (out = in1 > in2 ? 1 : in1 < in2 ? -1 : 0)
454              
455             #define SPVM_IMPLEMENT_IS_UNDEF(out, in) (out = in == NULL)
456             #define SPVM_IMPLEMENT_IS_NOT_UNDEF(out, in) (out = in != NULL)
457              
458 841           static inline void SPVM_IMPLEMENT_STRING_COMPARISON_OP(SPVM_ENV* env, SPVM_VALUE* stack, int32_t comparison_op_id, int32_t* out, void* in1, void* in2, int32_t object_length_offset) {
459 841           void* object1 = in1;
460 841           void* object2 = in2;
461            
462 841           int32_t flag = 0;
463 841 100         if (object1 == NULL && object2 == NULL) {
    100          
464 6           switch (comparison_op_id) {
465             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_EQ: {
466 1           flag = 1;
467 1           break;
468             }
469             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_NE: {
470 1           flag = 0;
471 1           break;
472             }
473             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GT: {
474 1           flag = 0;
475 1           break;
476             }
477             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GE: {
478 1           flag = 1;
479 1           break;
480             }
481             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LT: {
482 0           flag = 0;
483 0           break;
484             }
485             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LE: {
486 1           flag = 1;
487 1           break;
488             }
489             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_CMP: {
490 1           flag = 0;
491 1           break;
492             }
493             }
494 6           }
495 835 100         else if (object1 != NULL && object2 == NULL) {
    100          
496 7           switch (comparison_op_id) {
497             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_EQ: {
498 1           flag = 0;
499 1           break;
500             }
501             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_NE: {
502 1           flag = 1;
503 1           break;
504             }
505             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GT: {
506 1           flag = 1;
507 1           break;
508             }
509             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GE: {
510 1           flag = 1;
511 1           break;
512             }
513             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LT: {
514 0           flag = 0;
515 0           break;
516             }
517             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LE: {
518 1           flag = 0;
519 1           break;
520             }
521             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_CMP: {
522 2           flag = 1;
523 2           break;
524             }
525             }
526 7           }
527 828 100         else if (object1 == NULL && object2 != NULL) {
    50          
528 7           switch (comparison_op_id) {
529             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_EQ: {
530 1           flag = 0;
531 1           break;
532             }
533             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_NE: {
534 1           flag = 1;
535 1           break;
536             }
537             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GT: {
538 1           flag = 0;
539 1           break;
540             }
541             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GE: {
542 1           flag = 0;
543 1           break;
544             }
545             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LT: {
546 0           flag = 1;
547 0           break;
548             }
549             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LE: {
550 1           flag = 1;
551 1           break;
552             }
553             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_CMP: {
554 2           flag = -1;
555 2           break;
556             }
557             }
558 7           }
559             else {
560 821           int32_t length1 = *(int32_t*)((intptr_t)object1 + object_length_offset);
561 821           int32_t length2 = *(int32_t*)((intptr_t)object2 + object_length_offset);
562            
563 821           const char* bytes1 = env->get_chars(env, stack, object1);
564 821           const char* bytes2 = env->get_chars(env, stack, object2);
565            
566 821           int32_t short_string_length = length1 < length2 ? length1 : length2;
567 821           int32_t retval = memcmp(bytes1, bytes2, short_string_length);
568             int32_t cmp;
569 821 100         if (retval) {
570 134 100         cmp = retval < 0 ? -1 : 1;
571 687 100         } else if (length1 == length2) {
572 667           cmp = 0;
573             } else {
574 20 100         cmp = length1 < length2 ? -1 : 1;
575             }
576            
577 821           switch (comparison_op_id) {
578             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_EQ: {
579 669           flag = (cmp == 0);
580 669           break;
581             }
582             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_NE: {
583 8           flag = (cmp != 0);
584 8           break;
585             }
586             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GT: {
587 8           flag = (cmp == 1);
588 8           break;
589             }
590             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GE: {
591 8           flag = (cmp >= 0);
592 8           break;
593             }
594             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LT: {
595 1           flag = (cmp == -1);
596 1           break;
597             }
598             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LE: {
599 8           flag = (cmp <= 0);
600 8           break;
601             }
602             case SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_CMP: {
603 119           flag = cmp;
604 119           break;
605             }
606             }
607             }
608            
609 841           *out = flag;
610 841           }
611              
612             #define SPVM_IMPLEMENT_STRING_EQ(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_EQ, out, in1, in2, object_length_offset))
613             #define SPVM_IMPLEMENT_STRING_NE(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_NE, out, in1, in2, object_length_offset))
614             #define SPVM_IMPLEMENT_STRING_GT(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GT, out, in1, in2, object_length_offset))
615             #define SPVM_IMPLEMENT_STRING_GE(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_GE, out, in1, in2, object_length_offset))
616             #define SPVM_IMPLEMENT_STRING_LT(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LT, out, in1, in2, object_length_offset))
617             #define SPVM_IMPLEMENT_STRING_LE(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_LE, out, in1, in2, object_length_offset))
618             #define SPVM_IMPLEMENT_STRING_CMP(env, stack, out, in1, in2) (SPVM_IMPLEMENT_STRING_COMPARISON_OP(env, stack, SPVM_IMPLEMENT_C_COMPARISON_OP_STRING_CMP, out, in1, in2, object_length_offset))
619              
620 35670           static inline void SPVM_IMPLEMENT_NEW_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* basic_type, int32_t* error_id) {
621 35670           void* object = env->new_object_no_mortal(env, stack, basic_type);
622 35670 50         if (object == NULL) {
623 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_OBJECT_FAILED]);
624 0           env->set_exception(env, stack, exception);
625 0           *error_id = 1;
626             }
627             else {
628             // Push object
629 35670           env->assign_object(env, stack, out, object);
630             }
631 35670           }
632              
633 36068           static inline void SPVM_IMPLEMENT_NEW_OBJECT_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* basic_type, int32_t length, int32_t* error_id) {
634 36068 100         if (length >= 0) {
635 36067           void* object = env->new_object_array_no_mortal(env, stack, basic_type, length);
636 36067 50         if (object == NULL) {
637 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
638 0           env->set_exception(env, stack, exception);
639 0           *error_id = 1;
640             }
641             else {
642 36067           env->assign_object(env, stack, out, object);
643             }
644             }
645             else {
646 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
647 1           env->set_exception(env, stack, exception);
648 1           *error_id = 1;
649             }
650 36068           }
651              
652 25           static inline void SPVM_IMPLEMENT_NEW_MULDIM_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* basic_type, int32_t type_dimension, int32_t length, int32_t* error_id) {
653 25 100         if (length >= 0) {
654 24           void* object = env->new_muldim_array_no_mortal(env, stack, basic_type, type_dimension, length);
655 24 50         if (object == NULL) {
656 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
657 0           env->set_exception(env, stack, exception);
658 0           *error_id = 1;
659             }
660             else {
661 24           env->assign_object(env, stack, out, object);
662             }
663             }
664             else {
665 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
666 1           env->set_exception(env, stack, exception);
667 1           *error_id = 1;
668             }
669 25           }
670              
671 85           static inline void SPVM_IMPLEMENT_NEW_MULNUM_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* basic_type, int32_t length, int32_t* error_id) {
672 85 100         if (length >= 0) {
673 84           void* object = env->new_mulnum_array_no_mortal(env, stack, basic_type, length);
674 84 50         if (object == NULL) {
675 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
676 0           env->set_exception(env, stack, exception);
677 0           *error_id = 1;
678             }
679             else {
680 84           env->assign_object(env, stack, out, object);
681             }
682             }
683             else {
684 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
685 1           env->set_exception(env, stack, exception);
686 1           *error_id = 1;
687             }
688 85           }
689              
690 479           static inline void SPVM_IMPLEMENT_NEW_BYTE_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
691 479 100         if (length >= 0) {
692 478           void* object = env->new_byte_array_no_mortal(env, stack, length);
693 478 50         if (object == NULL) {
694 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
695 0           env->set_exception(env, stack, exception);
696 0           *error_id = 1;
697             }
698             else {
699 478           env->assign_object(env, stack, out, object);
700             }
701             }
702             else {
703 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
704 1           env->set_exception(env, stack, exception);
705 1           *error_id = 1;
706             }
707 479           }
708              
709 441           static inline void SPVM_IMPLEMENT_NEW_SHORT_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
710 441 100         if (length >= 0) {
711 440           void* object = env->new_short_array_no_mortal(env, stack, length);
712 440 50         if (object == NULL) {
713 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
714 0           env->set_exception(env, stack, exception);
715 0           *error_id = 1;
716             }
717             else {
718 440           env->assign_object(env, stack, out, object);
719             }
720             }
721             else {
722 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
723 1           env->set_exception(env, stack, exception);
724 1           *error_id = 1;
725             }
726 441           }
727              
728 529           static inline void SPVM_IMPLEMENT_NEW_INT_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
729 529 100         if (length >= 0) {
730 528           void* object = env->new_int_array_no_mortal(env, stack, length);
731 528 50         if (object == NULL) {
732 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
733 0           env->set_exception(env, stack, exception);
734 0           *error_id = 1;
735             }
736             else {
737 528           env->assign_object(env, stack, out, object);
738             }
739             }
740             else {
741 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
742 1           env->set_exception(env, stack, exception);
743 1           *error_id = 1;
744             }
745 529           }
746              
747 434           static inline void SPVM_IMPLEMENT_NEW_LONG_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
748 434 100         if (length >= 0) {
749 433           void* object = env->new_long_array_no_mortal(env, stack, length);
750 433 50         if (object == NULL) {
751 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
752 0           env->set_exception(env, stack, exception);
753 0           *error_id = 1;
754             }
755             else {
756 433           env->assign_object(env, stack, out, object);
757             }
758             }
759             else {
760 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
761 1           env->set_exception(env, stack, exception);
762 1           *error_id = 1;
763             }
764 434           }
765              
766 438           static inline void SPVM_IMPLEMENT_NEW_FLOAT_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
767 438 100         if (length >= 0) {
768 437           void* object = env->new_float_array_no_mortal(env, stack, length);
769 437 50         if (object == NULL) {
770 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
771 0           env->set_exception(env, stack, exception);
772 0           *error_id = 1;
773             }
774             else {
775 437           env->assign_object(env, stack, out, object);
776             }
777             }
778             else {
779 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
780 1           env->set_exception(env, stack, exception);
781 1           *error_id = 1;
782             }
783 438           }
784              
785 445           static inline void SPVM_IMPLEMENT_NEW_DOUBLE_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
786 445 100         if (length >= 0) {
787 444           void* object = env->new_double_array_no_mortal(env, stack, length);
788 444 50         if (object == NULL) {
789 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_ARRAY_FAILED]);
790 0           env->set_exception(env, stack, exception);
791 0           *error_id = 1;
792             }
793             else {
794 444           env->assign_object(env, stack, out, object);
795             }
796             }
797             else {
798 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRRAY_LENGTH_SMALL]);
799 1           env->set_exception(env, stack, exception);
800 1           *error_id = 1;
801             }
802 445           }
803              
804 4585           static inline void SPVM_IMPLEMENT_NEW_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, const char* constant_string, int32_t constant_string_length, int32_t* error_id) {
805 4585           void* string = env->new_string_no_mortal(env, stack, constant_string, constant_string_length);
806 4585 50         if (string == NULL) {
807 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_STRING_FAILED]);
808 0           env->set_exception(env, stack, exception);
809 0           *error_id = 1;
810             }
811             else {
812 4585           env->make_read_only(env, stack, string);
813 4585           env->assign_object(env, stack, out , string);
814             }
815 4585           }
816              
817 2221           static inline void SPVM_IMPLEMENT_NEW_STRING_LEN(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t length, int32_t* error_id) {
818 2221 100         if (length >= 0) {
819 2219           void* string = env->new_string_no_mortal(env, stack, NULL, length);
820 2219 50         if (string == NULL) {
821 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_NEW_STRING_FAILED]);
822 0           env->set_exception(env, stack, exception);
823 0           *error_id = 1;
824             }
825             else {
826 2219           env->assign_object(env, stack, out, string);
827             }
828             }
829             else {
830 2           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_STRING_LENGTH_SMALL]);
831 2           env->set_exception(env, stack, exception);
832 2           *error_id = 1;
833             }
834 2221           }
835              
836             #define SPVM_IMPLEMENT_IS_READ_ONLY(env, stack, out, in) (out = env->is_read_only(env, stack, in))
837              
838             #define SPVM_IMPLEMENT_MAKE_READ_ONLY(env, stack, in) (env->make_read_only(env, stack, in))
839              
840 3569           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
841            
842 3569           int8_t element = 0;
843            
844 3569 50         if (__builtin_expect(array == NULL, 0)) {
845 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
846 0           *error_id = 1;
847             }
848             else {
849 3569 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
850 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
851 1           *error_id = 1;
852             }
853             else {
854 3568           *out = ((int8_t*)((intptr_t)array + object_data_offset))[index];
855             }
856             }
857 3569           }
858              
859 559           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
860            
861 559           int16_t element = 0;
862            
863 559 50         if (__builtin_expect(array == NULL, 0)) {
864 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
865 0           *error_id = 1;
866             }
867             else {
868 559 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
869 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
870 1           *error_id = 1;
871             }
872             else {
873 558           *out = ((int16_t*)((intptr_t)array + object_data_offset))[index];
874             }
875             }
876 559           }
877              
878 617           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
879            
880 617           int32_t element = 0;
881            
882 617 50         if (__builtin_expect(array == NULL, 0)) {
883 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
884 0           *error_id = 1;
885             }
886             else {
887 617 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
888 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
889 1           *error_id = 1;
890             }
891             else {
892 616           *out = ((int32_t*)((intptr_t)array + object_data_offset))[index];
893             }
894             }
895 617           }
896              
897 568           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
898            
899 568           int64_t element = 0;
900            
901 568 50         if (__builtin_expect(array == NULL, 0)) {
902 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
903 0           *error_id = 1;
904             }
905             else {
906 568 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
907 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
908 1           *error_id = 1;
909             }
910             else {
911 567           *out = ((int64_t*)((intptr_t)array + object_data_offset))[index];
912             }
913             }
914 568           }
915              
916 559           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
917            
918 559           float element = 0;
919            
920 559 50         if (__builtin_expect(array == NULL, 0)) {
921 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
922 0           *error_id = 1;
923             }
924             else {
925 559 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
926 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
927 1           *error_id = 1;
928             }
929             else {
930 558           *out = ((float*)((intptr_t)array + object_data_offset))[index];
931             }
932             }
933 559           }
934              
935 559           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
936            
937 559           double element = 0;
938            
939 559 50         if (__builtin_expect(array == NULL, 0)) {
940 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
941 0           *error_id = 1;
942             }
943             else {
944 559 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
945 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
946 1           *error_id = 1;
947             }
948             else {
949 558           *out = ((double*)((intptr_t)array + object_data_offset))[index];
950             }
951             }
952 559           }
953              
954 74755           static inline void SPVM_IMPLEMENT_GET_ARRAY_ELEMENT_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
955            
956 74755           void* element = NULL;
957            
958 74755 50         if (__builtin_expect(array == NULL, 0)) {
959 0           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]));
960 0           *error_id = 1;
961             }
962             else {
963 74755 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    100          
964 1           env->set_exception(env, stack, env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]));
965 1           *error_id = 1;
966             }
967             else {
968 74754           env->assign_object(env, stack, out, ((void**)((intptr_t)array + object_data_offset))[index]);
969             }
970             }
971 74755           }
972              
973 4703           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, int8_t in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
974 4703 50         if (__builtin_expect(!array, 0)) {
975 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
976 0           env->set_exception(env, stack, exception);
977 0           *error_id = 1;
978             }
979             else {
980 4703 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
981 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
982 0           env->set_exception(env, stack, exception);
983 0           *error_id = 1;
984             }
985             else {
986 4703           ((int8_t*)((intptr_t)array + object_data_offset))[index] = in;
987             }
988             }
989 4703           }
990              
991 1094           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, int16_t in, int32_t* error_id, int32_t object_header_short_size, int32_t object_length_offset) {
992 1094 50         if (__builtin_expect(!array, 0)) {
993 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
994 0           env->set_exception(env, stack, exception);
995 0           *error_id = 1;
996             }
997             else {
998 1094 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
999 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1000 0           env->set_exception(env, stack, exception);
1001 0           *error_id = 1;
1002             }
1003             else {
1004 1094           ((int16_t*)((intptr_t)array + object_header_short_size))[index] = in;
1005             }
1006             }
1007 1094           }
1008              
1009 301228           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_INT(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, int32_t in, int32_t* error_id, int32_t object_header_int_size, int32_t object_length_offset) {
1010 301228 50         if (__builtin_expect(!array, 0)) {
1011 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1012 0           env->set_exception(env, stack, exception);
1013 0           *error_id = 1;
1014             }
1015             else {
1016 301228 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1017 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1018 0           env->set_exception(env, stack, exception);
1019 0           *error_id = 1;
1020             }
1021             else {
1022 301228           ((int32_t*)((intptr_t)array + object_header_int_size))[index] = in;
1023             }
1024             }
1025 301228           }
1026              
1027 1087           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_LONG(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, int64_t in, int32_t* error_id, int32_t object_header_long_size, int32_t object_length_offset) {
1028 1087 50         if (__builtin_expect(!array, 0)) {
1029 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1030 0           env->set_exception(env, stack, exception);
1031 0           *error_id = 1;
1032             }
1033             else {
1034 1087 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1035 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1036 0           env->set_exception(env, stack, exception);
1037 0           *error_id = 1;
1038             }
1039             else {
1040 1087           ((int64_t*)((intptr_t)array + object_header_long_size))[index] = in;
1041             }
1042             }
1043 1087           }
1044              
1045 1083           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, float in, int32_t* error_id, int32_t object_header_float_size, int32_t object_length_offset) {
1046 1083 50         if (__builtin_expect(!array, 0)) {
1047 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1048 0           env->set_exception(env, stack, exception);
1049 0           *error_id = 1;
1050             }
1051             else {
1052 1083 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1053 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1054 0           env->set_exception(env, stack, exception);
1055 0           *error_id = 1;
1056             }
1057             else {
1058 1083           ((float*)((intptr_t)array + object_header_float_size))[index] = in;
1059             }
1060             }
1061 1083           }
1062              
1063 1108           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, double in, int32_t* error_id, int32_t object_header_double_size, int32_t object_length_offset) {
1064 1108 50         if (__builtin_expect(!array, 0)) {
1065 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1066 0           env->set_exception(env, stack, exception);
1067 0           *error_id = 1;
1068             }
1069             else {
1070 1108 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1071 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1072 0           env->set_exception(env, stack, exception);
1073 0           *error_id = 1;
1074             }
1075             else {
1076 1108           ((double*)((intptr_t)array + object_header_double_size))[index] = in;
1077             }
1078             }
1079 1108           }
1080              
1081 34493           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, void* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1082 34493 50         if (__builtin_expect(!array, 0)) {
1083 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1084 0           env->set_exception(env, stack, exception);
1085 0           *error_id = 1;
1086             }
1087             else {
1088 34493 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1089 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1090 0           env->set_exception(env, stack, exception);
1091 0           *error_id = 1;
1092             }
1093             else {
1094 34493           void** element_address = &((void**)((intptr_t)array + object_data_offset))[index];
1095 34493           env->assign_object(env, stack, element_address, in);
1096             }
1097             }
1098 34493           }
1099              
1100 74131           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_OBJECT_CHECK_TYPE(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, void* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1101 74131 50         if (__builtin_expect(!array, 0)) {
1102 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1103 0           env->set_exception(env, stack, exception);
1104 0           *error_id = 1;
1105             }
1106             else {
1107 74131 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1108 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1109 0           env->set_exception(env, stack, exception);
1110 0           *error_id = 1;
1111             }
1112             else {
1113 74131           void** element_address = &((void**)((intptr_t)array + object_data_offset))[index];
1114 74131           void* object = in;
1115 74131           int32_t elem_isa = env->elem_isa(env, stack, array, object);
1116 74131 100         if (elem_isa) {
1117 74128           env->assign_object(env, stack, element_address, object);
1118             }
1119             else {
1120 3           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ELEMENT_ASSIGN_NON_ASSIGNABLE_TYPE]);
1121 3           env->set_exception(env, stack, exception);
1122 3           *error_id = 1;
1123             }
1124             }
1125             }
1126 74131           }
1127              
1128 103           static inline void SPVM_IMPLEMENT_SET_ARRAY_ELEMENT_UNDEF(SPVM_ENV* env, SPVM_VALUE* stack, void* array, int32_t index, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1129 103 50         if (__builtin_expect(!array, 0)) {
1130 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1131 0           env->set_exception(env, stack, exception);
1132 0           *error_id = 1;
1133             }
1134             else {
1135 103 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1136 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1137 0           env->set_exception(env, stack, exception);
1138 0           *error_id = 1;
1139             }
1140             else {
1141 103           void* object_address = &((void**)((intptr_t)array + object_data_offset))[index];
1142 103           env->assign_object(env, stack, object_address, NULL);
1143             }
1144             }
1145 103           }
1146              
1147 43908           static inline void SPVM_IMPLEMENT_ARRAY_LENGTH(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* array, int32_t* error_id, int32_t object_length_offset) {
1148 43908 100         if (array == NULL) {
1149 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1150 1           env->set_exception(env, stack, exception);
1151 1           *error_id = 1;
1152             }
1153             else {
1154 43907           *out = *(int32_t*)((intptr_t)array + object_length_offset);
1155             }
1156 43908           }
1157              
1158 62           static inline void SPVM_IMPLEMENT_GET_FIELD_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_data_offset) {
1159            
1160 62 100         if (__builtin_expect(object == NULL, 0)) {
1161 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1162 1           env->set_exception(env, stack, exception);
1163 1           *error_id = 1;
1164             }
1165             else {
1166 61           *out = *(int8_t*)((intptr_t)object + object_data_offset + field_offset);
1167             }
1168 62           }
1169              
1170 37           static inline void SPVM_IMPLEMENT_GET_FIELD_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_header_short_size) {
1171            
1172 37 100         if (__builtin_expect(object == NULL, 0)) {
1173 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1174 1           env->set_exception(env, stack, exception);
1175 1           *error_id = 1;
1176             }
1177             else {
1178 36           *out = *(int16_t*)((intptr_t)object + object_header_short_size + field_offset);
1179             }
1180 37           }
1181              
1182              
1183 116866           static inline void SPVM_IMPLEMENT_GET_FIELD_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_header_int_size) {
1184            
1185 116866 100         if (__builtin_expect(object == NULL, 0)) {
1186 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1187 1           env->set_exception(env, stack, exception);
1188 1           *error_id = 1;
1189             }
1190             else {
1191 116865           *out = *(int32_t*)((intptr_t)object + object_header_int_size + field_offset);
1192             }
1193 116866           }
1194              
1195              
1196 39           static inline void SPVM_IMPLEMENT_GET_FIELD_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_header_long_size) {
1197            
1198 39 100         if (__builtin_expect(object == NULL, 0)) {
1199 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1200 1           env->set_exception(env, stack, exception);
1201 1           *error_id = 1;
1202             }
1203             else {
1204 38           *out = *(int64_t*)((intptr_t)object + object_header_long_size + field_offset);
1205             }
1206 39           }
1207              
1208              
1209 65           static inline void SPVM_IMPLEMENT_GET_FIELD_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_header_float_size) {
1210            
1211 65 100         if (__builtin_expect(object == NULL, 0)) {
1212 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1213 1           env->set_exception(env, stack, exception);
1214 1           *error_id = 1;
1215             }
1216             else {
1217 64           *out = *(float*)((intptr_t)object + object_header_float_size + field_offset);
1218             }
1219 65           }
1220              
1221              
1222 93           static inline void SPVM_IMPLEMENT_GET_FIELD_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_header_double_size) {
1223            
1224 93 100         if (__builtin_expect(object == NULL, 0)) {
1225 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1226 1           env->set_exception(env, stack, exception);
1227 1           *error_id = 1;
1228             }
1229             else {
1230 92           *out = *(double*)((intptr_t)object + object_header_double_size + field_offset);
1231             }
1232 93           }
1233              
1234 69837           static inline void SPVM_IMPLEMENT_GET_FIELD_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_data_offset) {
1235 69837 100         if (__builtin_expect(object == NULL, 0)) {
1236 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1237 1           env->set_exception(env, stack, exception);
1238 1           *error_id = 1;
1239             }
1240             else {
1241 69836           void** ref = (void**)((intptr_t)object + object_data_offset + field_offset);
1242 69836           void* object = (void*)((intptr_t)*ref & ~(intptr_t)1);
1243 69836           env->assign_object(env, stack, out, object);
1244             }
1245 69837           }
1246              
1247 69           static inline void SPVM_IMPLEMENT_SET_FIELD_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int8_t in, int32_t* error_id, int32_t object_data_offset) {
1248            
1249 69 100         if (__builtin_expect(object == NULL, 0)) {
1250 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1251 1           env->set_exception(env, stack, exception);
1252 1           *error_id = 1;
1253             }
1254             else {
1255 68           *(int8_t*)((intptr_t)object + object_data_offset + field_offset) = in;
1256             }
1257 69           }
1258              
1259 51           static inline void SPVM_IMPLEMENT_SET_FIELD_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int16_t in, int32_t* error_id, int32_t object_data_offset) {
1260            
1261 51 100         if (__builtin_expect(object == NULL, 0)) {
1262 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1263 1           env->set_exception(env, stack, exception);
1264 1           *error_id = 1;
1265             }
1266             else {
1267 50           *(int16_t*)((intptr_t)object + object_data_offset + field_offset) = in;
1268             }
1269 51           }
1270              
1271 99151           static inline void SPVM_IMPLEMENT_SET_FIELD_INT(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int32_t in, int32_t* error_id, int32_t object_data_offset) {
1272            
1273 99151 100         if (__builtin_expect(object == NULL, 0)) {
1274 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1275 1           env->set_exception(env, stack, exception);
1276 1           *error_id = 1;
1277             }
1278             else {
1279 99150           *(int32_t*)((intptr_t)object + object_data_offset + field_offset) = in;
1280             }
1281 99151           }
1282              
1283 207           static inline void SPVM_IMPLEMENT_SET_FIELD_LONG(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int64_t in, int32_t* error_id, int32_t object_data_offset) {
1284            
1285 207 100         if (__builtin_expect(object == NULL, 0)) {
1286 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1287 1           env->set_exception(env, stack, exception);
1288 1           *error_id = 1;
1289             }
1290             else {
1291 206           *(int64_t*)((intptr_t)object + object_data_offset + field_offset) = in;
1292             }
1293 207           }
1294              
1295 75           static inline void SPVM_IMPLEMENT_SET_FIELD_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, float in, int32_t* error_id, int32_t object_data_offset) {
1296            
1297 75 100         if (__builtin_expect(object == NULL, 0)) {
1298 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1299 1           env->set_exception(env, stack, exception);
1300 1           *error_id = 1;
1301             }
1302             else {
1303 74           *(float*)((intptr_t)object + object_data_offset + field_offset) = in;
1304             }
1305 75           }
1306              
1307 79           static inline void SPVM_IMPLEMENT_SET_FIELD_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, double in, int32_t* error_id, int32_t object_data_offset) {
1308            
1309 79 100         if (__builtin_expect(object == NULL, 0)) {
1310 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1311 1           env->set_exception(env, stack, exception);
1312 1           *error_id = 1;
1313             }
1314             else {
1315 78           *(double*)((intptr_t)object + object_data_offset + field_offset) = in;
1316             }
1317 79           }
1318              
1319 21739           static inline void SPVM_IMPLEMENT_SET_FIELD_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, void* in, int32_t* error_id, int32_t object_data_offset) {
1320            
1321 21739 50         if (__builtin_expect(object == NULL, 0)) {
1322 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1323 0           env->set_exception(env, stack, exception);
1324 0           *error_id = 1;
1325             }
1326             else {
1327 21739           void* ref = (void**)((intptr_t)object + object_data_offset + field_offset);
1328 21739           env->assign_object(env, stack, ref, in);
1329             }
1330 21739           }
1331              
1332 6           static inline void SPVM_IMPLEMENT_SET_FIELD_UNDEF(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int32_t* error_id, int32_t object_data_offset) {
1333            
1334 6 100         if (__builtin_expect(object == NULL, 0)) {
1335 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1336 1           env->set_exception(env, stack, exception);
1337 1           *error_id = 1;
1338             }
1339             else {
1340 5           void* ref = (void**)((intptr_t)object + object_data_offset + field_offset);
1341 5           env->assign_object(env, stack, ref, NULL);
1342             }
1343 6           }
1344              
1345 19           static inline void SPVM_IMPLEMENT_WEAKEN_FIELD(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int32_t* error_id, int32_t object_data_offset) {
1346 19 50         if (object == NULL) {
1347 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1348 0           env->set_exception(env, stack, exception);
1349 0           *error_id = 1;
1350             }
1351             else {
1352 19           void** ref = (void**)((intptr_t)object + object_data_offset + field_offset);
1353 19           int32_t status = env->weaken(env, stack, ref);
1354 19 50         if (status != 0) {
1355 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_WEAKEN_BACK_REFERENCE_ALLOCATION_FAILED]);
1356 0           env->set_exception(env, stack, exception);
1357 0           *error_id = 1;
1358             }
1359             }
1360 19           }
1361              
1362 0           static inline void SPVM_IMPLEMENT_UNWEAKEN_FIELD(SPVM_ENV* env, SPVM_VALUE* stack, void* object, int32_t field_offset, int32_t* error_id, int32_t object_data_offset) {
1363 0 0         if (object == NULL) {
1364 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1365 0           env->set_exception(env, stack, exception);
1366 0           *error_id = 1;
1367             }
1368             else {
1369 0           void** ref = (void**)((intptr_t)object + object_data_offset + field_offset);
1370 0           env->unweaken(env, stack, ref);
1371             }
1372 0           }
1373              
1374 2           static inline void SPVM_IMPLEMENT_ISWEAK_FIELD(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* object, int32_t field_offset, int32_t* error_id, int32_t object_data_offset) {
1375 2 50         if (object == NULL) {
1376 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_FIELD_ACCESS_INVOCANT_UNDEFINED]);
1377 0           env->set_exception(env, stack, exception);
1378 0           *error_id = 1;
1379             }
1380             else {
1381 2           void** ref = (void**)((intptr_t)object + object_data_offset + field_offset);
1382 2           *out = env->isweak(env, stack, ref);
1383             }
1384 2           }
1385              
1386             #define SPVM_IMPLEMENT_GET_CLASS_VAR_BYTE(env, stack, out, class_var) (out = env->get_class_var_byte(env, stack, class_var))
1387             #define SPVM_IMPLEMENT_GET_CLASS_VAR_SHORT(env, stack, out, class_var) (out = env->get_class_var_short(env, stack, class_var))
1388             #define SPVM_IMPLEMENT_GET_CLASS_VAR_INT(env, stack, out, class_var) (out = env->get_class_var_int(env, stack, class_var))
1389             #define SPVM_IMPLEMENT_GET_CLASS_VAR_LONG(env, stack, out, class_var) (out = env->get_class_var_long(env, stack, class_var))
1390             #define SPVM_IMPLEMENT_GET_CLASS_VAR_FLOAT(env, stack, out, class_var) (out = env->get_class_var_float(env, stack, class_var))
1391             #define SPVM_IMPLEMENT_GET_CLASS_VAR_DOUBLE(env, stack, out, class_var) (out = env->get_class_var_double(env, stack, class_var))
1392             #define SPVM_IMPLEMENT_GET_CLASS_VAR_OBJECT(env, stack, out, class_var) (env->assign_object(env, stack, out, env->get_class_var_object(env, stack, class_var)))
1393              
1394             #define SPVM_IMPLEMENT_SET_CLASS_VAR_BYTE(env, stack, class_var, in) (env->set_class_var_byte(env, stack, class_var, in))
1395             #define SPVM_IMPLEMENT_SET_CLASS_VAR_SHORT(env, stack, class_var, in) (env->set_class_var_short(env, stack, class_var, in))
1396             #define SPVM_IMPLEMENT_SET_CLASS_VAR_INT(env, stack, class_var, in) (env->set_class_var_int(env, stack, class_var, in))
1397             #define SPVM_IMPLEMENT_SET_CLASS_VAR_LONG(env, stack, class_var, in) (env->set_class_var_long(env, stack, class_var, in))
1398             #define SPVM_IMPLEMENT_SET_CLASS_VAR_FLOAT(env, stack, class_var, in) (env->set_class_var_float(env, stack, class_var, in))
1399             #define SPVM_IMPLEMENT_SET_CLASS_VAR_DOUBLE(env, stack, class_var, in) (env->set_class_var_double(env, stack, class_var, in))
1400             #define SPVM_IMPLEMENT_SET_CLASS_VAR_OBJECT(env, stack, class_var, in) (env->assign_object(env, stack, env->get_class_var_object_ref(env, stack, class_var), in))
1401             #define SPVM_IMPLEMENT_SET_CLASS_VAR_UNDEF(env, stack, class_var) (env->assign_object(env, stack, env->get_class_var_object_ref(env, stack, class_var), NULL))
1402              
1403             #define SPVM_IMPLEMENT_GET_EXCEPTION_VAR(env, stack, out) (env->assign_object(env, stack, out, env->get_exception(env, stack)))
1404             #define SPVM_IMPLEMENT_SET_EXCEPTION_VAR(env, stack, in) (env->set_exception(env, stack, in))
1405             #define SPVM_IMPLEMENT_SET_EXCEPTION_VAR_UNDEF(env, stack) (env->set_exception(env, stack, NULL))
1406              
1407 138           static inline void SPVM_IMPLEMENT_ISA(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* object, void* dist_basic_type, int32_t dist_type_dimension) {
1408 138 100         if (object) {
1409 136           *out = env->isa(env, stack, object, dist_basic_type, dist_type_dimension);
1410             }
1411             else {
1412 2           *out = 0;
1413             }
1414 138           }
1415              
1416 7           static inline void SPVM_IMPLEMENT_ISA_ERROR(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* src_basic_type, void* dist_basic_type, int32_t dist_type_dimension) {
1417 7           *out = env->api->type->can_assign(env->runtime, dist_basic_type, dist_type_dimension, 0, src_basic_type, 0, 0);
1418 7           }
1419              
1420 91           static inline void SPVM_IMPLEMENT_IS_TYPE(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* object, void* dist_basic_type, int32_t dist_type_dimension) {
1421 91 100         if (object) {
1422 90           *out = env->is_type(env, stack, object, dist_basic_type, dist_type_dimension);
1423             }
1424             else {
1425 1           *out = 0;
1426             }
1427 91           }
1428              
1429 6           static inline void SPVM_IMPLEMENT_IS_ERROR(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* src_basic_type, void* dist_basic_type, int32_t dist_type_dimension) {
1430 6 100         *out = (dist_basic_type == src_basic_type && dist_type_dimension == 0);
    50          
1431 6           }
1432              
1433             #define SPVM_IMPLEMENT_CAN(env, stack, out, object, method_name) (out = (env->get_instance_method(env, stack, object, method_name) != NULL))
1434              
1435 8           static inline void SPVM_IMPLEMENT_PRINT(SPVM_ENV* env, SPVM_VALUE* stack, void* string) {
1436 8 100         if (string) {
1437 7           const char* bytes = env->get_chars(env, stack, string);
1438 7           int32_t string_length = env->length(env, stack, string);
1439            
1440 7 100         if (string_length > 0) {
1441 6           size_t ret = fwrite(bytes, 1, string_length, stdout);
1442             }
1443             }
1444 8           }
1445              
1446 5           static inline void SPVM_IMPLEMENT_SAY(SPVM_ENV* env, SPVM_VALUE* stack, void* string) {
1447 5 100         if (string) {
1448 4           const char* bytes = env->get_chars(env, stack, string);
1449 4           int32_t string_length = env->length(env, stack, string);
1450            
1451 4 100         if (string_length > 0) {
1452 3           size_t ret = fwrite(bytes, 1, string_length, stdout);
1453             }
1454             }
1455 5           fprintf(stdout, "\n");
1456 5           }
1457              
1458 10           static inline void SPVM_IMPLEMENT_WARN(SPVM_ENV* env, SPVM_VALUE* stack, void* string, const char* include_dir, const char* include_dir_sep, const char* class_rel_file, int32_t line) {
1459 10           int32_t empty_or_undef = 0;
1460 10 100         if (string) {
1461 9           const char* bytes = env->get_chars(env, stack, string);
1462 9           int32_t string_length = env->length(env, stack, string);
1463              
1464 9 100         if (string_length > 0) {
1465 8           size_t ret = fwrite(bytes, 1, string_length, stderr);
1466             // Add line and file information if last character is not '\n'
1467             int32_t add_line_file;
1468 8 100         if (bytes[string_length - 1] != '\n') {
1469 8           fprintf(stderr, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_WARN_AT], include_dir, include_dir_sep, class_rel_file, line);
1470             }
1471             }
1472             else {
1473 9           empty_or_undef = 1;
1474             }
1475             }
1476             else {
1477 1           empty_or_undef = 1;
1478             }
1479              
1480 10 100         if (empty_or_undef) {
1481 2           fprintf(stderr, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_WARN_UNDEF], include_dir, include_dir_sep, class_rel_file, line);
1482             }
1483              
1484 10           fflush(stderr);
1485 10           }
1486              
1487             #define SPVM_IMPLEMENT_CLEAR_EVAL_ERROR_ID(eval_error_id) (eval_error_id = 0)
1488              
1489             #define SPVM_IMPLEMENT_GET_EVAL_ERROR_ID(out, eval_error_id) (out = eval_error_id)
1490              
1491             #define SPVM_IMPLEMENT_SET_ERROR_ID(error_id, die_error_basic_type) (error_id = env->api->basic_type->get_id(env->runtime, die_error_basic_type))
1492              
1493             #define SPVM_IMPLEMENT_SET_EVAL_ERROR_ID(eval_error_id, die_error_id) (eval_error_id = die_error_id)
1494              
1495             #define SPVM_IMPLEMENT_ARGS_WIDTH(env, stack, out) (out = env->args_width(env, stack))
1496              
1497             #define SPVM_IMPLEMENT_GET_BASIC_TYPE_ID(env, stack, out, basic_type) (out = env->api->basic_type->get_id(env->runtime, basic_type))
1498              
1499 5           static inline void SPVM_IMPLEMENT_TYPE_NAME(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object) {
1500 5 100         if (object == NULL) {
1501 1           *out = NULL;
1502             }
1503             else {
1504 4           void* type_name = env->get_type_name_no_mortal(env, stack, object);
1505 4           env->assign_object(env, stack, out, type_name);
1506             }
1507 5           }
1508              
1509 31           static inline void SPVM_IMPLEMENT_DUMP(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object) {
1510 31           void* dump = env->dump_no_mortal(env, stack, object);
1511 31           env->assign_object(env, stack, out, dump);
1512 31           }
1513              
1514 146           static inline void SPVM_IMPLEMENT_COPY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object, int32_t* error_id) {
1515 146 100         if (object) {
1516 145 100         if (!(env->is_string(env, stack, object) || env->is_numeric_array(env, stack, object) || env->is_mulnum_array(env, stack, object))) {
    100          
    100          
1517 2           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_COPY_OPERAND_INVALID]);
1518 2           env->set_exception(env, stack, exception);
1519 2           *error_id = 1;
1520             }
1521             else {
1522 141           void* new_object_no_mortal = env->copy_no_mortal(env, stack, object);
1523 143           env->assign_object(env, stack, out, new_object_no_mortal);
1524             }
1525             }
1526             else {
1527 3           env->assign_object(env, stack, out, NULL);
1528             }
1529 146           }
1530              
1531             #define SPVM_IMPLEMENT_REF_BYTE(out, in) (out = in)
1532             #define SPVM_IMPLEMENT_REF_SHORT(out, in) (out = in)
1533             #define SPVM_IMPLEMENT_REF_INT(out, in) (out = in)
1534             #define SPVM_IMPLEMENT_REF_LONG(out, in) (out = in)
1535             #define SPVM_IMPLEMENT_REF_FLOAT(out, in) (out = in)
1536             #define SPVM_IMPLEMENT_REF_DOUBLE(out, in) (out = in)
1537              
1538             #define SPVM_IMPLEMENT_GET_DEREF_BYTE(out, in) (out = *(int8_t*)*(void**)in)
1539             #define SPVM_IMPLEMENT_GET_DEREF_SHORT(out, in) (out = *(int16_t*)*(void**)in)
1540             #define SPVM_IMPLEMENT_GET_DEREF_INT(out, in) (out = *(int32_t*)*(void**)in)
1541             #define SPVM_IMPLEMENT_GET_DEREF_LONG(out, in) (out = *(int64_t*)*(void**)in)
1542             #define SPVM_IMPLEMENT_GET_DEREF_FLOAT(out, in) (out = *(float*)*(void**)in)
1543             #define SPVM_IMPLEMENT_GET_DEREF_DOUBLE(out, in) (out = *(double*)*(void**)in)
1544              
1545             #define SPVM_IMPLEMENT_SET_DEREF_BYTE(out, in) (*(int8_t*)*(void**)out = in)
1546             #define SPVM_IMPLEMENT_SET_DEREF_SHORT(out, in) (*(int16_t*)*(void**)out = in)
1547             #define SPVM_IMPLEMENT_SET_DEREF_INT(out, in) (*(int32_t*)*(void**)out = in)
1548             #define SPVM_IMPLEMENT_SET_DEREF_LONG(out, in) (*(int64_t*)*(void**)out = in)
1549             #define SPVM_IMPLEMENT_SET_DEREF_FLOAT(out, in) (*(float*)*(void**)out = in)
1550             #define SPVM_IMPLEMENT_SET_DEREF_DOUBLE(out, in) (*(double*)*(void**)out = in)
1551              
1552             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_BYTE(out, in, field_index) (out = *(in + field_index))
1553             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_SHORT(out, in, field_index) (out = *(in + field_index))
1554             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_INT(out, in, field_index) (out = *(in + field_index))
1555             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_LONG(out, in, field_index) (out = *(in + field_index))
1556             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_FLOAT(out, in, field_index) (out = *(in + field_index))
1557             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DOUBLE(out, in, field_index) (out = *(in + field_index))
1558              
1559             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_BYTE(out, field_index, in) (*(out + field_index) = in)
1560             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_SHORT(out, field_index, in) (*(out + field_index) = in)
1561             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_INT(out, field_index, in) (*(out + field_index) = in)
1562             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_LONG(out, field_index, in) (*(out + field_index) = in)
1563             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_FLOAT(out, field_index, in) (*(out + field_index) = in)
1564             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DOUBLE(out, field_index, in) (*(out + field_index) = in)
1565              
1566 0           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, int8_t* in, int32_t fields_length) {
1567 0 0         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
1568 0           *(out + field_index) = *(in + field_index);
1569             }
1570 0           }
1571              
1572 0           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, int16_t* in, int32_t fields_length) {
1573 0 0         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
1574 0           *(out + field_index) = *(in + field_index);
1575             }
1576 0           }
1577              
1578 0           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t* in, int32_t fields_length) {
1579 0 0         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
1580 0           *(out + field_index) = *(in + field_index);
1581             }
1582 0           }
1583              
1584 0           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t* in, int32_t fields_length) {
1585 0 0         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
1586 0           *(out + field_index) = *(in + field_index);
1587             }
1588 0           }
1589              
1590 0           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, float* in, int32_t fields_length) {
1591 0 0         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
1592 0           *(out + field_index) = *(in + field_index);
1593             }
1594 0           }
1595              
1596 3           static inline void SPVM_IMPLEMENT_MOVE_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, double* in, int32_t fields_length) {
1597 9 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
1598 6           *(out + field_index) = *(in + field_index);
1599             }
1600 3           }
1601              
1602 1           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, int8_t* array, int32_t index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1603 1 50         if (__builtin_expect(array == NULL, 0)) {
1604 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1605 0           env->set_exception(env, stack, exception);
1606 0           *error_id = 1;
1607             }
1608             else {
1609 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1610 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1611 0           env->set_exception(env, stack, exception);
1612 0           *error_id = 1;
1613             }
1614             else {
1615             int32_t field_index;
1616 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1617 3           *(out + field_index) = ((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1618             }
1619             }
1620             }
1621 1           }
1622              
1623 1           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, int16_t* array, int32_t index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1624 1 50         if (__builtin_expect(array == NULL, 0)) {
1625 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1626 0           env->set_exception(env, stack, exception);
1627 0           *error_id = 1;
1628             }
1629             else {
1630 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1631 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1632 0           env->set_exception(env, stack, exception);
1633 0           *error_id = 1;
1634             }
1635             else {
1636             int32_t field_index;
1637 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1638 3           *(out + field_index) = ((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1639             }
1640             }
1641             }
1642 1           }
1643              
1644 1           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t* array, int32_t index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1645 1 50         if (__builtin_expect(array == NULL, 0)) {
1646 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1647 0           env->set_exception(env, stack, exception);
1648 0           *error_id = 1;
1649             }
1650             else {
1651 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1652 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1653 0           env->set_exception(env, stack, exception);
1654 0           *error_id = 1;
1655             }
1656             else {
1657             int32_t field_index;
1658 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1659 3           *(out + field_index) = ((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1660             }
1661             }
1662             }
1663 1           }
1664              
1665 1           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t* array, int32_t index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1666 1 50         if (__builtin_expect(array == NULL, 0)) {
1667 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1668 0           env->set_exception(env, stack, exception);
1669 0           *error_id = 1;
1670             }
1671             else {
1672 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1673 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1674 0           env->set_exception(env, stack, exception);
1675 0           *error_id = 1;
1676             }
1677             else {
1678             int32_t field_index;
1679 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1680 3           *(out + field_index) = ((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1681             }
1682             }
1683             }
1684 1           }
1685              
1686 1           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, float* array, int32_t index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1687 1 50         if (__builtin_expect(array == NULL, 0)) {
1688 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1689 0           env->set_exception(env, stack, exception);
1690 0           *error_id = 1;
1691             }
1692             else {
1693 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1694 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1695 0           env->set_exception(env, stack, exception);
1696 0           *error_id = 1;
1697             }
1698             else {
1699             int32_t field_index;
1700 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1701 3           *(out + field_index) = ((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1702             }
1703             }
1704             }
1705 1           }
1706              
1707 1           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, double* array, int32_t index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1708 1 50         if (__builtin_expect(array == NULL, 0)) {
1709 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1710 0           env->set_exception(env, stack, exception);
1711 0           *error_id = 1;
1712             }
1713             else {
1714 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1715 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1716 0           env->set_exception(env, stack, exception);
1717 0           *error_id = 1;
1718             }
1719             else {
1720             int32_t field_index;
1721 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1722 3           *(out + field_index) = ((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1723             }
1724             }
1725             }
1726 1           }
1727              
1728 1           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* array, int32_t index, int32_t fields_length, int8_t* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1729 1 50         if (__builtin_expect(!array, 0)) {
1730 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1731 0           env->set_exception(env, stack, exception);
1732 0           *error_id = 1;
1733             }
1734             else {
1735 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1736 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1737 0           env->set_exception(env, stack, exception);
1738 0           *error_id = 1;
1739             }
1740             else {
1741             int32_t field_index;
1742 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1743 3           ((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index);
1744             }
1745             }
1746             }
1747 1           }
1748              
1749 1           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* array, int32_t index, int32_t fields_length, int16_t* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1750 1 50         if (__builtin_expect(!array, 0)) {
1751 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1752 0           env->set_exception(env, stack, exception);
1753 0           *error_id = 1;
1754             }
1755             else {
1756 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1757 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1758 0           env->set_exception(env, stack, exception);
1759 0           *error_id = 1;
1760             }
1761             else {
1762             int32_t field_index;
1763 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1764 3           ((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index);
1765             }
1766             }
1767             }
1768 1           }
1769              
1770 1           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* array, int32_t index, int32_t fields_length, int32_t* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1771 1 50         if (__builtin_expect(!array, 0)) {
1772 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1773 0           env->set_exception(env, stack, exception);
1774 0           *error_id = 1;
1775             }
1776             else {
1777 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1778 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1779 0           env->set_exception(env, stack, exception);
1780 0           *error_id = 1;
1781             }
1782             else {
1783             int32_t field_index;
1784 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1785 3           ((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index);
1786             }
1787             }
1788             }
1789 1           }
1790              
1791 1           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* array, int32_t index, int32_t fields_length, int64_t* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1792 1 50         if (__builtin_expect(!array, 0)) {
1793 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1794 0           env->set_exception(env, stack, exception);
1795 0           *error_id = 1;
1796             }
1797             else {
1798 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1799 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1800 0           env->set_exception(env, stack, exception);
1801 0           *error_id = 1;
1802             }
1803             else {
1804             int32_t field_index;
1805 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1806 3           ((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index);
1807             }
1808             }
1809             }
1810 1           }
1811              
1812 1           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* array, int32_t index, int32_t fields_length, float* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1813 1 50         if (__builtin_expect(!array, 0)) {
1814 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1815 0           env->set_exception(env, stack, exception);
1816 0           *error_id = 1;
1817             }
1818             else {
1819 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1820 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1821 0           env->set_exception(env, stack, exception);
1822 0           *error_id = 1;
1823             }
1824             else {
1825             int32_t field_index;
1826 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1827 3           ((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index);
1828             }
1829             }
1830             }
1831 1           }
1832              
1833 1           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* array, int32_t index, int32_t fields_length, double* in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1834 1 50         if (__builtin_expect(!array, 0)) {
1835 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1836 0           env->set_exception(env, stack, exception);
1837 0           *error_id = 1;
1838             }
1839             else {
1840 1 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1841 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1842 0           env->set_exception(env, stack, exception);
1843 0           *error_id = 1;
1844             }
1845             else {
1846             int32_t field_index;
1847 4 100         for (field_index = 0; field_index < fields_length; field_index++) {
1848 3           ((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index);
1849             }
1850             }
1851             }
1852 1           }
1853              
1854 94           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FIELD_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, int8_t* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1855 94 50         if (__builtin_expect(array == NULL, 0)) {
1856 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1857 0           env->set_exception(env, stack, exception);
1858 0           *error_id = 1;
1859             }
1860             else {
1861 94 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1862 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1863 0           env->set_exception(env, stack, exception);
1864 0           *error_id = 1;
1865             }
1866             else {
1867 94           *out = ((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1868             }
1869             }
1870 94           }
1871              
1872 94           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FIELD_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, int16_t* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1873 94 50         if (__builtin_expect(array == NULL, 0)) {
1874 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1875 0           env->set_exception(env, stack, exception);
1876 0           *error_id = 1;
1877             }
1878             else {
1879 94 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1880 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1881 0           env->set_exception(env, stack, exception);
1882 0           *error_id = 1;
1883             }
1884             else {
1885 94           *out = ((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1886             }
1887             }
1888 94           }
1889              
1890 104           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FIELD_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_t* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1891 104 50         if (__builtin_expect(array == NULL, 0)) {
1892 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1893 0           env->set_exception(env, stack, exception);
1894 0           *error_id = 1;
1895             }
1896             else {
1897 104 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1898 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1899 0           env->set_exception(env, stack, exception);
1900 0           *error_id = 1;
1901             }
1902             else {
1903 104           *out = ((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1904             }
1905             }
1906 104           }
1907              
1908 94           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FIELD_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1909 94 50         if (__builtin_expect(array == NULL, 0)) {
1910 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1911 0           env->set_exception(env, stack, exception);
1912 0           *error_id = 1;
1913             }
1914             else {
1915 94 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1916 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1917 0           env->set_exception(env, stack, exception);
1918 0           *error_id = 1;
1919             }
1920             else {
1921 94           *out = ((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1922             }
1923             }
1924 94           }
1925              
1926 94           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FIELD_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, float* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1927 94 50         if (__builtin_expect(array == NULL, 0)) {
1928 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1929 0           env->set_exception(env, stack, exception);
1930 0           *error_id = 1;
1931             }
1932             else {
1933 94 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1934 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1935 0           env->set_exception(env, stack, exception);
1936 0           *error_id = 1;
1937             }
1938             else {
1939 94           *out = ((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1940             }
1941             }
1942 94           }
1943              
1944 111           static inline void SPVM_IMPLEMENT_GET_MULNUM_ARRAY_FIELD_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, double* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1945 111 50         if (__builtin_expect(array == NULL, 0)) {
1946 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1947 0           env->set_exception(env, stack, exception);
1948 0           *error_id = 1;
1949             }
1950             else {
1951 111 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1952 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1953 0           env->set_exception(env, stack, exception);
1954 0           *error_id = 1;
1955             }
1956             else {
1957 111           *out = ((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index];
1958             }
1959             }
1960 111           }
1961              
1962 79           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FIELD_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* array, int32_t index, int32_t field_index, int32_t fields_length, int8_t in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1963 79 50         if (__builtin_expect(!array, 0)) {
1964 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1965 0           env->set_exception(env, stack, exception);
1966 0           *error_id = 1;
1967             }
1968             else {
1969 79 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1970 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1971 0           env->set_exception(env, stack, exception);
1972 0           *error_id = 1;
1973             }
1974             else {
1975 79           ((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in;
1976             }
1977             }
1978 79           }
1979              
1980 79           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FIELD_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* array, int32_t index, int32_t field_index, int32_t fields_length, int16_t in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1981 79 50         if (__builtin_expect(!array, 0)) {
1982 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
1983 0           env->set_exception(env, stack, exception);
1984 0           *error_id = 1;
1985             }
1986             else {
1987 79 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
1988 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
1989 0           env->set_exception(env, stack, exception);
1990 0           *error_id = 1;
1991             }
1992             else {
1993 79           ((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in;
1994             }
1995             }
1996 79           }
1997              
1998 86           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FIELD_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* array, int32_t index, int32_t field_index, int32_t fields_length, int32_t in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
1999 86 50         if (__builtin_expect(!array, 0)) {
2000 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
2001 0           env->set_exception(env, stack, exception);
2002 0           *error_id = 1;
2003             }
2004             else {
2005 86 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
2006 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
2007 0           env->set_exception(env, stack, exception);
2008 0           *error_id = 1;
2009             }
2010             else {
2011 86           ((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in;
2012             }
2013             }
2014 86           }
2015              
2016 79           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FIELD_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* array, int32_t index, int32_t field_index, int32_t fields_length, int64_t in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
2017 79 50         if (__builtin_expect(!array, 0)) {
2018 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
2019 0           env->set_exception(env, stack, exception);
2020 0           *error_id = 1;
2021             }
2022             else {
2023 79 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
2024 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
2025 0           env->set_exception(env, stack, exception);
2026 0           *error_id = 1;
2027             }
2028             else {
2029 79           ((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in;
2030             }
2031             }
2032 79           }
2033              
2034 67           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FIELD_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* array, int32_t index, int32_t field_index, int32_t fields_length, float in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
2035 67 50         if (__builtin_expect(!array, 0)) {
2036 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
2037 0           env->set_exception(env, stack, exception);
2038 0           *error_id = 1;
2039             }
2040             else {
2041 67 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
2042 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
2043 0           env->set_exception(env, stack, exception);
2044 0           *error_id = 1;
2045             }
2046             else {
2047 67           ((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in;
2048             }
2049             }
2050 67           }
2051              
2052 79           static inline void SPVM_IMPLEMENT_SET_MULNUM_ARRAY_FIELD_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* array, int32_t index, int32_t field_index, int32_t fields_length, double in, int32_t* error_id, int32_t object_data_offset, int32_t object_length_offset) {
2053 79 50         if (__builtin_expect(!array, 0)) {
2054 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]);
2055 0           env->set_exception(env, stack, exception);
2056 0           *error_id = 1;
2057             }
2058             else {
2059 79 50         if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) {
    50          
2060 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_ACCESS_INDEX_OUT_OF_RANGE]);
2061 0           env->set_exception(env, stack, exception);
2062 0           *error_id = 1;
2063             }
2064             else {
2065 79           ((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in;
2066             }
2067             }
2068 79           }
2069              
2070 2           static inline void SPVM_IMPLEMENT_DEREF_MULNUM_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, void* mulnum_ref, int32_t fields_length) {
2071 8 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
2072 6           *(out + field_index) = *((int8_t*)mulnum_ref + field_index);
2073             }
2074 2           }
2075              
2076 1           static inline void SPVM_IMPLEMENT_DEREF_MULNUM_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, void* mulnum_ref, int32_t fields_length) {
2077 4 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
2078 3           *(out + field_index) = *((int16_t*)mulnum_ref + field_index);
2079             }
2080 1           }
2081              
2082 1           static inline void SPVM_IMPLEMENT_DEREF_MULNUM_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* mulnum_ref, int32_t fields_length) {
2083 4 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
2084 3           *(out + field_index) = *((int32_t*)mulnum_ref + field_index);
2085             }
2086 1           }
2087              
2088 1           static inline void SPVM_IMPLEMENT_DEREF_MULNUM_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, void* mulnum_ref, int32_t fields_length) {
2089 4 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
2090 3           *(out + field_index) = *((int64_t*)mulnum_ref + field_index);
2091             }
2092 1           }
2093              
2094 1           static inline void SPVM_IMPLEMENT_DEREF_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, void* mulnum_ref, int32_t fields_length) {
2095 4 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
2096 3           *(out + field_index) = *((float*)mulnum_ref + field_index);
2097             }
2098 1           }
2099              
2100 1           static inline void SPVM_IMPLEMENT_DEREF_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, void* mulnum_ref, int32_t fields_length) {
2101 4 100         for (int32_t field_index = 0; field_index < fields_length; field_index++) {
2102 3           *(out + field_index) = *((double*)mulnum_ref + field_index);
2103             }
2104 1           }
2105              
2106             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_BYTE(out, mulnum_ref, field_index) (out = *((int8_t*)mulnum_ref +field_index))
2107             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_SHORT(out, mulnum_ref, field_index) (out = *((int16_t*)mulnum_ref +field_index))
2108             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_INT(out, mulnum_ref, field_index) (out = *((int32_t*)mulnum_ref +field_index))
2109             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_LONG(out, mulnum_ref, field_index) (out = *((int64_t*)mulnum_ref +field_index))
2110             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_FLOAT(out, mulnum_ref, field_index) (out = *((float*)mulnum_ref +field_index))
2111             #define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_DOUBLE(out, mulnum_ref, field_index) (out = *((double*)mulnum_ref +field_index))
2112              
2113             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_BYTE(mulnum_ref, field_index, in) (*((int8_t*)mulnum_ref +field_index) = in)
2114             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_SHORT(mulnum_ref, field_index, in) (*((int16_t*)mulnum_ref +field_index) = in)
2115             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_INT(mulnum_ref, field_index, in) (*((int32_t*)mulnum_ref +field_index) = in)
2116             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_LONG(mulnum_ref, field_index, in) (*((int64_t*)mulnum_ref +field_index) = in)
2117             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_FLOAT(mulnum_ref, field_index, in) (*((float*)mulnum_ref +field_index) = in)
2118             #define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_DOUBLE(mulnum_ref, field_index, in) (*((double*)mulnum_ref +field_index) = in)
2119              
2120             #define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_SHORT(out, in) (out = (int16_t)in)
2121             #define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_INT(out, in) (out = (int32_t)in)
2122             #define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_LONG(out, in) (out = (int64_t)in)
2123             #define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_FLOAT(out, in) (out = (float)in)
2124             #define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_DOUBLE(out, in) (out = (double)in)
2125             #define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_BYTE(out, in) (out = (int8_t)in)
2126             #define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_INT(out, in) (out = (int32_t)in)
2127             #define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_LONG(out, in) (out = (int64_t)in)
2128             #define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_FLOAT(out, in) (out = (float)in)
2129             #define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_DOUBLE(out, in) (out = (double)in)
2130             #define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_BYTE(out, in) (out = (int8_t)in)
2131             #define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_SHORT(out, in) (out = (int16_t)in)
2132             #define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_LONG(out, in) (out = (int64_t)in)
2133             #define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_FLOAT(out, in) (out = (float)in)
2134             #define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_DOUBLE(out, in) (out = (double)in)
2135             #define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_BYTE(out, in) (out = (int8_t)in)
2136             #define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_SHORT(out, in) (out = (int16_t)in)
2137             #define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_INT(out, in) (out = (int32_t)in)
2138             #define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_FLOAT(out, in) (out = (float)in)
2139             #define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_DOUBLE(out, in) (out = (double)in)
2140             #define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_BYTE(out, in) (out = (int8_t)in)
2141             #define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_SHORT(out, in) (out = (int16_t)in)
2142             #define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_INT(out, in) (out = (int32_t)in)
2143             #define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_LONG(out, in) (out = (int64_t)in)
2144             #define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_DOUBLE(out, in) (out = (double)in)
2145             #define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_BYTE(out, in) (out = (int8_t)in)
2146             #define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_SHORT(out, in) (out = (int16_t)in)
2147             #define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_INT(out, in) (out = (int32_t)in)
2148             #define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_LONG(out, in) (out = (int64_t)in)
2149             #define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_FLOAT(out, in) (out = (float)in)
2150              
2151 2           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int8_t value, char* tmp_buffer, int32_t tmp_buffer_length) {
2152 2           snprintf(tmp_buffer, tmp_buffer_length, "%" PRId8, value);
2153 2           int32_t string_length = strlen(tmp_buffer);
2154 2           void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length);
2155 2           env->assign_object(env, stack, out, string);
2156 2           }
2157              
2158 2           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int16_t value, char* tmp_buffer, int32_t tmp_buffer_length) {
2159 2           snprintf(tmp_buffer, tmp_buffer_length, "%" PRId16, value);
2160 2           int32_t string_length = strlen(tmp_buffer);
2161 2           void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length);
2162 2           env->assign_object(env, stack, out, string);
2163 2           }
2164              
2165 828           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t value, char* tmp_buffer, int32_t tmp_buffer_length) {
2166 828           snprintf(tmp_buffer, tmp_buffer_length, "%" PRId32, value);
2167 828           int32_t string_length = strlen(tmp_buffer);
2168 828           void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length);
2169 828           env->assign_object(env, stack, out, string);
2170 828           }
2171              
2172 2           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int64_t value, char* tmp_buffer, int32_t tmp_buffer_length) {
2173 2           snprintf(tmp_buffer, tmp_buffer_length, "%" PRId64, value);
2174 2           int32_t string_length = strlen(tmp_buffer);
2175 2           void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length);
2176 2           env->assign_object(env, stack, out, string);
2177 2           }
2178              
2179 26           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, float value, char* tmp_buffer, int32_t tmp_buffer_length) {
2180 26           snprintf(tmp_buffer, tmp_buffer_length, "%g", value);
2181 26           int32_t string_length = strlen(tmp_buffer);
2182 26           void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length);
2183 26           env->assign_object(env, stack, out, string);
2184 26           }
2185              
2186 26           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, double value, char* tmp_buffer, int32_t tmp_buffer_length) {
2187 26           snprintf(tmp_buffer, tmp_buffer_length, "%g", value);
2188 26           int32_t string_length = strlen(tmp_buffer);
2189 26           void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length);
2190 26           env->assign_object(env, stack, out, string);
2191 26           }
2192              
2193 15           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_STRING_TO_BYTE_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* src_string) {
2194 15           int32_t src_string_length = env->length(env, stack, src_string);
2195 15           const char* src_string_data = env->get_chars(env, stack, src_string);
2196 15           void* byte_array = env->new_byte_array_no_mortal(env, stack, src_string_length);
2197 15           int8_t* byte_array_data = env->get_elems_byte(env, stack, byte_array);
2198 15           memcpy(byte_array_data, src_string_data, src_string_length);
2199 15           env->assign_object(env, stack, out, byte_array);
2200 15           }
2201              
2202 11           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_ARRAY_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* src_byte_array) {
2203 11           int32_t src_byte_array_length = env->length(env, stack, src_byte_array);
2204 11           int8_t* src_byte_array_data = env->get_elems_byte(env, stack, src_byte_array);
2205 11           void* string = env->new_string_no_mortal(env, stack, (const char*)src_byte_array_data, src_byte_array_length);
2206 11           env->assign_object(env, stack, out, string);
2207 11           }
2208              
2209 15           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_BYTE_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int8_t value, int32_t object_data_offset) {
2210 15           void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE_CLASS);
2211 15           void* object = env->new_object_no_mortal(env, stack, basic_type);
2212 15           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2213 15           *(int8_t*)&fields[0] = value;
2214 15           env->assign_object(env, stack, out, object);
2215 15           }
2216              
2217 8           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_SHORT_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int16_t value, int32_t object_data_offset) {
2218 8           void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT_CLASS);
2219 8           void* object = env->new_object_no_mortal(env, stack, basic_type);
2220 8           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2221 8           *(int16_t*)&fields[0] = value;
2222 8           env->assign_object(env, stack, out, object);
2223 8           }
2224              
2225 193           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_INT_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int32_t value, int32_t object_data_offset) {
2226 193           void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_INT_CLASS);
2227 193           void* object = env->new_object_no_mortal(env, stack, basic_type);
2228 193           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2229 193           *(int32_t*)&fields[0] = value;
2230 193           env->assign_object(env, stack, out, object);
2231 193           }
2232              
2233 34           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_LONG_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, int64_t value, int32_t object_data_offset) {
2234 34           void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG_CLASS);
2235 34           void* object = env->new_object_no_mortal(env, stack, basic_type);
2236 34           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2237 34           *(int64_t*)&fields[0] = value;
2238 34           env->assign_object(env, stack, out, object);
2239 34           }
2240              
2241 10           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_FLOAT_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, float value, int32_t object_data_offset) {
2242 10           void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT_CLASS);
2243 10           void* object = env->new_object_no_mortal(env, stack, basic_type);
2244 10           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2245 10           *(float*)&fields[0] = value;
2246 10           env->assign_object(env, stack, out, object);
2247 10           }
2248              
2249 23           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_DOUBLE_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, double value, int32_t object_data_offset) {
2250 23           void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE_CLASS);
2251 23           void* object = env->new_object_no_mortal(env, stack, basic_type);
2252 23           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2253 23           *(double*)&fields[0] = value;
2254 23           env->assign_object(env, stack, out, object);
2255 23           }
2256              
2257 11           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_OBJECT_TO_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* out, void* object, int32_t* error_id, int32_t object_data_offset) {
2258 11 50         if (object == NULL) {
2259 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]);
2260 0           env->set_exception(env, stack, exception);
2261 0           *error_id = 1;
2262             }
2263             else {
2264 11 50         if (env->is_type_by_name(env, stack, object, "Byte", 0)) {
2265 11           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2266 11           *out = *(int8_t*)&fields[0];
2267             }
2268             else {
2269 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE]);
2270 0           env->set_exception(env, stack, exception);
2271 0           *error_id = 1;
2272             }
2273             }
2274 11           }
2275              
2276 11           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_OBJECT_TO_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, void* object, int32_t* error_id, int32_t object_data_offset) {
2277 11 50         if (object == NULL) {
2278 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]);
2279 0           env->set_exception(env, stack, exception);
2280 0           *error_id = 1;
2281             }
2282             else {
2283 11 50         if (env->is_type_by_name(env, stack, object, "Short", 0)) {
2284 11           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2285 11           *out = *(int16_t*)&fields[0];
2286             }
2287             else {
2288 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE]);
2289 0           env->set_exception(env, stack, exception);
2290 0           *error_id = 1;
2291             }
2292             }
2293 11           }
2294              
2295 79           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_INT_OBJECT_TO_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, void* object, int32_t* error_id, int32_t object_data_offset) {
2296 79 50         if (object == NULL) {
2297 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]);
2298 0           env->set_exception(env, stack, exception);
2299 0           *error_id = 1;
2300             }
2301             else {
2302 79 50         if (env->is_type_by_name(env, stack, object, "Int", 0)) {
2303 79           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2304 79           *out = *(int32_t*)&fields[0];
2305             }
2306             else {
2307 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE]);
2308 0           env->set_exception(env, stack, exception);
2309 0           *error_id = 1;
2310             }
2311             }
2312 79           }
2313              
2314 11           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_OBJECT_TO_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, void* object, int32_t* error_id, int32_t object_data_offset) {
2315 11 50         if (object == NULL) {
2316 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]);
2317 0           env->set_exception(env, stack, exception);
2318 0           *error_id = 1;
2319             }
2320             else {
2321 11 50         if (env->is_type_by_name(env, stack, object, "Long", 0)) {
2322 11           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2323 11           *out = *(int64_t*)&fields[0];
2324             }
2325             else {
2326 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE]);
2327 0           env->set_exception(env, stack, exception);
2328 0           *error_id = 1;
2329             }
2330             }
2331 11           }
2332              
2333 11           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_OBJECT_TO_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, void* object, int32_t* error_id, int32_t object_data_offset) {
2334 11 50         if (object == NULL) {
2335 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]);
2336 0           env->set_exception(env, stack, exception);
2337 0           *error_id = 1;
2338             }
2339             else {
2340 11 50         if (env->is_type_by_name(env, stack, object, "Float", 0)) {
2341 11           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2342 11           *out = *(float*)&fields[0];
2343             }
2344             else {
2345 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE]);
2346 0           env->set_exception(env, stack, exception);
2347 0           *error_id = 1;
2348             }
2349             }
2350 11           }
2351              
2352 11           static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_OBJECT_TO_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, void* object, int32_t* error_id, int32_t object_data_offset) {
2353 11 50         if (object == NULL) {
2354 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]);
2355 0           env->set_exception(env, stack, exception);
2356 0           *error_id = 1;
2357             }
2358             else {
2359 11 50         if (env->is_type_by_name(env, stack, object, "Double", 0)) {
2360 11           SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset);
2361 11           *out = *(double*)&fields[0];
2362             }
2363             else {
2364 0           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_NON_CORRESPONDING_NUMERIC_OBJECT_TYPE]);
2365 0           env->set_exception(env, stack, exception);
2366 0           *error_id = 1;
2367             }
2368             }
2369 11           }
2370              
2371             #define SPVM_IMPLEMENT_SET_STACK_BYTE(stack, stack_index, in) (*(int8_t*)&stack[stack_index] = in)
2372             #define SPVM_IMPLEMENT_SET_STACK_SHORT(stack, stack_index, in) (*(int16_t*)&stack[stack_index] = in)
2373             #define SPVM_IMPLEMENT_SET_STACK_INT(stack, stack_index, in) (*(int32_t*)&stack[stack_index] = in)
2374             #define SPVM_IMPLEMENT_SET_STACK_LONG(stack, stack_index, in) (*(int64_t*)&stack[stack_index] = in)
2375             #define SPVM_IMPLEMENT_SET_STACK_FLOAT(stack, stack_index, in) (*(float*)&stack[stack_index] = in)
2376             #define SPVM_IMPLEMENT_SET_STACK_DOUBLE(stack, stack_index, in) (*(double*)&stack[stack_index] = in)
2377             #define SPVM_IMPLEMENT_SET_STACK_OBJECT(stack, stack_index, in) (*(void**)&stack[stack_index] = in)
2378             #define SPVM_IMPLEMENT_SET_STACK_REF(stack, stack_index, in) (*(void**)&stack[stack_index] = in)
2379             #define SPVM_IMPLEMENT_SET_STACK_UNDEF(stack, stack_index) (*(void**)&stack[stack_index] = NULL)
2380              
2381 3           static inline void SPVM_IMPLEMENT_SET_STACK_MULNUM_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width, int8_t* in) {
2382 12 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2383 9           *(int8_t*)&stack[stack_base + stack_index] = *(in + stack_index);
2384             }
2385 3           }
2386              
2387 3           static inline void SPVM_IMPLEMENT_SET_STACK_MULNUM_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width, int16_t* in) {
2388 12 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2389 9           *(int16_t*)&stack[stack_base + stack_index] = *(in + stack_index);
2390             }
2391 3           }
2392              
2393 3           static inline void SPVM_IMPLEMENT_SET_STACK_MULNUM_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width, int32_t* in) {
2394 12 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2395 9           *(int32_t*)&stack[stack_base + stack_index] = *(in + stack_index);
2396             }
2397 3           }
2398              
2399 3           static inline void SPVM_IMPLEMENT_SET_STACK_MULNUM_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width, int64_t* in) {
2400 12 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2401 9           *(int64_t*)&stack[stack_base + stack_index] = *(in + stack_index);
2402             }
2403 3           }
2404              
2405 3           static inline void SPVM_IMPLEMENT_SET_STACK_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width, float* in) {
2406 12 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2407 9           *(float*)&stack[stack_base + stack_index] = *(in + stack_index);
2408             }
2409 3           }
2410              
2411 7           static inline void SPVM_IMPLEMENT_SET_STACK_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width, double* in) {
2412 24 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2413 17           *(double*)&stack[stack_base + stack_index] = *(in + stack_index);
2414             }
2415 7           }
2416              
2417             #define SPVM_IMPLEMENT_GET_STACK_BYTE(out, stack, stack_index) (out = *(int8_t*)&stack[stack_index])
2418             #define SPVM_IMPLEMENT_GET_STACK_SHORT(out, stack, stack_index) (out = *(int16_t*)&stack[stack_index])
2419             #define SPVM_IMPLEMENT_GET_STACK_INT(out, stack, stack_index) (out = *(int32_t*)&stack[stack_index])
2420             #define SPVM_IMPLEMENT_GET_STACK_LONG(out, stack, stack_index) (out = *(int64_t*)&stack[stack_index])
2421             #define SPVM_IMPLEMENT_GET_STACK_FLOAT(out, stack, stack_index) (out = *(float*)&stack[stack_index])
2422             #define SPVM_IMPLEMENT_GET_STACK_DOUBLE(out, stack, stack_index) (out = *(double*)&stack[stack_index])
2423              
2424 531694           static inline void SPVM_IMPLEMENT_GET_STACK_OBJECT(SPVM_ENV* env, void** out, SPVM_VALUE* stack, int32_t stack_index) {
2425 531694           env->assign_object(env, stack, out, *(void**)&stack[stack_index]);
2426 531694           }
2427              
2428             #define SPVM_IMPLEMENT_GET_STACK_REF(out, stack, stack_index) (out = *(void**)&stack[stack_index])
2429              
2430 11           static inline void SPVM_IMPLEMENT_GET_STACK_MULNUM_BYTE(SPVM_ENV* env, int8_t* out, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width) {
2431 44 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2432 33           *(out + stack_index) = *(int8_t*)&stack[(stack_base) + stack_index];
2433             }
2434 11           }
2435              
2436 10           static inline void SPVM_IMPLEMENT_GET_STACK_MULNUM_SHORT(SPVM_ENV* env, int16_t* out, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width) {
2437 40 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2438 30           *(out + stack_index) = *(int16_t*)&stack[(stack_base) + stack_index];
2439             }
2440 10           }
2441              
2442 10           static inline void SPVM_IMPLEMENT_GET_STACK_MULNUM_INT(SPVM_ENV* env, int32_t* out, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width) {
2443 40 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2444 30           *(out + stack_index) = *(int32_t*)&stack[(stack_base) + stack_index];
2445             }
2446 10           }
2447              
2448 10           static inline void SPVM_IMPLEMENT_GET_STACK_MULNUM_LONG(SPVM_ENV* env, int64_t* out, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width) {
2449 40 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2450 30           *(out + stack_index) = *(int64_t*)&stack[(stack_base) + stack_index];
2451             }
2452 10           }
2453              
2454 10           static inline void SPVM_IMPLEMENT_GET_STACK_MULNUM_FLOAT(SPVM_ENV* env, float* out, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width) {
2455 40 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2456 30           *(out + stack_index) = *(float*)&stack[(stack_base) + stack_index];
2457             }
2458 10           }
2459              
2460 13           static inline void SPVM_IMPLEMENT_GET_STACK_MULNUM_DOUBLE(SPVM_ENV* env, double* out, SPVM_VALUE* stack, int32_t stack_base, int32_t args_width) {
2461 49 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2462 36           *(out + stack_index) = *(double*)&stack[(stack_base) + stack_index];
2463             }
2464 13           }
2465              
2466 4           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_BYTE(SPVM_ENV* env, int8_t* out, SPVM_VALUE* stack, int32_t stack_index, int8_t default_value) {
2467 4           int32_t args_width = env->args_width(env, stack);
2468 4 100         if (stack_index >= args_width) {
2469 3           *out = default_value;
2470             }
2471             else {
2472 1           *out = *(int8_t*)&stack[stack_index];
2473             }
2474 4           }
2475              
2476 4           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_SHORT(SPVM_ENV* env, int16_t* out, SPVM_VALUE* stack, int32_t stack_index, int16_t default_value) {
2477 4           int32_t args_width = env->args_width(env, stack);
2478 4 100         if (stack_index >= args_width) {
2479 3           *out = default_value;
2480             }
2481             else {
2482 1           *out = *(int16_t*)&stack[stack_index];
2483             }
2484 4           }
2485              
2486 646017           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_INT(SPVM_ENV* env, int32_t* out, SPVM_VALUE* stack, int32_t stack_index, int32_t default_value) {
2487 646017           int32_t args_width = env->args_width(env, stack);
2488 646017 100         if (stack_index >= args_width) {
2489 425796           *out = default_value;
2490             }
2491             else {
2492 220221           *out = *(int32_t*)&stack[stack_index];
2493             }
2494 646017           }
2495              
2496 5           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_LONG(SPVM_ENV* env, int64_t* out, SPVM_VALUE* stack, int32_t stack_index, int64_t default_value) {
2497 5           int32_t args_width = env->args_width(env, stack);
2498 5 100         if (stack_index >= args_width) {
2499 4           *out = default_value;
2500             }
2501             else {
2502 1           *out = *(int64_t*)&stack[stack_index];
2503             }
2504 5           }
2505              
2506 2           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_FLOAT(SPVM_ENV* env, float* out, SPVM_VALUE* stack, int32_t stack_index, float default_value) {
2507 2           int32_t args_width = env->args_width(env, stack);
2508 2 100         if (stack_index >= args_width) {
2509 1           *out = default_value;
2510             }
2511             else {
2512 1           *out = *(float*)&stack[stack_index];
2513             }
2514 2           }
2515              
2516 2           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_DOUBLE(SPVM_ENV* env, double* out, SPVM_VALUE* stack, int32_t stack_index, double default_value) {
2517 2           int32_t args_width = env->args_width(env, stack);
2518 2 100         if (stack_index >= args_width) {
2519 1           *out = default_value;
2520             }
2521             else {
2522 1           *out = *(double*)&stack[stack_index];
2523             }
2524 2           }
2525              
2526 18569           static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_OBJECT(SPVM_ENV* env, void** out, SPVM_VALUE* stack, int32_t stack_index) {
2527 18569           int32_t args_width = env->args_width(env, stack);
2528 18569 100         if (stack_index >= args_width) {
2529 17725           env->assign_object(env, stack, out, NULL);
2530             }
2531             else {
2532 844           env->assign_object(env, stack, out, *(void**)&stack[stack_index]);
2533             }
2534 18569           }
2535              
2536             #define SPVM_IMPLEMENT_RETURN_BYTE(stack, in) (*(int8_t*)&stack[0] = in)
2537             #define SPVM_IMPLEMENT_RETURN_SHORT(stack, in) (*(int16_t*)&stack[0] = in)
2538             #define SPVM_IMPLEMENT_RETURN_INT(stack, in) (*(int32_t*)&stack[0] = in)
2539             #define SPVM_IMPLEMENT_RETURN_LONG(stack, in) (*(int64_t*)&stack[0] = in)
2540             #define SPVM_IMPLEMENT_RETURN_FLOAT(stack, in) (*(float*)&stack[0] = in)
2541             #define SPVM_IMPLEMENT_RETURN_DOUBLE(stack, in) (*(double*)&stack[0] = in)
2542              
2543 89208           static inline void SPVM_IMPLEMENT_RETURN_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void* in) {
2544 89208           *(void**)&stack[0] = in;
2545 89208 100         if (in != NULL) {
2546 88807           env->api->internal->lock_object(env, stack, in);
2547 88807           env->api->internal->inc_ref_count(env, stack, in);
2548 88807           env->api->internal->unlock_object(env, stack, in);
2549             }
2550 89208           }
2551              
2552             #define SPVM_IMPLEMENT_RETURN_UNDEF(stack) (*(void**)&stack[0] = NULL)
2553              
2554 6           static inline void SPVM_IMPLEMENT_RETURN_MULNUM_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* in, int32_t args_width) {
2555 24 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2556 18           *(int8_t*)&stack[stack_index] = *(in + stack_index);
2557             }
2558 6           }
2559              
2560 5           static inline void SPVM_IMPLEMENT_RETURN_MULNUM_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* in, int32_t args_width) {
2561 20 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2562 15           *(int16_t*)&stack[stack_index] = *(in + stack_index);
2563             }
2564 5           }
2565              
2566 5           static inline void SPVM_IMPLEMENT_RETURN_MULNUM_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* in, int32_t args_width) {
2567 20 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2568 15           *(int32_t*)&stack[stack_index] = *(in + stack_index);
2569             }
2570 5           }
2571              
2572 5           static inline void SPVM_IMPLEMENT_RETURN_MULNUM_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* in, int32_t args_width) {
2573 20 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2574 15           *(int64_t*)&stack[stack_index] = *(in + stack_index);
2575             }
2576 5           }
2577              
2578 5           static inline void SPVM_IMPLEMENT_RETURN_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* in, int32_t args_width) {
2579 20 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2580 15           *(float*)&stack[stack_index] = *(in + stack_index);
2581             }
2582 5           }
2583              
2584 6           static inline void SPVM_IMPLEMENT_RETURN_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* in, int32_t args_width) {
2585 23 100         for (int32_t stack_index = 0; stack_index < args_width; stack_index++) {
2586 17           *(double*)&stack[stack_index] = *(in + stack_index);
2587             }
2588 6           }
2589              
2590             #define SPVM_IMPLEMENT_CALL_CLASS_METHOD(env, stack, error_id, method, args_width) (error_id = env->call_method_no_mortal(env, stack, method, args_width))
2591              
2592             #define SPVM_IMPLEMENT_CALL_INSTANCE_METHOD_STATIC(env, stack, error_id, method, args_width) (error_id = env->call_method_no_mortal(env, stack, method, args_width))
2593              
2594 514466           static inline void SPVM_IMPLEMENT_CALL_INSTANCE_METHOD(SPVM_ENV* env, SPVM_VALUE* stack, const char* interface_name, const char* method_name, int32_t args_width, int32_t* error_id, char* tmp_buffer, int32_t tmp_buffer_length) {
2595            
2596 514466           void* object = stack[0].oval;
2597            
2598 514466           *error_id = 0;
2599            
2600 514466           void* method = NULL;
2601 514466 100         if (!object) {
2602 1           void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_CALL_INSTANCE_METHOD_INVOCANT_UNDEF]);
2603 1           env->set_exception(env, stack, exception);
2604 1           *error_id = 1;
2605             }
2606             else {
2607 514465           method = env->get_instance_method(env, stack, object, method_name);
2608            
2609 514465 100         if (!method) {
2610 2           snprintf(tmp_buffer, tmp_buffer_length, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_CALL_INSTANCE_METHOD_IMPLEMENT_NOT_FOUND], method_name, interface_name);
2611 2           void* exception = env->new_string_nolen_no_mortal(env, stack, tmp_buffer);
2612 2           env->set_exception(env, stack, exception);
2613 2           *error_id = 1;
2614             }
2615             }
2616            
2617 514466 100         if (!*error_id) {
2618 514463           *error_id = env->call_method_no_mortal(env, stack, method, args_width);
2619             }
2620 514466           }
2621              
2622             #endif