line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
// Copyright (c) 2023 Yuki Kimoto |
2
|
|
|
|
|
|
|
// MIT License |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#include |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#include "spvm_native.h" |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "spvm_api_arg.h" |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "spvm_allocator.h" |
11
|
|
|
|
|
|
|
#include "spvm_runtime_arg.h" |
12
|
|
|
|
|
|
|
|
13
|
119269
|
|
|
|
|
|
SPVM_API_ARG* SPVM_API_ARG_new_api() { |
14
|
|
|
|
|
|
|
|
15
|
119269
|
|
|
|
|
|
void* native_apis_init[] = { |
16
|
|
|
|
|
|
|
SPVM_API_ARG_get_name, |
17
|
|
|
|
|
|
|
SPVM_API_ARG_get_index, |
18
|
|
|
|
|
|
|
SPVM_API_ARG_get_basic_type, |
19
|
|
|
|
|
|
|
SPVM_API_ARG_get_type_dimension, |
20
|
|
|
|
|
|
|
SPVM_API_ARG_get_type_flag, |
21
|
|
|
|
|
|
|
SPVM_API_ARG_get_stack_index, |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
119269
|
|
|
|
|
|
SPVM_API_ARG* native_apis = calloc(1, sizeof(native_apis_init)); |
25
|
|
|
|
|
|
|
|
26
|
119269
|
|
|
|
|
|
memcpy(native_apis, native_apis_init, sizeof(native_apis_init)); |
27
|
|
|
|
|
|
|
|
28
|
119269
|
|
|
|
|
|
return native_apis; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
119269
|
|
|
|
|
|
void SPVM_API_ARG_free_api(SPVM_API_ARG* api) { |
32
|
|
|
|
|
|
|
|
33
|
119269
|
|
|
|
|
|
free(api); |
34
|
119269
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
const char* SPVM_API_ARG_get_name(SPVM_RUNTIME* runtime, SPVM_RUNTIME_ARG* arg) { |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return arg->name; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
int32_t SPVM_API_ARG_get_index(SPVM_RUNTIME* runtime, SPVM_RUNTIME_ARG* arg) { |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return arg->index; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
300469
|
|
|
|
|
|
SPVM_RUNTIME_BASIC_TYPE* SPVM_API_ARG_get_basic_type(SPVM_RUNTIME* runtime, SPVM_RUNTIME_ARG* arg) { |
47
|
|
|
|
|
|
|
|
48
|
300469
|
|
|
|
|
|
return arg->basic_type; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
300469
|
|
|
|
|
|
int32_t SPVM_API_ARG_get_type_dimension(SPVM_RUNTIME* runtime, SPVM_RUNTIME_ARG* arg) { |
52
|
|
|
|
|
|
|
|
53
|
300469
|
|
|
|
|
|
return arg->type_dimension; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
600798
|
|
|
|
|
|
int32_t SPVM_API_ARG_get_type_flag(SPVM_RUNTIME* runtime, SPVM_RUNTIME_ARG* arg) { |
57
|
|
|
|
|
|
|
|
58
|
600798
|
|
|
|
|
|
return arg->type_flag; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
int32_t SPVM_API_ARG_get_stack_index(SPVM_RUNTIME* runtime, SPVM_RUNTIME_ARG* arg) { |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return arg->stack_index; |
64
|
|
|
|
|
|
|
} |