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
|
1203116
|
|
|
|
|
|
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
|
1203116
|
|
|
|
|
|
env->api->internal->leave_scope_local(env, stack, object_vars, mortal_stack, mortal_stack_top_ptr, original_mortal_stack_top); |
160
|
1203116
|
|
|
|
|
|
} |
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
|
340
|
|
|
|
|
|
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
|
340
|
|
|
|
|
|
void* object = in; |
357
|
340
|
|
|
|
|
|
int32_t isa = env->isa(env, stack, object, cast_basic_type, cast_type_dimension); |
358
|
340
|
100
|
|
|
|
|
if (isa) { |
359
|
334
|
|
|
|
|
|
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
|
340
|
|
|
|
|
|
} |
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
|
35330
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_NEW_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* basic_type, int32_t* error_id) { |
621
|
35330
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
622
|
35330
|
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
|
35330
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
630
|
|
|
|
|
|
|
} |
631
|
35330
|
|
|
|
|
|
} |
632
|
|
|
|
|
|
|
|
633
|
35666
|
|
|
|
|
|
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
|
35666
|
100
|
|
|
|
|
if (length >= 0) { |
635
|
35665
|
|
|
|
|
|
void* object = env->new_object_array_no_mortal(env, stack, basic_type, length); |
636
|
35665
|
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
|
35665
|
|
|
|
|
|
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
|
35666
|
|
|
|
|
|
} |
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
|
73232
|
|
|
|
|
|
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
|
73232
|
|
|
|
|
|
void* element = NULL; |
957
|
|
|
|
|
|
|
|
958
|
73232
|
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
|
73232
|
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
|
73231
|
|
|
|
|
|
env->assign_object(env, stack, out, ((void**)((intptr_t)array + object_data_offset))[index]); |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
} |
971
|
73232
|
|
|
|
|
|
} |
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
|
33802
|
|
|
|
|
|
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
|
33802
|
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
|
33802
|
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
|
33802
|
|
|
|
|
|
void** element_address = &((void**)((intptr_t)array + object_data_offset))[index]; |
1095
|
33802
|
|
|
|
|
|
env->assign_object(env, stack, element_address, in); |
1096
|
|
|
|
|
|
|
} |
1097
|
|
|
|
|
|
|
} |
1098
|
33802
|
|
|
|
|
|
} |
1099
|
|
|
|
|
|
|
|
1100
|
72606
|
|
|
|
|
|
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
|
72606
|
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
|
72606
|
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
|
72606
|
|
|
|
|
|
void** element_address = &((void**)((intptr_t)array + object_data_offset))[index]; |
1114
|
72606
|
|
|
|
|
|
void* object = in; |
1115
|
72606
|
|
|
|
|
|
int32_t elem_isa = env->elem_isa(env, stack, array, object); |
1116
|
72606
|
100
|
|
|
|
|
if (elem_isa) { |
1117
|
72603
|
|
|
|
|
|
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
|
72606
|
|
|
|
|
|
} |
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
|
43464
|
|
|
|
|
|
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
|
43464
|
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
|
43463
|
|
|
|
|
|
*out = *(int32_t*)((intptr_t)array + object_length_offset); |
1155
|
|
|
|
|
|
|
} |
1156
|
43464
|
|
|
|
|
|
} |
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
|
115262
|
|
|
|
|
|
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
|
115262
|
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
|
115261
|
|
|
|
|
|
*out = *(int32_t*)((intptr_t)object + object_header_int_size + field_offset); |
1192
|
|
|
|
|
|
|
} |
1193
|
115262
|
|
|
|
|
|
} |
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
|
68940
|
|
|
|
|
|
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
|
68940
|
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
|
68939
|
|
|
|
|
|
void** ref = (void**)((intptr_t)object + object_data_offset + field_offset); |
1242
|
68939
|
|
|
|
|
|
void* object = (void*)((intptr_t)*ref & ~(intptr_t)1); |
1243
|
68939
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
1244
|
|
|
|
|
|
|
} |
1245
|
68940
|
|
|
|
|
|
} |
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
|
97898
|
|
|
|
|
|
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
|
97898
|
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
|
97897
|
|
|
|
|
|
*(int32_t*)((intptr_t)object + object_data_offset + field_offset) = in; |
1280
|
|
|
|
|
|
|
} |
1281
|
97898
|
|
|
|
|
|
} |
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
|
21517
|
|
|
|
|
|
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
|
21517
|
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
|
21517
|
|
|
|
|
|
void* ref = (void**)((intptr_t)object + object_data_offset + field_offset); |
1328
|
21517
|
|
|
|
|
|
env->assign_object(env, stack, ref, in); |
1329
|
|
|
|
|
|
|
} |
1330
|
21517
|
|
|
|
|
|
} |
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
|
|
|
|
|
|
FILE* spvm_stdout = env->api->runtime->get_spvm_stdout(env->runtime); |
1442
|
6
|
|
|
|
|
|
size_t ret = fwrite(bytes, 1, string_length, spvm_stdout); |
1443
|
|
|
|
|
|
|
} |
1444
|
|
|
|
|
|
|
} |
1445
|
8
|
|
|
|
|
|
} |
1446
|
|
|
|
|
|
|
|
1447
|
5
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_SAY(SPVM_ENV* env, SPVM_VALUE* stack, void* string) { |
1448
|
5
|
|
|
|
|
|
FILE* spvm_stdout = env->api->runtime->get_spvm_stdout(env->runtime); |
1449
|
|
|
|
|
|
|
|
1450
|
5
|
100
|
|
|
|
|
if (string) { |
1451
|
4
|
|
|
|
|
|
const char* bytes = env->get_chars(env, stack, string); |
1452
|
4
|
|
|
|
|
|
int32_t string_length = env->length(env, stack, string); |
1453
|
|
|
|
|
|
|
|
1454
|
4
|
100
|
|
|
|
|
if (string_length > 0) { |
1455
|
3
|
|
|
|
|
|
size_t ret = fwrite(bytes, 1, string_length, spvm_stdout); |
1456
|
|
|
|
|
|
|
} |
1457
|
|
|
|
|
|
|
} |
1458
|
|
|
|
|
|
|
|
1459
|
5
|
|
|
|
|
|
fprintf(spvm_stdout, "\n"); |
1460
|
5
|
|
|
|
|
|
} |
1461
|
|
|
|
|
|
|
|
1462
|
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) { |
1463
|
10
|
|
|
|
|
|
FILE* spvm_stderr = env->api->runtime->get_spvm_stderr(env->runtime); |
1464
|
|
|
|
|
|
|
|
1465
|
10
|
|
|
|
|
|
int32_t empty_or_undef = 0; |
1466
|
10
|
100
|
|
|
|
|
if (string) { |
1467
|
9
|
|
|
|
|
|
const char* bytes = env->get_chars(env, stack, string); |
1468
|
9
|
|
|
|
|
|
int32_t string_length = env->length(env, stack, string); |
1469
|
|
|
|
|
|
|
|
1470
|
9
|
100
|
|
|
|
|
if (string_length > 0) { |
1471
|
8
|
|
|
|
|
|
size_t ret = fwrite(bytes, 1, string_length, spvm_stderr); |
1472
|
|
|
|
|
|
|
// Add line and file information if last character is not '\n' |
1473
|
|
|
|
|
|
|
int32_t add_line_file; |
1474
|
8
|
100
|
|
|
|
|
if (bytes[string_length - 1] != '\n') { |
1475
|
8
|
|
|
|
|
|
fprintf(spvm_stderr, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_WARN_AT], include_dir, include_dir_sep, class_rel_file, line); |
1476
|
|
|
|
|
|
|
} |
1477
|
|
|
|
|
|
|
} |
1478
|
|
|
|
|
|
|
else { |
1479
|
9
|
|
|
|
|
|
empty_or_undef = 1; |
1480
|
|
|
|
|
|
|
} |
1481
|
|
|
|
|
|
|
} |
1482
|
|
|
|
|
|
|
else { |
1483
|
1
|
|
|
|
|
|
empty_or_undef = 1; |
1484
|
|
|
|
|
|
|
} |
1485
|
|
|
|
|
|
|
|
1486
|
10
|
100
|
|
|
|
|
if (empty_or_undef) { |
1487
|
2
|
|
|
|
|
|
fprintf(spvm_stderr, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_WARN_UNDEF], include_dir, include_dir_sep, class_rel_file, line); |
1488
|
|
|
|
|
|
|
} |
1489
|
|
|
|
|
|
|
|
1490
|
10
|
|
|
|
|
|
fflush(spvm_stderr); |
1491
|
10
|
|
|
|
|
|
} |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_CLEAR_EVAL_ERROR_ID(eval_error_id) (eval_error_id = 0) |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_EVAL_ERROR_ID(out, eval_error_id) (out = eval_error_id) |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
#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)) |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_EVAL_ERROR_ID(eval_error_id, die_error_id) (eval_error_id = die_error_id) |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_ARGS_WIDTH(env, stack, out) (out = env->args_width(env, stack)) |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_BASIC_TYPE_ID(env, stack, out, basic_type) (out = env->api->basic_type->get_id(env->runtime, basic_type)) |
1504
|
|
|
|
|
|
|
|
1505
|
5
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_TYPE_NAME(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object) { |
1506
|
5
|
100
|
|
|
|
|
if (object == NULL) { |
1507
|
1
|
|
|
|
|
|
*out = NULL; |
1508
|
|
|
|
|
|
|
} |
1509
|
|
|
|
|
|
|
else { |
1510
|
4
|
|
|
|
|
|
void* type_name = env->get_type_name_no_mortal(env, stack, object); |
1511
|
4
|
|
|
|
|
|
env->assign_object(env, stack, out, type_name); |
1512
|
|
|
|
|
|
|
} |
1513
|
5
|
|
|
|
|
|
} |
1514
|
|
|
|
|
|
|
|
1515
|
31
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_DUMP(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object) { |
1516
|
31
|
|
|
|
|
|
void* dump = env->dump_no_mortal(env, stack, object); |
1517
|
31
|
|
|
|
|
|
env->assign_object(env, stack, out, dump); |
1518
|
31
|
|
|
|
|
|
} |
1519
|
|
|
|
|
|
|
|
1520
|
146
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_COPY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* object, int32_t* error_id) { |
1521
|
146
|
100
|
|
|
|
|
if (object) { |
1522
|
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
|
|
|
|
|
|
1523
|
2
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_COPY_OPERAND_INVALID]); |
1524
|
2
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1525
|
2
|
|
|
|
|
|
*error_id = 1; |
1526
|
|
|
|
|
|
|
} |
1527
|
|
|
|
|
|
|
else { |
1528
|
141
|
|
|
|
|
|
void* new_object_no_mortal = env->copy_no_mortal(env, stack, object); |
1529
|
143
|
|
|
|
|
|
env->assign_object(env, stack, out, new_object_no_mortal); |
1530
|
|
|
|
|
|
|
} |
1531
|
|
|
|
|
|
|
} |
1532
|
|
|
|
|
|
|
else { |
1533
|
3
|
|
|
|
|
|
env->assign_object(env, stack, out, NULL); |
1534
|
|
|
|
|
|
|
} |
1535
|
146
|
|
|
|
|
|
} |
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_REF_BYTE(out, in) (out = in) |
1538
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_REF_SHORT(out, in) (out = in) |
1539
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_REF_INT(out, in) (out = in) |
1540
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_REF_LONG(out, in) (out = in) |
1541
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_REF_FLOAT(out, in) (out = in) |
1542
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_REF_DOUBLE(out, in) (out = in) |
1543
|
|
|
|
|
|
|
|
1544
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_DEREF_BYTE(out, in) (out = *(int8_t*)*(void**)in) |
1545
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_DEREF_SHORT(out, in) (out = *(int16_t*)*(void**)in) |
1546
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_DEREF_INT(out, in) (out = *(int32_t*)*(void**)in) |
1547
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_DEREF_LONG(out, in) (out = *(int64_t*)*(void**)in) |
1548
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_DEREF_FLOAT(out, in) (out = *(float*)*(void**)in) |
1549
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_DEREF_DOUBLE(out, in) (out = *(double*)*(void**)in) |
1550
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_DEREF_BYTE(out, in) (*(int8_t*)*(void**)out = in) |
1552
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_DEREF_SHORT(out, in) (*(int16_t*)*(void**)out = in) |
1553
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_DEREF_INT(out, in) (*(int32_t*)*(void**)out = in) |
1554
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_DEREF_LONG(out, in) (*(int64_t*)*(void**)out = in) |
1555
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_DEREF_FLOAT(out, in) (*(float*)*(void**)out = in) |
1556
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_DEREF_DOUBLE(out, in) (*(double*)*(void**)out = in) |
1557
|
|
|
|
|
|
|
|
1558
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_BYTE(out, in, field_index) (out = *(in + field_index)) |
1559
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_SHORT(out, in, field_index) (out = *(in + field_index)) |
1560
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_INT(out, in, field_index) (out = *(in + field_index)) |
1561
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_LONG(out, in, field_index) (out = *(in + field_index)) |
1562
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_FLOAT(out, in, field_index) (out = *(in + field_index)) |
1563
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DOUBLE(out, in, field_index) (out = *(in + field_index)) |
1564
|
|
|
|
|
|
|
|
1565
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_BYTE(out, field_index, in) (*(out + field_index) = in) |
1566
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_SHORT(out, field_index, in) (*(out + field_index) = in) |
1567
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_INT(out, field_index, in) (*(out + field_index) = in) |
1568
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_LONG(out, field_index, in) (*(out + field_index) = in) |
1569
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_FLOAT(out, field_index, in) (*(out + field_index) = in) |
1570
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DOUBLE(out, field_index, in) (*(out + field_index) = in) |
1571
|
|
|
|
|
|
|
|
1572
|
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) { |
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_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* out, int16_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_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* out, int32_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_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* out, int64_t* 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
|
0
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_MOVE_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* out, float* in, int32_t fields_length) { |
1597
|
0
|
0
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
1598
|
0
|
|
|
|
|
|
*(out + field_index) = *(in + field_index); |
1599
|
|
|
|
|
|
|
} |
1600
|
0
|
|
|
|
|
|
} |
1601
|
|
|
|
|
|
|
|
1602
|
3
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_MOVE_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, double* in, int32_t fields_length) { |
1603
|
9
|
100
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
1604
|
6
|
|
|
|
|
|
*(out + field_index) = *(in + field_index); |
1605
|
|
|
|
|
|
|
} |
1606
|
3
|
|
|
|
|
|
} |
1607
|
|
|
|
|
|
|
|
1608
|
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) { |
1609
|
1
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1610
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1611
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1612
|
0
|
|
|
|
|
|
*error_id = 1; |
1613
|
|
|
|
|
|
|
} |
1614
|
|
|
|
|
|
|
else { |
1615
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1616
|
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]); |
1617
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1618
|
0
|
|
|
|
|
|
*error_id = 1; |
1619
|
|
|
|
|
|
|
} |
1620
|
|
|
|
|
|
|
else { |
1621
|
|
|
|
|
|
|
int32_t field_index; |
1622
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1623
|
3
|
|
|
|
|
|
*(out + field_index) = ((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1624
|
|
|
|
|
|
|
} |
1625
|
|
|
|
|
|
|
} |
1626
|
|
|
|
|
|
|
} |
1627
|
1
|
|
|
|
|
|
} |
1628
|
|
|
|
|
|
|
|
1629
|
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) { |
1630
|
1
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1631
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1632
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1633
|
0
|
|
|
|
|
|
*error_id = 1; |
1634
|
|
|
|
|
|
|
} |
1635
|
|
|
|
|
|
|
else { |
1636
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1637
|
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]); |
1638
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1639
|
0
|
|
|
|
|
|
*error_id = 1; |
1640
|
|
|
|
|
|
|
} |
1641
|
|
|
|
|
|
|
else { |
1642
|
|
|
|
|
|
|
int32_t field_index; |
1643
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1644
|
3
|
|
|
|
|
|
*(out + field_index) = ((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1645
|
|
|
|
|
|
|
} |
1646
|
|
|
|
|
|
|
} |
1647
|
|
|
|
|
|
|
} |
1648
|
1
|
|
|
|
|
|
} |
1649
|
|
|
|
|
|
|
|
1650
|
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) { |
1651
|
1
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1652
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1653
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1654
|
0
|
|
|
|
|
|
*error_id = 1; |
1655
|
|
|
|
|
|
|
} |
1656
|
|
|
|
|
|
|
else { |
1657
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1658
|
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]); |
1659
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1660
|
0
|
|
|
|
|
|
*error_id = 1; |
1661
|
|
|
|
|
|
|
} |
1662
|
|
|
|
|
|
|
else { |
1663
|
|
|
|
|
|
|
int32_t field_index; |
1664
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1665
|
3
|
|
|
|
|
|
*(out + field_index) = ((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1666
|
|
|
|
|
|
|
} |
1667
|
|
|
|
|
|
|
} |
1668
|
|
|
|
|
|
|
} |
1669
|
1
|
|
|
|
|
|
} |
1670
|
|
|
|
|
|
|
|
1671
|
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) { |
1672
|
1
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1673
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1674
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1675
|
0
|
|
|
|
|
|
*error_id = 1; |
1676
|
|
|
|
|
|
|
} |
1677
|
|
|
|
|
|
|
else { |
1678
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1679
|
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]); |
1680
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1681
|
0
|
|
|
|
|
|
*error_id = 1; |
1682
|
|
|
|
|
|
|
} |
1683
|
|
|
|
|
|
|
else { |
1684
|
|
|
|
|
|
|
int32_t field_index; |
1685
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1686
|
3
|
|
|
|
|
|
*(out + field_index) = ((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1687
|
|
|
|
|
|
|
} |
1688
|
|
|
|
|
|
|
} |
1689
|
|
|
|
|
|
|
} |
1690
|
1
|
|
|
|
|
|
} |
1691
|
|
|
|
|
|
|
|
1692
|
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) { |
1693
|
1
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1694
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1695
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1696
|
0
|
|
|
|
|
|
*error_id = 1; |
1697
|
|
|
|
|
|
|
} |
1698
|
|
|
|
|
|
|
else { |
1699
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1700
|
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]); |
1701
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1702
|
0
|
|
|
|
|
|
*error_id = 1; |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
else { |
1705
|
|
|
|
|
|
|
int32_t field_index; |
1706
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1707
|
3
|
|
|
|
|
|
*(out + field_index) = ((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1708
|
|
|
|
|
|
|
} |
1709
|
|
|
|
|
|
|
} |
1710
|
|
|
|
|
|
|
} |
1711
|
1
|
|
|
|
|
|
} |
1712
|
|
|
|
|
|
|
|
1713
|
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) { |
1714
|
1
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1715
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1716
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1717
|
0
|
|
|
|
|
|
*error_id = 1; |
1718
|
|
|
|
|
|
|
} |
1719
|
|
|
|
|
|
|
else { |
1720
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1721
|
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]); |
1722
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1723
|
0
|
|
|
|
|
|
*error_id = 1; |
1724
|
|
|
|
|
|
|
} |
1725
|
|
|
|
|
|
|
else { |
1726
|
|
|
|
|
|
|
int32_t field_index; |
1727
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1728
|
3
|
|
|
|
|
|
*(out + field_index) = ((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1729
|
|
|
|
|
|
|
} |
1730
|
|
|
|
|
|
|
} |
1731
|
|
|
|
|
|
|
} |
1732
|
1
|
|
|
|
|
|
} |
1733
|
|
|
|
|
|
|
|
1734
|
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) { |
1735
|
1
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1736
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1737
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1738
|
0
|
|
|
|
|
|
*error_id = 1; |
1739
|
|
|
|
|
|
|
} |
1740
|
|
|
|
|
|
|
else { |
1741
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1742
|
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]); |
1743
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1744
|
0
|
|
|
|
|
|
*error_id = 1; |
1745
|
|
|
|
|
|
|
} |
1746
|
|
|
|
|
|
|
else { |
1747
|
|
|
|
|
|
|
int32_t field_index; |
1748
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1749
|
3
|
|
|
|
|
|
((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index); |
1750
|
|
|
|
|
|
|
} |
1751
|
|
|
|
|
|
|
} |
1752
|
|
|
|
|
|
|
} |
1753
|
1
|
|
|
|
|
|
} |
1754
|
|
|
|
|
|
|
|
1755
|
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) { |
1756
|
1
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1757
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1758
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1759
|
0
|
|
|
|
|
|
*error_id = 1; |
1760
|
|
|
|
|
|
|
} |
1761
|
|
|
|
|
|
|
else { |
1762
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1763
|
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]); |
1764
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1765
|
0
|
|
|
|
|
|
*error_id = 1; |
1766
|
|
|
|
|
|
|
} |
1767
|
|
|
|
|
|
|
else { |
1768
|
|
|
|
|
|
|
int32_t field_index; |
1769
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1770
|
3
|
|
|
|
|
|
((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index); |
1771
|
|
|
|
|
|
|
} |
1772
|
|
|
|
|
|
|
} |
1773
|
|
|
|
|
|
|
} |
1774
|
1
|
|
|
|
|
|
} |
1775
|
|
|
|
|
|
|
|
1776
|
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) { |
1777
|
1
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1778
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1779
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1780
|
0
|
|
|
|
|
|
*error_id = 1; |
1781
|
|
|
|
|
|
|
} |
1782
|
|
|
|
|
|
|
else { |
1783
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1784
|
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]); |
1785
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1786
|
0
|
|
|
|
|
|
*error_id = 1; |
1787
|
|
|
|
|
|
|
} |
1788
|
|
|
|
|
|
|
else { |
1789
|
|
|
|
|
|
|
int32_t field_index; |
1790
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1791
|
3
|
|
|
|
|
|
((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index); |
1792
|
|
|
|
|
|
|
} |
1793
|
|
|
|
|
|
|
} |
1794
|
|
|
|
|
|
|
} |
1795
|
1
|
|
|
|
|
|
} |
1796
|
|
|
|
|
|
|
|
1797
|
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) { |
1798
|
1
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1799
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1800
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1801
|
0
|
|
|
|
|
|
*error_id = 1; |
1802
|
|
|
|
|
|
|
} |
1803
|
|
|
|
|
|
|
else { |
1804
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1805
|
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]); |
1806
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1807
|
0
|
|
|
|
|
|
*error_id = 1; |
1808
|
|
|
|
|
|
|
} |
1809
|
|
|
|
|
|
|
else { |
1810
|
|
|
|
|
|
|
int32_t field_index; |
1811
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1812
|
3
|
|
|
|
|
|
((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index); |
1813
|
|
|
|
|
|
|
} |
1814
|
|
|
|
|
|
|
} |
1815
|
|
|
|
|
|
|
} |
1816
|
1
|
|
|
|
|
|
} |
1817
|
|
|
|
|
|
|
|
1818
|
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) { |
1819
|
1
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1820
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1821
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1822
|
0
|
|
|
|
|
|
*error_id = 1; |
1823
|
|
|
|
|
|
|
} |
1824
|
|
|
|
|
|
|
else { |
1825
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1826
|
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]); |
1827
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1828
|
0
|
|
|
|
|
|
*error_id = 1; |
1829
|
|
|
|
|
|
|
} |
1830
|
|
|
|
|
|
|
else { |
1831
|
|
|
|
|
|
|
int32_t field_index; |
1832
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1833
|
3
|
|
|
|
|
|
((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index); |
1834
|
|
|
|
|
|
|
} |
1835
|
|
|
|
|
|
|
} |
1836
|
|
|
|
|
|
|
} |
1837
|
1
|
|
|
|
|
|
} |
1838
|
|
|
|
|
|
|
|
1839
|
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) { |
1840
|
1
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1841
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1842
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1843
|
0
|
|
|
|
|
|
*error_id = 1; |
1844
|
|
|
|
|
|
|
} |
1845
|
|
|
|
|
|
|
else { |
1846
|
1
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1847
|
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]); |
1848
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1849
|
0
|
|
|
|
|
|
*error_id = 1; |
1850
|
|
|
|
|
|
|
} |
1851
|
|
|
|
|
|
|
else { |
1852
|
|
|
|
|
|
|
int32_t field_index; |
1853
|
4
|
100
|
|
|
|
|
for (field_index = 0; field_index < fields_length; field_index++) { |
1854
|
3
|
|
|
|
|
|
((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = *(in + field_index); |
1855
|
|
|
|
|
|
|
} |
1856
|
|
|
|
|
|
|
} |
1857
|
|
|
|
|
|
|
} |
1858
|
1
|
|
|
|
|
|
} |
1859
|
|
|
|
|
|
|
|
1860
|
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) { |
1861
|
94
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1862
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1863
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1864
|
0
|
|
|
|
|
|
*error_id = 1; |
1865
|
|
|
|
|
|
|
} |
1866
|
|
|
|
|
|
|
else { |
1867
|
94
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1868
|
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]); |
1869
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1870
|
0
|
|
|
|
|
|
*error_id = 1; |
1871
|
|
|
|
|
|
|
} |
1872
|
|
|
|
|
|
|
else { |
1873
|
94
|
|
|
|
|
|
*out = ((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1874
|
|
|
|
|
|
|
} |
1875
|
|
|
|
|
|
|
} |
1876
|
94
|
|
|
|
|
|
} |
1877
|
|
|
|
|
|
|
|
1878
|
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) { |
1879
|
94
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1880
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1881
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1882
|
0
|
|
|
|
|
|
*error_id = 1; |
1883
|
|
|
|
|
|
|
} |
1884
|
|
|
|
|
|
|
else { |
1885
|
94
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1886
|
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]); |
1887
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1888
|
0
|
|
|
|
|
|
*error_id = 1; |
1889
|
|
|
|
|
|
|
} |
1890
|
|
|
|
|
|
|
else { |
1891
|
94
|
|
|
|
|
|
*out = ((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1892
|
|
|
|
|
|
|
} |
1893
|
|
|
|
|
|
|
} |
1894
|
94
|
|
|
|
|
|
} |
1895
|
|
|
|
|
|
|
|
1896
|
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) { |
1897
|
104
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1898
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1899
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1900
|
0
|
|
|
|
|
|
*error_id = 1; |
1901
|
|
|
|
|
|
|
} |
1902
|
|
|
|
|
|
|
else { |
1903
|
104
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1904
|
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]); |
1905
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1906
|
0
|
|
|
|
|
|
*error_id = 1; |
1907
|
|
|
|
|
|
|
} |
1908
|
|
|
|
|
|
|
else { |
1909
|
104
|
|
|
|
|
|
*out = ((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1910
|
|
|
|
|
|
|
} |
1911
|
|
|
|
|
|
|
} |
1912
|
104
|
|
|
|
|
|
} |
1913
|
|
|
|
|
|
|
|
1914
|
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) { |
1915
|
94
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1916
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1917
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1918
|
0
|
|
|
|
|
|
*error_id = 1; |
1919
|
|
|
|
|
|
|
} |
1920
|
|
|
|
|
|
|
else { |
1921
|
94
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1922
|
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]); |
1923
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1924
|
0
|
|
|
|
|
|
*error_id = 1; |
1925
|
|
|
|
|
|
|
} |
1926
|
|
|
|
|
|
|
else { |
1927
|
94
|
|
|
|
|
|
*out = ((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1928
|
|
|
|
|
|
|
} |
1929
|
|
|
|
|
|
|
} |
1930
|
94
|
|
|
|
|
|
} |
1931
|
|
|
|
|
|
|
|
1932
|
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) { |
1933
|
94
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1934
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1935
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1936
|
0
|
|
|
|
|
|
*error_id = 1; |
1937
|
|
|
|
|
|
|
} |
1938
|
|
|
|
|
|
|
else { |
1939
|
94
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1940
|
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]); |
1941
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1942
|
0
|
|
|
|
|
|
*error_id = 1; |
1943
|
|
|
|
|
|
|
} |
1944
|
|
|
|
|
|
|
else { |
1945
|
94
|
|
|
|
|
|
*out = ((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1946
|
|
|
|
|
|
|
} |
1947
|
|
|
|
|
|
|
} |
1948
|
94
|
|
|
|
|
|
} |
1949
|
|
|
|
|
|
|
|
1950
|
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) { |
1951
|
111
|
50
|
|
|
|
|
if (__builtin_expect(array == NULL, 0)) { |
1952
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1953
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1954
|
0
|
|
|
|
|
|
*error_id = 1; |
1955
|
|
|
|
|
|
|
} |
1956
|
|
|
|
|
|
|
else { |
1957
|
111
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1958
|
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]); |
1959
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1960
|
0
|
|
|
|
|
|
*error_id = 1; |
1961
|
|
|
|
|
|
|
} |
1962
|
|
|
|
|
|
|
else { |
1963
|
111
|
|
|
|
|
|
*out = ((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index]; |
1964
|
|
|
|
|
|
|
} |
1965
|
|
|
|
|
|
|
} |
1966
|
111
|
|
|
|
|
|
} |
1967
|
|
|
|
|
|
|
|
1968
|
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) { |
1969
|
79
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1970
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1971
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1972
|
0
|
|
|
|
|
|
*error_id = 1; |
1973
|
|
|
|
|
|
|
} |
1974
|
|
|
|
|
|
|
else { |
1975
|
79
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1976
|
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]); |
1977
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1978
|
0
|
|
|
|
|
|
*error_id = 1; |
1979
|
|
|
|
|
|
|
} |
1980
|
|
|
|
|
|
|
else { |
1981
|
79
|
|
|
|
|
|
((int8_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in; |
1982
|
|
|
|
|
|
|
} |
1983
|
|
|
|
|
|
|
} |
1984
|
79
|
|
|
|
|
|
} |
1985
|
|
|
|
|
|
|
|
1986
|
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) { |
1987
|
79
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
1988
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
1989
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1990
|
0
|
|
|
|
|
|
*error_id = 1; |
1991
|
|
|
|
|
|
|
} |
1992
|
|
|
|
|
|
|
else { |
1993
|
79
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
1994
|
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]); |
1995
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
1996
|
0
|
|
|
|
|
|
*error_id = 1; |
1997
|
|
|
|
|
|
|
} |
1998
|
|
|
|
|
|
|
else { |
1999
|
79
|
|
|
|
|
|
((int16_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in; |
2000
|
|
|
|
|
|
|
} |
2001
|
|
|
|
|
|
|
} |
2002
|
79
|
|
|
|
|
|
} |
2003
|
|
|
|
|
|
|
|
2004
|
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) { |
2005
|
86
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
2006
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
2007
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2008
|
0
|
|
|
|
|
|
*error_id = 1; |
2009
|
|
|
|
|
|
|
} |
2010
|
|
|
|
|
|
|
else { |
2011
|
86
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
2012
|
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]); |
2013
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2014
|
0
|
|
|
|
|
|
*error_id = 1; |
2015
|
|
|
|
|
|
|
} |
2016
|
|
|
|
|
|
|
else { |
2017
|
86
|
|
|
|
|
|
((int32_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in; |
2018
|
|
|
|
|
|
|
} |
2019
|
|
|
|
|
|
|
} |
2020
|
86
|
|
|
|
|
|
} |
2021
|
|
|
|
|
|
|
|
2022
|
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) { |
2023
|
79
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
2024
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
2025
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2026
|
0
|
|
|
|
|
|
*error_id = 1; |
2027
|
|
|
|
|
|
|
} |
2028
|
|
|
|
|
|
|
else { |
2029
|
79
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
2030
|
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]); |
2031
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2032
|
0
|
|
|
|
|
|
*error_id = 1; |
2033
|
|
|
|
|
|
|
} |
2034
|
|
|
|
|
|
|
else { |
2035
|
79
|
|
|
|
|
|
((int64_t*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in; |
2036
|
|
|
|
|
|
|
} |
2037
|
|
|
|
|
|
|
} |
2038
|
79
|
|
|
|
|
|
} |
2039
|
|
|
|
|
|
|
|
2040
|
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) { |
2041
|
67
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
2042
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
2043
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2044
|
0
|
|
|
|
|
|
*error_id = 1; |
2045
|
|
|
|
|
|
|
} |
2046
|
|
|
|
|
|
|
else { |
2047
|
67
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
2048
|
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]); |
2049
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2050
|
0
|
|
|
|
|
|
*error_id = 1; |
2051
|
|
|
|
|
|
|
} |
2052
|
|
|
|
|
|
|
else { |
2053
|
67
|
|
|
|
|
|
((float*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in; |
2054
|
|
|
|
|
|
|
} |
2055
|
|
|
|
|
|
|
} |
2056
|
67
|
|
|
|
|
|
} |
2057
|
|
|
|
|
|
|
|
2058
|
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) { |
2059
|
79
|
50
|
|
|
|
|
if (__builtin_expect(!array, 0)) { |
2060
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_ARRAY_UNDEFINED]); |
2061
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2062
|
0
|
|
|
|
|
|
*error_id = 1; |
2063
|
|
|
|
|
|
|
} |
2064
|
|
|
|
|
|
|
else { |
2065
|
79
|
50
|
|
|
|
|
if (__builtin_expect(index < 0 || index >= *(int32_t*)((intptr_t)array + object_length_offset), 0)) { |
|
|
50
|
|
|
|
|
|
2066
|
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]); |
2067
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2068
|
0
|
|
|
|
|
|
*error_id = 1; |
2069
|
|
|
|
|
|
|
} |
2070
|
|
|
|
|
|
|
else { |
2071
|
79
|
|
|
|
|
|
((double*)((intptr_t)array + object_data_offset))[fields_length * index + field_index] = in; |
2072
|
|
|
|
|
|
|
} |
2073
|
|
|
|
|
|
|
} |
2074
|
79
|
|
|
|
|
|
} |
2075
|
|
|
|
|
|
|
|
2076
|
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) { |
2077
|
8
|
100
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
2078
|
6
|
|
|
|
|
|
*(out + field_index) = *((int8_t*)mulnum_ref + field_index); |
2079
|
|
|
|
|
|
|
} |
2080
|
2
|
|
|
|
|
|
} |
2081
|
|
|
|
|
|
|
|
2082
|
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) { |
2083
|
4
|
100
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
2084
|
3
|
|
|
|
|
|
*(out + field_index) = *((int16_t*)mulnum_ref + field_index); |
2085
|
|
|
|
|
|
|
} |
2086
|
1
|
|
|
|
|
|
} |
2087
|
|
|
|
|
|
|
|
2088
|
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) { |
2089
|
4
|
100
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
2090
|
3
|
|
|
|
|
|
*(out + field_index) = *((int32_t*)mulnum_ref + field_index); |
2091
|
|
|
|
|
|
|
} |
2092
|
1
|
|
|
|
|
|
} |
2093
|
|
|
|
|
|
|
|
2094
|
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) { |
2095
|
4
|
100
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
2096
|
3
|
|
|
|
|
|
*(out + field_index) = *((int64_t*)mulnum_ref + field_index); |
2097
|
|
|
|
|
|
|
} |
2098
|
1
|
|
|
|
|
|
} |
2099
|
|
|
|
|
|
|
|
2100
|
1
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_DEREF_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* 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) = *((float*)mulnum_ref + field_index); |
2103
|
|
|
|
|
|
|
} |
2104
|
1
|
|
|
|
|
|
} |
2105
|
|
|
|
|
|
|
|
2106
|
1
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_DEREF_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* out, void* mulnum_ref, int32_t fields_length) { |
2107
|
4
|
100
|
|
|
|
|
for (int32_t field_index = 0; field_index < fields_length; field_index++) { |
2108
|
3
|
|
|
|
|
|
*(out + field_index) = *((double*)mulnum_ref + field_index); |
2109
|
|
|
|
|
|
|
} |
2110
|
1
|
|
|
|
|
|
} |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_BYTE(out, mulnum_ref, field_index) (out = *((int8_t*)mulnum_ref +field_index)) |
2113
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_SHORT(out, mulnum_ref, field_index) (out = *((int16_t*)mulnum_ref +field_index)) |
2114
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_INT(out, mulnum_ref, field_index) (out = *((int32_t*)mulnum_ref +field_index)) |
2115
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_LONG(out, mulnum_ref, field_index) (out = *((int64_t*)mulnum_ref +field_index)) |
2116
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_FLOAT(out, mulnum_ref, field_index) (out = *((float*)mulnum_ref +field_index)) |
2117
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_MULNUM_FIELD_DEREF_DOUBLE(out, mulnum_ref, field_index) (out = *((double*)mulnum_ref +field_index)) |
2118
|
|
|
|
|
|
|
|
2119
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_BYTE(mulnum_ref, field_index, in) (*((int8_t*)mulnum_ref +field_index) = in) |
2120
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_SHORT(mulnum_ref, field_index, in) (*((int16_t*)mulnum_ref +field_index) = in) |
2121
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_INT(mulnum_ref, field_index, in) (*((int32_t*)mulnum_ref +field_index) = in) |
2122
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_LONG(mulnum_ref, field_index, in) (*((int64_t*)mulnum_ref +field_index) = in) |
2123
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_FLOAT(mulnum_ref, field_index, in) (*((float*)mulnum_ref +field_index) = in) |
2124
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_MULNUM_FIELD_DEREF_DOUBLE(mulnum_ref, field_index, in) (*((double*)mulnum_ref +field_index) = in) |
2125
|
|
|
|
|
|
|
|
2126
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_SHORT(out, in) (out = (int16_t)in) |
2127
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_INT(out, in) (out = (int32_t)in) |
2128
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_LONG(out, in) (out = (int64_t)in) |
2129
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_FLOAT(out, in) (out = (float)in) |
2130
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_TO_DOUBLE(out, in) (out = (double)in) |
2131
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_BYTE(out, in) (out = (int8_t)in) |
2132
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_INT(out, in) (out = (int32_t)in) |
2133
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_LONG(out, in) (out = (int64_t)in) |
2134
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_FLOAT(out, in) (out = (float)in) |
2135
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_SHORT_TO_DOUBLE(out, in) (out = (double)in) |
2136
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_BYTE(out, in) (out = (int8_t)in) |
2137
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_SHORT(out, in) (out = (int16_t)in) |
2138
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_LONG(out, in) (out = (int64_t)in) |
2139
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_FLOAT(out, in) (out = (float)in) |
2140
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_INT_TO_DOUBLE(out, in) (out = (double)in) |
2141
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_BYTE(out, in) (out = (int8_t)in) |
2142
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_SHORT(out, in) (out = (int16_t)in) |
2143
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_INT(out, in) (out = (int32_t)in) |
2144
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_FLOAT(out, in) (out = (float)in) |
2145
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_LONG_TO_DOUBLE(out, in) (out = (double)in) |
2146
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_BYTE(out, in) (out = (int8_t)in) |
2147
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_SHORT(out, in) (out = (int16_t)in) |
2148
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_INT(out, in) (out = (int32_t)in) |
2149
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_LONG(out, in) (out = (int64_t)in) |
2150
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_FLOAT_TO_DOUBLE(out, in) (out = (double)in) |
2151
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_BYTE(out, in) (out = (int8_t)in) |
2152
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_SHORT(out, in) (out = (int16_t)in) |
2153
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_INT(out, in) (out = (int32_t)in) |
2154
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_LONG(out, in) (out = (int64_t)in) |
2155
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_TYPE_CONVERSION_DOUBLE_TO_FLOAT(out, in) (out = (float)in) |
2156
|
|
|
|
|
|
|
|
2157
|
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) { |
2158
|
2
|
|
|
|
|
|
snprintf(tmp_buffer, tmp_buffer_length, "%" PRId8, value); |
2159
|
2
|
|
|
|
|
|
int32_t string_length = strlen(tmp_buffer); |
2160
|
2
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length); |
2161
|
2
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2162
|
2
|
|
|
|
|
|
} |
2163
|
|
|
|
|
|
|
|
2164
|
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) { |
2165
|
2
|
|
|
|
|
|
snprintf(tmp_buffer, tmp_buffer_length, "%" PRId16, value); |
2166
|
2
|
|
|
|
|
|
int32_t string_length = strlen(tmp_buffer); |
2167
|
2
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length); |
2168
|
2
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2169
|
2
|
|
|
|
|
|
} |
2170
|
|
|
|
|
|
|
|
2171
|
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) { |
2172
|
828
|
|
|
|
|
|
snprintf(tmp_buffer, tmp_buffer_length, "%" PRId32, value); |
2173
|
828
|
|
|
|
|
|
int32_t string_length = strlen(tmp_buffer); |
2174
|
828
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length); |
2175
|
828
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2176
|
828
|
|
|
|
|
|
} |
2177
|
|
|
|
|
|
|
|
2178
|
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) { |
2179
|
2
|
|
|
|
|
|
snprintf(tmp_buffer, tmp_buffer_length, "%" PRId64, value); |
2180
|
2
|
|
|
|
|
|
int32_t string_length = strlen(tmp_buffer); |
2181
|
2
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length); |
2182
|
2
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2183
|
2
|
|
|
|
|
|
} |
2184
|
|
|
|
|
|
|
|
2185
|
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) { |
2186
|
26
|
|
|
|
|
|
snprintf(tmp_buffer, tmp_buffer_length, "%g", value); |
2187
|
26
|
|
|
|
|
|
int32_t string_length = strlen(tmp_buffer); |
2188
|
26
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length); |
2189
|
26
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2190
|
26
|
|
|
|
|
|
} |
2191
|
|
|
|
|
|
|
|
2192
|
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) { |
2193
|
26
|
|
|
|
|
|
snprintf(tmp_buffer, tmp_buffer_length, "%g", value); |
2194
|
26
|
|
|
|
|
|
int32_t string_length = strlen(tmp_buffer); |
2195
|
26
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, tmp_buffer, string_length); |
2196
|
26
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2197
|
26
|
|
|
|
|
|
} |
2198
|
|
|
|
|
|
|
|
2199
|
15
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_STRING_TO_BYTE_ARRAY(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* src_string) { |
2200
|
15
|
|
|
|
|
|
int32_t src_string_length = env->length(env, stack, src_string); |
2201
|
15
|
|
|
|
|
|
const char* src_string_data = env->get_chars(env, stack, src_string); |
2202
|
15
|
|
|
|
|
|
void* byte_array = env->new_byte_array_no_mortal(env, stack, src_string_length); |
2203
|
15
|
|
|
|
|
|
int8_t* byte_array_data = env->get_elems_byte(env, stack, byte_array); |
2204
|
15
|
|
|
|
|
|
memcpy(byte_array_data, src_string_data, src_string_length); |
2205
|
15
|
|
|
|
|
|
env->assign_object(env, stack, out, byte_array); |
2206
|
15
|
|
|
|
|
|
} |
2207
|
|
|
|
|
|
|
|
2208
|
11
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_TYPE_CONVERSION_BYTE_ARRAY_TO_STRING(SPVM_ENV* env, SPVM_VALUE* stack, void** out, void* src_byte_array) { |
2209
|
11
|
|
|
|
|
|
int32_t src_byte_array_length = env->length(env, stack, src_byte_array); |
2210
|
11
|
|
|
|
|
|
int8_t* src_byte_array_data = env->get_elems_byte(env, stack, src_byte_array); |
2211
|
11
|
|
|
|
|
|
void* string = env->new_string_no_mortal(env, stack, (const char*)src_byte_array_data, src_byte_array_length); |
2212
|
11
|
|
|
|
|
|
env->assign_object(env, stack, out, string); |
2213
|
11
|
|
|
|
|
|
} |
2214
|
|
|
|
|
|
|
|
2215
|
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) { |
2216
|
15
|
|
|
|
|
|
void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_BYTE_CLASS); |
2217
|
15
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
2218
|
15
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2219
|
15
|
|
|
|
|
|
*(int8_t*)&fields[0] = value; |
2220
|
15
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
2221
|
15
|
|
|
|
|
|
} |
2222
|
|
|
|
|
|
|
|
2223
|
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) { |
2224
|
8
|
|
|
|
|
|
void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_SHORT_CLASS); |
2225
|
8
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
2226
|
8
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2227
|
8
|
|
|
|
|
|
*(int16_t*)&fields[0] = value; |
2228
|
8
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
2229
|
8
|
|
|
|
|
|
} |
2230
|
|
|
|
|
|
|
|
2231
|
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) { |
2232
|
193
|
|
|
|
|
|
void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_INT_CLASS); |
2233
|
193
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
2234
|
193
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2235
|
193
|
|
|
|
|
|
*(int32_t*)&fields[0] = value; |
2236
|
193
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
2237
|
193
|
|
|
|
|
|
} |
2238
|
|
|
|
|
|
|
|
2239
|
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) { |
2240
|
34
|
|
|
|
|
|
void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_LONG_CLASS); |
2241
|
34
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
2242
|
34
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2243
|
34
|
|
|
|
|
|
*(int64_t*)&fields[0] = value; |
2244
|
34
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
2245
|
34
|
|
|
|
|
|
} |
2246
|
|
|
|
|
|
|
|
2247
|
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) { |
2248
|
10
|
|
|
|
|
|
void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_FLOAT_CLASS); |
2249
|
10
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
2250
|
10
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2251
|
10
|
|
|
|
|
|
*(float*)&fields[0] = value; |
2252
|
10
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
2253
|
10
|
|
|
|
|
|
} |
2254
|
|
|
|
|
|
|
|
2255
|
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) { |
2256
|
23
|
|
|
|
|
|
void* basic_type = env->api->runtime->get_basic_type_by_id(env->runtime, SPVM_NATIVE_C_BASIC_TYPE_ID_DOUBLE_CLASS); |
2257
|
23
|
|
|
|
|
|
void* object = env->new_object_no_mortal(env, stack, basic_type); |
2258
|
23
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2259
|
23
|
|
|
|
|
|
*(double*)&fields[0] = value; |
2260
|
23
|
|
|
|
|
|
env->assign_object(env, stack, out, object); |
2261
|
23
|
|
|
|
|
|
} |
2262
|
|
|
|
|
|
|
|
2263
|
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) { |
2264
|
11
|
50
|
|
|
|
|
if (object == NULL) { |
2265
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]); |
2266
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2267
|
0
|
|
|
|
|
|
*error_id = 1; |
2268
|
|
|
|
|
|
|
} |
2269
|
|
|
|
|
|
|
else { |
2270
|
11
|
50
|
|
|
|
|
if (env->is_type_by_name(env, stack, object, "Byte", 0)) { |
2271
|
11
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2272
|
11
|
|
|
|
|
|
*out = *(int8_t*)&fields[0]; |
2273
|
|
|
|
|
|
|
} |
2274
|
|
|
|
|
|
|
else { |
2275
|
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]); |
2276
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2277
|
0
|
|
|
|
|
|
*error_id = 1; |
2278
|
|
|
|
|
|
|
} |
2279
|
|
|
|
|
|
|
} |
2280
|
11
|
|
|
|
|
|
} |
2281
|
|
|
|
|
|
|
|
2282
|
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) { |
2283
|
11
|
50
|
|
|
|
|
if (object == NULL) { |
2284
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]); |
2285
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2286
|
0
|
|
|
|
|
|
*error_id = 1; |
2287
|
|
|
|
|
|
|
} |
2288
|
|
|
|
|
|
|
else { |
2289
|
11
|
50
|
|
|
|
|
if (env->is_type_by_name(env, stack, object, "Short", 0)) { |
2290
|
11
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2291
|
11
|
|
|
|
|
|
*out = *(int16_t*)&fields[0]; |
2292
|
|
|
|
|
|
|
} |
2293
|
|
|
|
|
|
|
else { |
2294
|
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]); |
2295
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2296
|
0
|
|
|
|
|
|
*error_id = 1; |
2297
|
|
|
|
|
|
|
} |
2298
|
|
|
|
|
|
|
} |
2299
|
11
|
|
|
|
|
|
} |
2300
|
|
|
|
|
|
|
|
2301
|
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) { |
2302
|
79
|
50
|
|
|
|
|
if (object == NULL) { |
2303
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]); |
2304
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2305
|
0
|
|
|
|
|
|
*error_id = 1; |
2306
|
|
|
|
|
|
|
} |
2307
|
|
|
|
|
|
|
else { |
2308
|
79
|
50
|
|
|
|
|
if (env->is_type_by_name(env, stack, object, "Int", 0)) { |
2309
|
79
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2310
|
79
|
|
|
|
|
|
*out = *(int32_t*)&fields[0]; |
2311
|
|
|
|
|
|
|
} |
2312
|
|
|
|
|
|
|
else { |
2313
|
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]); |
2314
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2315
|
0
|
|
|
|
|
|
*error_id = 1; |
2316
|
|
|
|
|
|
|
} |
2317
|
|
|
|
|
|
|
} |
2318
|
79
|
|
|
|
|
|
} |
2319
|
|
|
|
|
|
|
|
2320
|
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) { |
2321
|
11
|
50
|
|
|
|
|
if (object == NULL) { |
2322
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]); |
2323
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2324
|
0
|
|
|
|
|
|
*error_id = 1; |
2325
|
|
|
|
|
|
|
} |
2326
|
|
|
|
|
|
|
else { |
2327
|
11
|
50
|
|
|
|
|
if (env->is_type_by_name(env, stack, object, "Long", 0)) { |
2328
|
11
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2329
|
11
|
|
|
|
|
|
*out = *(int64_t*)&fields[0]; |
2330
|
|
|
|
|
|
|
} |
2331
|
|
|
|
|
|
|
else { |
2332
|
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]); |
2333
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2334
|
0
|
|
|
|
|
|
*error_id = 1; |
2335
|
|
|
|
|
|
|
} |
2336
|
|
|
|
|
|
|
} |
2337
|
11
|
|
|
|
|
|
} |
2338
|
|
|
|
|
|
|
|
2339
|
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) { |
2340
|
11
|
50
|
|
|
|
|
if (object == NULL) { |
2341
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]); |
2342
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2343
|
0
|
|
|
|
|
|
*error_id = 1; |
2344
|
|
|
|
|
|
|
} |
2345
|
|
|
|
|
|
|
else { |
2346
|
11
|
50
|
|
|
|
|
if (env->is_type_by_name(env, stack, object, "Float", 0)) { |
2347
|
11
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2348
|
11
|
|
|
|
|
|
*out = *(float*)&fields[0]; |
2349
|
|
|
|
|
|
|
} |
2350
|
|
|
|
|
|
|
else { |
2351
|
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]); |
2352
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2353
|
0
|
|
|
|
|
|
*error_id = 1; |
2354
|
|
|
|
|
|
|
} |
2355
|
|
|
|
|
|
|
} |
2356
|
11
|
|
|
|
|
|
} |
2357
|
|
|
|
|
|
|
|
2358
|
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) { |
2359
|
11
|
50
|
|
|
|
|
if (object == NULL) { |
2360
|
0
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_UNBOXING_CONVERSION_FROM_UNDEF]); |
2361
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2362
|
0
|
|
|
|
|
|
*error_id = 1; |
2363
|
|
|
|
|
|
|
} |
2364
|
|
|
|
|
|
|
else { |
2365
|
11
|
50
|
|
|
|
|
if (env->is_type_by_name(env, stack, object, "Double", 0)) { |
2366
|
11
|
|
|
|
|
|
SPVM_VALUE* fields = (SPVM_VALUE*)((intptr_t)object + object_data_offset); |
2367
|
11
|
|
|
|
|
|
*out = *(double*)&fields[0]; |
2368
|
|
|
|
|
|
|
} |
2369
|
|
|
|
|
|
|
else { |
2370
|
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]); |
2371
|
0
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2372
|
0
|
|
|
|
|
|
*error_id = 1; |
2373
|
|
|
|
|
|
|
} |
2374
|
|
|
|
|
|
|
} |
2375
|
11
|
|
|
|
|
|
} |
2376
|
|
|
|
|
|
|
|
2377
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_BYTE(stack, stack_index, in) (*(int8_t*)&stack[stack_index] = in) |
2378
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_SHORT(stack, stack_index, in) (*(int16_t*)&stack[stack_index] = in) |
2379
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_INT(stack, stack_index, in) (*(int32_t*)&stack[stack_index] = in) |
2380
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_LONG(stack, stack_index, in) (*(int64_t*)&stack[stack_index] = in) |
2381
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_FLOAT(stack, stack_index, in) (*(float*)&stack[stack_index] = in) |
2382
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_DOUBLE(stack, stack_index, in) (*(double*)&stack[stack_index] = in) |
2383
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_OBJECT(stack, stack_index, in) (*(void**)&stack[stack_index] = in) |
2384
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_REF(stack, stack_index, in) (*(void**)&stack[stack_index] = in) |
2385
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_SET_STACK_UNDEF(stack, stack_index) (*(void**)&stack[stack_index] = NULL) |
2386
|
|
|
|
|
|
|
|
2387
|
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) { |
2388
|
12
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2389
|
9
|
|
|
|
|
|
*(int8_t*)&stack[stack_base + stack_index] = *(in + stack_index); |
2390
|
|
|
|
|
|
|
} |
2391
|
3
|
|
|
|
|
|
} |
2392
|
|
|
|
|
|
|
|
2393
|
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) { |
2394
|
12
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2395
|
9
|
|
|
|
|
|
*(int16_t*)&stack[stack_base + stack_index] = *(in + stack_index); |
2396
|
|
|
|
|
|
|
} |
2397
|
3
|
|
|
|
|
|
} |
2398
|
|
|
|
|
|
|
|
2399
|
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) { |
2400
|
12
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2401
|
9
|
|
|
|
|
|
*(int32_t*)&stack[stack_base + stack_index] = *(in + stack_index); |
2402
|
|
|
|
|
|
|
} |
2403
|
3
|
|
|
|
|
|
} |
2404
|
|
|
|
|
|
|
|
2405
|
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) { |
2406
|
12
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2407
|
9
|
|
|
|
|
|
*(int64_t*)&stack[stack_base + stack_index] = *(in + stack_index); |
2408
|
|
|
|
|
|
|
} |
2409
|
3
|
|
|
|
|
|
} |
2410
|
|
|
|
|
|
|
|
2411
|
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) { |
2412
|
12
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2413
|
9
|
|
|
|
|
|
*(float*)&stack[stack_base + stack_index] = *(in + stack_index); |
2414
|
|
|
|
|
|
|
} |
2415
|
3
|
|
|
|
|
|
} |
2416
|
|
|
|
|
|
|
|
2417
|
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) { |
2418
|
24
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2419
|
17
|
|
|
|
|
|
*(double*)&stack[stack_base + stack_index] = *(in + stack_index); |
2420
|
|
|
|
|
|
|
} |
2421
|
7
|
|
|
|
|
|
} |
2422
|
|
|
|
|
|
|
|
2423
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_BYTE(out, stack, stack_index) (out = *(int8_t*)&stack[stack_index]) |
2424
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_SHORT(out, stack, stack_index) (out = *(int16_t*)&stack[stack_index]) |
2425
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_INT(out, stack, stack_index) (out = *(int32_t*)&stack[stack_index]) |
2426
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_LONG(out, stack, stack_index) (out = *(int64_t*)&stack[stack_index]) |
2427
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_FLOAT(out, stack, stack_index) (out = *(float*)&stack[stack_index]) |
2428
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_DOUBLE(out, stack, stack_index) (out = *(double*)&stack[stack_index]) |
2429
|
|
|
|
|
|
|
|
2430
|
524037
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_GET_STACK_OBJECT(SPVM_ENV* env, void** out, SPVM_VALUE* stack, int32_t stack_index) { |
2431
|
524037
|
|
|
|
|
|
env->assign_object(env, stack, out, *(void**)&stack[stack_index]); |
2432
|
524037
|
|
|
|
|
|
} |
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_GET_STACK_REF(out, stack, stack_index) (out = *(void**)&stack[stack_index]) |
2435
|
|
|
|
|
|
|
|
2436
|
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) { |
2437
|
44
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2438
|
33
|
|
|
|
|
|
*(out + stack_index) = *(int8_t*)&stack[(stack_base) + stack_index]; |
2439
|
|
|
|
|
|
|
} |
2440
|
11
|
|
|
|
|
|
} |
2441
|
|
|
|
|
|
|
|
2442
|
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) { |
2443
|
40
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2444
|
30
|
|
|
|
|
|
*(out + stack_index) = *(int16_t*)&stack[(stack_base) + stack_index]; |
2445
|
|
|
|
|
|
|
} |
2446
|
10
|
|
|
|
|
|
} |
2447
|
|
|
|
|
|
|
|
2448
|
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) { |
2449
|
40
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2450
|
30
|
|
|
|
|
|
*(out + stack_index) = *(int32_t*)&stack[(stack_base) + stack_index]; |
2451
|
|
|
|
|
|
|
} |
2452
|
10
|
|
|
|
|
|
} |
2453
|
|
|
|
|
|
|
|
2454
|
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) { |
2455
|
40
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2456
|
30
|
|
|
|
|
|
*(out + stack_index) = *(int64_t*)&stack[(stack_base) + stack_index]; |
2457
|
|
|
|
|
|
|
} |
2458
|
10
|
|
|
|
|
|
} |
2459
|
|
|
|
|
|
|
|
2460
|
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) { |
2461
|
40
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2462
|
30
|
|
|
|
|
|
*(out + stack_index) = *(float*)&stack[(stack_base) + stack_index]; |
2463
|
|
|
|
|
|
|
} |
2464
|
10
|
|
|
|
|
|
} |
2465
|
|
|
|
|
|
|
|
2466
|
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) { |
2467
|
49
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2468
|
36
|
|
|
|
|
|
*(out + stack_index) = *(double*)&stack[(stack_base) + stack_index]; |
2469
|
|
|
|
|
|
|
} |
2470
|
13
|
|
|
|
|
|
} |
2471
|
|
|
|
|
|
|
|
2472
|
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) { |
2473
|
4
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2474
|
4
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2475
|
3
|
|
|
|
|
|
*out = default_value; |
2476
|
|
|
|
|
|
|
} |
2477
|
|
|
|
|
|
|
else { |
2478
|
1
|
|
|
|
|
|
*out = *(int8_t*)&stack[stack_index]; |
2479
|
|
|
|
|
|
|
} |
2480
|
4
|
|
|
|
|
|
} |
2481
|
|
|
|
|
|
|
|
2482
|
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) { |
2483
|
4
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2484
|
4
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2485
|
3
|
|
|
|
|
|
*out = default_value; |
2486
|
|
|
|
|
|
|
} |
2487
|
|
|
|
|
|
|
else { |
2488
|
1
|
|
|
|
|
|
*out = *(int16_t*)&stack[stack_index]; |
2489
|
|
|
|
|
|
|
} |
2490
|
4
|
|
|
|
|
|
} |
2491
|
|
|
|
|
|
|
|
2492
|
645657
|
|
|
|
|
|
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) { |
2493
|
645657
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2494
|
645657
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2495
|
425616
|
|
|
|
|
|
*out = default_value; |
2496
|
|
|
|
|
|
|
} |
2497
|
|
|
|
|
|
|
else { |
2498
|
220041
|
|
|
|
|
|
*out = *(int32_t*)&stack[stack_index]; |
2499
|
|
|
|
|
|
|
} |
2500
|
645657
|
|
|
|
|
|
} |
2501
|
|
|
|
|
|
|
|
2502
|
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) { |
2503
|
5
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2504
|
5
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2505
|
4
|
|
|
|
|
|
*out = default_value; |
2506
|
|
|
|
|
|
|
} |
2507
|
|
|
|
|
|
|
else { |
2508
|
1
|
|
|
|
|
|
*out = *(int64_t*)&stack[stack_index]; |
2509
|
|
|
|
|
|
|
} |
2510
|
5
|
|
|
|
|
|
} |
2511
|
|
|
|
|
|
|
|
2512
|
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) { |
2513
|
2
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2514
|
2
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2515
|
1
|
|
|
|
|
|
*out = default_value; |
2516
|
|
|
|
|
|
|
} |
2517
|
|
|
|
|
|
|
else { |
2518
|
1
|
|
|
|
|
|
*out = *(float*)&stack[stack_index]; |
2519
|
|
|
|
|
|
|
} |
2520
|
2
|
|
|
|
|
|
} |
2521
|
|
|
|
|
|
|
|
2522
|
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) { |
2523
|
2
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2524
|
2
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2525
|
1
|
|
|
|
|
|
*out = default_value; |
2526
|
|
|
|
|
|
|
} |
2527
|
|
|
|
|
|
|
else { |
2528
|
1
|
|
|
|
|
|
*out = *(double*)&stack[stack_index]; |
2529
|
|
|
|
|
|
|
} |
2530
|
2
|
|
|
|
|
|
} |
2531
|
|
|
|
|
|
|
|
2532
|
18389
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_GET_STACK_OPTIONAL_OBJECT(SPVM_ENV* env, void** out, SPVM_VALUE* stack, int32_t stack_index) { |
2533
|
18389
|
|
|
|
|
|
int32_t args_width = env->args_width(env, stack); |
2534
|
18389
|
100
|
|
|
|
|
if (stack_index >= args_width) { |
2535
|
17545
|
|
|
|
|
|
env->assign_object(env, stack, out, NULL); |
2536
|
|
|
|
|
|
|
} |
2537
|
|
|
|
|
|
|
else { |
2538
|
844
|
|
|
|
|
|
env->assign_object(env, stack, out, *(void**)&stack[stack_index]); |
2539
|
|
|
|
|
|
|
} |
2540
|
18389
|
|
|
|
|
|
} |
2541
|
|
|
|
|
|
|
|
2542
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_BYTE(stack, in) (*(int8_t*)&stack[0] = in) |
2543
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_SHORT(stack, in) (*(int16_t*)&stack[0] = in) |
2544
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_INT(stack, in) (*(int32_t*)&stack[0] = in) |
2545
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_LONG(stack, in) (*(int64_t*)&stack[0] = in) |
2546
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_FLOAT(stack, in) (*(float*)&stack[0] = in) |
2547
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_DOUBLE(stack, in) (*(double*)&stack[0] = in) |
2548
|
|
|
|
|
|
|
|
2549
|
88324
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_OBJECT(SPVM_ENV* env, SPVM_VALUE* stack, void* in) { |
2550
|
88324
|
|
|
|
|
|
*(void**)&stack[0] = in; |
2551
|
88324
|
100
|
|
|
|
|
if (in != NULL) { |
2552
|
87923
|
|
|
|
|
|
env->api->internal->lock_object(env, stack, in); |
2553
|
87923
|
|
|
|
|
|
env->api->internal->inc_ref_count(env, stack, in); |
2554
|
87923
|
|
|
|
|
|
env->api->internal->unlock_object(env, stack, in); |
2555
|
|
|
|
|
|
|
} |
2556
|
88324
|
|
|
|
|
|
} |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
#define SPVM_IMPLEMENT_RETURN_UNDEF(stack) (*(void**)&stack[0] = NULL) |
2559
|
|
|
|
|
|
|
|
2560
|
6
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_MULNUM_BYTE(SPVM_ENV* env, SPVM_VALUE* stack, int8_t* in, int32_t args_width) { |
2561
|
24
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2562
|
18
|
|
|
|
|
|
*(int8_t*)&stack[stack_index] = *(in + stack_index); |
2563
|
|
|
|
|
|
|
} |
2564
|
6
|
|
|
|
|
|
} |
2565
|
|
|
|
|
|
|
|
2566
|
5
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_MULNUM_SHORT(SPVM_ENV* env, SPVM_VALUE* stack, int16_t* in, int32_t args_width) { |
2567
|
20
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2568
|
15
|
|
|
|
|
|
*(int16_t*)&stack[stack_index] = *(in + stack_index); |
2569
|
|
|
|
|
|
|
} |
2570
|
5
|
|
|
|
|
|
} |
2571
|
|
|
|
|
|
|
|
2572
|
5
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_MULNUM_INT(SPVM_ENV* env, SPVM_VALUE* stack, int32_t* in, int32_t args_width) { |
2573
|
20
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2574
|
15
|
|
|
|
|
|
*(int32_t*)&stack[stack_index] = *(in + stack_index); |
2575
|
|
|
|
|
|
|
} |
2576
|
5
|
|
|
|
|
|
} |
2577
|
|
|
|
|
|
|
|
2578
|
5
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_MULNUM_LONG(SPVM_ENV* env, SPVM_VALUE* stack, int64_t* in, int32_t args_width) { |
2579
|
20
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2580
|
15
|
|
|
|
|
|
*(int64_t*)&stack[stack_index] = *(in + stack_index); |
2581
|
|
|
|
|
|
|
} |
2582
|
5
|
|
|
|
|
|
} |
2583
|
|
|
|
|
|
|
|
2584
|
5
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_MULNUM_FLOAT(SPVM_ENV* env, SPVM_VALUE* stack, float* in, int32_t args_width) { |
2585
|
20
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2586
|
15
|
|
|
|
|
|
*(float*)&stack[stack_index] = *(in + stack_index); |
2587
|
|
|
|
|
|
|
} |
2588
|
5
|
|
|
|
|
|
} |
2589
|
|
|
|
|
|
|
|
2590
|
6
|
|
|
|
|
|
static inline void SPVM_IMPLEMENT_RETURN_MULNUM_DOUBLE(SPVM_ENV* env, SPVM_VALUE* stack, double* in, int32_t args_width) { |
2591
|
23
|
100
|
|
|
|
|
for (int32_t stack_index = 0; stack_index < args_width; stack_index++) { |
2592
|
17
|
|
|
|
|
|
*(double*)&stack[stack_index] = *(in + stack_index); |
2593
|
|
|
|
|
|
|
} |
2594
|
6
|
|
|
|
|
|
} |
2595
|
|
|
|
|
|
|
|
2596
|
|
|
|
|
|
|
#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)) |
2597
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
#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)) |
2599
|
|
|
|
|
|
|
|
2600
|
505973
|
|
|
|
|
|
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) { |
2601
|
|
|
|
|
|
|
|
2602
|
505973
|
|
|
|
|
|
void* object = stack[0].oval; |
2603
|
|
|
|
|
|
|
|
2604
|
505973
|
|
|
|
|
|
*error_id = 0; |
2605
|
|
|
|
|
|
|
|
2606
|
505973
|
|
|
|
|
|
void* method = NULL; |
2607
|
505973
|
100
|
|
|
|
|
if (!object) { |
2608
|
1
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, SPVM_IMPLEMENT_STRING_LITERALS[SPVM_IMPLEMENT_C_STRING_CALL_INSTANCE_METHOD_INVOCANT_UNDEF]); |
2609
|
1
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2610
|
1
|
|
|
|
|
|
*error_id = 1; |
2611
|
|
|
|
|
|
|
} |
2612
|
|
|
|
|
|
|
else { |
2613
|
505972
|
|
|
|
|
|
method = env->get_instance_method(env, stack, object, method_name); |
2614
|
|
|
|
|
|
|
|
2615
|
505972
|
100
|
|
|
|
|
if (!method) { |
2616
|
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); |
2617
|
2
|
|
|
|
|
|
void* exception = env->new_string_nolen_no_mortal(env, stack, tmp_buffer); |
2618
|
2
|
|
|
|
|
|
env->set_exception(env, stack, exception); |
2619
|
2
|
|
|
|
|
|
*error_id = 1; |
2620
|
|
|
|
|
|
|
} |
2621
|
|
|
|
|
|
|
} |
2622
|
|
|
|
|
|
|
|
2623
|
505973
|
100
|
|
|
|
|
if (!*error_id) { |
2624
|
505970
|
|
|
|
|
|
*error_id = env->call_method_no_mortal(env, stack, method, args_width); |
2625
|
|
|
|
|
|
|
} |
2626
|
505973
|
|
|
|
|
|
} |
2627
|
|
|
|
|
|
|
|
2628
|
|
|
|
|
|
|
#endif |